From 1f7654e80fdfc082487db31d51a5262ad8f68ab5 Mon Sep 17 00:00:00 2001 From: LongYinan Date: Fri, 1 Dec 2023 08:52:40 +0000 Subject: [PATCH 01/68] chore: bump @adobe/css-tools from 4.3.1 to 4.3.2 (#5154) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bumps [@adobe/css-tools](https://github.com/adobe/css-tools) from 4.3.1 to 4.3.2.
Changelog

Sourced from @​adobe/css-tools's changelog.

4.3.2 / 2023-11-28

  • Fix redos vulnerability with specific crafted css string - CVE-2023-48631
  • Fix Problem parsing with :is() and nested :nth-child() #211
Commits

[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=@adobe/css-tools&package-manager=npm_and_yarn&previous-version=4.3.1&new-version=4.3.2)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) ---
Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot show ignore conditions` will show all of the ignore conditions of the specified dependency - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself) You can disable automated security fix PRs for this repo from the [Security Alerts page](https://github.com/toeverything/AFFiNE/network/alerts).
--- yarn.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/yarn.lock b/yarn.lock index 2bc8715170..c4ebddf134 100644 --- a/yarn.lock +++ b/yarn.lock @@ -13,9 +13,9 @@ __metadata: linkType: hard "@adobe/css-tools@npm:^4.3.1": - version: 4.3.1 - resolution: "@adobe/css-tools@npm:4.3.1" - checksum: 039a42ffdd41ecf3abcaf09c9fef0ffd634ccbe81c04002fc989e74564eba99bb19169a8f48dadf6442aa2c5c9f0925a7b27ec5c36a1ed1a3515fe77d6930996 + version: 4.3.2 + resolution: "@adobe/css-tools@npm:4.3.2" + checksum: 973dcb7ba5141f57ec726ddec2e94e8947361bb0c5f0e8ebd1e8aa3a84b28e66db4ad843908825f99730d59784ff3c43868b014a7268676a65950cdb850c42cc languageName: node linkType: hard From 512504e17704e15e5c6b4fd875846b5bf1b0654f Mon Sep 17 00:00:00 2001 From: Peng Xiao Date: Sat, 2 Dec 2023 15:13:48 +0000 Subject: [PATCH 02/68] fix(electron): do not restore window on get window (#5163) fix https://github.com/toeverything/AFFiNE/issues/5161 Looks like I used window.restore incorrectly. --- .../frontend/electron/src/main/deep-link.ts | 9 ++++--- packages/frontend/electron/src/main/index.ts | 6 ++--- .../frontend/electron/src/main/main-window.ts | 25 ++++++++++++------- .../frontend/electron/src/main/protocol.ts | 8 ++++-- 4 files changed, 30 insertions(+), 18 deletions(-) diff --git a/packages/frontend/electron/src/main/deep-link.ts b/packages/frontend/electron/src/main/deep-link.ts index d006c55bb5..bc5edb05f6 100644 --- a/packages/frontend/electron/src/main/deep-link.ts +++ b/packages/frontend/electron/src/main/deep-link.ts @@ -5,10 +5,10 @@ import { type App, type BrowserWindow, ipcMain } from 'electron'; import { buildType, CLOUD_BASE_URL, isDev } from './config'; import { logger } from './logger'; import { + getOrCreateWindow, handleOpenUrlInHiddenWindow, mainWindowOrigin, removeCookie, - restoreOrCreateWindow, setCookie, } from './main-window'; @@ -39,8 +39,9 @@ export function setupDeepLink(app: App) { // on windows & linux, we need to listen for the second-instance event app.on('second-instance', (event, commandLine) => { - restoreOrCreateWindow() - .then(() => { + getOrCreateWindow() + .then(window => { + window.show(); const url = commandLine.pop(); if (url?.startsWith(`${protocol}://`)) { event.preventDefault(); @@ -67,7 +68,7 @@ async function handleAffineUrl(url: string) { async function handleOauthJwt(url: string) { if (url) { try { - const mainWindow = await restoreOrCreateWindow(); + const mainWindow = await getOrCreateWindow(); mainWindow.show(); const urlObj = new URL(url); const token = urlObj.searchParams.get('token'); diff --git a/packages/frontend/electron/src/main/index.ts b/packages/frontend/electron/src/main/index.ts index ccaed0b076..3a38caa3f0 100644 --- a/packages/frontend/electron/src/main/index.ts +++ b/packages/frontend/electron/src/main/index.ts @@ -11,7 +11,7 @@ import { registerEvents } from './events'; import { registerHandlers } from './handlers'; import { ensureHelperProcess } from './helper-process'; import { logger } from './logger'; -import { restoreOrCreateWindow } from './main-window'; +import { getOrCreateWindow } from './main-window'; import { registerProtocol } from './protocol'; import { registerUpdater } from './updater'; @@ -56,7 +56,7 @@ app.on('window-all-closed', () => { * @see https://www.electronjs.org/docs/v14-x-y/api/app#event-activate-macos Event: 'activate' */ app.on('activate', () => { - restoreOrCreateWindow().catch(e => + getOrCreateWindow().catch(e => console.error('Failed to restore or create window:', e) ); }); @@ -72,7 +72,7 @@ app .then(registerHandlers) .then(registerEvents) .then(ensureHelperProcess) - .then(restoreOrCreateWindow) + .then(getOrCreateWindow) .then(createApplicationMenu) .then(registerUpdater) .catch(e => console.error('Failed create window:', e)); diff --git a/packages/frontend/electron/src/main/main-window.ts b/packages/frontend/electron/src/main/main-window.ts index 9aeeb5e3e7..c4234adfa8 100644 --- a/packages/frontend/electron/src/main/main-window.ts +++ b/packages/frontend/electron/src/main/main-window.ts @@ -148,16 +148,11 @@ let browserWindow$: Promise | undefined; /** * Restore existing BrowserWindow or Create new BrowserWindow */ -export async function restoreOrCreateWindow() { +export async function getOrCreateWindow() { if (!browserWindow$ || (await browserWindow$.then(w => w.isDestroyed()))) { browserWindow$ = createWindow(); } const mainWindow = await browserWindow$; - - if (mainWindow.isMinimized()) { - mainWindow.restore(); - logger.info('restore main window'); - } return mainWindow; } @@ -188,7 +183,11 @@ export async function setCookie( arg0: CookiesSetDetails | string, arg1?: string ) { - const window = await restoreOrCreateWindow(); + const window = await browserWindow$; + if (!window) { + // do nothing if window is not ready + return; + } const details = typeof arg1 === 'string' && typeof arg0 === 'string' ? parseCookie(arg0, arg1) @@ -204,12 +203,20 @@ export async function setCookie( } export async function removeCookie(url: string, name: string): Promise { - const window = await restoreOrCreateWindow(); + const window = await browserWindow$; + if (!window) { + // do nothing if window is not ready + return; + } await window.webContents.session.cookies.remove(url, name); } export async function getCookie(url?: string, name?: string) { - const window = await restoreOrCreateWindow(); + const window = await browserWindow$; + if (!window) { + // do nothing if window is not ready + return; + } const cookies = await window.webContents.session.cookies.get({ url, name, diff --git a/packages/frontend/electron/src/main/protocol.ts b/packages/frontend/electron/src/main/protocol.ts index 9b622a0cf4..e874ff6cab 100644 --- a/packages/frontend/electron/src/main/protocol.ts +++ b/packages/frontend/electron/src/main/protocol.ts @@ -119,8 +119,12 @@ export function registerProtocol() { // if sending request to the cloud, attach the session cookie if (isNetworkResource(pathname)) { const cookie = await getCookie(CLOUD_BASE_URL); - const cookieString = cookie.map(c => `${c.name}=${c.value}`).join('; '); - details.requestHeaders['cookie'] = cookieString; + if (cookie) { + const cookieString = cookie + .map(c => `${c.name}=${c.value}`) + .join('; '); + details.requestHeaders['cookie'] = cookieString; + } } callback({ cancel: false, From 661b4a91bad18f7ca1312f99421961272f049721 Mon Sep 17 00:00:00 2001 From: Rakhee Singh Date: Sat, 2 Dec 2023 21:09:51 +0530 Subject: [PATCH 03/68] style(core): add page list header emptypage (#5162) Co-authored-by: rakhee28 --- packages/frontend/core/src/pages/workspace/all-page.tsx | 1 + .../frontend/core/src/pages/workspace/page-list-empty.tsx | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/frontend/core/src/pages/workspace/all-page.tsx b/packages/frontend/core/src/pages/workspace/all-page.tsx index f4a44e1e40..d62bf16b29 100644 --- a/packages/frontend/core/src/pages/workspace/all-page.tsx +++ b/packages/frontend/core/src/pages/workspace/all-page.tsx @@ -295,6 +295,7 @@ export const AllPage = () => { ) : ( } blockSuiteWorkspace={currentWorkspace.blockSuiteWorkspace} /> )} diff --git a/packages/frontend/core/src/pages/workspace/page-list-empty.tsx b/packages/frontend/core/src/pages/workspace/page-list-empty.tsx index 4cf41ea70e..dc813941a5 100644 --- a/packages/frontend/core/src/pages/workspace/page-list-empty.tsx +++ b/packages/frontend/core/src/pages/workspace/page-list-empty.tsx @@ -2,7 +2,7 @@ import { Empty } from '@affine/component'; import { Trans } from '@affine/i18n'; import { useAFFiNEI18N } from '@affine/i18n/hooks'; import type { Workspace } from '@blocksuite/store'; -import { useCallback } from 'react'; +import { type ReactNode, useCallback } from 'react'; import { usePageHelper } from '../../components/blocksuite/block-suite-page-list/utils'; import * as styles from './page-list-empty.css'; @@ -10,9 +10,11 @@ import * as styles from './page-list-empty.css'; export const EmptyPageList = ({ type, blockSuiteWorkspace, + heading, }: { type: 'all' | 'trash' | 'shared' | 'public'; blockSuiteWorkspace: Workspace; + heading?: ReactNode; }) => { const { createPage } = usePageHelper(blockSuiteWorkspace); const t = useAFFiNEI18N(); @@ -56,6 +58,7 @@ export const EmptyPageList = ({ return (
+ {heading &&
{heading}
} Date: Sat, 2 Dec 2023 17:27:07 +0000 Subject: [PATCH 04/68] fix(workspace): fix svg display on browser (#5158) --- packages/frontend/workspace/src/blob/storage/affine-cloud.ts | 3 ++- packages/frontend/workspace/src/blob/storage/indexeddb.ts | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/frontend/workspace/src/blob/storage/affine-cloud.ts b/packages/frontend/workspace/src/blob/storage/affine-cloud.ts index 91ffa92a4f..a1c23f54bd 100644 --- a/packages/frontend/workspace/src/blob/storage/affine-cloud.ts +++ b/packages/frontend/workspace/src/blob/storage/affine-cloud.ts @@ -8,6 +8,7 @@ import { import { fetcher } from '@affine/workspace/affine/gql'; import type { BlobStorage } from '../engine'; +import { bufferToBlob } from '../util'; export const createAffineCloudBlobStorage = ( workspaceId: string @@ -26,7 +27,7 @@ export const createAffineCloudBlobStorage = ( // status not in the range 200-299 return undefined; } - return await res.blob(); + return bufferToBlob(await res.arrayBuffer()); } ); }, diff --git a/packages/frontend/workspace/src/blob/storage/indexeddb.ts b/packages/frontend/workspace/src/blob/storage/indexeddb.ts index 66973bd28a..ce5fb35bf6 100644 --- a/packages/frontend/workspace/src/blob/storage/indexeddb.ts +++ b/packages/frontend/workspace/src/blob/storage/indexeddb.ts @@ -1,6 +1,7 @@ import { createStore, del, get, keys, set } from 'idb-keyval'; import type { BlobStorage } from '../engine'; +import { bufferToBlob } from '../util'; export const createIndexeddbBlobStorage = ( workspaceId: string @@ -13,7 +14,7 @@ export const createIndexeddbBlobStorage = ( get: async (key: string) => { const res = await get(key, db); if (res) { - return new Blob([res], { type: await get(key, mimeTypeDb) }); + return bufferToBlob(res); } return undefined; }, From 33c53217c37e943c1650c3f9dc480bdc5a675303 Mon Sep 17 00:00:00 2001 From: LongYinan Date: Mon, 4 Dec 2023 06:42:54 +0000 Subject: [PATCH 05/68] chore: move cargo fmt to lint-staged from pre-commit (#5150) --- .husky/pre-commit | 2 +- package.json | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/.husky/pre-commit b/.husky/pre-commit index 2f1bef1ce9..3ea16f0a05 100755 --- a/.husky/pre-commit +++ b/.husky/pre-commit @@ -1,4 +1,4 @@ #!/usr/bin/env sh . "$(dirname -- "$0")/_/husky.sh" -yarn lint-staged && yarn lint:ox && cargo fmt --all && git add . +yarn lint-staged && yarn lint:ox diff --git a/package.json b/package.json index 903d543533..0b394bb8dc 100644 --- a/package.json +++ b/package.json @@ -50,6 +50,9 @@ ], "*.toml": [ "taplo format" + ], + "*.rs": [ + "cargo fmt --" ] }, "devDependencies": { From 0abadbe7bbc98f3a8c0a16ecad7cc6b65a03e9b4 Mon Sep 17 00:00:00 2001 From: Cats Juice Date: Mon, 4 Dec 2023 08:32:12 +0000 Subject: [PATCH 06/68] refactor(component): migrate design components (#5000) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ```[tasklist] ### Tasks - [x] Migrate components from [design](https://github.com/toeverything/design) - [x] Replace all imports from `@toeverything/components` - [x] Clean up `@toeverything/components` dependencies - [x] Storybook ``` ### Influence Here are all the components that are influenced by `@toeverything/components` - `@affine/component` - App update `Button` `Tooltip` - App sidebar header `IconButton`, `Tooltip` - Back `Button` - Auth - Change email page save `Button` - Change password page all `Button`s (Save, Later, Open) - Confirm change email `Button` - Set password page `Button` - Sign in success page `Button` - Sign up page `Button` - Auth `Modal` - Workspace card `Avatar`, `Divider`, `Tooltip`, `IconButton` - Share - Disable shared public link `Modal` - Import page `IconButton`, `Tooltip` - Accept invite page `Avatar`, `Button` - Invite member `Modal` - 404 Page `Avatar`, `Button`, `IconButton`, `Tooltip` - Notification center `IconButton` - Page list - operation cell `IconButton`, `Menu`, `ConfirmModal`, `Tooltip` - tags more `Menu` - favorite `IconButton`, `Tooltip` - new page dropdown `Menu` - filter `Menu`, `Button`, `IconButton` - Page operation `Menu` - export `MenuItem` - move to trash `MenuItem`, `ConfirmModal` - Workspace header filter `Menu`, `Button` - Collection bar `Button`, `Tooltip` (*⚠️ seems not used*) - Collection operation `Menu`, `MenuItem` - Create collection `Modal`, `Button` - Edit collection `Modal`, `Button` - Page mode filter `Menu` - Page mode `Button`, `Menu` - Setting modal - storage usage progress `Button`, `Tooltip` - On boarding tour `Modal` - `@affine/core` - Bookmark `Menu` - Affine error boundary `Button` - After sign in send email `Button` - After sign up send email `Button` - Send email `Button` - Sign in `Button` - Subscription redirect `Loading`, `Button` - Setting `Modal` - User plan button `Tooltip` - Members `Avatar`, `Button`, `IconButton`, `Loading`, `Tooltip`, `Menu` - Profile `Button`, `Avatar` - Workspace - publish panel `Button`, `Tooltip` - export panel `Button` - storage panel `Button`, `Tooltip` - delete `ConfirmModal` - Language `Menu` - Account setting `Avatar`, `Button` - Date format setting `Menu` - Billing `Button`, `IconButton`, `Loading` - Payment plans `Button`, `ConfirmModal`, `Modal`, `Tooltip` - Create workspace `Modal`, `ConfirmModal`, `Button` - Payment disabled `ConfirmModal` - Share/Export `Menu`, `Button`, `Divider` - Sign out `ConfirmModal` - Temp disable affine cloud `Modal` - Page detail operation `Menu` - Blocksuite mode switch `Tooltip` - Login card `Avatar` - Help island `Tooltip` - `plugin` - copilot - hello world - image preview - outline --- packages/frontend/component/package.json | 3 + packages/frontend/component/src/index.ts | 7 + .../component/src/ui/avatar/avatar.tsx | 143 +++++++ .../src/ui/avatar/colorful-fallback.tsx | 67 ++++ .../frontend/component/src/ui/avatar/index.ts | 1 + .../component/src/ui/avatar/style.css.ts | 210 ++++++++++ .../component/src/ui/button/button.css.ts | 373 ++++++++++++++++++ .../component/src/ui/button/button.tsx | 175 ++++++++ .../component/src/ui/button/icon-button.tsx | 88 +++++ .../frontend/component/src/ui/button/index.ts | 2 + .../component/src/ui/divider/divider.tsx | 52 +++ .../component/src/ui/divider/index.ts | 1 + .../component/src/ui/divider/style.css.ts | 21 + .../frontend/component/src/ui/menu/index.ts | 7 + .../component/src/ui/menu/menu-icon.tsx | 39 ++ .../component/src/ui/menu/menu-item.tsx | 33 ++ .../component/src/ui/menu/menu-separator.tsx | 21 + .../component/src/ui/menu/menu-sub.tsx | 72 ++++ .../component/src/ui/menu/menu-trigger.tsx | 87 ++++ .../frontend/component/src/ui/menu/menu.tsx | 52 +++ .../component/src/ui/menu/menu.types.ts | 11 + .../component/src/ui/menu/styles.css.ts | 157 ++++++++ .../component/src/ui/menu/use-menu-item.tsx | 73 ++++ .../component/src/ui/modal/confirm-modal.tsx | 47 +++ .../frontend/component/src/ui/modal/index.ts | 2 + .../frontend/component/src/ui/modal/modal.tsx | 111 ++++++ .../component/src/ui/modal/styles.css.ts | 79 ++++ .../component/src/ui/popover/index.ts | 1 + .../component/src/ui/popover/popover.tsx | 50 +++ .../component/src/ui/popover/styles.css.ts | 13 + .../component/src/ui/tooltip/index.ts | 5 + .../component/src/ui/tooltip/styles.css.ts | 11 + .../component/src/ui/tooltip/tooltip.tsx | 60 +++ yarn.lock | 9 +- 34 files changed, 2080 insertions(+), 3 deletions(-) create mode 100644 packages/frontend/component/src/ui/avatar/avatar.tsx create mode 100644 packages/frontend/component/src/ui/avatar/colorful-fallback.tsx create mode 100644 packages/frontend/component/src/ui/avatar/index.ts create mode 100644 packages/frontend/component/src/ui/avatar/style.css.ts create mode 100644 packages/frontend/component/src/ui/button/button.css.ts create mode 100644 packages/frontend/component/src/ui/button/button.tsx create mode 100644 packages/frontend/component/src/ui/button/icon-button.tsx create mode 100644 packages/frontend/component/src/ui/divider/divider.tsx create mode 100644 packages/frontend/component/src/ui/divider/index.ts create mode 100644 packages/frontend/component/src/ui/divider/style.css.ts create mode 100644 packages/frontend/component/src/ui/menu/index.ts create mode 100644 packages/frontend/component/src/ui/menu/menu-icon.tsx create mode 100644 packages/frontend/component/src/ui/menu/menu-item.tsx create mode 100644 packages/frontend/component/src/ui/menu/menu-separator.tsx create mode 100644 packages/frontend/component/src/ui/menu/menu-sub.tsx create mode 100644 packages/frontend/component/src/ui/menu/menu-trigger.tsx create mode 100644 packages/frontend/component/src/ui/menu/menu.tsx create mode 100644 packages/frontend/component/src/ui/menu/menu.types.ts create mode 100644 packages/frontend/component/src/ui/menu/styles.css.ts create mode 100644 packages/frontend/component/src/ui/menu/use-menu-item.tsx create mode 100644 packages/frontend/component/src/ui/modal/confirm-modal.tsx create mode 100644 packages/frontend/component/src/ui/modal/index.ts create mode 100644 packages/frontend/component/src/ui/modal/modal.tsx create mode 100644 packages/frontend/component/src/ui/modal/styles.css.ts create mode 100644 packages/frontend/component/src/ui/popover/index.ts create mode 100644 packages/frontend/component/src/ui/popover/popover.tsx create mode 100644 packages/frontend/component/src/ui/popover/styles.css.ts create mode 100644 packages/frontend/component/src/ui/tooltip/index.ts create mode 100644 packages/frontend/component/src/ui/tooltip/styles.css.ts create mode 100644 packages/frontend/component/src/ui/tooltip/tooltip.tsx diff --git a/packages/frontend/component/package.json b/packages/frontend/component/package.json index 118be62427..717ee513ff 100644 --- a/packages/frontend/component/package.json +++ b/packages/frontend/component/package.json @@ -29,11 +29,14 @@ "@popperjs/core": "^2.11.8", "@radix-ui/react-avatar": "^1.0.4", "@radix-ui/react-collapsible": "^1.0.3", + "@radix-ui/react-dialog": "^1.0.5", + "@radix-ui/react-dropdown-menu": "^2.0.6", "@radix-ui/react-popover": "^1.0.7", "@radix-ui/react-radio-group": "^1.1.3", "@radix-ui/react-scroll-area": "^1.0.5", "@radix-ui/react-toast": "^1.1.5", "@radix-ui/react-toolbar": "^1.0.4", + "@radix-ui/react-tooltip": "^1.0.7", "@toeverything/hooks": "workspace:*", "@toeverything/infra": "workspace:*", "@toeverything/theme": "^0.7.24", diff --git a/packages/frontend/component/src/index.ts b/packages/frontend/component/src/index.ts index 25218e5bc3..bd9d76dc72 100644 --- a/packages/frontend/component/src/index.ts +++ b/packages/frontend/component/src/index.ts @@ -1,13 +1,20 @@ +// TODO: Check `input` , `loading`, not migrated from `design` export * from './styles'; +export * from './ui/avatar'; export * from './ui/button'; export * from './ui/checkbox'; +export * from './ui/divider'; export * from './ui/empty'; export * from './ui/input'; export * from './ui/layout'; export * from './ui/lottie/collections-icon'; export * from './ui/lottie/delete-icon'; +export * from './ui/menu'; +export * from './ui/modal'; +export * from './ui/popover'; export * from './ui/scrollbar'; export * from './ui/skeleton'; export * from './ui/switch'; export * from './ui/table'; export * from './ui/toast'; +export * from './ui/tooltip'; diff --git a/packages/frontend/component/src/ui/avatar/avatar.tsx b/packages/frontend/component/src/ui/avatar/avatar.tsx new file mode 100644 index 0000000000..a1efd89949 --- /dev/null +++ b/packages/frontend/component/src/ui/avatar/avatar.tsx @@ -0,0 +1,143 @@ +import { CloseIcon } from '@blocksuite/icons'; +import { + type AvatarFallbackProps, + type AvatarImageProps, + type AvatarProps as RadixAvatarProps, + Fallback as AvatarFallback, + Image as AvatarImage, + Root as AvatarRoot, +} from '@radix-ui/react-avatar'; +import { assignInlineVars } from '@vanilla-extract/dynamic'; +import clsx from 'clsx'; +import type { CSSProperties, HTMLAttributes, MouseEvent } from 'react'; +import { forwardRef, type ReactElement, useMemo, useState } from 'react'; + +import { IconButton } from '../button'; +import { Tooltip, type TooltipProps } from '../tooltip'; +import { ColorfulFallback } from './colorful-fallback'; +import * as style from './style.css'; +import { sizeVar } from './style.css'; + +export type AvatarProps = { + size?: number; + url?: string | null; + name?: string; + className?: string; + style?: CSSProperties; + colorfulFallback?: boolean; + hoverIcon?: ReactElement; + onRemove?: (e: MouseEvent) => void; + avatarTooltipOptions?: Omit; + removeTooltipOptions?: Omit; + + fallbackProps?: AvatarFallbackProps; + imageProps?: Omit; + avatarProps?: RadixAvatarProps; + hoverWrapperProps?: HTMLAttributes; + removeButtonProps?: HTMLAttributes; +} & HTMLAttributes; + +export const Avatar = forwardRef( + ( + { + size = 20, + style: propsStyles = {}, + url, + name, + className, + colorfulFallback = false, + hoverIcon, + fallbackProps: { className: fallbackClassName, ...fallbackProps } = {}, + imageProps, + avatarProps, + onRemove, + hoverWrapperProps: { + className: hoverWrapperClassName, + ...hoverWrapperProps + } = {}, + avatarTooltipOptions, + removeTooltipOptions, + removeButtonProps: { + className: removeButtonClassName, + ...removeButtonProps + } = {}, + ...props + }, + ref + ) => { + const firstCharOfName = useMemo(() => { + return name?.slice(0, 1) || 'A'; + }, [name]); + const [imageDom, setImageDom] = useState(null); + const [removeButtonDom, setRemoveButtonDom] = + useState(null); + + return ( + + +
+ + + + {colorfulFallback ? ( + + ) : ( + firstCharOfName + )} + + {hoverIcon ? ( +
+ {hoverIcon} +
+ ) : null} +
+
+ + {onRemove ? ( + + + + + + ) : null} +
+ ); + } +); + +Avatar.displayName = 'Avatar'; diff --git a/packages/frontend/component/src/ui/avatar/colorful-fallback.tsx b/packages/frontend/component/src/ui/avatar/colorful-fallback.tsx new file mode 100644 index 0000000000..0318e60fbc --- /dev/null +++ b/packages/frontend/component/src/ui/avatar/colorful-fallback.tsx @@ -0,0 +1,67 @@ +import clsx from 'clsx'; +import { useMemo, useRef, useState } from 'react'; + +import { + DefaultAvatarBottomItemStyle, + DefaultAvatarBottomItemWithAnimationStyle, + DefaultAvatarContainerStyle, + DefaultAvatarMiddleItemStyle, + DefaultAvatarMiddleItemWithAnimationStyle, + DefaultAvatarTopItemStyle, +} from './style.css'; + +const colorsSchema = [ + ['#FF0000', '#FF00E5', '#FFAE73'], + ['#FF5C00', '#FFC700', '#FFE073'], + ['#FFDA16', '#FFFBA6', '#FFBE73'], + ['#8CD317', '#FCFF5C', '#67CAE9'], + ['#28E19F', '#89FFC6', '#39A880'], + ['#35B7E0', '#77FFCE', '#5076FF'], + ['#3D39FF', '#77BEFF', '#3502FF'], + ['#BD08EB', '#755FFF', '#6967E4'], +]; + +export const ColorfulFallback = ({ char }: { char: string }) => { + const colors = useMemo(() => { + const index = char.toUpperCase().charCodeAt(0); + return colorsSchema[index % colorsSchema.length]; + }, [char]); + + const timer = useRef>(); + + const [topColor, middleColor, bottomColor] = colors; + const [isHover, setIsHover] = useState(false); + + return ( +
{ + timer.current = setTimeout(() => { + setIsHover(true); + }, 300); + }} + onMouseLeave={() => { + clearTimeout(timer.current); + setIsHover(false); + }} + > +
+
+
+
+ ); +}; +export default ColorfulFallback; diff --git a/packages/frontend/component/src/ui/avatar/index.ts b/packages/frontend/component/src/ui/avatar/index.ts new file mode 100644 index 0000000000..a7424ca311 --- /dev/null +++ b/packages/frontend/component/src/ui/avatar/index.ts @@ -0,0 +1 @@ +export * from './avatar'; diff --git a/packages/frontend/component/src/ui/avatar/style.css.ts b/packages/frontend/component/src/ui/avatar/style.css.ts new file mode 100644 index 0000000000..46753c359a --- /dev/null +++ b/packages/frontend/component/src/ui/avatar/style.css.ts @@ -0,0 +1,210 @@ +import { createVar, globalStyle, keyframes, style } from '@vanilla-extract/css'; +export const sizeVar = createVar('sizeVar'); + +const bottomAnimation = keyframes({ + '0%': { + top: '-44%', + left: '-11%', + transform: 'matrix(-0.29, -0.96, 0.94, -0.35, 0, 0)', + }, + '16%': { + left: '-18%', + top: '-51%', + transform: 'matrix(-0.73, -0.69, 0.64, -0.77, 0, 0)', + }, + '32%': { + left: '-7%', + top: '-40%', + transform: 'matrix(-0.97, -0.23, 0.16, -0.99, 0, 0)', + }, + '48%': { + left: '-15%', + top: '-39%', + transform: 'matrix(-0.88, 0.48, -0.6, -0.8, 0, 0)', + }, + '64%': { + left: '-7%', + top: '-40%', + transform: 'matrix(-0.97, -0.23, 0.16, -0.99, 0, 0)', + }, + '80%': { + left: '-18%', + top: '-51%', + transform: 'matrix(-0.73, -0.69, 0.64, -0.77, 0, 0)', + }, + '100%': { + top: '-44%', + left: '-11%', + transform: 'matrix(-0.29, -0.96, 0.94, -0.35, 0, 0)', + }, +}); +const middleAnimation = keyframes({ + '0%': { + left: '-30px', + top: '-30px', + transform: 'matrix(-0.48, -0.88, 0.8, -0.6, 0, 0)', + }, + '16%': { + left: '-37px', + top: '-37px', + transform: 'matrix(-0.86, -0.52, 0.39, -0.92, 0, 0)', + }, + '32%': { + left: '-20px', + top: '-10px', + transform: 'matrix(-1, -0.02, -0.12, -0.99, 0, 0)', + }, + '48%': { + left: '-27px', + top: '-2px', + transform: 'matrix(-0.88, 0.48, -0.6, -0.8, 0, 0)', + }, + '64%': { + left: '-20px', + top: '-10px', + transform: 'matrix(-1, -0.02, -0.12, -0.99, 0, 0)', + }, + '80%': { + left: '-37px', + top: '-37px', + transform: 'matrix(-0.86, -0.52, 0.39, -0.92, 0, 0)', + }, + '100%': { + left: '-30px', + top: '-30px', + transform: 'matrix(-0.48, -0.88, 0.8, -0.6, 0, 0)', + }, +}); + +export const DefaultAvatarContainerStyle = style({ + width: '100%', + height: '100%', + position: 'relative', + borderRadius: '50%', + overflow: 'hidden', +}); + +export const DefaultAvatarMiddleItemStyle = style({ + width: '83%', + height: '81%', + position: 'absolute', + left: '-30%', + top: '-30%', + transform: 'matrix(-0.48, -0.88, 0.8, -0.6, 0, 0)', + opacity: '0.8', + filter: 'blur(12px)', + transformOrigin: 'center center', + animation: `${middleAnimation} 3s ease-in-out forwards infinite`, + animationPlayState: 'paused', +}); +export const DefaultAvatarMiddleItemWithAnimationStyle = style({ + animationPlayState: 'running', +}); +export const DefaultAvatarBottomItemStyle = style({ + width: '98%', + height: '97%', + position: 'absolute', + top: '-44%', + left: '-11%', + transform: 'matrix(-0.29, -0.96, 0.94, -0.35, 0, 0)', + opacity: '0.8', + filter: 'blur(12px)', + transformOrigin: 'center center', + willChange: 'left, top, transform', + animation: `${bottomAnimation} 3s ease-in-out forwards infinite`, + animationPlayState: 'paused', +}); +export const DefaultAvatarBottomItemWithAnimationStyle = style({ + animationPlayState: 'running', +}); +export const DefaultAvatarTopItemStyle = style({ + width: '104%', + height: '94%', + position: 'absolute', + right: '-30%', + top: '-30%', + opacity: '0.8', + filter: 'blur(12px)', + transform: 'matrix(-0.28, -0.96, 0.93, -0.37, 0, 0)', + transformOrigin: 'center center', +}); + +export const avatarRoot = style({ + position: 'relative', + display: 'inline-flex', + flexShrink: 0, +}); +export const avatarWrapper = style({ + vars: { + [sizeVar]: 'unset', + }, + width: sizeVar, + height: sizeVar, + fontSize: `calc(${sizeVar} / 2)`, + display: 'flex', + alignItems: 'center', + justifyContent: 'center', + verticalAlign: 'middle', + userSelect: 'none', + position: 'relative', +}); + +export const avatarImage = style({ + width: '100%', + height: '100%', + objectFit: 'cover', + borderRadius: '50%', +}); + +export const avatarFallback = style({ + width: '100%', + height: '100%', + borderRadius: '50%', + display: 'flex', + alignItems: 'center', + justifyContent: 'center', + backgroundColor: 'var(--affine-primary-color)', + color: 'var(--affine-white)', + lineHeight: '1', + fontWeight: '500', +}); + +export const hoverWrapper = style({ + width: '100%', + height: '100%', + borderRadius: '50%', + position: 'absolute', + display: 'flex', + justifyContent: 'center', + alignItems: 'center', + backgroundColor: 'rgba(60, 61, 63, 0.5)', + zIndex: '1', + color: 'var(--affine-white)', + opacity: 0, + transition: 'opacity .15s', + cursor: 'pointer', + selectors: { + '&:hover': { + opacity: 1, + }, + }, +}); + +export const removeButton = style({ + position: 'absolute', + right: '-8px', + top: '-2px', + visibility: 'hidden', + zIndex: '1', + selectors: { + '&:hover': { + background: '#f6f6f6', + }, + }, +}); +globalStyle(`${avatarRoot}:hover ${removeButton}`, { + visibility: 'visible', +}); +globalStyle(`${avatarRoot} ${removeButton}:hover`, { + background: '#f6f6f6', +}); diff --git a/packages/frontend/component/src/ui/button/button.css.ts b/packages/frontend/component/src/ui/button/button.css.ts new file mode 100644 index 0000000000..f74f0a2661 --- /dev/null +++ b/packages/frontend/component/src/ui/button/button.css.ts @@ -0,0 +1,373 @@ +import { globalStyle, style } from '@vanilla-extract/css'; + +export const button = style({ + display: 'inline-flex', + justifyContent: 'center', + alignItems: 'center', + userSelect: 'none', + touchAction: 'manipulation', + outline: '0', + border: '1px solid', + padding: '0 18px', + borderRadius: '8px', + fontSize: 'var(--affine-font-xs)', + fontWeight: 500, + transition: 'all .3s', + ['WebkitAppRegion' as string]: 'no-drag', + cursor: 'pointer', + + // changeable + height: '28px', + background: 'var(--affine-white)', + borderColor: 'var(--affine-border-color)', + color: 'var(--affine-text-primary-color)', + + selectors: { + '&.text-bold': { + fontWeight: 600, + }, + '&:not(.without-hover):hover': { + background: 'var(--affine-hover-color)', + }, + '&.disabled': { + opacity: '.4', + cursor: 'default', + color: 'var(--affine-disable-color)', + pointerEvents: 'none', + }, + '&.loading': { + cursor: 'default', + color: 'var(--affine-disable-color)', + pointerEvents: 'none', + }, + '&.disabled:not(.without-hover):hover, &.loading:not(.without-hover):hover': + { + background: 'inherit', + }, + + '&.block': { display: 'flex', width: '100%' }, + + '&.circle': { + borderRadius: '50%', + }, + '&.round': { + borderRadius: '14px', + }, + // size + '&.large': { + height: '32px', + fontSize: 'var(--affine-font-base)', + fontWeight: 600, + }, + '&.round.large': { + borderRadius: '16px', + }, + '&.extraLarge': { + height: '40px', + fontSize: 'var(--affine-font-base)', + fontWeight: 700, + }, + '&.extraLarge.primary': { + boxShadow: 'var(--affine-large-button-effect) !important', + }, + '&.round.extraLarge': { + borderRadius: '20px', + }, + + // type + '&.plain': { + color: 'var(--affine-text-primary-color)', + borderColor: 'transparent', + background: 'transparent', + }, + + '&.primary': { + color: 'var(--affine-pure-white)', + background: 'var(--affine-primary-color)', + borderColor: 'var(--affine-black-10)', + boxShadow: 'var(--affine-button-inner-shadow)', + }, + '&.primary:not(.without-hover):hover': { + background: + 'linear-gradient(0deg, rgba(0, 0, 0, 0.04) 0%, rgba(0, 0, 0, 0.04) 100%), var(--affine-primary-color)', + }, + '&.primary.disabled': { + opacity: '.4', + cursor: 'default', + }, + '&.primary.disabled:not(.without-hover):hover': { + background: 'var(--affine-primary-color)', + }, + + '&.error': { + color: 'var(--affine-pure-white)', + background: 'var(--affine-error-color)', + borderColor: 'var(--affine-black-10)', + boxShadow: 'var(--affine-button-inner-shadow)', + }, + '&.error:not(.without-hover):hover': { + background: + 'linear-gradient(0deg, rgba(0, 0, 0, 0.04) 0%, rgba(0, 0, 0, 0.04) 100%), var(--affine-error-color)', + }, + '&.error.disabled': { + opacity: '.4', + cursor: 'default', + }, + '&.error.disabled:not(.without-hover):hover': { + background: 'var(--affine-error-color)', + }, + + '&.warning': { + color: 'var(--affine-pure-white)', + background: 'var(--affine-warning-color)', + borderColor: 'var(--affine-black-10)', + boxShadow: 'var(--affine-button-inner-shadow)', + }, + '&.warning:not(.without-hover):hover': { + background: + 'linear-gradient(0deg, rgba(0, 0, 0, 0.04) 0%, rgba(0, 0, 0, 0.04) 100%), var(--affine-warning-color)', + }, + '&.warning.disabled': { + opacity: '.4', + cursor: 'default', + }, + '&.warning.disabled:not(.without-hover):hover': { + background: 'var(--affine-warning-color)', + }, + + '&.success': { + color: 'var(--affine-pure-white)', + background: 'var(--affine-success-color)', + borderColor: 'var(--affine-black-10)', + boxShadow: 'var(--affine-button-inner-shadow)', + }, + '&.success:not(.without-hover):hover': { + background: + 'linear-gradient(0deg, rgba(0, 0, 0, 0.04) 0%, rgba(0, 0, 0, 0.04) 100%), var(--affine-success-color)', + }, + '&.success.disabled': { + opacity: '.4', + cursor: 'default', + }, + '&.success.disabled:not(.without-hover):hover': { + background: 'var(--affine-success-color)', + }, + + '&.processing': { + color: 'var(--affine-pure-white)', + background: 'var(--affine-processing-color)', + borderColor: 'var(--affine-black-10)', + boxShadow: 'var(--affine-button-inner-shadow)', + }, + '&.processing:not(.without-hover):hover': { + background: + 'linear-gradient(0deg, rgba(0, 0, 0, 0.04) 0%, rgba(0, 0, 0, 0.04) 100%), var(--affine-processing-color)', + }, + '&.processing.disabled': { + opacity: '.4', + cursor: 'default', + }, + '&.processing.disabled:not(.without-hover):hover': { + background: 'var(--affine-processing-color)', + }, + }, +}); + +globalStyle(`${button} > span`, { + // flex: 1, + lineHeight: 1, + padding: '0 4px', +}); + +export const buttonIcon = style({ + flexShrink: 0, + display: 'inline-flex', + justifyContent: 'center', + alignItems: 'center', + color: 'var(--affine-icon-color)', + fontSize: '16px', + width: '16px', + height: '16px', + selectors: { + '&.start': { + marginRight: '4px', + }, + '&.end': { + marginLeft: '4px', + }, + '&.large': { + fontSize: '20px', + width: '20px', + height: '20px', + }, + '&.extraLarge': { + fontSize: '20px', + width: '20px', + height: '20px', + }, + '&.color-white': { + color: 'var(--affine-pure-white)', + }, + }, +}); + +export const iconButton = style({ + display: 'inline-flex', + justifyContent: 'center', + alignItems: 'center', + userSelect: 'none', + touchAction: 'manipulation', + outline: '0', + border: '1px solid', + borderRadius: '4px', + transition: 'all .3s', + ['WebkitAppRegion' as string]: 'no-drag', + cursor: 'pointer', + background: 'var(--affine-white)', + + // changeable + width: '24px', + height: '24px', + fontSize: '20px', + color: 'var(--affine-text-primary-color)', + borderColor: 'var(--affine-border-color)', + selectors: { + '&.without-padding': { + margin: '-2px', + }, + '&.active': { + color: 'var(--affine-primary-color)', + }, + + '&:not(.without-hover):hover': { + background: 'var(--affine-hover-color)', + }, + '&.disabled': { + opacity: '.4', + cursor: 'default', + color: 'var(--affine-disable-color)', + pointerEvents: 'none', + }, + '&.loading': { + cursor: 'default', + color: 'var(--affine-disable-color)', + pointerEvents: 'none', + }, + '&.disabled:not(.without-hover):hover, &.loading:not(.without-hover):hover': + { + background: 'inherit', + }, + + // size + '&.large': { + width: '32px', + height: '32px', + fontSize: '24px', + }, + '&.large.without-padding': { + margin: '-4px', + }, + '&.small': { width: '20px', height: '20px', fontSize: '16px' }, + '&.extra-small': { width: '16px', height: '16px', fontSize: '12px' }, + + // type + '&.plain': { + color: 'var(--affine-icon-color)', + borderColor: 'transparent', + background: 'transparent', + }, + '&.plain.active': { + color: 'var(--affine-primary-color)', + }, + + '&.primary': { + color: 'var(--affine-white)', + background: 'var(--affine-primary-color)', + borderColor: 'var(--affine-black-10)', + boxShadow: '0px 1px 2px 0px rgba(255, 255, 255, 0.25) inset', + }, + '&.primary:not(.without-hover):hover': { + background: + 'linear-gradient(0deg, rgba(0, 0, 0, 0.04) 0%, rgba(0, 0, 0, 0.04) 100%), var(--affine-primary-color)', + }, + '&.primary.disabled': { + opacity: '.4', + cursor: 'default', + }, + '&.primary.disabled:not(.without-hover):hover': { + background: 'var(--affine-primary-color)', + }, + + '&.error': { + color: 'var(--affine-white)', + background: 'var(--affine-error-color)', + borderColor: 'var(--affine-black-10)', + boxShadow: '0px 1px 2px 0px rgba(255, 255, 255, 0.25) inset', + }, + '&.error:not(.without-hover):hover': { + background: + 'linear-gradient(0deg, rgba(0, 0, 0, 0.04) 0%, rgba(0, 0, 0, 0.04) 100%), var(--affine-error-color)', + }, + '&.error.disabled': { + opacity: '.4', + cursor: 'default', + }, + '&.error.disabled:not(.without-hover):hover': { + background: 'var(--affine-error-color)', + }, + + '&.warning': { + color: 'var(--affine-white)', + background: 'var(--affine-warning-color)', + borderColor: 'var(--affine-black-10)', + boxShadow: '0px 1px 2px 0px rgba(255, 255, 255, 0.25) inset', + }, + '&.warning:not(.without-hover):hover': { + background: + 'linear-gradient(0deg, rgba(0, 0, 0, 0.04) 0%, rgba(0, 0, 0, 0.04) 100%), var(--affine-warning-color)', + }, + '&.warning.disabled': { + opacity: '.4', + cursor: 'default', + }, + '&.warning.disabled:not(.without-hover):hover': { + background: 'var(--affine-warning-color)', + }, + + '&.success': { + color: 'var(--affine-white)', + background: 'var(--affine-success-color)', + borderColor: 'var(--affine-black-10)', + boxShadow: '0px 1px 2px 0px rgba(255, 255, 255, 0.25) inset', + }, + '&.success:not(.without-hover):hover': { + background: + 'linear-gradient(0deg, rgba(0, 0, 0, 0.04) 0%, rgba(0, 0, 0, 0.04) 100%), var(--affine-success-color)', + }, + '&.success.disabled': { + opacity: '.4', + cursor: 'default', + }, + '&.success.disabled:not(.without-hover):hover': { + background: 'var(--affine-success-color)', + }, + + '&.processing': { + color: 'var(--affine-white)', + background: 'var(--affine-processing-color)', + borderColor: 'var(--affine-black-10)', + boxShadow: '0px 1px 2px 0px rgba(255, 255, 255, 0.25) inset', + }, + '&.processing:not(.without-hover):hover': { + background: + 'linear-gradient(0deg, rgba(0, 0, 0, 0.04) 0%, rgba(0, 0, 0, 0.04) 100%), var(--affine-processing-color)', + }, + '&.processing.disabled': { + opacity: '.4', + cursor: 'default', + }, + '&.processing.disabled:not(.without-hover):hover': { + background: 'var(--affine-processing-color)', + }, + }, +}); diff --git a/packages/frontend/component/src/ui/button/button.tsx b/packages/frontend/component/src/ui/button/button.tsx new file mode 100644 index 0000000000..dd8dbaf91f --- /dev/null +++ b/packages/frontend/component/src/ui/button/button.tsx @@ -0,0 +1,175 @@ +import clsx from 'clsx'; +import { + type FC, + forwardRef, + type HTMLAttributes, + type PropsWithChildren, + type ReactElement, + useMemo, +} from 'react'; + +import { Loading } from '../loading'; +import { button, buttonIcon } from './button.css'; + +export type ButtonType = + | 'default' + | 'primary' + | 'plain' + | 'error' + | 'warning' + | 'success' + | 'processing'; +export type ButtonSize = 'default' | 'large' | 'extraLarge'; +type BaseButtonProps = { + type?: ButtonType; + disabled?: boolean; + icon?: ReactElement; + iconPosition?: 'start' | 'end'; + shape?: 'default' | 'round' | 'circle'; + block?: boolean; + size?: ButtonSize; + loading?: boolean; + withoutHoverStyle?: boolean; +}; + +export type ButtonProps = PropsWithChildren & + Omit, 'type'> & { + componentProps?: { + startIcon?: Omit; + endIcon?: Omit; + }; + }; + +type IconButtonProps = PropsWithChildren & + Omit, 'type'>; + +const defaultProps = { + type: 'default', + disabled: false, + shape: 'default', + size: 'default', + iconPosition: 'start', + loading: false, + withoutHoverStyle: false, +} as const; + +const ButtonIcon: FC = props => { + const { + size, + icon, + iconPosition = 'start', + children, + type, + loading, + withoutHoverStyle, + ...otherProps + } = { + ...defaultProps, + ...props, + }; + const onlyIcon = icon && !children; + return ( +
+ {icon} +
+ ); +}; +export const Button = forwardRef( + (props, ref) => { + const { + children, + type, + disabled, + shape, + size, + icon: propsIcon, + iconPosition, + block, + loading, + withoutHoverStyle, + className, + ...otherProps + } = { + ...defaultProps, + ...props, + } satisfies ButtonProps; + + const icon = useMemo(() => { + if (loading) { + return ; + } + return propsIcon; + }, [propsIcon, loading]); + + const baseIconButtonProps = useMemo(() => { + return { + size, + iconPosition, + icon, + type, + disabled, + loading, + } as const; + }, [disabled, icon, iconPosition, loading, size, type]); + + return ( + + ); + } +); +Button.displayName = 'Button'; +export default Button; diff --git a/packages/frontend/component/src/ui/button/icon-button.tsx b/packages/frontend/component/src/ui/button/icon-button.tsx new file mode 100644 index 0000000000..880bed1414 --- /dev/null +++ b/packages/frontend/component/src/ui/button/icon-button.tsx @@ -0,0 +1,88 @@ +import clsx from 'clsx'; +import type { HTMLAttributes, PropsWithChildren } from 'react'; +import { forwardRef, type ReactElement } from 'react'; + +import { Loading } from '../loading'; +import type { ButtonType } from './button'; +import { iconButton } from './button.css'; + +export type IconButtonSize = 'default' | 'large' | 'small' | 'extraSmall'; +export type IconButtonProps = Omit, 'type'> & + PropsWithChildren<{ + type?: ButtonType; + disabled?: boolean; + size?: IconButtonSize; + loading?: boolean; + withoutPadding?: boolean; + active?: boolean; + withoutHoverStyle?: boolean; + icon?: ReactElement; + }>; + +const defaultProps = { + type: 'plain', + disabled: false, + size: 'default', + loading: false, + withoutPadding: false, + active: false, + withoutHoverStyle: false, +} as const; + +export const IconButton = forwardRef( + (props, ref) => { + const { + type, + size, + withoutPadding, + children, + disabled, + loading, + active, + withoutHoverStyle, + icon: propsIcon, + className, + ...otherProps + } = { + ...defaultProps, + ...props, + }; + + return ( + + ); + } +); + +IconButton.displayName = 'IconButton'; +export default IconButton; diff --git a/packages/frontend/component/src/ui/button/index.ts b/packages/frontend/component/src/ui/button/index.ts index d0456a6981..a8957d85da 100644 --- a/packages/frontend/component/src/ui/button/index.ts +++ b/packages/frontend/component/src/ui/button/index.ts @@ -1,2 +1,4 @@ +export * from './button'; export * from './dropdown-button'; +export * from './icon-button'; export * from './radio'; diff --git a/packages/frontend/component/src/ui/divider/divider.tsx b/packages/frontend/component/src/ui/divider/divider.tsx new file mode 100644 index 0000000000..56f7a57b57 --- /dev/null +++ b/packages/frontend/component/src/ui/divider/divider.tsx @@ -0,0 +1,52 @@ +import clsx from 'clsx'; +import type { HTMLAttributes, PropsWithChildren } from 'react'; +import { forwardRef } from 'react'; + +import * as styles from './style.css'; +export type DividerOrientation = 'horizontal' | 'vertical'; +export type DividerProps = PropsWithChildren & + Omit, 'type'> & { + orientation?: DividerOrientation; + size?: 'thinner' | 'default'; + dividerColor?: string; + }; + +const defaultProps = { + orientation: 'horizontal', + size: 'default', +}; + +export const Divider = forwardRef( + (props, ref) => { + const { orientation, className, size, dividerColor, style, ...otherProps } = + { + ...defaultProps, + ...props, + }; + + return ( +
+ ); + } +); + +Divider.displayName = 'Divider'; +export default Divider; diff --git a/packages/frontend/component/src/ui/divider/index.ts b/packages/frontend/component/src/ui/divider/index.ts new file mode 100644 index 0000000000..bf4ed01967 --- /dev/null +++ b/packages/frontend/component/src/ui/divider/index.ts @@ -0,0 +1 @@ +export * from './divider'; diff --git a/packages/frontend/component/src/ui/divider/style.css.ts b/packages/frontend/component/src/ui/divider/style.css.ts new file mode 100644 index 0000000000..48f1dd1346 --- /dev/null +++ b/packages/frontend/component/src/ui/divider/style.css.ts @@ -0,0 +1,21 @@ +import { style } from '@vanilla-extract/css'; + +export const divider = style({ + height: '1px', + backgroundColor: 'var(--affine-border-color)', + borderRadius: '8px', + margin: '8px 0', + width: '100%', +}); +export const thinner = style({ + height: '0.5px', +}); +export const verticalDivider = style({ + width: '1px', + borderRadius: '8px', + height: '100%', + margin: '0 2px', +}); +export const verticalThinner = style({ + width: '0.5px', +}); diff --git a/packages/frontend/component/src/ui/menu/index.ts b/packages/frontend/component/src/ui/menu/index.ts new file mode 100644 index 0000000000..405ef1e04c --- /dev/null +++ b/packages/frontend/component/src/ui/menu/index.ts @@ -0,0 +1,7 @@ +export * from './menu'; +export * from './menu.types'; +export * from './menu-icon'; +export * from './menu-item'; +export * from './menu-separator'; +export * from './menu-sub'; +export * from './menu-trigger'; diff --git a/packages/frontend/component/src/ui/menu/menu-icon.tsx b/packages/frontend/component/src/ui/menu/menu-icon.tsx new file mode 100644 index 0000000000..f0b1497f01 --- /dev/null +++ b/packages/frontend/component/src/ui/menu/menu-icon.tsx @@ -0,0 +1,39 @@ +import clsx from 'clsx'; +import type { PropsWithChildren, ReactNode } from 'react'; +import { forwardRef, type HTMLAttributes, useMemo } from 'react'; + +import { menuItemIcon } from './styles.css'; + +export interface MenuIconProps + extends PropsWithChildren, + HTMLAttributes { + icon?: ReactNode; + position?: 'start' | 'end'; +} + +export const MenuIcon = forwardRef( + ({ children, icon, position = 'start', className, ...otherProps }, ref) => { + return ( +
+ clsx( + menuItemIcon, + { + end: position === 'end', + start: position === 'start', + }, + className + ), + [className, position] + )} + {...otherProps} + > + {icon || children} +
+ ); + } +); + +MenuIcon.displayName = 'MenuIcon'; diff --git a/packages/frontend/component/src/ui/menu/menu-item.tsx b/packages/frontend/component/src/ui/menu/menu-item.tsx new file mode 100644 index 0000000000..a6278f9648 --- /dev/null +++ b/packages/frontend/component/src/ui/menu/menu-item.tsx @@ -0,0 +1,33 @@ +import * as DropdownMenu from '@radix-ui/react-dropdown-menu'; + +import type { MenuItemProps } from './menu.types'; +import { useMenuItem } from './use-menu-item'; + +export const MenuItem = ({ + children: propsChildren, + type = 'default', + className: propsClassName, + preFix, + endFix, + checked, + selected, + block, + ...otherProps +}: MenuItemProps) => { + const { className, children } = useMenuItem({ + children: propsChildren, + className: propsClassName, + type, + preFix, + endFix, + checked, + selected, + block, + }); + + return ( + + {children} + + ); +}; diff --git a/packages/frontend/component/src/ui/menu/menu-separator.tsx b/packages/frontend/component/src/ui/menu/menu-separator.tsx new file mode 100644 index 0000000000..dc306549e0 --- /dev/null +++ b/packages/frontend/component/src/ui/menu/menu-separator.tsx @@ -0,0 +1,21 @@ +import type { MenuSeparatorProps } from '@radix-ui/react-dropdown-menu'; +import * as DropdownMenu from '@radix-ui/react-dropdown-menu'; +import clsx from 'clsx'; +import { useMemo } from 'react'; + +import * as styles from './styles.css'; + +export const MenuSeparator = ({ + className, + ...otherProps +}: MenuSeparatorProps) => { + return ( + clsx(styles.menuSeparator, className), + [className] + )} + {...otherProps} + /> + ); +}; diff --git a/packages/frontend/component/src/ui/menu/menu-sub.tsx b/packages/frontend/component/src/ui/menu/menu-sub.tsx new file mode 100644 index 0000000000..6b947feece --- /dev/null +++ b/packages/frontend/component/src/ui/menu/menu-sub.tsx @@ -0,0 +1,72 @@ +import { ArrowRightSmallIcon } from '@blocksuite/icons'; +import type { + DropdownMenuSubProps, + MenuPortalProps, + MenuSubContentProps, +} from '@radix-ui/react-dropdown-menu'; +import * as DropdownMenu from '@radix-ui/react-dropdown-menu'; +import clsx from 'clsx'; +import type { ReactNode } from 'react'; +import { useMemo } from 'react'; + +import type { MenuItemProps } from './menu.types'; +import { MenuIcon } from './menu-icon'; +import * as styles from './styles.css'; +import { useMenuItem } from './use-menu-item'; +export interface MenuSubProps { + children: ReactNode; + items: ReactNode; + triggerOptions?: Omit; + portalOptions?: Omit; + subOptions?: Omit; + subContentOptions?: Omit; +} + +export const MenuSub = ({ + children: propsChildren, + items, + portalOptions, + subOptions, + triggerOptions: { + className: propsClassName, + preFix, + endFix, + type, + ...otherTriggerOptions + } = {}, + subContentOptions: { + className: subContentClassName = '', + ...otherSubContentOptions + } = {}, +}: MenuSubProps) => { + const { className, children } = useMenuItem({ + children: propsChildren, + className: propsClassName, + type, + preFix, + endFix, + }); + + return ( + + + {children} + + + + + + clsx(styles.menuContent, subContentClassName), + [subContentClassName] + )} + {...otherSubContentOptions} + > + {items} + + + + ); +}; diff --git a/packages/frontend/component/src/ui/menu/menu-trigger.tsx b/packages/frontend/component/src/ui/menu/menu-trigger.tsx new file mode 100644 index 0000000000..483e83c8d0 --- /dev/null +++ b/packages/frontend/component/src/ui/menu/menu-trigger.tsx @@ -0,0 +1,87 @@ +import { ArrowDownSmallIcon } from '@blocksuite/icons'; +import { assignInlineVars } from '@vanilla-extract/dynamic'; +import clsx from 'clsx'; +import type { PropsWithChildren } from 'react'; +import { + type CSSProperties, + forwardRef, + type HTMLAttributes, + type ReactNode, +} from 'react'; + +import { MenuIcon } from './menu-icon'; +import * as styles from './styles.css'; +import { triggerWidthVar } from './styles.css'; + +export interface MenuTriggerProps + extends PropsWithChildren, + HTMLAttributes { + width?: CSSProperties['width']; + disabled?: boolean; + noBorder?: boolean; + status?: 'error' | 'success' | 'warning' | 'default'; + size?: 'default' | 'large' | 'extraLarge'; + preFix?: ReactNode; + endFix?: ReactNode; + block?: boolean; +} + +export const MenuTrigger = forwardRef( + ( + { + disabled, + noBorder = false, + className, + status = 'default', + size = 'default', + preFix, + endFix, + block = false, + children, + width, + style = {}, + ...otherProps + }, + ref + ) => { + return ( + + ); + } +); + +MenuTrigger.displayName = 'MenuTrigger'; diff --git a/packages/frontend/component/src/ui/menu/menu.tsx b/packages/frontend/component/src/ui/menu/menu.tsx new file mode 100644 index 0000000000..620e3e9efe --- /dev/null +++ b/packages/frontend/component/src/ui/menu/menu.tsx @@ -0,0 +1,52 @@ +import type { + DropdownMenuProps, + MenuContentProps, + MenuPortalProps, +} from '@radix-ui/react-dropdown-menu'; +import * as DropdownMenu from '@radix-ui/react-dropdown-menu'; +import clsx from 'clsx'; +import type { ReactNode } from 'react'; +import { useMemo } from 'react'; + +import * as styles from './styles.css'; + +export interface MenuProps { + children: ReactNode; + items: ReactNode; + portalOptions?: Omit; + rootOptions?: Omit; + contentOptions?: Omit; +} + +export const Menu = ({ + children, + items, + portalOptions, + rootOptions, + contentOptions: { + className = '', + style: contentStyle = {}, + ...otherContentOptions + } = {}, +}: MenuProps) => { + return ( + + {children} + + + clsx(styles.menuContent, className), + [className] + )} + sideOffset={5} + align="start" + style={{ zIndex: 'var(--affine-z-index-popover)', ...contentStyle }} + {...otherContentOptions} + > + {items} + + + + ); +}; diff --git a/packages/frontend/component/src/ui/menu/menu.types.ts b/packages/frontend/component/src/ui/menu/menu.types.ts new file mode 100644 index 0000000000..658f2b02d7 --- /dev/null +++ b/packages/frontend/component/src/ui/menu/menu.types.ts @@ -0,0 +1,11 @@ +import type { MenuItemProps as MenuItemPropsPrimitive } from '@radix-ui/react-dropdown-menu'; + +export interface MenuItemProps + extends Omit { + type?: 'default' | 'warning' | 'danger'; + preFix?: React.ReactNode; + endFix?: React.ReactNode; + checked?: boolean; + selected?: boolean; + block?: boolean; +} diff --git a/packages/frontend/component/src/ui/menu/styles.css.ts b/packages/frontend/component/src/ui/menu/styles.css.ts new file mode 100644 index 0000000000..8a95ad1ac8 --- /dev/null +++ b/packages/frontend/component/src/ui/menu/styles.css.ts @@ -0,0 +1,157 @@ +import { createVar, style } from '@vanilla-extract/css'; +export const triggerWidthVar = createVar('triggerWidthVar'); + +export const menuContent = style({ + minWidth: '180px', + color: 'var(--affine-text-primary-color)', + borderRadius: '8px', + padding: '8px', + fontSize: 'var(--affine-font-sm)', + fontWeight: '400', + backgroundColor: 'var(--affine-background-overlay-panel-color)', + boxShadow: 'var(--affine-menu-shadow)', + userSelect: 'none', +}); + +export const menuItem = style({ + maxWidth: '296px', + display: 'flex', + alignItems: 'center', + justifyContent: 'space-between', + padding: '4px 12px', + borderRadius: '4px', + lineHeight: '22px', + border: 'none', + outline: 'none', + cursor: 'pointer', + boxSizing: 'border-box', + selectors: { + '&:not(:last-of-type)': { + marginBottom: '4px', + }, + '&.block': { maxWidth: '100%' }, + '&[data-disabled]': { + color: 'var(--affine-text-disable-color)', + pointerEvents: 'none', + cursor: 'not-allowed', + }, + '&[data-highlighted]': { + backgroundColor: 'var(--affine-hover-color)', + }, + + '&:hover': { + backgroundColor: 'var(--affine-hover-color)', + }, + '&.danger:hover': { + color: 'var(--affine-error-color)', + backgroundColor: 'var(--affine-background-error-color)', + }, + + '&.warning:hover': { + color: 'var(--affine-warning-color)', + backgroundColor: 'var(--affine-background-warning-color)', + }, + + '&.selected, &.checked': { + backgroundColor: 'var(--affine-hover-color)', + color: 'var(--affine-primary-color)', + }, + }, +}); + +export const menuSpan = style({ + flex: 1, + overflow: 'hidden', + textOverflow: 'ellipsis', + whiteSpace: 'nowrap', + textAlign: 'left', +}); +export const menuItemIcon = style({ + display: 'flex', + flexShrink: 0, + fontSize: 'var(--affine-font-h-5)', + color: 'var(--affine-icon-color)', + selectors: { + '&.start': { marginRight: '8px' }, + '&.end': { marginLeft: '8px' }, + '&.selected, &.checked': { + color: 'var(--affine-primary-color)', + }, + + [`${menuItem}.danger:hover &`]: { + color: 'var(--affine-error-color)', + }, + [`${menuItem}.warning:hover &`]: { + color: 'var(--affine-warning-color)', + }, + }, +}); + +export const menuSeparator = style({ + height: '1px', + backgroundColor: 'var(--affine-border-color)', + marginTop: '12px', + marginBottom: '8px', +}); + +export const menuTrigger = style({ + vars: { + [triggerWidthVar]: 'auto', + }, + width: triggerWidthVar, + height: 28, + lineHeight: '22px', + padding: '0 10px', + color: 'var(--affine-text-primary-color)', + border: '1px solid', + backgroundColor: 'var(--affine-white)', + borderRadius: 8, + display: 'inline-flex', + justifyContent: 'space-between', + alignItems: 'center', + fontSize: 'var(--affine-font-xs)', + cursor: 'pointer', + ['WebkitAppRegion' as string]: 'no-drag', + borderColor: 'var(--affine-border-color)', + outline: 'none', + + selectors: { + '&:hover': { + background: 'var(--affine-hover-color)', + }, + '&.no-border': { + border: 'unset', + }, + '&.block': { + display: 'flex', + width: '100%', + }, + // size + '&.large': { + height: 32, + }, + '&.extra-large': { + height: 40, + fontWeight: 600, + }, + // color + '&.disabled': { + cursor: 'default', + color: 'var(--affine-disable-color)', + pointerEvents: 'none', + }, + // TODO: wait for design + '&.error': { + // borderColor: 'var(--affine-error-color)', + }, + '&.success': { + // borderColor: 'var(--affine-success-color)', + }, + '&.warning': { + // borderColor: 'var(--affine-warning-color)', + }, + '&.default': { + // borderColor: 'var(--affine-border-color)', + }, + }, +}); diff --git a/packages/frontend/component/src/ui/menu/use-menu-item.tsx b/packages/frontend/component/src/ui/menu/use-menu-item.tsx new file mode 100644 index 0000000000..a3b4a3a296 --- /dev/null +++ b/packages/frontend/component/src/ui/menu/use-menu-item.tsx @@ -0,0 +1,73 @@ +import { DoneIcon } from '@blocksuite/icons'; +import clsx from 'clsx'; +import { useMemo } from 'react'; + +import { type MenuItemProps } from './menu.types'; +import { MenuIcon } from './menu-icon'; +import * as styles from './styles.css'; + +interface useMenuItemProps { + children: MenuItemProps['children']; + type: MenuItemProps['type']; + className: MenuItemProps['className']; + preFix: MenuItemProps['preFix']; + endFix: MenuItemProps['endFix']; + checked?: MenuItemProps['checked']; + selected?: MenuItemProps['selected']; + block?: MenuItemProps['block']; +} + +export const useMenuItem = ({ + children: propsChildren, + type = 'default', + className: propsClassName, + preFix, + endFix, + checked, + selected, + block, +}: useMenuItemProps) => { + const className = useMemo( + () => + clsx( + styles.menuItem, + { + danger: type === 'danger', + warning: type === 'warning', + checked, + selected, + block, + }, + propsClassName + ), + [block, checked, propsClassName, selected, type] + ); + + const children = useMemo( + () => ( + <> + {preFix} + {propsChildren} + {endFix} + + {checked || selected ? ( + + + + ) : null} + + ), + [checked, endFix, preFix, propsChildren, selected] + ); + + return { + children, + className, + }; +}; diff --git a/packages/frontend/component/src/ui/modal/confirm-modal.tsx b/packages/frontend/component/src/ui/modal/confirm-modal.tsx new file mode 100644 index 0000000000..64ea4e2ae8 --- /dev/null +++ b/packages/frontend/component/src/ui/modal/confirm-modal.tsx @@ -0,0 +1,47 @@ +import { DialogTrigger } from '@radix-ui/react-dialog'; +import clsx from 'clsx'; + +import type { ButtonProps } from '../button'; +import { Button } from '../button'; +import { Modal, type ModalProps } from './modal'; +import * as styles from './styles.css'; + +export interface ConfirmModalProps extends ModalProps { + confirmButtonOptions?: ButtonProps; + onConfirm?: () => void; + cancelText?: string; + cancelButtonOptions?: ButtonProps; +} + +export const ConfirmModal = ({ + children, + confirmButtonOptions, + // FIXME: we need i18n + cancelText = 'Cancel', + cancelButtonOptions, + onConfirm, + width = 480, + ...props +}: ConfirmModalProps) => { + return ( + + {children ? ( +
{children}
+ ) : null} +
+ + + + +
+
+ ); +}; diff --git a/packages/frontend/component/src/ui/modal/index.ts b/packages/frontend/component/src/ui/modal/index.ts new file mode 100644 index 0000000000..1d7b6892d3 --- /dev/null +++ b/packages/frontend/component/src/ui/modal/index.ts @@ -0,0 +1,2 @@ +export * from './confirm-modal'; +export * from './modal'; diff --git a/packages/frontend/component/src/ui/modal/modal.tsx b/packages/frontend/component/src/ui/modal/modal.tsx new file mode 100644 index 0000000000..d34de8e6e7 --- /dev/null +++ b/packages/frontend/component/src/ui/modal/modal.tsx @@ -0,0 +1,111 @@ +import { CloseIcon } from '@blocksuite/icons'; +import type { + DialogContentProps, + DialogOverlayProps, + DialogPortalProps, + DialogProps, +} from '@radix-ui/react-dialog'; +import * as Dialog from '@radix-ui/react-dialog'; +import { assignInlineVars } from '@vanilla-extract/dynamic'; +import clsx from 'clsx'; +import { type CSSProperties, forwardRef } from 'react'; + +import { IconButton, type IconButtonProps } from '../button'; +import * as styles from './styles.css'; + +export interface ModalProps extends DialogProps { + width?: CSSProperties['width']; + height?: CSSProperties['height']; + minHeight?: CSSProperties['minHeight']; + title?: string; + description?: string; + withoutCloseButton?: boolean; + + portalOptions?: DialogPortalProps; + contentOptions?: DialogContentProps; + overlayOptions?: DialogOverlayProps; + closeButtonOptions?: IconButtonProps; +} + +const getVar = (style: number | string = '', defaultValue = '') => { + return style + ? typeof style === 'number' + ? `${style}px` + : style + : defaultValue; +}; + +export const Modal = forwardRef( + ( + { + width, + height, + minHeight = 194, + title, + description, + withoutCloseButton = false, + + portalOptions, + contentOptions: { + style: contentStyle, + className: contentClassName, + ...otherContentOptions + } = {}, + overlayOptions: { + className: overlayClassName, + ...otherOverlayOptions + } = {}, + closeButtonOptions = {}, + children, + ...props + }, + ref + ) => ( + + + + + {withoutCloseButton ? null : ( + + + + + + )} + {title ? ( + {title} + ) : null} + {description ? ( + + {description} + + ) : null} + + {children} + + + + ) +); + +Modal.displayName = 'Modal'; diff --git a/packages/frontend/component/src/ui/modal/styles.css.ts b/packages/frontend/component/src/ui/modal/styles.css.ts new file mode 100644 index 0000000000..f5e6ef18ec --- /dev/null +++ b/packages/frontend/component/src/ui/modal/styles.css.ts @@ -0,0 +1,79 @@ +import { createVar, style } from '@vanilla-extract/css'; + +export const widthVar = createVar('widthVar'); +export const heightVar = createVar('heightVar'); +export const minHeightVar = createVar('minHeightVar'); + +export const modalOverlay = style({ + position: 'fixed', + inset: 0, + backgroundColor: 'var(--affine-background-modal-color)', + zIndex: 'var(--affine-z-index-modal)', +}); + +export const modalContent = style({ + vars: { + [widthVar]: '', + [heightVar]: '', + [minHeightVar]: '', + }, + width: widthVar, + height: heightVar, + minHeight: minHeightVar, + boxSizing: 'border-box', + fontSize: 'var(--affine-font-base)', + fontWeight: '400', + lineHeight: '1.6', + padding: '20px 24px', + backgroundColor: 'var(--affine-background-overlay-panel-color)', + boxShadow: 'var(--affine-popover-shadow)', + borderRadius: '12px', + maxHeight: 'calc(100vh - 32px)', + // :focus-visible will set outline + outline: 'none', + position: 'fixed', + zIndex: 'var(--affine-z-index-modal)', + top: ' 50%', + left: '50%', + transform: 'translate(-50%, -50%)', +}); + +export const closeButton = style({ + position: 'absolute', + top: '22px', + right: '20px', +}); + +export const modalHeader = style({ + fontSize: 'var(--affine-font-h-6)', + fontWeight: '600', + lineHeight: '1.45', + marginBottom: '12px', +}); +export const modalDescription = style({ + // marginBottom: '20px', +}); + +export const modalFooter = style({ + display: 'flex', + justifyContent: 'flex-end', + alignItems: 'center', + paddingTop: '40px', + marginTop: 'auto', + gap: '20px', + selectors: { + '&.modalFooterWithChildren': { + paddingTop: '20px', + }, + }, +}); + +export const confirmModalContent = style({ + marginTop: '12px', + marginBottom: '20px', +}); + +export const confirmModalContainer = style({ + display: 'flex', + flexDirection: 'column', +}); diff --git a/packages/frontend/component/src/ui/popover/index.ts b/packages/frontend/component/src/ui/popover/index.ts new file mode 100644 index 0000000000..1f4904cff9 --- /dev/null +++ b/packages/frontend/component/src/ui/popover/index.ts @@ -0,0 +1 @@ +export * from './popover'; diff --git a/packages/frontend/component/src/ui/popover/popover.tsx b/packages/frontend/component/src/ui/popover/popover.tsx new file mode 100644 index 0000000000..e9031c79c8 --- /dev/null +++ b/packages/frontend/component/src/ui/popover/popover.tsx @@ -0,0 +1,50 @@ +import type { + PopoverContentProps, + PopoverPortalProps, + PopoverProps as PopoverPrimitiveProps, +} from '@radix-ui/react-popover'; +import * as PopoverPrimitive from '@radix-ui/react-popover'; +import clsx from 'clsx'; +import { type ReactNode, useMemo } from 'react'; + +import * as styles from './styles.css'; + +export interface PopoverProps extends PopoverPrimitiveProps { + content?: ReactNode; + portalOptions?: PopoverPortalProps; + contentOptions?: PopoverContentProps; +} +export const Popover = ({ + content, + children, + portalOptions, + contentOptions: { + className: contentClassName, + style: contentStyle, + ...otherContentOptions + } = {}, + ...props +}: PopoverProps) => { + return ( + + {children} + + + clsx(styles.popoverContent, contentClassName), + [contentClassName] + )} + sideOffset={5} + align="start" + style={{ zIndex: 'var(--affine-z-index-popover)', ...contentStyle }} + {...otherContentOptions} + > + {content} + + + + ); +}; + +Popover.displayName = 'Popover'; diff --git a/packages/frontend/component/src/ui/popover/styles.css.ts b/packages/frontend/component/src/ui/popover/styles.css.ts new file mode 100644 index 0000000000..af9e7b509c --- /dev/null +++ b/packages/frontend/component/src/ui/popover/styles.css.ts @@ -0,0 +1,13 @@ +import { style } from '@vanilla-extract/css'; + +export const popoverContent = style({ + minWidth: '180px', + color: 'var(--affine-text-primary-color)', + borderRadius: '8px', + padding: '8px', + fontSize: 'var(--affine-font-sm)', + fontWeight: '400', + backgroundColor: 'var(--affine-background-overlay-panel-color)', + boxShadow: 'var(--affine-menu-shadow)', + userSelect: 'none', +}); diff --git a/packages/frontend/component/src/ui/tooltip/index.ts b/packages/frontend/component/src/ui/tooltip/index.ts new file mode 100644 index 0000000000..d605d91ad0 --- /dev/null +++ b/packages/frontend/component/src/ui/tooltip/index.ts @@ -0,0 +1,5 @@ +import { Tooltip } from './tooltip'; + +export * from './tooltip'; + +export default Tooltip; diff --git a/packages/frontend/component/src/ui/tooltip/styles.css.ts b/packages/frontend/component/src/ui/tooltip/styles.css.ts new file mode 100644 index 0000000000..0de1af2cf6 --- /dev/null +++ b/packages/frontend/component/src/ui/tooltip/styles.css.ts @@ -0,0 +1,11 @@ +import { style } from '@vanilla-extract/css'; + +export const tooltipContent = style({ + backgroundColor: 'var(--affine-tooltip)', + color: 'var(--affine-white)', + padding: '5px 12px', + fontSize: 'var(--affine-font-sm)', + lineHeight: '22px', + borderRadius: '4px', + maxWidth: '280px', +}); diff --git a/packages/frontend/component/src/ui/tooltip/tooltip.tsx b/packages/frontend/component/src/ui/tooltip/tooltip.tsx new file mode 100644 index 0000000000..4dc827865c --- /dev/null +++ b/packages/frontend/component/src/ui/tooltip/tooltip.tsx @@ -0,0 +1,60 @@ +import type { + TooltipContentProps, + TooltipPortalProps, + TooltipProps as RootProps, +} from '@radix-ui/react-tooltip'; +import * as TooltipPrimitive from '@radix-ui/react-tooltip'; +import type { ReactElement, ReactNode } from 'react'; + +import * as styles from './styles.css'; + +export interface TooltipProps { + // `children` can not be string, number or even undefined + children: ReactElement; + content?: ReactNode; + side?: TooltipContentProps['side']; + align?: TooltipContentProps['align']; + + rootOptions?: Omit; + portalOptions?: TooltipPortalProps; + options?: Omit; +} + +export const Tooltip = ({ + children, + content, + side = 'top', + align = 'center', + options, + rootOptions, + portalOptions, +}: TooltipProps) => { + if (!content) { + return children; + } + return ( + + + {children} + + + + {content} + + + + + + ); +}; diff --git a/yarn.lock b/yarn.lock index c4ebddf134..b87736ed45 100644 --- a/yarn.lock +++ b/yarn.lock @@ -238,11 +238,14 @@ __metadata: "@popperjs/core": "npm:^2.11.8" "@radix-ui/react-avatar": "npm:^1.0.4" "@radix-ui/react-collapsible": "npm:^1.0.3" + "@radix-ui/react-dialog": "npm:^1.0.5" + "@radix-ui/react-dropdown-menu": "npm:^2.0.6" "@radix-ui/react-popover": "npm:^1.0.7" "@radix-ui/react-radio-group": "npm:^1.1.3" "@radix-ui/react-scroll-area": "npm:^1.0.5" "@radix-ui/react-toast": "npm:^1.1.5" "@radix-ui/react-toolbar": "npm:^1.0.4" + "@radix-ui/react-tooltip": "npm:^1.0.7" "@storybook/jest": "npm:^0.2.3" "@storybook/testing-library": "npm:^0.2.2" "@testing-library/react": "npm:^14.0.0" @@ -9726,7 +9729,7 @@ __metadata: languageName: node linkType: hard -"@radix-ui/react-dialog@npm:^1.0.4": +"@radix-ui/react-dialog@npm:^1.0.4, @radix-ui/react-dialog@npm:^1.0.5": version: 1.0.5 resolution: "@radix-ui/react-dialog@npm:1.0.5" dependencies: @@ -9833,7 +9836,7 @@ __metadata: languageName: node linkType: hard -"@radix-ui/react-dropdown-menu@npm:^2.0.5": +"@radix-ui/react-dropdown-menu@npm:^2.0.5, @radix-ui/react-dropdown-menu@npm:^2.0.6": version: 2.0.6 resolution: "@radix-ui/react-dropdown-menu@npm:2.0.6" dependencies: @@ -10510,7 +10513,7 @@ __metadata: languageName: node linkType: hard -"@radix-ui/react-tooltip@npm:^1.0.6": +"@radix-ui/react-tooltip@npm:^1.0.6, @radix-ui/react-tooltip@npm:^1.0.7": version: 1.0.7 resolution: "@radix-ui/react-tooltip@npm:1.0.7" dependencies: From 9c50dbc3624f1328f62e10eaab9cb3e5c3216947 Mon Sep 17 00:00:00 2001 From: Cats Juice Date: Mon, 4 Dec 2023 08:32:16 +0000 Subject: [PATCH 07/68] feat(core): remove all imports from design/component (#5078) feat(core): remove all imports from design/component feat(plugin): remove imports from design-components feat(storybook): remove design-components imoprts feat(core): remove fix(component): remove design/component import in local-demo-tip --- README.md | 11 +++---- packages/frontend/component/package.json | 1 + .../affine-banner/local-demo-tips.tsx | 2 +- .../app-sidebar/app-updater-button/index.tsx | 2 +- .../app-sidebar/sidebar-header/index.tsx | 4 +-- .../sidebar-header/sidebar-switch.tsx | 4 +-- .../auth-components/back-button.tsx | 3 +- .../auth-components/change-email-page.tsx | 2 +- .../auth-components/change-password-page.tsx | 2 +- .../auth-components/confirm-change-email.tsx | 2 +- .../src/components/auth-components/modal.tsx | 3 +- .../auth-components/set-password-page.tsx | 2 +- .../auth-components/set-password.tsx | 2 +- .../auth-components/sign-in-success-page.tsx | 2 +- .../auth-components/sign-up-page.tsx | 2 +- .../components/card/workspace-card/index.tsx | 6 ++-- .../components/card/workspace-card/styles.ts | 3 +- .../components/disable-public-link/index.tsx | 6 ++-- .../src/components/import-page/index.tsx | 4 +-- .../member-components/accept-invite-page.tsx | 4 +-- .../member-components/invite-modal.tsx | 2 +- .../not-found-page/not-found-page.tsx | 6 ++-- .../components/notification-center/index.tsx | 2 +- .../page-list/components/favorite-tag.tsx | 7 ++--- .../page-list/components/new-page-buttton.tsx | 2 +- .../components/page-list/filter/condition.tsx | 2 +- .../page-list/filter/filter-list.tsx | 6 ++-- .../page-list/filter/multi-select.tsx | 2 +- .../src/components/page-list/filter/vars.tsx | 6 +--- .../components/page-list/operation-cell.tsx | 8 ++--- .../disable-public-sharing.tsx | 6 +--- .../page-list/operation-menu-items/export.tsx | 2 +- .../operation-menu-items/move-to-trash.tsx | 12 ++----- .../src/components/page-list/page-tags.tsx | 2 +- .../page-list/view/collection-bar.tsx | 4 +-- .../page-list/view/collection-list.tsx | 4 +-- .../page-list/view/collection-operations.tsx | 7 +---- .../page-list/view/create-collection.tsx | 4 +-- .../view/edit-collection/edit-collection.tsx | 6 ++-- .../page-list/view/edit-collection/hooks.tsx | 2 +- .../view/edit-collection/pages-mode.tsx | 2 +- .../view/edit-collection/select-page.tsx | 4 +-- .../view/save-as-collection-button.tsx | 2 +- .../setting-components/storage-progess.tsx | 4 +-- .../src/components/tour-modal/tour-modal.tsx | 2 +- packages/frontend/core/package.json | 1 - packages/frontend/core/src/app.tsx | 1 - .../core/src/bootstrap/plugins/setup.ts | 8 ++--- .../error-basic/error-detail.tsx | 2 +- .../affine/auth/after-sign-in-send-email.tsx | 2 +- .../affine/auth/after-sign-up-send-email.tsx | 2 +- .../src/components/affine/auth/send-email.tsx | 2 +- .../affine/auth/sign-in-with-password.tsx | 2 +- .../src/components/affine/auth/sign-in.tsx | 2 +- .../affine/auth/subscription-redirect.tsx | 4 +-- .../affine/auth/user-plan-button.tsx | 2 +- .../affine/create-workspace-modal/index.tsx | 12 +++---- .../enable-affine-cloud-modal/index.tsx | 4 +-- .../components/affine/language-menu/index.tsx | 2 +- .../delete-leave-workspace/delete/index.tsx | 8 ++--- .../delete-leave-workspace/index.tsx | 2 +- .../new-workspace-setting-detail/export.tsx | 2 +- .../new-workspace-setting-detail/members.tsx | 10 +++--- .../new-workspace-setting-detail/profile.tsx | 4 +-- .../new-workspace-setting-detail/publish.tsx | 4 +-- .../new-workspace-setting-detail/storage.tsx | 4 +-- .../page-history-modal/history-modal.tsx | 4 +-- .../affine/payment-disable/index.tsx | 2 +- .../setting-modal/account-setting/index.tsx | 4 +-- .../about/update-check-section.tsx | 2 +- .../appearance/date-format-setting.tsx | 2 +- .../general-setting/billing/index.tsx | 4 +-- .../general-setting/plans/modals.tsx | 8 ++--- .../general-setting/plans/plan-card.tsx | 4 +-- .../components/affine/setting-modal/index.tsx | 2 +- .../setting-modal/setting-sidebar/index.tsx | 4 +-- .../share-menu/share-export.tsx | 4 +-- .../share-menu/share-menu.tsx | 6 ++-- .../share-menu/share-page.tsx | 4 +-- .../affine/sign-out-modal/index.tsx | 4 +-- .../tmp-disable-affine-cloud-modal/index.tsx | 2 +- .../tmp-disable-affine-cloud-modal/style.ts | 2 +- .../operation-menu.tsx | 12 +++---- .../block-suite-mode-switch/index.tsx | 2 +- .../frontend/core/src/components/bookmark.tsx | 2 +- .../core/src/components/cloud/login-card.tsx | 2 +- .../share-header-left-item/user-avatar.tsx | 4 +-- .../authenticated-item.tsx | 2 +- .../src/components/pure/file-upload/index.tsx | 2 +- .../pure/header-drop-down-button/index.tsx | 5 +-- .../src/components/pure/help-island/index.tsx | 2 +- .../pure/trash-button-group/index.tsx | 6 ++-- .../collections/add-collection-button.tsx | 2 +- .../collections/collections-list.tsx | 2 +- .../workspace-slider-bar/collections/page.tsx | 14 ++++----- .../favorite/add-favourite-button.tsx | 2 +- .../add-workspace/index.tsx | 2 +- .../user-with-workspace-list/index.tsx | 4 +-- .../user-account/index.tsx | 6 ++-- .../workspace-list/index.tsx | 2 +- .../workspace-card/index.tsx | 4 +-- .../src/components/root-app-sidebar/index.tsx | 2 +- .../components/workspace-upgrade/upgrade.tsx | 2 +- packages/frontend/core/src/pages/expired.tsx | 2 +- packages/frontend/core/src/pages/index.tsx | 2 +- packages/frontend/core/src/pages/open-app.tsx | 2 +- .../core/src/pages/upgrade-success.tsx | 2 +- packages/plugins/copilot/package.json | 1 - .../plugins/copilot/src/UI/debug-content.tsx | 2 +- .../plugins/copilot/src/UI/detail-content.tsx | 2 +- .../plugins/copilot/src/UI/header-item.tsx | 4 +-- .../core/components/conversation/index.tsx | 2 +- packages/plugins/hello-world/package.json | 3 +- packages/plugins/hello-world/src/app.tsx | 4 +-- packages/plugins/image-preview/package.json | 1 - .../image-preview/src/component/index.tsx | 4 +-- packages/plugins/outline/package.json | 3 +- packages/plugins/outline/src/app.tsx | 4 +-- tests/storybook/.storybook/preview.tsx | 1 - tests/storybook/src/stories/card.stories.tsx | 2 +- .../quick-search-modal.stories.tsx | 2 +- yarn.lock | 31 +++---------------- 122 files changed, 203 insertions(+), 263 deletions(-) diff --git a/README.md b/README.md index 513a0ff604..8bef8a5965 100644 --- a/README.md +++ b/README.md @@ -107,12 +107,11 @@ If you have questions, you are welcome to contact us. One of the best places to ## Ecosystem -| Name | | | -| ----------------------------------------------------------------------------------------------- | --------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------- | -| [@toeverything/component](https://github.com/toeverything/design/tree/main/packages/components) | Toeverything Shared Component Resources | | -| [@affine/component](packages/frontend/component) | AFFiNE Component Resources | [![](https://img.shields.io/codecov/c/github/toeverything/affine?style=flat-square)](https://affine-storybook.vercel.app/) | -| [@toeverything/y-indexeddb](packages/common/y-indexeddb) | IndexedDB database adapter for Yjs | [![](https://img.shields.io/npm/dm/@toeverything/y-indexeddb?style=flat-square&color=eee)](https://www.npmjs.com/package/@toeverything/y-indexeddb) | -| [@toeverything/theme](packages/common/theme) | AFFiNE theme | [![](https://img.shields.io/npm/dm/@toeverything/theme?style=flat-square&color=eee)](https://www.npmjs.com/package/@toeverything/theme) | +| Name | | | +| -------------------------------------------------------- | ---------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------- | +| [@affine/component](packages/frontend/component) | AFFiNE Component Resources | [![](https://img.shields.io/codecov/c/github/toeverything/affine?style=flat-square)](https://affine-storybook.vercel.app/) | +| [@toeverything/y-indexeddb](packages/common/y-indexeddb) | IndexedDB database adapter for Yjs | [![](https://img.shields.io/npm/dm/@toeverything/y-indexeddb?style=flat-square&color=eee)](https://www.npmjs.com/package/@toeverything/y-indexeddb) | +| [@toeverything/theme](packages/common/theme) | AFFiNE theme | [![](https://img.shields.io/npm/dm/@toeverything/theme?style=flat-square&color=eee)](https://www.npmjs.com/package/@toeverything/theme) | ## Plugins diff --git a/packages/frontend/component/package.json b/packages/frontend/component/package.json index 717ee513ff..161fd3d706 100644 --- a/packages/frontend/component/package.json +++ b/packages/frontend/component/package.json @@ -5,6 +5,7 @@ "exports": { ".": "./src/index.ts", "./theme/*": "./src/theme/*", + "./ui/*": "./src/ui/*/index.ts", "./*": "./src/components/*/index.tsx" }, "peerDependencies": { diff --git a/packages/frontend/component/src/components/affine-banner/local-demo-tips.tsx b/packages/frontend/component/src/components/affine-banner/local-demo-tips.tsx index 3a9eea2ef2..ea251d895a 100644 --- a/packages/frontend/component/src/components/affine-banner/local-demo-tips.tsx +++ b/packages/frontend/component/src/components/affine-banner/local-demo-tips.tsx @@ -1,5 +1,5 @@ +import { Button, IconButton } from '@affine/component/ui/button'; import { CloseIcon } from '@blocksuite/icons'; -import { Button, IconButton } from '@toeverything/components/button'; import { useCallback } from 'react'; import * as styles from './index.css'; diff --git a/packages/frontend/component/src/components/app-sidebar/app-updater-button/index.tsx b/packages/frontend/component/src/components/app-sidebar/app-updater-button/index.tsx index 4d7a442c81..d1c51a3b62 100644 --- a/packages/frontend/component/src/components/app-sidebar/app-updater-button/index.tsx +++ b/packages/frontend/component/src/components/app-sidebar/app-updater-button/index.tsx @@ -1,7 +1,6 @@ import { Unreachable } from '@affine/env/constant'; import { useAFFiNEI18N } from '@affine/i18n/hooks'; import { CloseIcon, NewIcon, ResetIcon } from '@blocksuite/icons'; -import { Tooltip } from '@toeverything/components/tooltip'; import { changelogCheckedAtom, currentChangelogUnreadAtom, @@ -15,6 +14,7 @@ import clsx from 'clsx'; import { useAtomValue, useSetAtom } from 'jotai'; import { startTransition, useCallback } from 'react'; +import { Tooltip } from '../../../ui/tooltip'; import * as styles from './index.css'; export interface AddPageButtonPureProps { diff --git a/packages/frontend/component/src/components/app-sidebar/sidebar-header/index.tsx b/packages/frontend/component/src/components/app-sidebar/sidebar-header/index.tsx index 5392318316..09c0e5491f 100644 --- a/packages/frontend/component/src/components/app-sidebar/sidebar-header/index.tsx +++ b/packages/frontend/component/src/components/app-sidebar/sidebar-header/index.tsx @@ -1,10 +1,10 @@ import { useAFFiNEI18N } from '@affine/i18n/hooks'; import { ArrowLeftSmallIcon, ArrowRightSmallIcon } from '@blocksuite/icons'; -import { IconButton } from '@toeverything/components/button'; -import { Tooltip } from '@toeverything/components/tooltip'; import { useAtomValue } from 'jotai'; import { useMemo } from 'react'; +import { IconButton } from '../../../ui/button'; +import { Tooltip } from '../../../ui/tooltip'; import type { History } from '..'; import { navHeaderButton, diff --git a/packages/frontend/component/src/components/app-sidebar/sidebar-header/sidebar-switch.tsx b/packages/frontend/component/src/components/app-sidebar/sidebar-header/sidebar-switch.tsx index e4210e65ad..d8fe62a8df 100644 --- a/packages/frontend/component/src/components/app-sidebar/sidebar-header/sidebar-switch.tsx +++ b/packages/frontend/component/src/components/app-sidebar/sidebar-header/sidebar-switch.tsx @@ -1,9 +1,9 @@ import { useAFFiNEI18N } from '@affine/i18n/hooks'; import { SidebarIcon } from '@blocksuite/icons'; -import { IconButton } from '@toeverything/components/button'; -import { Tooltip } from '@toeverything/components/tooltip'; import { useAtom } from 'jotai'; +import { IconButton } from '../../../ui/button'; +import { Tooltip } from '../../../ui/tooltip'; import { appSidebarOpenAtom } from '../index.jotai'; import * as styles from './sidebar-switch.css'; diff --git a/packages/frontend/component/src/components/auth-components/back-button.tsx b/packages/frontend/component/src/components/auth-components/back-button.tsx index a63d417902..1291160176 100644 --- a/packages/frontend/component/src/components/auth-components/back-button.tsx +++ b/packages/frontend/component/src/components/auth-components/back-button.tsx @@ -1,8 +1,9 @@ import { useAFFiNEI18N } from '@affine/i18n/hooks'; import { ArrowLeftSmallIcon } from '@blocksuite/icons'; -import { Button, type ButtonProps } from '@toeverything/components/button'; import { type FC } from 'react'; +import { Button, type ButtonProps } from '../../ui/button'; + export const BackButton: FC = props => { const t = useAFFiNEI18N(); return ( diff --git a/packages/frontend/component/src/components/auth-components/change-email-page.tsx b/packages/frontend/component/src/components/auth-components/change-email-page.tsx index c39ccb7b3c..e8560c2df9 100644 --- a/packages/frontend/component/src/components/auth-components/change-email-page.tsx +++ b/packages/frontend/component/src/components/auth-components/change-email-page.tsx @@ -1,7 +1,7 @@ import { useAFFiNEI18N } from '@affine/i18n/hooks'; -import { Button } from '@toeverything/components/button'; import { useCallback, useState } from 'react'; +import { Button } from '../../ui/button'; import { AuthInput } from './auth-input'; import { AuthPageContainer } from './auth-page-container'; import { emailRegex } from './utils'; diff --git a/packages/frontend/component/src/components/auth-components/change-password-page.tsx b/packages/frontend/component/src/components/auth-components/change-password-page.tsx index 95aa6e72e3..cb11b6898e 100644 --- a/packages/frontend/component/src/components/auth-components/change-password-page.tsx +++ b/packages/frontend/component/src/components/auth-components/change-password-page.tsx @@ -1,9 +1,9 @@ import { useAFFiNEI18N } from '@affine/i18n/hooks'; -import { Button } from '@toeverything/components/button'; import { useSetAtom } from 'jotai'; import type { FC } from 'react'; import { useCallback, useState } from 'react'; +import { Button } from '../../ui/button'; import { pushNotificationAtom } from '../notification-center'; import { AuthPageContainer } from './auth-page-container'; import { SetPassword } from './set-password'; diff --git a/packages/frontend/component/src/components/auth-components/confirm-change-email.tsx b/packages/frontend/component/src/components/auth-components/confirm-change-email.tsx index baafb0c952..bd49495333 100644 --- a/packages/frontend/component/src/components/auth-components/confirm-change-email.tsx +++ b/packages/frontend/component/src/components/auth-components/confirm-change-email.tsx @@ -1,7 +1,7 @@ import { useAFFiNEI18N } from '@affine/i18n/hooks'; -import { Button } from '@toeverything/components/button'; import type { FC } from 'react'; +import { Button } from '../../ui/button'; import { AuthPageContainer } from './auth-page-container'; export const ConfirmChangeEmail: FC<{ diff --git a/packages/frontend/component/src/components/auth-components/modal.tsx b/packages/frontend/component/src/components/auth-components/modal.tsx index 44baa65a2e..8561963800 100644 --- a/packages/frontend/component/src/components/auth-components/modal.tsx +++ b/packages/frontend/component/src/components/auth-components/modal.tsx @@ -1,6 +1,7 @@ -import { Modal } from '@toeverything/components/modal'; import type { FC, PropsWithChildren } from 'react'; +import { Modal } from '../../ui/modal'; + export type AuthModalProps = { open: boolean; setOpen: (value: boolean) => void; diff --git a/packages/frontend/component/src/components/auth-components/set-password-page.tsx b/packages/frontend/component/src/components/auth-components/set-password-page.tsx index d420533d73..09639d596a 100644 --- a/packages/frontend/component/src/components/auth-components/set-password-page.tsx +++ b/packages/frontend/component/src/components/auth-components/set-password-page.tsx @@ -1,9 +1,9 @@ import { useAFFiNEI18N } from '@affine/i18n/hooks'; -import { Button } from '@toeverything/components/button'; import { useSetAtom } from 'jotai'; import type { FC } from 'react'; import { useCallback, useState } from 'react'; +import { Button } from '../../ui/button'; import { pushNotificationAtom } from '../notification-center'; import { AuthPageContainer } from './auth-page-container'; import { SetPassword } from './set-password'; diff --git a/packages/frontend/component/src/components/auth-components/set-password.tsx b/packages/frontend/component/src/components/auth-components/set-password.tsx index 579950d1e0..42e4a9ed35 100644 --- a/packages/frontend/component/src/components/auth-components/set-password.tsx +++ b/packages/frontend/component/src/components/auth-components/set-password.tsx @@ -1,7 +1,7 @@ import { useAFFiNEI18N } from '@affine/i18n/hooks'; -import { Button } from '@toeverything/components/button'; import { type FC, useCallback, useRef, useState } from 'react'; +import { Button } from '../../ui/button'; import { Wrapper } from '../../ui/layout'; import { PasswordInput } from './password-input'; diff --git a/packages/frontend/component/src/components/auth-components/sign-in-success-page.tsx b/packages/frontend/component/src/components/auth-components/sign-in-success-page.tsx index 807269d8a1..37b0083e8f 100644 --- a/packages/frontend/component/src/components/auth-components/sign-in-success-page.tsx +++ b/packages/frontend/component/src/components/auth-components/sign-in-success-page.tsx @@ -1,7 +1,7 @@ import { useAFFiNEI18N } from '@affine/i18n/hooks'; -import { Button } from '@toeverything/components/button'; import type { FC } from 'react'; +import { Button } from '../../ui/button'; import { AuthPageContainer } from './auth-page-container'; export const SignInSuccessPage: FC<{ diff --git a/packages/frontend/component/src/components/auth-components/sign-up-page.tsx b/packages/frontend/component/src/components/auth-components/sign-up-page.tsx index 7fb6eba910..684b6cdd9e 100644 --- a/packages/frontend/component/src/components/auth-components/sign-up-page.tsx +++ b/packages/frontend/component/src/components/auth-components/sign-up-page.tsx @@ -1,9 +1,9 @@ import { useAFFiNEI18N } from '@affine/i18n/hooks'; -import { Button } from '@toeverything/components/button'; import { useSetAtom } from 'jotai'; import type { FC } from 'react'; import { useCallback, useState } from 'react'; +import { Button } from '../../ui/button'; import { pushNotificationAtom } from '../notification-center'; import { AuthPageContainer } from './auth-page-container'; import { SetPassword } from './set-password'; diff --git a/packages/frontend/component/src/components/card/workspace-card/index.tsx b/packages/frontend/component/src/components/card/workspace-card/index.tsx index 3df908a3f9..a8d6049a9c 100644 --- a/packages/frontend/component/src/components/card/workspace-card/index.tsx +++ b/packages/frontend/component/src/components/card/workspace-card/index.tsx @@ -2,16 +2,16 @@ import { WorkspaceFlavour } from '@affine/env/workspace'; import { useAFFiNEI18N } from '@affine/i18n/hooks'; import type { RootWorkspaceMetadata } from '@affine/workspace/atom'; import { CollaborationIcon, SettingsIcon } from '@blocksuite/icons'; -import { Avatar } from '@toeverything/components/avatar'; -import { Divider } from '@toeverything/components/divider'; -import { Tooltip } from '@toeverything/components/tooltip'; import { useBlockSuiteWorkspaceAvatarUrl } from '@toeverything/hooks/use-block-suite-workspace-avatar-url'; import { useBlockSuiteWorkspaceName } from '@toeverything/hooks/use-block-suite-workspace-name'; import { getBlockSuiteWorkspaceAtom } from '@toeverything/infra/__internal__/workspace'; import { useAtomValue } from 'jotai/react'; import { useCallback } from 'react'; +import { Avatar } from '../../../ui/avatar'; +import { Divider } from '../../../ui/divider'; import { Skeleton } from '../../../ui/skeleton'; +import { Tooltip } from '../../../ui/tooltip'; import { StyledCard, StyledIconContainer, diff --git a/packages/frontend/component/src/components/card/workspace-card/styles.ts b/packages/frontend/component/src/components/card/workspace-card/styles.ts index bd1d645003..46d48c2de2 100644 --- a/packages/frontend/component/src/components/card/workspace-card/styles.ts +++ b/packages/frontend/component/src/components/card/workspace-card/styles.ts @@ -1,6 +1,5 @@ -import { IconButton } from '@toeverything/components/button'; - import { displayFlex, styled, textEllipsis } from '../../../styles'; +import { IconButton } from '../../../ui/button'; export const StyledWorkspaceInfo = styled('div')(() => { return { diff --git a/packages/frontend/component/src/components/disable-public-link/index.tsx b/packages/frontend/component/src/components/disable-public-link/index.tsx index 5402eff74c..0b4868f828 100644 --- a/packages/frontend/component/src/components/disable-public-link/index.tsx +++ b/packages/frontend/component/src/components/disable-public-link/index.tsx @@ -1,8 +1,6 @@ import { useAFFiNEI18N } from '@affine/i18n/hooks'; -import { - ConfirmModal, - type ConfirmModalProps, -} from '@toeverything/components/modal'; + +import { ConfirmModal, type ConfirmModalProps } from '../../ui/modal'; export const PublicLinkDisableModal = (props: ConfirmModalProps) => { const t = useAFFiNEI18N(); diff --git a/packages/frontend/component/src/components/import-page/index.tsx b/packages/frontend/component/src/components/import-page/index.tsx index 66563ba8da..53784b1af7 100644 --- a/packages/frontend/component/src/components/import-page/index.tsx +++ b/packages/frontend/component/src/components/import-page/index.tsx @@ -6,9 +6,9 @@ import { NewIcon, NotionIcon, } from '@blocksuite/icons'; -import { IconButton } from '@toeverything/components/button'; -import { Tooltip } from '@toeverything/components/tooltip'; +import { IconButton } from '../../ui/button'; +import { Tooltip } from '../../ui/tooltip'; import { BlockCard } from '../card/block-card'; import { importPageBodyStyle, diff --git a/packages/frontend/component/src/components/member-components/accept-invite-page.tsx b/packages/frontend/component/src/components/member-components/accept-invite-page.tsx index 574a19a8ec..03cae33dae 100644 --- a/packages/frontend/component/src/components/member-components/accept-invite-page.tsx +++ b/packages/frontend/component/src/components/member-components/accept-invite-page.tsx @@ -1,9 +1,9 @@ import { AuthPageContainer } from '@affine/component/auth-components'; import { type GetInviteInfoQuery } from '@affine/graphql'; import { useAFFiNEI18N } from '@affine/i18n/hooks'; -import { Avatar } from '@toeverything/components/avatar'; -import { Button } from '@toeverything/components/button'; +import { Avatar } from '../../ui/avatar'; +import { Button } from '../../ui/button'; import { FlexWrapper } from '../../ui/layout'; import * as styles from './styles.css'; export const AcceptInvitePage = ({ diff --git a/packages/frontend/component/src/components/member-components/invite-modal.tsx b/packages/frontend/component/src/components/member-components/invite-modal.tsx index 9371a50a78..920671319b 100644 --- a/packages/frontend/component/src/components/member-components/invite-modal.tsx +++ b/packages/frontend/component/src/components/member-components/invite-modal.tsx @@ -1,8 +1,8 @@ import { Permission } from '@affine/graphql'; import { useAFFiNEI18N } from '@affine/i18n/hooks'; -import { ConfirmModal } from '@toeverything/components/modal'; import { useCallback, useEffect, useState } from 'react'; +import { ConfirmModal } from '../../ui/modal'; import { AuthInput } from '..//auth-components'; import { emailRegex } from '..//auth-components/utils'; diff --git a/packages/frontend/component/src/components/not-found-page/not-found-page.tsx b/packages/frontend/component/src/components/not-found-page/not-found-page.tsx index fe3aa2cc00..aad290e815 100644 --- a/packages/frontend/component/src/components/not-found-page/not-found-page.tsx +++ b/packages/frontend/component/src/components/not-found-page/not-found-page.tsx @@ -1,9 +1,9 @@ import { useAFFiNEI18N } from '@affine/i18n/hooks'; import { SignOutIcon } from '@blocksuite/icons'; -import { Avatar } from '@toeverything/components/avatar'; -import { Button, IconButton } from '@toeverything/components/button'; -import { Tooltip } from '@toeverything/components/tooltip'; +import { Avatar } from '../../ui/avatar'; +import { Button, IconButton } from '../../ui/button'; +import { Tooltip } from '../../ui/tooltip'; import { NotFoundPattern } from './not-found-pattern'; import { largeButtonEffect, diff --git a/packages/frontend/component/src/components/notification-center/index.tsx b/packages/frontend/component/src/components/notification-center/index.tsx index 5574b82a80..73870ad836 100644 --- a/packages/frontend/component/src/components/notification-center/index.tsx +++ b/packages/frontend/component/src/components/notification-center/index.tsx @@ -4,7 +4,6 @@ import { CloseIcon, InformationFillDuotoneIcon } from '@blocksuite/icons'; import * as Toast from '@radix-ui/react-toast'; -import { IconButton } from '@toeverything/components/button'; import clsx from 'clsx'; import { useAtom, useAtomValue, useSetAtom } from 'jotai'; import type { ReactNode } from 'react'; @@ -17,6 +16,7 @@ import { useState, } from 'react'; +import { IconButton } from '../../ui/button'; import { SuccessIcon } from './icons'; import * as styles from './index.css'; import type { Notification } from './index.jotai'; diff --git a/packages/frontend/component/src/components/page-list/components/favorite-tag.tsx b/packages/frontend/component/src/components/page-list/components/favorite-tag.tsx index 7256ff2e1e..b035f68113 100644 --- a/packages/frontend/component/src/components/page-list/components/favorite-tag.tsx +++ b/packages/frontend/component/src/components/page-list/components/favorite-tag.tsx @@ -1,13 +1,10 @@ import { useAFFiNEI18N } from '@affine/i18n/hooks'; import { FavoritedIcon, FavoriteIcon } from '@blocksuite/icons'; -import { - IconButton, - type IconButtonProps, -} from '@toeverything/components/button'; -import { Tooltip } from '@toeverything/components/tooltip'; import Lottie from 'lottie-react'; import { forwardRef, useCallback, useState } from 'react'; +import { IconButton, type IconButtonProps } from '../../../ui/button'; +import { Tooltip } from '../../../ui/tooltip'; import favoritedAnimation from './favorited-animation/data.json'; export const FavoriteTag = forwardRef< diff --git a/packages/frontend/component/src/components/page-list/components/new-page-buttton.tsx b/packages/frontend/component/src/components/page-list/components/new-page-buttton.tsx index 613277af2e..5267b25b26 100644 --- a/packages/frontend/component/src/components/page-list/components/new-page-buttton.tsx +++ b/packages/frontend/component/src/components/page-list/components/new-page-buttton.tsx @@ -1,9 +1,9 @@ import { useAFFiNEI18N } from '@affine/i18n/hooks'; import { EdgelessIcon, ImportIcon, PageIcon } from '@blocksuite/icons'; -import { Menu } from '@toeverything/components/menu'; import { type PropsWithChildren, useCallback, useState } from 'react'; import { DropdownButton } from '../../../ui/button'; +import { Menu } from '../../../ui/menu'; import { BlockCard } from '../../card/block-card'; import { menuContent } from './new-page-button.css'; diff --git a/packages/frontend/component/src/components/page-list/filter/condition.tsx b/packages/frontend/component/src/components/page-list/filter/condition.tsx index 462223c95f..76db433231 100644 --- a/packages/frontend/component/src/components/page-list/filter/condition.tsx +++ b/packages/frontend/component/src/components/page-list/filter/condition.tsx @@ -1,9 +1,9 @@ import type { Filter, Literal } from '@affine/env/filter'; import type { PropertiesMeta } from '@affine/env/filter'; -import { Menu, MenuItem } from '@toeverything/components/menu'; import type { ReactNode } from 'react'; import { useMemo } from 'react'; +import { Menu, MenuItem } from '../../../ui/menu'; import { FilterTag } from './filter-tag-translation'; import * as styles from './index.css'; import { literalMatcher } from './literal-matcher'; diff --git a/packages/frontend/component/src/components/page-list/filter/filter-list.tsx b/packages/frontend/component/src/components/page-list/filter/filter-list.tsx index 3169814ca7..56d8a00783 100644 --- a/packages/frontend/component/src/components/page-list/filter/filter-list.tsx +++ b/packages/frontend/component/src/components/page-list/filter/filter-list.tsx @@ -2,10 +2,10 @@ import type { Filter } from '@affine/env/filter'; import type { PropertiesMeta } from '@affine/env/filter'; import { useAFFiNEI18N } from '@affine/i18n/hooks'; import { CloseIcon, PlusIcon } from '@blocksuite/icons'; -import { Button } from '@toeverything/components/button'; -import { IconButton } from '@toeverything/components/button'; -import { Menu } from '@toeverything/components/menu'; +import { Button } from '../../../ui/button'; +import { IconButton } from '../../../ui/button'; +import { Menu } from '../../../ui/menu'; import { Condition } from './condition'; import * as styles from './index.css'; import { CreateFilterMenu } from './vars'; diff --git a/packages/frontend/component/src/components/page-list/filter/multi-select.tsx b/packages/frontend/component/src/components/page-list/filter/multi-select.tsx index 797a248761..84264c6ff6 100644 --- a/packages/frontend/component/src/components/page-list/filter/multi-select.tsx +++ b/packages/frontend/component/src/components/page-list/filter/multi-select.tsx @@ -1,7 +1,7 @@ -import { Menu, MenuItem } from '@toeverything/components/menu'; import type { MouseEvent } from 'react'; import { useMemo } from 'react'; +import { Menu, MenuItem } from '../../../ui/menu'; import * as styles from './multi-select.css'; export const MultiSelect = ({ diff --git a/packages/frontend/component/src/components/page-list/filter/vars.tsx b/packages/frontend/component/src/components/page-list/filter/vars.tsx index bf4af661af..8bb53ab57d 100644 --- a/packages/frontend/component/src/components/page-list/filter/vars.tsx +++ b/packages/frontend/component/src/components/page-list/filter/vars.tsx @@ -5,14 +5,10 @@ import type { VariableMap, } from '@affine/env/filter'; import { useAFFiNEI18N } from '@affine/i18n/hooks'; -import { - MenuIcon, - MenuItem, - MenuSeparator, -} from '@toeverything/components/menu'; import dayjs from 'dayjs'; import type { ReactNode } from 'react'; +import { MenuIcon, MenuItem, MenuSeparator } from '../../../ui/menu'; import { FilterTag } from './filter-tag-translation'; import * as styles from './index.css'; import { tBoolean, tDate, tTag } from './logical/custom-type'; diff --git a/packages/frontend/component/src/components/page-list/operation-cell.tsx b/packages/frontend/component/src/components/page-list/operation-cell.tsx index 7e080448bc..9dd04a262f 100644 --- a/packages/frontend/component/src/components/page-list/operation-cell.tsx +++ b/packages/frontend/component/src/components/page-list/operation-cell.tsx @@ -7,13 +7,13 @@ import { OpenInNewIcon, ResetIcon, } from '@blocksuite/icons'; -import { IconButton } from '@toeverything/components/button'; -import { Menu, MenuIcon, MenuItem } from '@toeverything/components/menu'; -import { ConfirmModal } from '@toeverything/components/modal'; -import { Tooltip } from '@toeverything/components/tooltip'; import { useState } from 'react'; import { Link } from 'react-router-dom'; +import { IconButton } from '../../ui/button'; +import { Menu, MenuIcon, MenuItem } from '../../ui/menu'; +import { ConfirmModal } from '../../ui/modal'; +import { Tooltip } from '../../ui/tooltip'; import { FavoriteTag } from './components/favorite-tag'; import { DisablePublicSharing, MoveToTrash } from './operation-menu-items'; import * as styles from './page-list.css'; diff --git a/packages/frontend/component/src/components/page-list/operation-menu-items/disable-public-sharing.tsx b/packages/frontend/component/src/components/page-list/operation-menu-items/disable-public-sharing.tsx index 296c220db8..7456e72217 100644 --- a/packages/frontend/component/src/components/page-list/operation-menu-items/disable-public-sharing.tsx +++ b/packages/frontend/component/src/components/page-list/operation-menu-items/disable-public-sharing.tsx @@ -1,11 +1,7 @@ import { useAFFiNEI18N } from '@affine/i18n/hooks'; import { ShareIcon } from '@blocksuite/icons'; -import { - MenuIcon, - MenuItem, - type MenuItemProps, -} from '@toeverything/components/menu'; +import { MenuIcon, MenuItem, type MenuItemProps } from '../../../ui/menu'; import { PublicLinkDisableModal } from '../../disable-public-link'; export const DisablePublicSharing = (props: MenuItemProps) => { diff --git a/packages/frontend/component/src/components/page-list/operation-menu-items/export.tsx b/packages/frontend/component/src/components/page-list/operation-menu-items/export.tsx index a924f71e58..d37bb64a18 100644 --- a/packages/frontend/component/src/components/page-list/operation-menu-items/export.tsx +++ b/packages/frontend/component/src/components/page-list/operation-menu-items/export.tsx @@ -6,9 +6,9 @@ import { ExportToPdfIcon, ExportToPngIcon, } from '@blocksuite/icons'; -import { MenuIcon, MenuItem, MenuSub } from '@toeverything/components/menu'; import { type ReactNode, useMemo } from 'react'; +import { MenuIcon, MenuItem, MenuSub } from '../../../ui/menu'; import { transitionStyle } from './index.css'; interface ExportMenuItemProps { diff --git a/packages/frontend/component/src/components/page-list/operation-menu-items/move-to-trash.tsx b/packages/frontend/component/src/components/page-list/operation-menu-items/move-to-trash.tsx index 9738381081..82abf8c15d 100644 --- a/packages/frontend/component/src/components/page-list/operation-menu-items/move-to-trash.tsx +++ b/packages/frontend/component/src/components/page-list/operation-menu-items/move-to-trash.tsx @@ -1,14 +1,8 @@ import { useAFFiNEI18N } from '@affine/i18n/hooks'; import { DeleteIcon } from '@blocksuite/icons'; -import { - MenuIcon, - MenuItem, - type MenuItemProps, -} from '@toeverything/components/menu'; -import { - ConfirmModal, - type ConfirmModalProps, -} from '@toeverything/components/modal'; + +import { MenuIcon, MenuItem, type MenuItemProps } from '../../../ui/menu'; +import { ConfirmModal, type ConfirmModalProps } from '../../../ui/modal'; export const MoveToTrash = (props: MenuItemProps) => { const t = useAFFiNEI18N(); diff --git a/packages/frontend/component/src/components/page-list/page-tags.tsx b/packages/frontend/component/src/components/page-list/page-tags.tsx index 3fd43ea9df..7fb86e9dce 100644 --- a/packages/frontend/component/src/components/page-list/page-tags.tsx +++ b/packages/frontend/component/src/components/page-list/page-tags.tsx @@ -1,10 +1,10 @@ import type { Tag } from '@affine/env/filter'; import { MoreHorizontalIcon } from '@blocksuite/icons'; -import { Menu } from '@toeverything/components/menu'; import { assignInlineVars } from '@vanilla-extract/dynamic'; import clsx from 'clsx'; import { useMemo } from 'react'; +import { Menu } from '../../ui/menu'; import * as styles from './page-tags.css'; import { stopPropagation } from './utils'; diff --git a/packages/frontend/component/src/components/page-list/view/collection-bar.tsx b/packages/frontend/component/src/components/page-list/view/collection-bar.tsx index 453dafa6ae..2b8c102158 100644 --- a/packages/frontend/component/src/components/page-list/view/collection-bar.tsx +++ b/packages/frontend/component/src/components/page-list/view/collection-bar.tsx @@ -2,11 +2,11 @@ import type { DeleteCollectionInfo, PropertiesMeta } from '@affine/env/filter'; import type { GetPageInfoById } from '@affine/env/page-info'; import { useAFFiNEI18N } from '@affine/i18n/hooks'; import { ViewLayersIcon } from '@blocksuite/icons'; -import { Button } from '@toeverything/components/button'; -import { Tooltip } from '@toeverything/components/tooltip'; import clsx from 'clsx'; import { useState } from 'react'; +import { Button } from '../../../ui/button'; +import { Tooltip } from '../../../ui/tooltip'; import { type CollectionsCRUDAtom, useCollectionManager, diff --git a/packages/frontend/component/src/components/page-list/view/collection-list.tsx b/packages/frontend/component/src/components/page-list/view/collection-list.tsx index 563bef0414..80a31205b1 100644 --- a/packages/frontend/component/src/components/page-list/view/collection-list.tsx +++ b/packages/frontend/component/src/components/page-list/view/collection-list.tsx @@ -6,11 +6,11 @@ import type { import type { PropertiesMeta } from '@affine/env/filter'; import { useAFFiNEI18N } from '@affine/i18n/hooks'; import { FilterIcon } from '@blocksuite/icons'; -import { Button } from '@toeverything/components/button'; -import { Menu } from '@toeverything/components/menu'; import { useCallback, useState } from 'react'; +import { Button } from '../../../ui/button'; import { FlexWrapper } from '../../../ui/layout'; +import { Menu } from '../../../ui/menu'; import { CreateFilterMenu } from '../filter/vars'; import type { useCollectionManager } from '../use-collection-manager'; import * as styles from './collection-list.css'; diff --git a/packages/frontend/component/src/components/page-list/view/collection-operations.tsx b/packages/frontend/component/src/components/page-list/view/collection-operations.tsx index c7deb837a4..fc2564c812 100644 --- a/packages/frontend/component/src/components/page-list/view/collection-operations.tsx +++ b/packages/frontend/component/src/components/page-list/view/collection-operations.tsx @@ -1,12 +1,6 @@ import type { Collection, DeleteCollectionInfo } from '@affine/env/filter'; import { useAFFiNEI18N } from '@affine/i18n/hooks'; import { DeleteIcon, EditIcon, FilterIcon } from '@blocksuite/icons'; -import { - Menu, - MenuIcon, - MenuItem, - type MenuItemProps, -} from '@toeverything/components/menu'; import { type PropsWithChildren, type ReactElement, @@ -14,6 +8,7 @@ import { useMemo, } from 'react'; +import { Menu, MenuIcon, MenuItem, type MenuItemProps } from '../../../ui/menu'; import type { useCollectionManager } from '../use-collection-manager'; import type { AllPageListConfig } from '.'; import * as styles from './collection-operations.css'; diff --git a/packages/frontend/component/src/components/page-list/view/create-collection.tsx b/packages/frontend/component/src/components/page-list/view/create-collection.tsx index a769e1c078..086c449e8c 100644 --- a/packages/frontend/component/src/components/page-list/view/create-collection.tsx +++ b/packages/frontend/component/src/components/page-list/view/create-collection.tsx @@ -1,9 +1,9 @@ import { useAFFiNEI18N } from '@affine/i18n/hooks'; -import { Button } from '@toeverything/components/button'; -import { Modal } from '@toeverything/components/modal'; import { useCallback, useMemo, useState } from 'react'; +import { Button } from '../../../ui/button'; import Input from '../../../ui/input'; +import { Modal } from '../../../ui/modal'; import * as styles from './create-collection.css'; export interface CreateCollectionModalProps { diff --git a/packages/frontend/component/src/components/page-list/view/edit-collection/edit-collection.tsx b/packages/frontend/component/src/components/page-list/view/edit-collection/edit-collection.tsx index ad91403861..f789467b83 100644 --- a/packages/frontend/component/src/components/page-list/view/edit-collection/edit-collection.tsx +++ b/packages/frontend/component/src/components/page-list/view/edit-collection/edit-collection.tsx @@ -2,11 +2,11 @@ import type { Collection } from '@affine/env/filter'; import { useAFFiNEI18N } from '@affine/i18n/hooks'; import type { PageMeta, Workspace } from '@blocksuite/store'; import type { DialogContentProps } from '@radix-ui/react-dialog'; -import { Button } from '@toeverything/components/button'; -import { Modal } from '@toeverything/components/modal'; import { type ReactNode, useCallback, useMemo, useState } from 'react'; -import { RadioButton, RadioButtonGroup } from '../../../../ui/button'; +import { RadioButton, RadioButtonGroup } from '../../../../index'; +import { Button } from '../../../../ui/button'; +import { Modal } from '../../../../ui/modal'; import * as styles from './edit-collection.css'; import { PagesMode } from './pages-mode'; import { RulesMode } from './rules-mode'; diff --git a/packages/frontend/component/src/components/page-list/view/edit-collection/hooks.tsx b/packages/frontend/component/src/components/page-list/view/edit-collection/hooks.tsx index 58fde6a7ed..b21106f0fc 100644 --- a/packages/frontend/component/src/components/page-list/view/edit-collection/hooks.tsx +++ b/packages/frontend/component/src/components/page-list/view/edit-collection/hooks.tsx @@ -1,6 +1,6 @@ -import { Modal } from '@toeverything/components/modal'; import { useCallback, useState } from 'react'; +import { Modal } from '../../../../ui/modal'; import type { AllPageListConfig } from './edit-collection'; import { SelectPage } from './select-page'; export const useSelectPage = ({ diff --git a/packages/frontend/component/src/components/page-list/view/edit-collection/pages-mode.tsx b/packages/frontend/component/src/components/page-list/view/edit-collection/pages-mode.tsx index 4f25b105e7..d04a681e0c 100644 --- a/packages/frontend/component/src/components/page-list/view/edit-collection/pages-mode.tsx +++ b/packages/frontend/component/src/components/page-list/view/edit-collection/pages-mode.tsx @@ -2,10 +2,10 @@ import type { Collection } from '@affine/env/filter'; import { useAFFiNEI18N } from '@affine/i18n/hooks'; import { FilterIcon } from '@blocksuite/icons'; import type { PageMeta } from '@blocksuite/store'; -import { Menu } from '@toeverything/components/menu'; import clsx from 'clsx'; import { type ReactNode, useCallback } from 'react'; +import { Menu } from '../../../../ui/menu'; import { FilterList } from '../../filter/filter-list'; import { VariableSelect } from '../../filter/vars'; import { VirtualizedPageList } from '../../virtualized-page-list'; diff --git a/packages/frontend/component/src/components/page-list/view/edit-collection/select-page.tsx b/packages/frontend/component/src/components/page-list/view/edit-collection/select-page.tsx index f4a4e7ffcf..28616a4df1 100644 --- a/packages/frontend/component/src/components/page-list/view/edit-collection/select-page.tsx +++ b/packages/frontend/component/src/components/page-list/view/edit-collection/select-page.tsx @@ -1,11 +1,11 @@ import { Trans } from '@affine/i18n'; import { useAFFiNEI18N } from '@affine/i18n/hooks'; import { FilterIcon } from '@blocksuite/icons'; -import { Button } from '@toeverything/components/button'; -import { Menu } from '@toeverything/components/menu'; import clsx from 'clsx'; import { useCallback, useState } from 'react'; +import { Button } from '../../../../ui/button'; +import { Menu } from '../../../../ui/menu'; import { FilterList } from '../../filter'; import { VariableSelect } from '../../filter/vars'; import { VirtualizedPageList } from '../../virtualized-page-list'; diff --git a/packages/frontend/component/src/components/page-list/view/save-as-collection-button.tsx b/packages/frontend/component/src/components/page-list/view/save-as-collection-button.tsx index bcdd35c44f..98e7fb4234 100644 --- a/packages/frontend/component/src/components/page-list/view/save-as-collection-button.tsx +++ b/packages/frontend/component/src/components/page-list/view/save-as-collection-button.tsx @@ -1,10 +1,10 @@ import type { Collection } from '@affine/env/filter'; import { useAFFiNEI18N } from '@affine/i18n/hooks'; import { SaveIcon } from '@blocksuite/icons'; -import { Button } from '@toeverything/components/button'; import { nanoid } from 'nanoid'; import { useCallback } from 'react'; +import { Button } from '../../../ui/button'; import { createEmptyCollection } from '../use-collection-manager'; import { useEditCollectionName } from './use-edit-collection'; diff --git a/packages/frontend/component/src/components/setting-components/storage-progess.tsx b/packages/frontend/component/src/components/setting-components/storage-progess.tsx index e98c564069..174b6c83d8 100644 --- a/packages/frontend/component/src/components/setting-components/storage-progess.tsx +++ b/packages/frontend/component/src/components/setting-components/storage-progess.tsx @@ -1,11 +1,11 @@ import { SubscriptionPlan } from '@affine/graphql'; import { useAFFiNEI18N } from '@affine/i18n/hooks'; -import { Button } from '@toeverything/components/button'; -import { Tooltip } from '@toeverything/components/tooltip'; import bytes from 'bytes'; import clsx from 'clsx'; import { useMemo } from 'react'; +import { Button } from '../../ui/button'; +import { Tooltip } from '../../ui/tooltip'; import * as styles from './share.css'; export interface StorageProgressProgress { diff --git a/packages/frontend/component/src/components/tour-modal/tour-modal.tsx b/packages/frontend/component/src/components/tour-modal/tour-modal.tsx index 84e51eced1..95610743ab 100644 --- a/packages/frontend/component/src/components/tour-modal/tour-modal.tsx +++ b/packages/frontend/component/src/components/tour-modal/tour-modal.tsx @@ -1,10 +1,10 @@ /// import { useAFFiNEI18N } from '@affine/i18n/hooks'; import { ArrowLeftSmallIcon, ArrowRightSmallIcon } from '@blocksuite/icons'; -import { Modal, type ModalProps } from '@toeverything/components/modal'; import clsx from 'clsx'; import { useState } from 'react'; +import { Modal, type ModalProps } from '../../ui/modal'; import editingVideo from './editingVideo.mp4'; import { arrowStyle, diff --git a/packages/frontend/core/package.json b/packages/frontend/core/package.json index fd30a0a01f..64ee8a74fe 100644 --- a/packages/frontend/core/package.json +++ b/packages/frontend/core/package.json @@ -47,7 +47,6 @@ "@react-hookz/web": "^23.1.0", "@sentry/integrations": "^7.83.0", "@sentry/react": "^7.83.0", - "@toeverything/components": "^0.0.46", "@toeverything/theme": "^0.7.20", "@vanilla-extract/css": "^1.13.0", "@vanilla-extract/dynamic": "^2.0.3", diff --git a/packages/frontend/core/src/app.tsx b/packages/frontend/core/src/app.tsx index be9deb4d55..d7db06564a 100644 --- a/packages/frontend/core/src/app.tsx +++ b/packages/frontend/core/src/app.tsx @@ -1,6 +1,5 @@ import '@affine/component/theme/global.css'; import '@affine/component/theme/theme.css'; -import '@toeverything/components/style.css'; import { AffineContext } from '@affine/component/context'; import { GlobalLoading } from '@affine/component/global-loading'; diff --git a/packages/frontend/core/src/bootstrap/plugins/setup.ts b/packages/frontend/core/src/bootstrap/plugins/setup.ts index f894165369..8fc87d11b4 100644 --- a/packages/frontend/core/src/bootstrap/plugins/setup.ts +++ b/packages/frontend/core/src/bootstrap/plugins/setup.ts @@ -156,12 +156,8 @@ function createSetupImpl(rootStore: ReturnType) { }, '@blocksuite/global/utils': import('@blocksuite/global/utils'), '@toeverything/infra/atom': import('@toeverything/infra/atom'), - '@toeverything/components/button': import( - '@toeverything/components/button' - ), - '@toeverything/components/tooltip': import( - '@toeverything/components/tooltip' - ), + '@affine/component/ui/button': import('@affine/component/ui/button'), + '@affine/component/ui/tooltip': import('@affine/component/ui/tooltip'), }); // pluginName -> module -> importName -> updater[] diff --git a/packages/frontend/core/src/components/affine/affine-error-boundary/error-basic/error-detail.tsx b/packages/frontend/core/src/components/affine/affine-error-boundary/error-basic/error-detail.tsx index 2aa22a1f7b..fc481979eb 100644 --- a/packages/frontend/core/src/components/affine/affine-error-boundary/error-basic/error-detail.tsx +++ b/packages/frontend/core/src/components/affine/affine-error-boundary/error-basic/error-detail.tsx @@ -1,6 +1,6 @@ +import { Button } from '@affine/component/ui/button'; import { Trans } from '@affine/i18n'; import { useAFFiNEI18N } from '@affine/i18n/hooks'; -import { Button } from '@toeverything/components/button'; import { useAsyncCallback } from '@toeverything/hooks/affine-async-hooks'; import { type FC, diff --git a/packages/frontend/core/src/components/affine/auth/after-sign-in-send-email.tsx b/packages/frontend/core/src/components/affine/auth/after-sign-in-send-email.tsx index db76cc27bd..e9e578d1a8 100644 --- a/packages/frontend/core/src/components/affine/auth/after-sign-in-send-email.tsx +++ b/packages/frontend/core/src/components/affine/auth/after-sign-in-send-email.tsx @@ -4,9 +4,9 @@ import { CountDownRender, ModalHeader, } from '@affine/component/auth-components'; +import { Button } from '@affine/component/ui/button'; import { Trans } from '@affine/i18n'; import { useAFFiNEI18N } from '@affine/i18n/hooks'; -import { Button } from '@toeverything/components/button'; import { useAsyncCallback } from '@toeverything/hooks/affine-async-hooks'; import React, { useCallback } from 'react'; diff --git a/packages/frontend/core/src/components/affine/auth/after-sign-up-send-email.tsx b/packages/frontend/core/src/components/affine/auth/after-sign-up-send-email.tsx index 3841104620..dd5dd74b46 100644 --- a/packages/frontend/core/src/components/affine/auth/after-sign-up-send-email.tsx +++ b/packages/frontend/core/src/components/affine/auth/after-sign-up-send-email.tsx @@ -4,8 +4,8 @@ import { CountDownRender, ModalHeader, } from '@affine/component/auth-components'; +import { Button } from '@affine/component/ui/button'; import { useAFFiNEI18N } from '@affine/i18n/hooks'; -import { Button } from '@toeverything/components/button'; import { useAsyncCallback } from '@toeverything/hooks/affine-async-hooks'; import { type FC, useCallback } from 'react'; diff --git a/packages/frontend/core/src/components/affine/auth/send-email.tsx b/packages/frontend/core/src/components/affine/auth/send-email.tsx index 0b3399c1d8..bd0b72dcfc 100644 --- a/packages/frontend/core/src/components/affine/auth/send-email.tsx +++ b/packages/frontend/core/src/components/affine/auth/send-email.tsx @@ -6,6 +6,7 @@ import { ModalHeader, } from '@affine/component/auth-components'; import { pushNotificationAtom } from '@affine/component/notification-center'; +import { Button } from '@affine/component/ui/button'; import { sendChangeEmailMutation, sendChangePasswordEmailMutation, @@ -13,7 +14,6 @@ import { } from '@affine/graphql'; import { useAFFiNEI18N } from '@affine/i18n/hooks'; import { useMutation } from '@affine/workspace/affine/gql'; -import { Button } from '@toeverything/components/button'; import { useAsyncCallback } from '@toeverything/hooks/affine-async-hooks'; import { useSetAtom } from 'jotai/react'; import { useCallback, useState } from 'react'; diff --git a/packages/frontend/core/src/components/affine/auth/sign-in-with-password.tsx b/packages/frontend/core/src/components/affine/auth/sign-in-with-password.tsx index 9657c850c3..8bea5bd67e 100644 --- a/packages/frontend/core/src/components/affine/auth/sign-in-with-password.tsx +++ b/packages/frontend/core/src/components/affine/auth/sign-in-with-password.tsx @@ -4,8 +4,8 @@ import { BackButton, ModalHeader, } from '@affine/component/auth-components'; +import { Button } from '@affine/component/ui/button'; import { useAFFiNEI18N } from '@affine/i18n/hooks'; -import { Button } from '@toeverything/components/button'; import { useAsyncCallback } from '@toeverything/hooks/affine-async-hooks'; // eslint-disable-next-line @typescript-eslint/no-restricted-imports import { useSession } from 'next-auth/react'; diff --git a/packages/frontend/core/src/components/affine/auth/sign-in.tsx b/packages/frontend/core/src/components/affine/auth/sign-in.tsx index 93bd0d42be..df4e87d183 100644 --- a/packages/frontend/core/src/components/affine/auth/sign-in.tsx +++ b/packages/frontend/core/src/components/affine/auth/sign-in.tsx @@ -3,12 +3,12 @@ import { CountDownRender, ModalHeader, } from '@affine/component/auth-components'; +import { Button } from '@affine/component/ui/button'; import { type GetUserQuery, getUserQuery } from '@affine/graphql'; import { Trans } from '@affine/i18n'; import { useAFFiNEI18N } from '@affine/i18n/hooks'; import { useMutation } from '@affine/workspace/affine/gql'; import { ArrowDownBigIcon, GoogleDuotoneIcon } from '@blocksuite/icons'; -import { Button } from '@toeverything/components/button'; import { useAsyncCallback } from '@toeverything/hooks/affine-async-hooks'; import { GraphQLError } from 'graphql'; import { type FC, useState } from 'react'; diff --git a/packages/frontend/core/src/components/affine/auth/subscription-redirect.tsx b/packages/frontend/core/src/components/affine/auth/subscription-redirect.tsx index 26b720b60f..c206883a29 100644 --- a/packages/frontend/core/src/components/affine/auth/subscription-redirect.tsx +++ b/packages/frontend/core/src/components/affine/auth/subscription-redirect.tsx @@ -1,5 +1,7 @@ import { SignUpPage } from '@affine/component/auth-components'; import { AffineShapeIcon } from '@affine/component/page-list'; +import { Button } from '@affine/component/ui/button'; +import { Loading } from '@affine/component/ui/loading'; import type { SubscriptionRecurring } from '@affine/graphql'; import { changePasswordMutation, @@ -8,8 +10,6 @@ import { } from '@affine/graphql'; import { useAFFiNEI18N } from '@affine/i18n/hooks'; import { useMutation, useQuery } from '@affine/workspace/affine/gql'; -import { Button } from '@toeverything/components/button'; -import { Loading } from '@toeverything/components/loading'; import { useAsyncCallback } from '@toeverything/hooks/affine-async-hooks'; import { nanoid } from 'nanoid'; import { Suspense, useCallback, useEffect, useMemo } from 'react'; diff --git a/packages/frontend/core/src/components/affine/auth/user-plan-button.tsx b/packages/frontend/core/src/components/affine/auth/user-plan-button.tsx index dc1ecfdb29..fdc007828b 100644 --- a/packages/frontend/core/src/components/affine/auth/user-plan-button.tsx +++ b/packages/frontend/core/src/components/affine/auth/user-plan-button.tsx @@ -1,6 +1,6 @@ +import { Tooltip } from '@affine/component/ui/tooltip'; import { SubscriptionPlan } from '@affine/graphql'; import { useAFFiNEI18N } from '@affine/i18n/hooks'; -import Tooltip from '@toeverything/components/tooltip'; import { useSetAtom } from 'jotai'; import { useCallback } from 'react'; import { withErrorBoundary } from 'react-error-boundary'; diff --git a/packages/frontend/core/src/components/affine/create-workspace-modal/index.tsx b/packages/frontend/core/src/components/affine/create-workspace-modal/index.tsx index 0ec4f8920d..682da9fa7d 100644 --- a/packages/frontend/core/src/components/affine/create-workspace-modal/index.tsx +++ b/packages/frontend/core/src/components/affine/create-workspace-modal/index.tsx @@ -1,14 +1,14 @@ import { Input, toast } from '@affine/component'; -import { DebugLogger } from '@affine/debug'; -import { useAFFiNEI18N } from '@affine/i18n/hooks'; -import { HelpIcon } from '@blocksuite/icons'; -import { Button } from '@toeverything/components/button'; +import { Button } from '@affine/component/ui/button'; import { ConfirmModal, type ConfirmModalProps, Modal, -} from '@toeverything/components/modal'; -import { Tooltip } from '@toeverything/components/tooltip'; +} from '@affine/component/ui/modal'; +import { Tooltip } from '@affine/component/ui/tooltip'; +import { DebugLogger } from '@affine/debug'; +import { useAFFiNEI18N } from '@affine/i18n/hooks'; +import { HelpIcon } from '@blocksuite/icons'; import { useAsyncCallback } from '@toeverything/hooks/affine-async-hooks'; import type { LoadDBFileResult, diff --git a/packages/frontend/core/src/components/affine/enable-affine-cloud-modal/index.tsx b/packages/frontend/core/src/components/affine/enable-affine-cloud-modal/index.tsx index e26990481d..441e0a82b9 100644 --- a/packages/frontend/core/src/components/affine/enable-affine-cloud-modal/index.tsx +++ b/packages/frontend/core/src/components/affine/enable-affine-cloud-modal/index.tsx @@ -1,8 +1,8 @@ -import { useAFFiNEI18N } from '@affine/i18n/hooks'; import { ConfirmModal, type ConfirmModalProps, -} from '@toeverything/components/modal'; +} from '@affine/component/ui/modal'; +import { useAFFiNEI18N } from '@affine/i18n/hooks'; import { useSetAtom } from 'jotai'; import { useCallback } from 'react'; diff --git a/packages/frontend/core/src/components/affine/language-menu/index.tsx b/packages/frontend/core/src/components/affine/language-menu/index.tsx index 8856057dcc..e16b3b4bfa 100644 --- a/packages/frontend/core/src/components/affine/language-menu/index.tsx +++ b/packages/frontend/core/src/components/affine/language-menu/index.tsx @@ -1,4 +1,4 @@ -import { Menu, MenuItem, MenuTrigger } from '@toeverything/components/menu'; +import { Menu, MenuItem, MenuTrigger } from '@affine/component/ui/menu'; import { memo, type ReactElement } from 'react'; import { useLanguageHelper } from '../../../hooks/affine/use-language-helper'; diff --git a/packages/frontend/core/src/components/affine/new-workspace-setting-detail/delete-leave-workspace/delete/index.tsx b/packages/frontend/core/src/components/affine/new-workspace-setting-detail/delete-leave-workspace/delete/index.tsx index c076117d2c..6632476fa2 100644 --- a/packages/frontend/core/src/components/affine/new-workspace-setting-detail/delete-leave-workspace/delete/index.tsx +++ b/packages/frontend/core/src/components/affine/new-workspace-setting-detail/delete-leave-workspace/delete/index.tsx @@ -1,12 +1,12 @@ import { Input } from '@affine/component'; +import { + ConfirmModal, + type ConfirmModalProps, +} from '@affine/component/ui/modal'; import type { AffineOfficialWorkspace } from '@affine/env/workspace'; import { WorkspaceFlavour } from '@affine/env/workspace'; import { Trans } from '@affine/i18n'; import { useAFFiNEI18N } from '@affine/i18n/hooks'; -import { - ConfirmModal, - type ConfirmModalProps, -} from '@toeverything/components/modal'; import { useBlockSuiteWorkspaceName } from '@toeverything/hooks/use-block-suite-workspace-name'; import { useCallback, useState } from 'react'; diff --git a/packages/frontend/core/src/components/affine/new-workspace-setting-detail/delete-leave-workspace/index.tsx b/packages/frontend/core/src/components/affine/new-workspace-setting-detail/delete-leave-workspace/index.tsx index 86cd3ce6ac..ad27044b7d 100644 --- a/packages/frontend/core/src/components/affine/new-workspace-setting-detail/delete-leave-workspace/index.tsx +++ b/packages/frontend/core/src/components/affine/new-workspace-setting-detail/delete-leave-workspace/index.tsx @@ -1,9 +1,9 @@ import { SettingRow } from '@affine/component/setting-components'; +import { ConfirmModal } from '@affine/component/ui/modal'; import type { AffineOfficialWorkspace } from '@affine/env/workspace'; import { WorkspaceFlavour } from '@affine/env/workspace'; import { useAFFiNEI18N } from '@affine/i18n/hooks'; import { ArrowRightSmallIcon } from '@blocksuite/icons'; -import { ConfirmModal } from '@toeverything/components/modal'; import { useCallback, useState } from 'react'; import type { WorkspaceSettingDetailProps } from '../types'; diff --git a/packages/frontend/core/src/components/affine/new-workspace-setting-detail/export.tsx b/packages/frontend/core/src/components/affine/new-workspace-setting-detail/export.tsx index 592ccf09c0..a74908f90e 100644 --- a/packages/frontend/core/src/components/affine/new-workspace-setting-detail/export.tsx +++ b/packages/frontend/core/src/components/affine/new-workspace-setting-detail/export.tsx @@ -1,8 +1,8 @@ import { pushNotificationAtom } from '@affine/component/notification-center'; import { SettingRow } from '@affine/component/setting-components'; +import { Button } from '@affine/component/ui/button'; import type { AffineOfficialWorkspace } from '@affine/env/workspace'; import { useAFFiNEI18N } from '@affine/i18n/hooks'; -import { Button } from '@toeverything/components/button'; import { useAsyncCallback } from '@toeverything/hooks/affine-async-hooks'; import type { SaveDBFileResult } from '@toeverything/infra/type'; import { useSetAtom } from 'jotai'; diff --git a/packages/frontend/core/src/components/affine/new-workspace-setting-detail/members.tsx b/packages/frontend/core/src/components/affine/new-workspace-setting-detail/members.tsx index 5901dce957..f1d5a0adde 100644 --- a/packages/frontend/core/src/components/affine/new-workspace-setting-detail/members.tsx +++ b/packages/frontend/core/src/components/affine/new-workspace-setting-detail/members.tsx @@ -8,16 +8,16 @@ import { } from '@affine/component/member-components'; import { pushNotificationAtom } from '@affine/component/notification-center'; import { SettingRow } from '@affine/component/setting-components'; +import { Avatar } from '@affine/component/ui/avatar'; +import { Button, IconButton } from '@affine/component/ui/button'; +import { Loading } from '@affine/component/ui/loading'; +import { Menu, MenuItem } from '@affine/component/ui/menu'; +import { Tooltip } from '@affine/component/ui/tooltip'; import type { AffineOfficialWorkspace } from '@affine/env/workspace'; import { WorkspaceFlavour } from '@affine/env/workspace'; import { Permission, SubscriptionPlan } from '@affine/graphql'; import { useAFFiNEI18N } from '@affine/i18n/hooks'; import { ArrowRightBigIcon, MoreVerticalIcon } from '@blocksuite/icons'; -import { Avatar } from '@toeverything/components/avatar'; -import { Button, IconButton } from '@toeverything/components/button'; -import { Loading } from '@toeverything/components/loading'; -import { Menu, MenuItem } from '@toeverything/components/menu'; -import { Tooltip } from '@toeverything/components/tooltip'; import clsx from 'clsx'; import { useSetAtom } from 'jotai'; import type { ReactElement } from 'react'; diff --git a/packages/frontend/core/src/components/affine/new-workspace-setting-detail/profile.tsx b/packages/frontend/core/src/components/affine/new-workspace-setting-detail/profile.tsx index ef9722ab58..59a06c6ed3 100644 --- a/packages/frontend/core/src/components/affine/new-workspace-setting-detail/profile.tsx +++ b/packages/frontend/core/src/components/affine/new-workspace-setting-detail/profile.tsx @@ -1,10 +1,10 @@ import { FlexWrapper, Input, Wrapper } from '@affine/component'; import { pushNotificationAtom } from '@affine/component/notification-center'; +import { Avatar } from '@affine/component/ui/avatar'; +import { Button } from '@affine/component/ui/button'; import type { AffineOfficialWorkspace } from '@affine/env/workspace'; import { useAFFiNEI18N } from '@affine/i18n/hooks'; import { CameraIcon } from '@blocksuite/icons'; -import { Avatar } from '@toeverything/components/avatar'; -import { Button } from '@toeverything/components/button'; import { useBlockSuiteWorkspaceAvatarUrl } from '@toeverything/hooks/use-block-suite-workspace-avatar-url'; import { useBlockSuiteWorkspaceName } from '@toeverything/hooks/use-block-suite-workspace-name'; import { useSetAtom } from 'jotai'; diff --git a/packages/frontend/core/src/components/affine/new-workspace-setting-detail/publish.tsx b/packages/frontend/core/src/components/affine/new-workspace-setting-detail/publish.tsx index 95652cdd91..f7869905fd 100644 --- a/packages/frontend/core/src/components/affine/new-workspace-setting-detail/publish.tsx +++ b/packages/frontend/core/src/components/affine/new-workspace-setting-detail/publish.tsx @@ -1,5 +1,7 @@ import { FlexWrapper, Input, Switch } from '@affine/component'; import { SettingRow } from '@affine/component/setting-components'; +import { Button } from '@affine/component/ui/button'; +import { Tooltip } from '@affine/component/ui/tooltip'; import { Unreachable } from '@affine/env/constant'; import type { AffineCloudWorkspace, @@ -9,8 +11,6 @@ import type { import type { AffineOfficialWorkspace } from '@affine/env/workspace'; import { WorkspaceFlavour } from '@affine/env/workspace'; import { useAFFiNEI18N } from '@affine/i18n/hooks'; -import { Button } from '@toeverything/components/button'; -import { Tooltip } from '@toeverything/components/tooltip'; import { useAsyncCallback } from '@toeverything/hooks/affine-async-hooks'; import { useBlockSuiteWorkspaceName } from '@toeverything/hooks/use-block-suite-workspace-name'; import { noop } from 'foxact/noop'; diff --git a/packages/frontend/core/src/components/affine/new-workspace-setting-detail/storage.tsx b/packages/frontend/core/src/components/affine/new-workspace-setting-detail/storage.tsx index afe7b918f0..9c6ac08873 100644 --- a/packages/frontend/core/src/components/affine/new-workspace-setting-detail/storage.tsx +++ b/packages/frontend/core/src/components/affine/new-workspace-setting-detail/storage.tsx @@ -1,9 +1,9 @@ import { FlexWrapper, toast } from '@affine/component'; import { SettingRow } from '@affine/component/setting-components'; +import { Button } from '@affine/component/ui/button'; +import { Tooltip } from '@affine/component/ui/tooltip'; import type { AffineOfficialWorkspace } from '@affine/env/workspace'; import { useAFFiNEI18N } from '@affine/i18n/hooks'; -import { Button } from '@toeverything/components/button'; -import { Tooltip } from '@toeverything/components/tooltip'; import type { MoveDBFileResult } from '@toeverything/infra/type'; import { useMemo } from 'react'; import { useCallback, useEffect, useState } from 'react'; diff --git a/packages/frontend/core/src/components/affine/page-history-modal/history-modal.tsx b/packages/frontend/core/src/components/affine/page-history-modal/history-modal.tsx index 8eb7150e82..c78d856020 100644 --- a/packages/frontend/core/src/components/affine/page-history-modal/history-modal.tsx +++ b/packages/frontend/core/src/components/affine/page-history-modal/history-modal.tsx @@ -3,12 +3,12 @@ import { BlockSuiteEditor, EditorLoading, } from '@affine/component/block-suite-editor'; +import { Button } from '@affine/component/ui/button'; +import { ConfirmModal, Modal } from '@affine/component/ui/modal'; import type { PageMode } from '@affine/core/atoms'; import { useAFFiNEI18N } from '@affine/i18n/hooks'; import type { Workspace } from '@blocksuite/store'; import type { DialogContentProps } from '@radix-ui/react-dialog'; -import { Button } from '@toeverything/components/button'; -import { ConfirmModal, Modal } from '@toeverything/components/modal'; import { useAsyncCallback } from '@toeverything/hooks/affine-async-hooks'; import { useAtom, useAtomValue } from 'jotai'; import { diff --git a/packages/frontend/core/src/components/affine/payment-disable/index.tsx b/packages/frontend/core/src/components/affine/payment-disable/index.tsx index 58a29da3c5..869837c7d7 100644 --- a/packages/frontend/core/src/components/affine/payment-disable/index.tsx +++ b/packages/frontend/core/src/components/affine/payment-disable/index.tsx @@ -1,5 +1,5 @@ +import { ConfirmModal } from '@affine/component/ui/modal'; import { useAFFiNEI18N } from '@affine/i18n/hooks'; -import { ConfirmModal } from '@toeverything/components/modal'; import { useAtom } from 'jotai'; import { useCallback } from 'react'; diff --git a/packages/frontend/core/src/components/affine/setting-modal/account-setting/index.tsx b/packages/frontend/core/src/components/affine/setting-modal/account-setting/index.tsx index 4d82b3c5d8..651dc953d3 100644 --- a/packages/frontend/core/src/components/affine/setting-modal/account-setting/index.tsx +++ b/packages/frontend/core/src/components/affine/setting-modal/account-setting/index.tsx @@ -5,6 +5,8 @@ import { SettingRow, StorageProgress, } from '@affine/component/setting-components'; +import { Avatar } from '@affine/component/ui/avatar'; +import { Button } from '@affine/component/ui/button'; import { allBlobSizesQuery, removeAvatarMutation, @@ -14,8 +16,6 @@ import { import { useAFFiNEI18N } from '@affine/i18n/hooks'; import { useMutation, useQuery } from '@affine/workspace/affine/gql'; import { ArrowRightSmallIcon, CameraIcon } from '@blocksuite/icons'; -import { Avatar } from '@toeverything/components/avatar'; -import { Button } from '@toeverything/components/button'; import { useAsyncCallback } from '@toeverything/hooks/affine-async-hooks'; import { validateAndReduceImage } from '@toeverything/hooks/use-block-suite-workspace-avatar-url'; import bytes from 'bytes'; diff --git a/packages/frontend/core/src/components/affine/setting-modal/general-setting/about/update-check-section.tsx b/packages/frontend/core/src/components/affine/setting-modal/general-setting/about/update-check-section.tsx index 64f615169f..4aaef0b709 100644 --- a/packages/frontend/core/src/components/affine/setting-modal/general-setting/about/update-check-section.tsx +++ b/packages/frontend/core/src/components/affine/setting-modal/general-setting/about/update-check-section.tsx @@ -1,6 +1,6 @@ import { SettingRow } from '@affine/component/setting-components'; +import { Button } from '@affine/component/ui/button'; import { useAFFiNEI18N } from '@affine/i18n/hooks'; -import { Button } from '@toeverything/components/button'; import { useAsyncCallback } from '@toeverything/hooks/affine-async-hooks'; import { downloadProgressAtom, diff --git a/packages/frontend/core/src/components/affine/setting-modal/general-setting/appearance/date-format-setting.tsx b/packages/frontend/core/src/components/affine/setting-modal/general-setting/appearance/date-format-setting.tsx index 1b790e86c7..fb1be173a9 100644 --- a/packages/frontend/core/src/components/affine/setting-modal/general-setting/appearance/date-format-setting.tsx +++ b/packages/frontend/core/src/components/affine/setting-modal/general-setting/appearance/date-format-setting.tsx @@ -1,4 +1,4 @@ -import { Menu, MenuItem, MenuTrigger } from '@toeverything/components/menu'; +import { Menu, MenuItem, MenuTrigger } from '@affine/component/ui/menu'; import dayjs from 'dayjs'; import { useCallback } from 'react'; diff --git a/packages/frontend/core/src/components/affine/setting-modal/general-setting/billing/index.tsx b/packages/frontend/core/src/components/affine/setting-modal/general-setting/billing/index.tsx index 48b10075f3..8fe1fdda44 100644 --- a/packages/frontend/core/src/components/affine/setting-modal/general-setting/billing/index.tsx +++ b/packages/frontend/core/src/components/affine/setting-modal/general-setting/billing/index.tsx @@ -5,6 +5,8 @@ import { SettingRow, SettingWrapper, } from '@affine/component/setting-components'; +import { Button, IconButton } from '@affine/component/ui/button'; +import { Loading } from '@affine/component/ui/loading'; import { createCustomerPortalMutation, getInvoicesCountQuery, @@ -20,8 +22,6 @@ import { Trans } from '@affine/i18n'; import { useAFFiNEI18N } from '@affine/i18n/hooks'; import { useMutation, useQuery } from '@affine/workspace/affine/gql'; import { ArrowRightSmallIcon } from '@blocksuite/icons'; -import { Button, IconButton } from '@toeverything/components/button'; -import { Loading } from '@toeverything/components/loading'; import { useAsyncCallback } from '@toeverything/hooks/affine-async-hooks'; import { useSetAtom } from 'jotai'; import { Suspense, useCallback, useMemo, useState } from 'react'; diff --git a/packages/frontend/core/src/components/affine/setting-modal/general-setting/plans/modals.tsx b/packages/frontend/core/src/components/affine/setting-modal/general-setting/plans/modals.tsx index cd3531ab0f..816d364e82 100644 --- a/packages/frontend/core/src/components/affine/setting-modal/general-setting/plans/modals.tsx +++ b/packages/frontend/core/src/components/affine/setting-modal/general-setting/plans/modals.tsx @@ -1,11 +1,11 @@ -import { useAFFiNEI18N } from '@affine/i18n/hooks'; -import { DialogTrigger } from '@radix-ui/react-dialog'; -import { Button } from '@toeverything/components/button'; +import { Button } from '@affine/component/ui/button'; import { ConfirmModal, type ConfirmModalProps, Modal, -} from '@toeverything/components/modal'; +} from '@affine/component/ui/modal'; +import { useAFFiNEI18N } from '@affine/i18n/hooks'; +import { DialogTrigger } from '@radix-ui/react-dialog'; import { type ReactNode, useEffect, useRef } from 'react'; import * as styles from './style.css'; diff --git a/packages/frontend/core/src/components/affine/setting-modal/general-setting/plans/plan-card.tsx b/packages/frontend/core/src/components/affine/setting-modal/general-setting/plans/plan-card.tsx index f8f415ee69..a160b5da35 100644 --- a/packages/frontend/core/src/components/affine/setting-modal/general-setting/plans/plan-card.tsx +++ b/packages/frontend/core/src/components/affine/setting-modal/general-setting/plans/plan-card.tsx @@ -1,3 +1,5 @@ +import { Button } from '@affine/component/ui/button'; +import { Tooltip } from '@affine/component/ui/tooltip'; import type { Subscription, SubscriptionMutator, @@ -13,8 +15,6 @@ import { Trans } from '@affine/i18n'; import { useAFFiNEI18N } from '@affine/i18n/hooks'; import { useMutation } from '@affine/workspace/affine/gql'; import { DoneIcon } from '@blocksuite/icons'; -import { Button } from '@toeverything/components/button'; -import { Tooltip } from '@toeverything/components/tooltip'; import { useAsyncCallback } from '@toeverything/hooks/affine-async-hooks'; import { useSetAtom } from 'jotai'; import { useAtom } from 'jotai'; diff --git a/packages/frontend/core/src/components/affine/setting-modal/index.tsx b/packages/frontend/core/src/components/affine/setting-modal/index.tsx index 075a78b321..9651d5a0fd 100644 --- a/packages/frontend/core/src/components/affine/setting-modal/index.tsx +++ b/packages/frontend/core/src/components/affine/setting-modal/index.tsx @@ -1,7 +1,7 @@ import { WorkspaceDetailSkeleton } from '@affine/component/setting-components'; +import { Modal, type ModalProps } from '@affine/component/ui/modal'; import { useAFFiNEI18N } from '@affine/i18n/hooks'; import { ContactWithUsIcon } from '@blocksuite/icons'; -import { Modal, type ModalProps } from '@toeverything/components/modal'; import { debounce } from 'lodash-es'; import { Suspense, useCallback, useLayoutEffect, useRef } from 'react'; diff --git a/packages/frontend/core/src/components/affine/setting-modal/setting-sidebar/index.tsx b/packages/frontend/core/src/components/affine/setting-modal/setting-sidebar/index.tsx index 030b08fcc4..a39509437d 100644 --- a/packages/frontend/core/src/components/affine/setting-modal/setting-sidebar/index.tsx +++ b/packages/frontend/core/src/components/affine/setting-modal/setting-sidebar/index.tsx @@ -2,13 +2,13 @@ import { WorkspaceListItemSkeleton, WorkspaceListSkeleton, } from '@affine/component/setting-components'; +import { Avatar } from '@affine/component/ui/avatar'; +import { Tooltip } from '@affine/component/ui/tooltip'; import { WorkspaceFlavour } from '@affine/env/workspace'; import { useAFFiNEI18N } from '@affine/i18n/hooks'; import type { RootWorkspaceMetadata } from '@affine/workspace/atom'; import { rootWorkspacesMetadataAtom } from '@affine/workspace/atom'; import { Logo1Icon } from '@blocksuite/icons'; -import { Avatar } from '@toeverything/components/avatar'; -import { Tooltip } from '@toeverything/components/tooltip'; import { useBlockSuiteWorkspaceAvatarUrl } from '@toeverything/hooks/use-block-suite-workspace-avatar-url'; import { useBlockSuiteWorkspaceName } from '@toeverything/hooks/use-block-suite-workspace-name'; import { getBlockSuiteWorkspaceAtom } from '@toeverything/infra/__internal__/workspace'; diff --git a/packages/frontend/core/src/components/affine/share-page-modal/share-menu/share-export.tsx b/packages/frontend/core/src/components/affine/share-page-modal/share-menu/share-export.tsx index e8e081221c..2f5895e201 100644 --- a/packages/frontend/core/src/components/affine/share-page-modal/share-menu/share-export.tsx +++ b/packages/frontend/core/src/components/affine/share-page-modal/share-menu/share-export.tsx @@ -1,9 +1,9 @@ import { ExportMenuItems } from '@affine/component/page-list'; +import { Button } from '@affine/component/ui/button'; +import { Divider } from '@affine/component/ui/divider'; import { WorkspaceFlavour } from '@affine/env/workspace'; import { useAFFiNEI18N } from '@affine/i18n/hooks'; import { LinkIcon } from '@blocksuite/icons'; -import { Button } from '@toeverything/components/button'; -import { Divider } from '@toeverything/components/divider'; import { useExportPage } from '../../../../hooks/affine/use-export-page'; import * as styles from './index.css'; diff --git a/packages/frontend/core/src/components/affine/share-page-modal/share-menu/share-menu.tsx b/packages/frontend/core/src/components/affine/share-page-modal/share-menu/share-menu.tsx index 9b364cc04a..aa8f7df5a7 100644 --- a/packages/frontend/core/src/components/affine/share-page-modal/share-menu/share-menu.tsx +++ b/packages/frontend/core/src/components/affine/share-page-modal/share-menu/share-menu.tsx @@ -1,3 +1,6 @@ +import { Button } from '@affine/component/ui/button'; +import { Divider } from '@affine/component/ui/divider'; +import { Menu } from '@affine/component/ui/menu'; import { type AffineCloudWorkspace, type AffineOfficialWorkspace, @@ -8,9 +11,6 @@ import { import { useAFFiNEI18N } from '@affine/i18n/hooks'; import { WebIcon } from '@blocksuite/icons'; import type { Page } from '@blocksuite/store'; -import { Button } from '@toeverything/components/button'; -import { Divider } from '@toeverything/components/divider'; -import { Menu } from '@toeverything/components/menu'; import { useIsSharedPage } from '../../../../hooks/affine/use-is-shared-page'; import * as styles from './index.css'; diff --git a/packages/frontend/core/src/components/affine/share-page-modal/share-menu/share-page.tsx b/packages/frontend/core/src/components/affine/share-page-modal/share-menu/share-page.tsx index 250bd718cd..d56c40740e 100644 --- a/packages/frontend/core/src/components/affine/share-page-modal/share-menu/share-page.tsx +++ b/packages/frontend/core/src/components/affine/share-page-modal/share-menu/share-page.tsx @@ -6,11 +6,11 @@ import { toast, } from '@affine/component'; import { PublicLinkDisableModal } from '@affine/component/disable-public-link'; +import { Button } from '@affine/component/ui/button'; +import { Menu, MenuItem, MenuTrigger } from '@affine/component/ui/menu'; import { WorkspaceFlavour } from '@affine/env/workspace'; import { useAFFiNEI18N } from '@affine/i18n/hooks'; import { ArrowRightSmallIcon } from '@blocksuite/icons'; -import { Button } from '@toeverything/components/button'; -import { Menu, MenuItem, MenuTrigger } from '@toeverything/components/menu'; import { useAtomValue } from 'jotai'; import { useMemo, useState } from 'react'; import { useCallback } from 'react'; diff --git a/packages/frontend/core/src/components/affine/sign-out-modal/index.tsx b/packages/frontend/core/src/components/affine/sign-out-modal/index.tsx index e53ef91916..032c0972b2 100644 --- a/packages/frontend/core/src/components/affine/sign-out-modal/index.tsx +++ b/packages/frontend/core/src/components/affine/sign-out-modal/index.tsx @@ -1,8 +1,8 @@ -import { useAFFiNEI18N } from '@affine/i18n/hooks'; import { ConfirmModal, type ConfirmModalProps, -} from '@toeverything/components/modal'; +} from '@affine/component/ui/modal'; +import { useAFFiNEI18N } from '@affine/i18n/hooks'; import { useMemo } from 'react'; type SignOutConfirmModalI18NKeys = diff --git a/packages/frontend/core/src/components/affine/tmp-disable-affine-cloud-modal/index.tsx b/packages/frontend/core/src/components/affine/tmp-disable-affine-cloud-modal/index.tsx index f581d23dab..1d4e7e21fb 100644 --- a/packages/frontend/core/src/components/affine/tmp-disable-affine-cloud-modal/index.tsx +++ b/packages/frontend/core/src/components/affine/tmp-disable-affine-cloud-modal/index.tsx @@ -1,7 +1,7 @@ import { Empty } from '@affine/component'; +import { Modal, type ModalProps } from '@affine/component/ui/modal'; import { Trans } from '@affine/i18n'; import { useAFFiNEI18N } from '@affine/i18n/hooks'; -import { Modal, type ModalProps } from '@toeverything/components/modal'; import { useCallback } from 'react'; import { diff --git a/packages/frontend/core/src/components/affine/tmp-disable-affine-cloud-modal/style.ts b/packages/frontend/core/src/components/affine/tmp-disable-affine-cloud-modal/style.ts index 24f4adde04..bbc181a3c2 100644 --- a/packages/frontend/core/src/components/affine/tmp-disable-affine-cloud-modal/style.ts +++ b/packages/frontend/core/src/components/affine/tmp-disable-affine-cloud-modal/style.ts @@ -1,5 +1,5 @@ import { displayFlex, styled } from '@affine/component'; -import { Button } from '@toeverything/components/button'; +import { Button } from '@affine/component/ui/button'; export const Header = styled('div')({ height: '44px', diff --git a/packages/frontend/core/src/components/blocksuite/block-suite-header-title/operation-menu.tsx b/packages/frontend/core/src/components/blocksuite/block-suite-header-title/operation-menu.tsx index 2fa9a63ad9..f02a7a13b3 100644 --- a/packages/frontend/core/src/components/blocksuite/block-suite-header-title/operation-menu.tsx +++ b/packages/frontend/core/src/components/blocksuite/block-suite-header-title/operation-menu.tsx @@ -1,5 +1,11 @@ import { FlexWrapper } from '@affine/component'; import { Export, MoveToTrash } from '@affine/component/page-list'; +import { + Menu, + MenuIcon, + MenuItem, + MenuSeparator, +} from '@affine/component/ui/menu'; import { WorkspaceFlavour } from '@affine/env/workspace'; import { useAFFiNEI18N } from '@affine/i18n/hooks'; import { assertExists } from '@blocksuite/global/utils'; @@ -14,12 +20,6 @@ import { PageIcon, } from '@blocksuite/icons'; import type { PageMeta } from '@blocksuite/store'; -import { - Menu, - MenuIcon, - MenuItem, - MenuSeparator, -} from '@toeverything/components/menu'; import { useBlockSuitePageMeta } from '@toeverything/hooks/use-block-suite-page-meta'; import { useAtomValue } from 'jotai'; import { useCallback, useRef, useState } from 'react'; diff --git a/packages/frontend/core/src/components/blocksuite/block-suite-mode-switch/index.tsx b/packages/frontend/core/src/components/blocksuite/block-suite-mode-switch/index.tsx index 477fa4be2c..c522693ae6 100644 --- a/packages/frontend/core/src/components/blocksuite/block-suite-mode-switch/index.tsx +++ b/packages/frontend/core/src/components/blocksuite/block-suite-mode-switch/index.tsx @@ -1,6 +1,6 @@ +import { Tooltip } from '@affine/component/ui/tooltip'; import { useAFFiNEI18N } from '@affine/i18n/hooks'; import { assertExists } from '@blocksuite/global/utils'; -import { Tooltip } from '@toeverything/components/tooltip'; import { useBlockSuitePageMeta } from '@toeverything/hooks/use-block-suite-page-meta'; import { useAtomValue } from 'jotai'; import type { CSSProperties } from 'react'; diff --git a/packages/frontend/core/src/components/bookmark.tsx b/packages/frontend/core/src/components/bookmark.tsx index 0792a71ae7..18705f14b0 100644 --- a/packages/frontend/core/src/components/bookmark.tsx +++ b/packages/frontend/core/src/components/bookmark.tsx @@ -1,8 +1,8 @@ +import { Menu, MenuItem } from '@affine/component/ui/menu'; import type { SerializedBlock } from '@blocksuite/blocks'; import type { BaseBlockModel } from '@blocksuite/store'; import type { Page } from '@blocksuite/store'; import type { VEditor } from '@blocksuite/virgo'; -import { Menu, MenuItem } from '@toeverything/components/menu'; import { useEffect, useState } from 'react'; import { createPortal } from 'react-dom'; diff --git a/packages/frontend/core/src/components/cloud/login-card.tsx b/packages/frontend/core/src/components/cloud/login-card.tsx index 747139f5c8..a871ee3396 100644 --- a/packages/frontend/core/src/components/cloud/login-card.tsx +++ b/packages/frontend/core/src/components/cloud/login-card.tsx @@ -1,6 +1,6 @@ +import { Avatar } from '@affine/component/ui/avatar'; import { useAFFiNEI18N } from '@affine/i18n/hooks'; import { CloudWorkspaceIcon } from '@blocksuite/icons'; -import { Avatar } from '@toeverything/components/avatar'; import { useAsyncCallback } from '@toeverything/hooks/affine-async-hooks'; import { useCurrentLoginStatus } from '../../hooks/affine/use-current-login-status'; diff --git a/packages/frontend/core/src/components/cloud/share-header-left-item/user-avatar.tsx b/packages/frontend/core/src/components/cloud/share-header-left-item/user-avatar.tsx index 43558bdd03..e63da0f7ee 100644 --- a/packages/frontend/core/src/components/cloud/share-header-left-item/user-avatar.tsx +++ b/packages/frontend/core/src/components/cloud/share-header-left-item/user-avatar.tsx @@ -1,7 +1,7 @@ +import { Avatar } from '@affine/component/ui/avatar'; +import { Menu, MenuIcon, MenuItem } from '@affine/component/ui/menu'; import { useAFFiNEI18N } from '@affine/i18n/hooks'; import { SignOutIcon } from '@blocksuite/icons'; -import { Avatar } from '@toeverything/components/avatar'; -import { Menu, MenuIcon, MenuItem } from '@toeverything/components/menu'; import { useAsyncCallback } from '@toeverything/hooks/affine-async-hooks'; import { useMemo } from 'react'; import { useLocation } from 'react-router-dom'; diff --git a/packages/frontend/core/src/components/cloud/share-header-right-item/authenticated-item.tsx b/packages/frontend/core/src/components/cloud/share-header-right-item/authenticated-item.tsx index f927723365..a12fd69838 100644 --- a/packages/frontend/core/src/components/cloud/share-header-right-item/authenticated-item.tsx +++ b/packages/frontend/core/src/components/cloud/share-header-right-item/authenticated-item.tsx @@ -1,5 +1,5 @@ +import { Button } from '@affine/component/ui/button'; import { useAFFiNEI18N } from '@affine/i18n/hooks'; -import { Button } from '@toeverything/components/button'; import { useCurrentUser } from '../../../hooks/affine/use-current-user'; import { useMembers } from '../../../hooks/affine/use-members'; diff --git a/packages/frontend/core/src/components/pure/file-upload/index.tsx b/packages/frontend/core/src/components/pure/file-upload/index.tsx index 76ca15ed0d..8d09b530a5 100644 --- a/packages/frontend/core/src/components/pure/file-upload/index.tsx +++ b/packages/frontend/core/src/components/pure/file-upload/index.tsx @@ -1,6 +1,6 @@ import { styled } from '@affine/component'; +import { Button } from '@affine/component/ui/button'; import { useAFFiNEI18N } from '@affine/i18n/hooks'; -import { Button } from '@toeverything/components/button'; import type { ChangeEvent, PropsWithChildren } from 'react'; import { useRef } from 'react'; diff --git a/packages/frontend/core/src/components/pure/header-drop-down-button/index.tsx b/packages/frontend/core/src/components/pure/header-drop-down-button/index.tsx index dc9e1b8c94..8cb02f804f 100644 --- a/packages/frontend/core/src/components/pure/header-drop-down-button/index.tsx +++ b/packages/frontend/core/src/components/pure/header-drop-down-button/index.tsx @@ -1,8 +1,5 @@ +import { IconButton, type IconButtonProps } from '@affine/component/ui/button'; import { ArrowDownSmallIcon } from '@blocksuite/icons'; -import { - IconButton, - type IconButtonProps, -} from '@toeverything/components/button'; import { forwardRef } from 'react'; import { headerMenuTrigger } from './styles.css'; diff --git a/packages/frontend/core/src/components/pure/help-island/index.tsx b/packages/frontend/core/src/components/pure/help-island/index.tsx index 714ce1514b..a1df89cab2 100644 --- a/packages/frontend/core/src/components/pure/help-island/index.tsx +++ b/packages/frontend/core/src/components/pure/help-island/index.tsx @@ -1,6 +1,6 @@ +import { Tooltip } from '@affine/component/ui/tooltip'; import { useAFFiNEI18N } from '@affine/i18n/hooks'; import { CloseIcon, NewIcon, UserGuideIcon } from '@blocksuite/icons'; -import { Tooltip } from '@toeverything/components/tooltip'; import { useSetAtom } from 'jotai/react'; import { useAtomValue } from 'jotai/react'; import { useCallback, useState } from 'react'; diff --git a/packages/frontend/core/src/components/pure/trash-button-group/index.tsx b/packages/frontend/core/src/components/pure/trash-button-group/index.tsx index f4592d4ea4..f806334408 100644 --- a/packages/frontend/core/src/components/pure/trash-button-group/index.tsx +++ b/packages/frontend/core/src/components/pure/trash-button-group/index.tsx @@ -1,10 +1,10 @@ +import { Button } from '@affine/component/ui/button'; +import { ConfirmModal } from '@affine/component/ui/modal'; +import { Tooltip } from '@affine/component/ui/tooltip'; import { WorkspaceSubPath } from '@affine/env/workspace'; import { useAFFiNEI18N } from '@affine/i18n/hooks'; import { assertExists } from '@blocksuite/global/utils'; import { DeleteIcon, ResetIcon } from '@blocksuite/icons'; -import { Button } from '@toeverything/components/button'; -import { ConfirmModal } from '@toeverything/components/modal'; -import { Tooltip } from '@toeverything/components/tooltip'; import { useBlockSuitePageMeta } from '@toeverything/hooks/use-block-suite-page-meta'; import { currentPageIdAtom } from '@toeverything/infra/atom'; import { useAtomValue } from 'jotai'; diff --git a/packages/frontend/core/src/components/pure/workspace-slider-bar/collections/add-collection-button.tsx b/packages/frontend/core/src/components/pure/workspace-slider-bar/collections/add-collection-button.tsx index 115784314b..9dfc4ee386 100644 --- a/packages/frontend/core/src/components/pure/workspace-slider-bar/collections/add-collection-button.tsx +++ b/packages/frontend/core/src/components/pure/workspace-slider-bar/collections/add-collection-button.tsx @@ -3,9 +3,9 @@ import { useCollectionManager, useEditCollectionName, } from '@affine/component/page-list'; +import { IconButton } from '@affine/component/ui/button'; import { useAFFiNEI18N } from '@affine/i18n/hooks'; import { PlusIcon } from '@blocksuite/icons'; -import { IconButton } from '@toeverything/components/button'; import { nanoid } from 'nanoid'; import { useCallback } from 'react'; diff --git a/packages/frontend/core/src/components/pure/workspace-slider-bar/collections/collections-list.tsx b/packages/frontend/core/src/components/pure/workspace-slider-bar/collections/collections-list.tsx index 1dfa9edf4b..277531876e 100644 --- a/packages/frontend/core/src/components/pure/workspace-slider-bar/collections/collections-list.tsx +++ b/packages/frontend/core/src/components/pure/workspace-slider-bar/collections/collections-list.tsx @@ -10,6 +10,7 @@ import { useCollectionManager, useSavedCollections, } from '@affine/component/page-list'; +import { IconButton } from '@affine/component/ui/button'; import type { Collection, DeleteCollectionInfo } from '@affine/env/filter'; import { useAFFiNEI18N } from '@affine/i18n/hooks'; import { InformationIcon, MoreHorizontalIcon } from '@blocksuite/icons'; @@ -17,7 +18,6 @@ import type { PageMeta, Workspace } from '@blocksuite/store'; import type { DragEndEvent } from '@dnd-kit/core'; import { useDroppable } from '@dnd-kit/core'; import * as Collapsible from '@radix-ui/react-collapsible'; -import { IconButton } from '@toeverything/components/button'; import { useAsyncCallback } from '@toeverything/hooks/affine-async-hooks'; import { useBlockSuitePageMeta } from '@toeverything/hooks/use-block-suite-page-meta'; import { useMemo, useState } from 'react'; diff --git a/packages/frontend/core/src/components/pure/workspace-slider-bar/collections/page.tsx b/packages/frontend/core/src/components/pure/workspace-slider-bar/collections/page.tsx index b4f701580b..e50458dfd3 100644 --- a/packages/frontend/core/src/components/pure/workspace-slider-bar/collections/page.tsx +++ b/packages/frontend/core/src/components/pure/workspace-slider-bar/collections/page.tsx @@ -1,4 +1,11 @@ import { MenuItem as CollectionItem } from '@affine/component/app-sidebar'; +import { IconButton } from '@affine/component/ui/button'; +import { + Menu, + MenuIcon, + MenuItem, + type MenuItemProps, +} from '@affine/component/ui/menu'; import { useAFFiNEI18N } from '@affine/i18n/hooks'; import { DeleteIcon, @@ -9,13 +16,6 @@ import { } from '@blocksuite/icons'; import type { PageMeta, Workspace } from '@blocksuite/store'; import * as Collapsible from '@radix-ui/react-collapsible'; -import { IconButton } from '@toeverything/components/button'; -import { - Menu, - MenuIcon, - MenuItem, - type MenuItemProps, -} from '@toeverything/components/menu'; import { useBlockSuitePageReferences } from '@toeverything/hooks/use-block-suite-page-references'; import { useAtomValue } from 'jotai/index'; import type { ReactElement } from 'react'; diff --git a/packages/frontend/core/src/components/pure/workspace-slider-bar/favorite/add-favourite-button.tsx b/packages/frontend/core/src/components/pure/workspace-slider-bar/favorite/add-favourite-button.tsx index 92e04e86b8..4db8ff54b3 100644 --- a/packages/frontend/core/src/components/pure/workspace-slider-bar/favorite/add-favourite-button.tsx +++ b/packages/frontend/core/src/components/pure/workspace-slider-bar/favorite/add-favourite-button.tsx @@ -1,6 +1,6 @@ +import { IconButton } from '@affine/component/ui/button'; import { PlusIcon } from '@blocksuite/icons'; import type { Workspace } from '@blocksuite/store'; -import { IconButton } from '@toeverything/components/button'; import { useAsyncCallback } from '@toeverything/hooks/affine-async-hooks'; import { usePageMetaHelper } from '@toeverything/hooks/use-block-suite-page-meta'; diff --git a/packages/frontend/core/src/components/pure/workspace-slider-bar/user-with-workspace-list/add-workspace/index.tsx b/packages/frontend/core/src/components/pure/workspace-slider-bar/user-with-workspace-list/add-workspace/index.tsx index 75f04e46b8..52388e8a4c 100644 --- a/packages/frontend/core/src/components/pure/workspace-slider-bar/user-with-workspace-list/add-workspace/index.tsx +++ b/packages/frontend/core/src/components/pure/workspace-slider-bar/user-with-workspace-list/add-workspace/index.tsx @@ -1,6 +1,6 @@ +import { MenuItem } from '@affine/component/ui/menu'; import { useAFFiNEI18N } from '@affine/i18n/hooks'; import { ImportIcon, PlusIcon } from '@blocksuite/icons'; -import { MenuItem } from '@toeverything/components/menu'; import * as styles from './index.css'; diff --git a/packages/frontend/core/src/components/pure/workspace-slider-bar/user-with-workspace-list/index.tsx b/packages/frontend/core/src/components/pure/workspace-slider-bar/user-with-workspace-list/index.tsx index b5a4524051..ebd70789c9 100644 --- a/packages/frontend/core/src/components/pure/workspace-slider-bar/user-with-workspace-list/index.tsx +++ b/packages/frontend/core/src/components/pure/workspace-slider-bar/user-with-workspace-list/index.tsx @@ -1,8 +1,8 @@ +import { Divider } from '@affine/component/ui/divider'; +import { MenuItem } from '@affine/component/ui/menu'; import { useAFFiNEI18N } from '@affine/i18n/hooks'; import { rootWorkspacesMetadataAtom } from '@affine/workspace/atom'; import { Logo1Icon } from '@blocksuite/icons'; -import { Divider } from '@toeverything/components/divider'; -import { MenuItem } from '@toeverything/components/menu'; import { useAtomValue, useSetAtom } from 'jotai'; // eslint-disable-next-line @typescript-eslint/no-restricted-imports import { useSession } from 'next-auth/react'; diff --git a/packages/frontend/core/src/components/pure/workspace-slider-bar/user-with-workspace-list/user-account/index.tsx b/packages/frontend/core/src/components/pure/workspace-slider-bar/user-with-workspace-list/user-account/index.tsx index 3e959c6690..bb67ce51ae 100644 --- a/packages/frontend/core/src/components/pure/workspace-slider-bar/user-with-workspace-list/user-account/index.tsx +++ b/packages/frontend/core/src/components/pure/workspace-slider-bar/user-with-workspace-list/user-account/index.tsx @@ -1,12 +1,12 @@ +import { IconButton } from '@affine/component/ui/button'; +import { Divider } from '@affine/component/ui/divider'; +import { Menu, MenuIcon, MenuItem } from '@affine/component/ui/menu'; import { useAFFiNEI18N } from '@affine/i18n/hooks'; import { AccountIcon, MoreHorizontalIcon, SignOutIcon, } from '@blocksuite/icons'; -import { IconButton } from '@toeverything/components/button'; -import { Divider } from '@toeverything/components/divider'; -import { Menu, MenuIcon, MenuItem } from '@toeverything/components/menu'; import { useSetAtom } from 'jotai'; import { useCallback } from 'react'; diff --git a/packages/frontend/core/src/components/pure/workspace-slider-bar/user-with-workspace-list/workspace-list/index.tsx b/packages/frontend/core/src/components/pure/workspace-slider-bar/user-with-workspace-list/workspace-list/index.tsx index 9d065ec449..4d4cd25ecc 100644 --- a/packages/frontend/core/src/components/pure/workspace-slider-bar/user-with-workspace-list/workspace-list/index.tsx +++ b/packages/frontend/core/src/components/pure/workspace-slider-bar/user-with-workspace-list/workspace-list/index.tsx @@ -1,4 +1,5 @@ import { ScrollableContainer } from '@affine/component'; +import { Divider } from '@affine/component/ui/divider'; import { WorkspaceList } from '@affine/component/workspace-list'; import type { AffineCloudWorkspace, @@ -10,7 +11,6 @@ import type { RootWorkspaceMetadata } from '@affine/workspace/atom'; import { rootWorkspacesMetadataAtom } from '@affine/workspace/atom'; import type { DragEndEvent } from '@dnd-kit/core'; import { arrayMove } from '@dnd-kit/sortable'; -import { Divider } from '@toeverything/components/divider'; import { currentPageIdAtom, currentWorkspaceIdAtom, diff --git a/packages/frontend/core/src/components/pure/workspace-slider-bar/workspace-card/index.tsx b/packages/frontend/core/src/components/pure/workspace-slider-bar/workspace-card/index.tsx index 223a30b02c..d34b79e522 100644 --- a/packages/frontend/core/src/components/pure/workspace-slider-bar/workspace-card/index.tsx +++ b/packages/frontend/core/src/components/pure/workspace-slider-bar/workspace-card/index.tsx @@ -1,3 +1,5 @@ +import { Avatar } from '@affine/component/ui/avatar'; +import { Tooltip } from '@affine/component/ui/tooltip'; import { WorkspaceFlavour } from '@affine/env/workspace'; import { type SyncEngineStatus, @@ -10,8 +12,6 @@ import { NoNetworkIcon, UnsyncIcon, } from '@blocksuite/icons'; -import { Avatar } from '@toeverything/components/avatar'; -import { Tooltip } from '@toeverything/components/tooltip'; import { useBlockSuiteWorkspaceAvatarUrl } from '@toeverything/hooks/use-block-suite-workspace-avatar-url'; import { useBlockSuiteWorkspaceName } from '@toeverything/hooks/use-block-suite-workspace-name'; import { debounce } from 'lodash-es'; diff --git a/packages/frontend/core/src/components/root-app-sidebar/index.tsx b/packages/frontend/core/src/components/root-app-sidebar/index.tsx index e08826e098..9696b991be 100644 --- a/packages/frontend/core/src/components/root-app-sidebar/index.tsx +++ b/packages/frontend/core/src/components/root-app-sidebar/index.tsx @@ -13,12 +13,12 @@ import { SidebarScrollableContainer, } from '@affine/component/app-sidebar'; import { MoveToTrash } from '@affine/component/page-list'; +import { Menu } from '@affine/component/ui/menu'; import { WorkspaceSubPath } from '@affine/env/workspace'; import { useAFFiNEI18N } from '@affine/i18n/hooks'; import { FolderIcon, SettingsIcon } from '@blocksuite/icons'; import type { Page } from '@blocksuite/store'; import { useDroppable } from '@dnd-kit/core'; -import { Menu } from '@toeverything/components/menu'; import { useAsyncCallback } from '@toeverything/hooks/affine-async-hooks'; import { isAutoCheckUpdateAtom, diff --git a/packages/frontend/core/src/components/workspace-upgrade/upgrade.tsx b/packages/frontend/core/src/components/workspace-upgrade/upgrade.tsx index e132926baa..62fd5dcf98 100644 --- a/packages/frontend/core/src/components/workspace-upgrade/upgrade.tsx +++ b/packages/frontend/core/src/components/workspace-upgrade/upgrade.tsx @@ -1,6 +1,6 @@ import { AffineShapeIcon } from '@affine/component/page-list'; // TODO: import from page-list temporarily, need to defined common svg icon/images management. +import { Button } from '@affine/component/ui/button'; import { useAFFiNEI18N } from '@affine/i18n/hooks'; -import { Button } from '@toeverything/components/button'; import type { MigrationPoint } from '@toeverything/infra/blocksuite'; import { useCallback, useMemo } from 'react'; diff --git a/packages/frontend/core/src/pages/expired.tsx b/packages/frontend/core/src/pages/expired.tsx index 5d4cd67ae8..6c6efbcd6d 100644 --- a/packages/frontend/core/src/pages/expired.tsx +++ b/packages/frontend/core/src/pages/expired.tsx @@ -1,6 +1,6 @@ import { AuthPageContainer } from '@affine/component/auth-components'; +import { Button } from '@affine/component/ui/button'; import { useAFFiNEI18N } from '@affine/i18n/hooks'; -import { Button } from '@toeverything/components/button'; import { useCallback } from 'react'; import { RouteLogic, useNavigateHelper } from '../hooks/use-navigate-helper'; diff --git a/packages/frontend/core/src/pages/index.tsx b/packages/frontend/core/src/pages/index.tsx index a980a5879d..0d98c9e85c 100644 --- a/packages/frontend/core/src/pages/index.tsx +++ b/packages/frontend/core/src/pages/index.tsx @@ -1,6 +1,6 @@ +import { Menu } from '@affine/component/ui/menu'; import { DebugLogger } from '@affine/debug'; import { rootWorkspacesMetadataAtom } from '@affine/workspace/atom'; -import { Menu } from '@toeverything/components/menu'; import { getWorkspace } from '@toeverything/infra/__internal__/workspace'; import { getCurrentStore } from '@toeverything/infra/atom'; import { lazy } from 'react'; diff --git a/packages/frontend/core/src/pages/open-app.tsx b/packages/frontend/core/src/pages/open-app.tsx index b26da450ff..6941a45289 100644 --- a/packages/frontend/core/src/pages/open-app.tsx +++ b/packages/frontend/core/src/pages/open-app.tsx @@ -1,9 +1,9 @@ +import { Button } from '@affine/component/ui/button'; import { type GetCurrentUserQuery, getCurrentUserQuery } from '@affine/graphql'; import { Trans } from '@affine/i18n'; import { useAFFiNEI18N } from '@affine/i18n/hooks'; import { fetcher } from '@affine/workspace/affine/gql'; import { Logo1Icon } from '@blocksuite/icons'; -import { Button } from '@toeverything/components/button'; import { useCallback, useMemo } from 'react'; import { type LoaderFunction, diff --git a/packages/frontend/core/src/pages/upgrade-success.tsx b/packages/frontend/core/src/pages/upgrade-success.tsx index a8af870ead..ab0cdd168f 100644 --- a/packages/frontend/core/src/pages/upgrade-success.tsx +++ b/packages/frontend/core/src/pages/upgrade-success.tsx @@ -1,8 +1,8 @@ import { Empty } from '@affine/component'; +import { Button } from '@affine/component/ui/button'; import { Trans } from '@affine/i18n'; import { useAFFiNEI18N } from '@affine/i18n/hooks'; import { Logo1Icon } from '@blocksuite/icons'; -import { Button } from '@toeverything/components/button'; import { useCallback } from 'react'; import { useNavigateHelper } from '../hooks/use-navigate-helper'; diff --git a/packages/plugins/copilot/package.json b/packages/plugins/copilot/package.json index 0a83ec6ad6..76eb4a6635 100644 --- a/packages/plugins/copilot/package.json +++ b/packages/plugins/copilot/package.json @@ -17,7 +17,6 @@ "@affine/component": "workspace:*", "@affine/sdk": "workspace:*", "@blocksuite/icons": "2.1.36", - "@toeverything/components": "^0.0.46", "@vanilla-extract/css": "^1.13.0", "clsx": "^2.0.0", "idb": "^7.1.1", diff --git a/packages/plugins/copilot/src/UI/debug-content.tsx b/packages/plugins/copilot/src/UI/debug-content.tsx index 1df626ca8b..9cc0fb822a 100644 --- a/packages/plugins/copilot/src/UI/debug-content.tsx +++ b/packages/plugins/copilot/src/UI/debug-content.tsx @@ -1,5 +1,5 @@ import { FlexWrapper, Input } from '@affine/component'; -import { Button } from '@toeverything/components/button'; +import { Button } from '@affine/component/ui/button'; import { useAtom } from 'jotai'; import { type ReactElement, useCallback } from 'react'; diff --git a/packages/plugins/copilot/src/UI/detail-content.tsx b/packages/plugins/copilot/src/UI/detail-content.tsx index 5a39732fab..78855ff672 100644 --- a/packages/plugins/copilot/src/UI/detail-content.tsx +++ b/packages/plugins/copilot/src/UI/detail-content.tsx @@ -1,5 +1,5 @@ +import { IconButton } from '@affine/component/ui/button'; import { SendIcon } from '@blocksuite/icons'; -import { IconButton } from '@toeverything/components/button'; import { useAtomValue, useSetAtom } from 'jotai'; import type { ReactElement } from 'react'; import { Suspense, useCallback, useState } from 'react'; diff --git a/packages/plugins/copilot/src/UI/header-item.tsx b/packages/plugins/copilot/src/UI/header-item.tsx index 8dc7ea7ac7..9f72c344fc 100644 --- a/packages/plugins/copilot/src/UI/header-item.tsx +++ b/packages/plugins/copilot/src/UI/header-item.tsx @@ -1,7 +1,7 @@ +import { IconButton } from '@affine/component/ui/button'; +import { Tooltip } from '@affine/component/ui/tooltip'; import { deleteLayoutAtom, pushLayoutAtom } from '@affine/sdk/entry'; import { AiIcon } from '@blocksuite/icons'; -import { IconButton } from '@toeverything/components/button'; -import { Tooltip } from '@toeverything/components/tooltip'; import { useSetAtom } from 'jotai'; import type { ComponentType, PropsWithChildren, ReactElement } from 'react'; import { useCallback, useState } from 'react'; diff --git a/packages/plugins/copilot/src/core/components/conversation/index.tsx b/packages/plugins/copilot/src/core/components/conversation/index.tsx index f4bbf19ca5..8c4e5f517a 100644 --- a/packages/plugins/copilot/src/core/components/conversation/index.tsx +++ b/packages/plugins/copilot/src/core/components/conversation/index.tsx @@ -1,5 +1,5 @@ +import { Button } from '@affine/component/ui/button'; import { PlusIcon, ResetIcon } from '@blocksuite/icons'; -import { Button } from '@toeverything/components/button'; import { clsx } from 'clsx'; import type { MessageType } from 'langchain/schema'; import { marked } from 'marked'; diff --git a/packages/plugins/hello-world/package.json b/packages/plugins/hello-world/package.json index 2054049fb2..3d841355d8 100644 --- a/packages/plugins/hello-world/package.json +++ b/packages/plugins/hello-world/package.json @@ -17,8 +17,7 @@ "dependencies": { "@affine/component": "workspace:*", "@affine/sdk": "workspace:*", - "@blocksuite/icons": "2.1.36", - "@toeverything/components": "^0.0.46" + "@blocksuite/icons": "2.1.36" }, "devDependencies": { "@affine/plugin-cli": "workspace:*" diff --git a/packages/plugins/hello-world/src/app.tsx b/packages/plugins/hello-world/src/app.tsx index 8639b900a8..d79927f078 100644 --- a/packages/plugins/hello-world/src/app.tsx +++ b/packages/plugins/hello-world/src/app.tsx @@ -1,6 +1,6 @@ +import { IconButton } from '@affine/component/ui/button'; +import { Tooltip } from '@affine/component/ui/tooltip'; import { Logo1Icon } from '@blocksuite/icons'; -import { IconButton } from '@toeverything/components/button'; -import { Tooltip } from '@toeverything/components/tooltip'; import { useCallback } from 'react'; export const HeaderItem = () => { diff --git a/packages/plugins/image-preview/package.json b/packages/plugins/image-preview/package.json index 93d7b351f4..fc9ec6ebff 100644 --- a/packages/plugins/image-preview/package.json +++ b/packages/plugins/image-preview/package.json @@ -17,7 +17,6 @@ "@affine/component": "workspace:*", "@affine/sdk": "workspace:*", "@blocksuite/icons": "2.1.36", - "@toeverything/components": "^0.0.46", "@toeverything/theme": "^0.7.24", "clsx": "^2.0.0", "foxact": "^0.2.20", diff --git a/packages/plugins/image-preview/src/component/index.tsx b/packages/plugins/image-preview/src/component/index.tsx index 853ddd52a2..b0ff6ef467 100644 --- a/packages/plugins/image-preview/src/component/index.tsx +++ b/packages/plugins/image-preview/src/component/index.tsx @@ -1,3 +1,5 @@ +import { Button, IconButton } from '@affine/component/ui/button'; +import { Tooltip } from '@affine/component/ui/tooltip'; import type { ImageBlockModel } from '@blocksuite/blocks'; import { assertExists } from '@blocksuite/global/utils'; import { @@ -11,8 +13,6 @@ import { ViewBarIcon, } from '@blocksuite/icons'; import type { Workspace } from '@blocksuite/store'; -import { Button, IconButton } from '@toeverything/components/button'; -import { Tooltip } from '@toeverything/components/tooltip'; import clsx from 'clsx'; import { useErrorBoundary } from 'foxact/use-error-boundary'; import { useAtom } from 'jotai'; diff --git a/packages/plugins/outline/package.json b/packages/plugins/outline/package.json index 8fd7b8cf32..87d3970ab2 100644 --- a/packages/plugins/outline/package.json +++ b/packages/plugins/outline/package.json @@ -17,8 +17,7 @@ "dependencies": { "@affine/component": "workspace:*", "@affine/sdk": "workspace:*", - "@blocksuite/icons": "2.1.36", - "@toeverything/components": "^0.0.46" + "@blocksuite/icons": "2.1.36" }, "devDependencies": { "@affine/plugin-cli": "workspace:*", diff --git a/packages/plugins/outline/src/app.tsx b/packages/plugins/outline/src/app.tsx index caeb0eaa1a..c22b0a2c61 100644 --- a/packages/plugins/outline/src/app.tsx +++ b/packages/plugins/outline/src/app.tsx @@ -1,3 +1,5 @@ +import { IconButton } from '@affine/component/ui/button'; +import { Tooltip } from '@affine/component/ui/tooltip'; import { currentPageIdAtom, currentWorkspaceAtom, @@ -7,8 +9,6 @@ import { import { TOCNotesPanel } from '@blocksuite/blocks'; import { assertExists } from '@blocksuite/global/utils'; import { RightSidebarIcon } from '@blocksuite/icons'; -import { IconButton } from '@toeverything/components/button'; -import { Tooltip } from '@toeverything/components/tooltip'; import { useAtomValue, useSetAtom } from 'jotai'; import type { ComponentType, PropsWithChildren } from 'react'; import { useCallback, useRef, useState } from 'react'; diff --git a/tests/storybook/.storybook/preview.tsx b/tests/storybook/.storybook/preview.tsx index fc0d9253a6..82f655b9ac 100644 --- a/tests/storybook/.storybook/preview.tsx +++ b/tests/storybook/.storybook/preview.tsx @@ -1,7 +1,6 @@ import 'ses'; import '@affine/component/theme/global.css'; import '@affine/component/theme/theme.css'; -import '@toeverything/components/style.css'; import { createI18n } from '@affine/i18n'; import MockSessionContext, { mockAuthStates, diff --git a/tests/storybook/src/stories/card.stories.tsx b/tests/storybook/src/stories/card.stories.tsx index 305554f2a3..296383629d 100644 --- a/tests/storybook/src/stories/card.stories.tsx +++ b/tests/storybook/src/stories/card.stories.tsx @@ -1,6 +1,7 @@ import { toast } from '@affine/component'; import { BlockCard } from '@affine/component/card/block-card'; import { WorkspaceCard } from '@affine/component/card/workspace-card'; +import { Tooltip } from '@affine/component/ui/tooltip'; import { WorkspaceFlavour } from '@affine/env/workspace'; import { getOrCreateWorkspace } from '@affine/workspace/manager'; import { @@ -10,7 +11,6 @@ import { PageIcon, } from '@blocksuite/icons'; import type { Meta } from '@storybook/react'; -import { Tooltip } from '@toeverything/components/tooltip'; export default { title: 'AFFiNE/Card', diff --git a/tests/storybook/src/stories/quick-search/quick-search-modal.stories.tsx b/tests/storybook/src/stories/quick-search/quick-search-modal.stories.tsx index 2b026b617d..368df7e97e 100644 --- a/tests/storybook/src/stories/quick-search/quick-search-modal.stories.tsx +++ b/tests/storybook/src/stories/quick-search/quick-search-modal.stories.tsx @@ -1,6 +1,6 @@ +import { Button } from '@affine/component/ui/button'; import { CMDKContainer, CMDKModal } from '@affine/core/components/pure/cmdk'; import type { Meta, StoryFn } from '@storybook/react'; -import { Button } from '@toeverything/components/button'; import { useState } from 'react'; export default { diff --git a/yarn.lock b/yarn.lock index b87736ed45..8d7c72100d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -305,7 +305,6 @@ __metadata: "@affine/plugin-cli": "workspace:*" "@affine/sdk": "workspace:*" "@blocksuite/icons": "npm:2.1.36" - "@toeverything/components": "npm:^0.0.46" "@types/marked": "npm:^6.0.0" "@vanilla-extract/css": "npm:^1.13.0" clsx: "npm:^2.0.0" @@ -366,7 +365,6 @@ __metadata: "@svgr/webpack": "npm:^8.1.0" "@swc/core": "npm:^1.3.93" "@testing-library/react": "npm:^14.0.0" - "@toeverything/components": "npm:^0.0.46" "@toeverything/theme": "npm:^0.7.20" "@types/bytes": "npm:^3.1.3" "@types/lodash-es": "npm:^4.17.9" @@ -544,7 +542,6 @@ __metadata: "@affine/plugin-cli": "workspace:*" "@affine/sdk": "workspace:*" "@blocksuite/icons": "npm:2.1.36" - "@toeverything/components": "npm:^0.0.46" languageName: unknown linkType: soft @@ -569,7 +566,6 @@ __metadata: "@affine/plugin-cli": "workspace:*" "@affine/sdk": "workspace:*" "@blocksuite/icons": "npm:2.1.36" - "@toeverything/components": "npm:^0.0.46" "@toeverything/theme": "npm:^0.7.24" clsx: "npm:^2.0.0" foxact: "npm:^0.2.20" @@ -669,7 +665,6 @@ __metadata: "@affine/plugin-cli": "workspace:*" "@affine/sdk": "workspace:*" "@blocksuite/icons": "npm:2.1.36" - "@toeverything/components": "npm:^0.0.46" jotai: "npm:^2.5.1" react: "npm:18.2.0" react-dom: "npm:18.2.0" @@ -4142,7 +4137,7 @@ __metadata: languageName: node linkType: hard -"@blocksuite/icons@npm:2.1.36, @blocksuite/icons@npm:^2.1.33": +"@blocksuite/icons@npm:2.1.36": version: 2.1.36 resolution: "@blocksuite/icons@npm:2.1.36" peerDependencies: @@ -9836,7 +9831,7 @@ __metadata: languageName: node linkType: hard -"@radix-ui/react-dropdown-menu@npm:^2.0.5, @radix-ui/react-dropdown-menu@npm:^2.0.6": +"@radix-ui/react-dropdown-menu@npm:^2.0.6": version: 2.0.6 resolution: "@radix-ui/react-dropdown-menu@npm:2.0.6" dependencies: @@ -9974,7 +9969,7 @@ __metadata: languageName: node linkType: hard -"@radix-ui/react-popover@npm:^1.0.6, @radix-ui/react-popover@npm:^1.0.7": +"@radix-ui/react-popover@npm:^1.0.7": version: 1.0.7 resolution: "@radix-ui/react-popover@npm:1.0.7" dependencies: @@ -10513,7 +10508,7 @@ __metadata: languageName: node linkType: hard -"@radix-ui/react-tooltip@npm:^1.0.6, @radix-ui/react-tooltip@npm:^1.0.7": +"@radix-ui/react-tooltip@npm:^1.0.7": version: 1.0.7 resolution: "@radix-ui/react-tooltip@npm:1.0.7" dependencies: @@ -13118,24 +13113,6 @@ __metadata: languageName: node linkType: hard -"@toeverything/components@npm:^0.0.46": - version: 0.0.46 - resolution: "@toeverything/components@npm:0.0.46" - dependencies: - "@blocksuite/icons": "npm:^2.1.33" - "@radix-ui/react-dialog": "npm:^1.0.4" - "@radix-ui/react-dropdown-menu": "npm:^2.0.5" - "@radix-ui/react-popover": "npm:^1.0.6" - "@radix-ui/react-tooltip": "npm:^1.0.6" - peerDependencies: - "@radix-ui/react-avatar": ^1 - clsx: ^2 - react: ^18 - react-dom: ^18 - checksum: 1e74a620d82bc6f6c318ccac35a2f4f86d5e3b97761e798d0ad3f3b31a74f377e402338ad00a2af54c62dda7d88c231cc07b53f2aa9c9bff1de5088659e1c712 - languageName: node - linkType: hard - "@toeverything/hooks@workspace:*, @toeverything/hooks@workspace:packages/frontend/hooks": version: 0.0.0-use.local resolution: "@toeverything/hooks@workspace:packages/frontend/hooks" From d911d21d1c65bd75f40251e13128edd705f9193b Mon Sep 17 00:00:00 2001 From: Cats Juice Date: Mon, 4 Dec 2023 08:32:19 +0000 Subject: [PATCH 08/68] feat(component): add storybook (#5079) --- .../frontend/component/.storybook/main.ts | 54 ++ .../component/.storybook/preview.css.ts | 27 + .../component/.storybook/preview.html | 3 + .../frontend/component/.storybook/preview.tsx | 60 ++ packages/frontend/component/package.json | 16 + .../src/ui/avatar/avatar.stories.tsx | 52 ++ .../src/ui/button/button.stories.tsx | 46 ++ .../src/ui/button/icon-button.stories.tsx | 48 ++ .../src/ui/checkbox/checkbox.stories.tsx | 65 ++ .../src/ui/divider/divider.stories.tsx | 25 + .../component/src/ui/divider/divider.tsx | 23 +- .../component/src/ui/empty/empty.stories.tsx | 16 + .../component/src/ui/input/input.stories.tsx | 58 ++ .../component/src/ui/input/style.css.ts | 43 +- .../src/ui/loading/loading.stories.tsx | 13 + .../ui/lottie/collections-icon.stories.tsx | 18 + .../src/ui/lottie/delete-icon.stories.tsx | 15 + .../src/ui/menu/menu-trigger.stories.tsx | 17 + .../component/src/ui/menu/menu.stories.tsx | 203 ++++++ .../component/src/ui/modal/modal.stories.tsx | 69 ++ .../component/src/ui/popover/index.ts | 3 + .../src/ui/scrollbar/scrollbar.stories.tsx | 24 + .../src/ui/skeleton/skeleton.stories.tsx | 39 ++ .../component/src/ui/skeleton/types.ts | 12 +- .../src/ui/switch/switch.stories.tsx | 13 + .../component/src/ui/switch/switch.tsx | 2 +- .../component/src/ui/table/table.stories.tsx | 46 ++ .../component/src/ui/toast/toast.stories.tsx | 20 + .../src/ui/tooltip/tooltip.stories.tsx | 32 + yarn.lock | 628 +++++++++++++++++- 30 files changed, 1640 insertions(+), 50 deletions(-) create mode 100644 packages/frontend/component/.storybook/main.ts create mode 100644 packages/frontend/component/.storybook/preview.css.ts create mode 100644 packages/frontend/component/.storybook/preview.html create mode 100644 packages/frontend/component/.storybook/preview.tsx create mode 100644 packages/frontend/component/src/ui/avatar/avatar.stories.tsx create mode 100644 packages/frontend/component/src/ui/button/button.stories.tsx create mode 100644 packages/frontend/component/src/ui/button/icon-button.stories.tsx create mode 100644 packages/frontend/component/src/ui/checkbox/checkbox.stories.tsx create mode 100644 packages/frontend/component/src/ui/divider/divider.stories.tsx create mode 100644 packages/frontend/component/src/ui/empty/empty.stories.tsx create mode 100644 packages/frontend/component/src/ui/input/input.stories.tsx create mode 100644 packages/frontend/component/src/ui/loading/loading.stories.tsx create mode 100644 packages/frontend/component/src/ui/lottie/collections-icon.stories.tsx create mode 100644 packages/frontend/component/src/ui/lottie/delete-icon.stories.tsx create mode 100644 packages/frontend/component/src/ui/menu/menu-trigger.stories.tsx create mode 100644 packages/frontend/component/src/ui/menu/menu.stories.tsx create mode 100644 packages/frontend/component/src/ui/modal/modal.stories.tsx create mode 100644 packages/frontend/component/src/ui/scrollbar/scrollbar.stories.tsx create mode 100644 packages/frontend/component/src/ui/skeleton/skeleton.stories.tsx create mode 100644 packages/frontend/component/src/ui/switch/switch.stories.tsx create mode 100644 packages/frontend/component/src/ui/table/table.stories.tsx create mode 100644 packages/frontend/component/src/ui/toast/toast.stories.tsx create mode 100644 packages/frontend/component/src/ui/tooltip/tooltip.stories.tsx diff --git a/packages/frontend/component/.storybook/main.ts b/packages/frontend/component/.storybook/main.ts new file mode 100644 index 0000000000..2e6b6a0463 --- /dev/null +++ b/packages/frontend/component/.storybook/main.ts @@ -0,0 +1,54 @@ +import { StorybookConfig } from '@storybook/react-vite'; +import { vanillaExtractPlugin } from '@vanilla-extract/vite-plugin'; +import { fileURLToPath } from 'url'; +import { mergeConfig } from 'vite'; +import tsconfigPaths from 'vite-tsconfig-paths'; +import { getRuntimeConfig } from '../../core/.webpack/runtime-config'; + +export default { + stories: ['../src/ui/**/*.stories.@(js|jsx|ts|tsx|mdx)'], + addons: [ + '@storybook/addon-links', + '@storybook/addon-essentials', + '@storybook/addon-interactions', + '@storybook/addon-mdx-gfm', + 'storybook-dark-mode', + ], + framework: { + name: '@storybook/react-vite', + options: {}, + }, + features: { + storyStoreV7: true, + }, + docs: { + autodocs: true, + }, + async viteFinal(config, _options) { + return mergeConfig(config, { + plugins: [ + vanillaExtractPlugin(), + tsconfigPaths({ + root: fileURLToPath(new URL('../../../../', import.meta.url)), + ignoreConfigErrors: true, + }), + ], + define: { + 'process.on': '(() => void 0)', + 'process.env': {}, + 'process.env.COVERAGE': JSON.stringify(!!process.env.COVERAGE), + 'process.env.SHOULD_REPORT_TRACE': `${Boolean( + process.env.SHOULD_REPORT_TRACE === 'true' + )}`, + 'process.env.TRACE_REPORT_ENDPOINT': `"${process.env.TRACE_REPORT_ENDPOINT}"`, + 'process.env.CAPTCHA_SITE_KEY': `"${process.env.CAPTCHA_SITE_KEY}"`, + runtimeConfig: getRuntimeConfig({ + distribution: 'browser', + mode: 'development', + channel: 'canary', + coverage: false, + }), + }, + }); + }, +} satisfies StorybookConfig; diff --git a/packages/frontend/component/.storybook/preview.css.ts b/packages/frontend/component/.storybook/preview.css.ts new file mode 100644 index 0000000000..08ed839414 --- /dev/null +++ b/packages/frontend/component/.storybook/preview.css.ts @@ -0,0 +1,27 @@ +import { darkCssVariables, lightCssVariables } from '@toeverything/theme'; +import { globalStyle } from '@vanilla-extract/css'; + +globalStyle('*', { + margin: 0, + padding: 0, +}); + +globalStyle('body', { + color: 'var(--affine-text-primary-color)', + fontFamily: 'var(--affine-font-family)', + fontSize: 'var(--affine-font-base)', + lineHeight: 'var(--affine-font-height)', + backgroundColor: 'var(--affine-background-primary-color)', +}); + +globalStyle('html', { + vars: lightCssVariables, +}); + +globalStyle('html[data-theme="dark"]', { + vars: darkCssVariables, +}); + +globalStyle('.docs-story', { + backgroundColor: 'var(--affine-background-primary-color)', +}); diff --git a/packages/frontend/component/.storybook/preview.html b/packages/frontend/component/.storybook/preview.html new file mode 100644 index 0000000000..e551040105 --- /dev/null +++ b/packages/frontend/component/.storybook/preview.html @@ -0,0 +1,3 @@ + diff --git a/packages/frontend/component/.storybook/preview.tsx b/packages/frontend/component/.storybook/preview.tsx new file mode 100644 index 0000000000..942413a879 --- /dev/null +++ b/packages/frontend/component/.storybook/preview.tsx @@ -0,0 +1,60 @@ +import './preview.css'; +import { ThemeProvider, useTheme } from 'next-themes'; +import type { ComponentType } from 'react'; +import { useEffect } from 'react'; +import { useDarkMode } from 'storybook-dark-mode'; + +import type { Preview } from '@storybook/react'; +import React from 'react'; + +export const parameters: Preview = { + argTypes: { + param: { + table: { category: 'Group' }, + }, + }, + globalTypes: { + theme: { + description: 'Global theme for components', + defaultValue: 'light', + toolbar: { + title: 'Theme', + icon: 'circlehollow', + items: ['light', 'dark'], + dynamicTitle: true, + }, + }, + }, +}; + +const ThemeChange = () => { + const isDark = useDarkMode(); + const theme = useTheme(); + if (theme.resolvedTheme === 'dark' && !isDark) { + theme.setTheme('light'); + } else if (theme.resolvedTheme === 'light' && isDark) { + theme.setTheme('dark'); + } + return null; +}; + +const Component = () => { + const isDark = useDarkMode(); + const theme = useTheme(); + useEffect(() => { + theme.setTheme(isDark ? 'dark' : 'light'); + }, [isDark]); + return null; +}; + +export const decorators = [ + (Story: ComponentType, context) => { + return ( + + + + + + ); + }, +]; diff --git a/packages/frontend/component/package.json b/packages/frontend/component/package.json index 161fd3d706..0e6fee3b71 100644 --- a/packages/frontend/component/package.json +++ b/packages/frontend/component/package.json @@ -8,6 +8,9 @@ "./ui/*": "./src/ui/*/index.ts", "./*": "./src/components/*/index.tsx" }, + "scripts": { + "dev": "storybook dev -p 6006" + }, "peerDependencies": { "@blocksuite/blocks": "*", "@blocksuite/editor": "*", @@ -74,7 +77,18 @@ "@blocksuite/icons": "2.1.36", "@blocksuite/lit": "0.0.0-20231124123613-7c06e95d-nightly", "@blocksuite/store": "0.0.0-20231124123613-7c06e95d-nightly", + "@storybook/addon-actions": "^7.5.3", + "@storybook/addon-essentials": "^7.5.3", + "@storybook/addon-interactions": "^7.5.3", + "@storybook/addon-links": "^7.5.3", + "@storybook/addon-mdx-gfm": "^7.5.3", + "@storybook/addon-storysource": "^7.5.3", + "@storybook/blocks": "^7.5.3", + "@storybook/builder-vite": "^7.5.3", "@storybook/jest": "^0.2.3", + "@storybook/react": "^7.5.3", + "@storybook/react-vite": "^7.5.3", + "@storybook/test-runner": "^0.15.2", "@storybook/testing-library": "^0.2.2", "@testing-library/react": "^14.0.0", "@types/bytes": "^3.1.3", @@ -84,6 +98,8 @@ "@types/react-dom": "^18.2.13", "@vanilla-extract/css": "^1.13.0", "fake-indexeddb": "^5.0.0", + "storybook": "^7.5.3", + "storybook-dark-mode": "^3.0.1", "typescript": "^5.3.2", "vite": "^4.4.11", "vitest": "0.34.6", diff --git a/packages/frontend/component/src/ui/avatar/avatar.stories.tsx b/packages/frontend/component/src/ui/avatar/avatar.stories.tsx new file mode 100644 index 0000000000..f7e3447c5b --- /dev/null +++ b/packages/frontend/component/src/ui/avatar/avatar.stories.tsx @@ -0,0 +1,52 @@ +import { CameraIcon } from '@blocksuite/icons'; +import type { Meta, StoryFn } from '@storybook/react'; + +import { Avatar, type AvatarProps } from './avatar'; + +export default { + title: 'UI/Avatar', + component: Avatar, + argTypes: { + onClick: () => console.log('Click button'), + }, +} satisfies Meta; + +const Template: StoryFn = args => ; + +export const DefaultAvatar: StoryFn = Template.bind(undefined); +DefaultAvatar.args = { + name: 'AFFiNE', + url: 'https://affine.pro/favicon-96.png', + size: 50, +}; +export const Fallback: StoryFn = Template.bind(undefined); +Fallback.args = { + name: 'AFFiNE', + size: 50, +}; +export const ColorfulFallback: StoryFn = Template.bind(undefined); +ColorfulFallback.args = { + size: 50, + colorfulFallback: true, + name: 'blocksuite', +}; +export const WithHover: StoryFn = Template.bind(undefined); +WithHover.args = { + size: 50, + colorfulFallback: true, + name: 'With Hover', + hoverIcon: , +}; + +export const WithRemove: StoryFn = Template.bind(undefined); +WithRemove.args = { + size: 50, + colorfulFallback: true, + name: 'With Hover', + hoverIcon: , + removeTooltipOptions: { content: 'This is remove tooltip' }, + avatarTooltipOptions: { content: 'This is avatar tooltip' }, + onRemove: e => { + console.log('on remove', e); + }, +}; diff --git a/packages/frontend/component/src/ui/button/button.stories.tsx b/packages/frontend/component/src/ui/button/button.stories.tsx new file mode 100644 index 0000000000..93739ce78b --- /dev/null +++ b/packages/frontend/component/src/ui/button/button.stories.tsx @@ -0,0 +1,46 @@ +import { InformationIcon } from '@blocksuite/icons'; +import type { Meta, StoryFn } from '@storybook/react'; + +import { Button, type ButtonProps } from './button'; +export default { + title: 'UI/Button', + component: Button, + argTypes: { + onClick: () => console.log('Click button'), + }, +} satisfies Meta; + +const Template: StoryFn = args => + + ); +}; + +export const AsSelect: StoryFn = AsSelectTemplate.bind({}); diff --git a/packages/frontend/component/src/ui/modal/modal.stories.tsx b/packages/frontend/component/src/ui/modal/modal.stories.tsx new file mode 100644 index 0000000000..906ed94fb6 --- /dev/null +++ b/packages/frontend/component/src/ui/modal/modal.stories.tsx @@ -0,0 +1,69 @@ +import type { Meta, StoryFn } from '@storybook/react'; +import { useCallback, useState } from 'react'; + +import { Button } from '../button'; +import { Input, type InputProps } from '../input'; +import { ConfirmModal, type ConfirmModalProps } from './confirm-modal'; +import { Modal, type ModalProps } from './modal'; + +export default { + title: 'UI/Modal', + component: Modal, + argTypes: {}, +} satisfies Meta; + +const Template: StoryFn = args => { + const [open, setOpen] = useState(false); + + return ( + <> + + + + ); +}; + +export const Default: StoryFn = Template.bind(undefined); +Default.args = { + title: 'Modal Title', + description: + 'If the day is done, if birds sing no more, if the wind has flagged tired, then draw the veil of darkness thick upon me, even as thou hast wrapt the earth with the coverlet of sleep and tenderly closed the petals of the drooping lotus at dusk.', +}; + +const wait = () => new Promise(resolve => setTimeout(resolve, 1000)); +const ConfirmModalTemplate: StoryFn = () => { + const [open, setOpen] = useState(false); + const [loading, setLoading] = useState(false); + const [inputStatus, setInputStatus] = + useState('default'); + + const handleConfirm = useCallback(async () => { + setLoading(true); + await wait(); + setInputStatus(inputStatus !== 'error' ? 'error' : 'success'); + setLoading(false); + }, [inputStatus]); + + return ( + <> + + + + + + ); +}; + +export const Confirm: StoryFn = + ConfirmModalTemplate.bind(undefined); diff --git a/packages/frontend/component/src/ui/popover/index.ts b/packages/frontend/component/src/ui/popover/index.ts index 1f4904cff9..1b82f8c720 100644 --- a/packages/frontend/component/src/ui/popover/index.ts +++ b/packages/frontend/component/src/ui/popover/index.ts @@ -1 +1,4 @@ +/** + * @deprecated + */ export * from './popover'; diff --git a/packages/frontend/component/src/ui/scrollbar/scrollbar.stories.tsx b/packages/frontend/component/src/ui/scrollbar/scrollbar.stories.tsx new file mode 100644 index 0000000000..ff8bd3b3bc --- /dev/null +++ b/packages/frontend/component/src/ui/scrollbar/scrollbar.stories.tsx @@ -0,0 +1,24 @@ +import type { Meta, StoryFn } from '@storybook/react'; + +import { ScrollableContainer, type ScrollableContainerProps } from '.'; + +export default { + title: 'UI/Scrollbar', + component: ScrollableContainer, +} satisfies Meta; + +const Template: StoryFn = args => ( +
+ +
    + {Array.from({ length: 100 }).map((_, index) => ( +
  • item {index}
  • + ))} +
+
+
+); + +export const Default: StoryFn = + Template.bind(undefined); +Default.args = {}; diff --git a/packages/frontend/component/src/ui/skeleton/skeleton.stories.tsx b/packages/frontend/component/src/ui/skeleton/skeleton.stories.tsx new file mode 100644 index 0000000000..58b5b94b0f --- /dev/null +++ b/packages/frontend/component/src/ui/skeleton/skeleton.stories.tsx @@ -0,0 +1,39 @@ +import type { Meta, StoryFn } from '@storybook/react'; + +import { Skeleton, type SkeletonProps } from '.'; + +export default { + title: 'UI/Skeleton', + component: Skeleton, +} satisfies Meta; + +const Template: StoryFn = args => ( + <> + {Array.from({ length: 4 }).map(i => ( +
+ +
+ ))} + +); + +export const Default: StoryFn = Template.bind(undefined); +Default.args = {}; + +export const Circle: StoryFn = Template.bind(undefined); +Circle.args = { + variant: 'circular', +}; + +export const Rectangle: StoryFn = Template.bind(undefined); +Rectangle.args = { + variant: 'rectangular', +}; + +export const Text: StoryFn = Template.bind(undefined); +Text.args = { + variant: 'text', +}; diff --git a/packages/frontend/component/src/ui/skeleton/types.ts b/packages/frontend/component/src/ui/skeleton/types.ts index e0ad3eaae9..bda6b78418 100644 --- a/packages/frontend/component/src/ui/skeleton/types.ts +++ b/packages/frontend/component/src/ui/skeleton/types.ts @@ -1,5 +1,8 @@ import type { HTMLAttributes, PropsWithChildren } from 'react'; +/** + * @reference These props are migrated from [MUI Skeleton props](https://mui.com/material-ui/api/skeleton/#props) + */ export interface SkeletonProps extends PropsWithChildren, HTMLAttributes { @@ -12,22 +15,19 @@ export interface SkeletonProps * The type of content that will be rendered. * @default `'text'` */ - variant?: 'circular' | 'rectangular' | 'rounded' | 'text' | string; + variant?: 'circular' | 'rectangular' | 'rounded' | 'text'; /** * Width of the skeleton. Useful when the skeleton is inside an inline element with no width of its own. + * Number values are treated as pixels. */ width?: number | string; /** * Height of the skeleton. Useful when you don't want to adapt the skeleton to a text element but for instance a card. + * Number values are treated as pixels. */ height?: number | string; - - /** - * Wrapper component. If not provided, the default element is a div. - */ - wrapper?: string; } export type PickStringFromUnion = T extends string ? T : never; diff --git a/packages/frontend/component/src/ui/switch/switch.stories.tsx b/packages/frontend/component/src/ui/switch/switch.stories.tsx new file mode 100644 index 0000000000..f50875ac78 --- /dev/null +++ b/packages/frontend/component/src/ui/switch/switch.stories.tsx @@ -0,0 +1,13 @@ +import type { Meta, StoryFn } from '@storybook/react'; + +import { Switch, type SwitchProps } from '.'; + +export default { + title: 'UI/Switch', + component: Switch, +} satisfies Meta; + +const Template: StoryFn = args => ; + +export const Default: StoryFn = Template.bind(undefined); +Default.args = {}; diff --git a/packages/frontend/component/src/ui/switch/switch.tsx b/packages/frontend/component/src/ui/switch/switch.tsx index fb65a98869..b26c896396 100644 --- a/packages/frontend/component/src/ui/switch/switch.tsx +++ b/packages/frontend/component/src/ui/switch/switch.tsx @@ -9,7 +9,7 @@ import { import * as styles from './index.css'; -type SwitchProps = Omit, 'onChange'> & { +export type SwitchProps = Omit, 'onChange'> & { checked?: boolean; onChange?: (checked: boolean) => void; children?: ReactNode; diff --git a/packages/frontend/component/src/ui/table/table.stories.tsx b/packages/frontend/component/src/ui/table/table.stories.tsx new file mode 100644 index 0000000000..2d48a07b16 --- /dev/null +++ b/packages/frontend/component/src/ui/table/table.stories.tsx @@ -0,0 +1,46 @@ +import type { Meta, StoryFn } from '@storybook/react'; + +import { + Table, + TableBody, + TableBodyRow, + TableCell, + TableHead, + TableHeadRow, +} from '.'; + +export default { + title: 'UI/Table', + component: Table, +} satisfies Meta; + +const Template: StoryFn = args => ( + + + + Title 1 + Title 2 + Title 3 + Title 4 + + + + + {Array.from({ length: 10 }).map((_, rowNum) => { + return ( + + {Array.from({ length: 4 }).map((_, colNum) => { + return ( + + Cell {rowNum}-{colNum} + + ); + })} + + ); + })} + +
+); + +export const Default: StoryFn = Template.bind(undefined); diff --git a/packages/frontend/component/src/ui/toast/toast.stories.tsx b/packages/frontend/component/src/ui/toast/toast.stories.tsx new file mode 100644 index 0000000000..0a058f473c --- /dev/null +++ b/packages/frontend/component/src/ui/toast/toast.stories.tsx @@ -0,0 +1,20 @@ +import { useCallback, useState } from 'react'; + +import { Button } from '../button'; +import { toast } from '.'; + +export default { + title: 'UI/Toast', + component: () => null, +}; + +export const Default = () => { + const [count, setCount] = useState(1); + + const showToast = useCallback(() => { + toast(`Toast ${count}`); + setCount(count + 1); + }, [count]); + + return ; +}; diff --git a/packages/frontend/component/src/ui/tooltip/tooltip.stories.tsx b/packages/frontend/component/src/ui/tooltip/tooltip.stories.tsx new file mode 100644 index 0000000000..fcba72f979 --- /dev/null +++ b/packages/frontend/component/src/ui/tooltip/tooltip.stories.tsx @@ -0,0 +1,32 @@ +import type { Meta, StoryFn } from '@storybook/react'; + +import { Button } from '../button'; +import Tooltip, { type TooltipProps } from '.'; + +export default { + title: 'UI/Tooltip', + component: Tooltip, +} satisfies Meta; + +const Template: StoryFn = args => ( + + + +); + +export const Default: StoryFn = Template.bind(undefined); +Default.args = {}; + +export const WithCustomContent: StoryFn = args => ( + +
  • This is a tooltip
  • +
  • With custom content
  • + + } + {...args} + > + +
    +); diff --git a/yarn.lock b/yarn.lock index 8d7c72100d..5aaabdcb44 100644 --- a/yarn.lock +++ b/yarn.lock @@ -246,7 +246,18 @@ __metadata: "@radix-ui/react-toast": "npm:^1.1.5" "@radix-ui/react-toolbar": "npm:^1.0.4" "@radix-ui/react-tooltip": "npm:^1.0.7" + "@storybook/addon-actions": "npm:^7.5.3" + "@storybook/addon-essentials": "npm:^7.5.3" + "@storybook/addon-interactions": "npm:^7.5.3" + "@storybook/addon-links": "npm:^7.5.3" + "@storybook/addon-mdx-gfm": "npm:^7.5.3" + "@storybook/addon-storysource": "npm:^7.5.3" + "@storybook/blocks": "npm:^7.5.3" + "@storybook/builder-vite": "npm:^7.5.3" "@storybook/jest": "npm:^0.2.3" + "@storybook/react": "npm:^7.5.3" + "@storybook/react-vite": "npm:^7.5.3" + "@storybook/test-runner": "npm:^0.15.2" "@storybook/testing-library": "npm:^0.2.2" "@testing-library/react": "npm:^14.0.0" "@toeverything/hooks": "workspace:*" @@ -283,6 +294,8 @@ __metadata: react-router-dom: "npm:^6.16.0" react-virtuoso: "npm:^4.6.2" rxjs: "npm:^7.8.1" + storybook: "npm:^7.5.3" + storybook-dark-mode: "npm:^3.0.1" typescript: "npm:^5.3.2" uuid: "npm:^9.0.1" vite: "npm:^4.4.11" @@ -11898,6 +11911,17 @@ __metadata: languageName: node linkType: hard +"@storybook/addon-mdx-gfm@npm:^7.5.3": + version: 7.5.3 + resolution: "@storybook/addon-mdx-gfm@npm:7.5.3" + dependencies: + "@storybook/node-logger": "npm:7.5.3" + remark-gfm: "npm:^3.0.1" + ts-dedent: "npm:^2.0.0" + checksum: 6814b9c042047e441353a0f7b35138bc83de8e8be0cbc78740ff926ae1128c546b5143c39b11872fbe7e018dd3dfd838bfa198f32f63e22d72655a7b1e3091fa + languageName: node + linkType: hard + "@storybook/addon-measure@npm:7.5.3": version: 7.5.3 resolution: "@storybook/addon-measure@npm:7.5.3" @@ -13939,6 +13963,15 @@ __metadata: languageName: node linkType: hard +"@types/mdast@npm:^3.0.0": + version: 3.0.15 + resolution: "@types/mdast@npm:3.0.15" + dependencies: + "@types/unist": "npm:^2" + checksum: 050a5c1383928b2688dd145382a22535e2af87dc3fd592c843abb7851bcc99893a1ee0f63be19fc4e89779387ec26a57486cfb425b016c0b2a98a17fc4a1e8b3 + languageName: node + linkType: hard + "@types/mdast@npm:^4.0.0, @types/mdast@npm:^4.0.2": version: 4.0.3 resolution: "@types/mdast@npm:4.0.3" @@ -18972,7 +19005,7 @@ __metadata: languageName: node linkType: hard -"diff@npm:^5.1.0": +"diff@npm:^5.0.0, diff@npm:^5.1.0": version: 5.1.0 resolution: "diff@npm:5.1.0" checksum: f4557032a98b2967fe27b1a91dfcf8ebb6b9a24b1afe616b5c2312465100b861e9b8d4da374be535f2d6b967ce2f53826d7f6edc2a0d32b2ab55abc96acc2f9d @@ -23209,6 +23242,13 @@ __metadata: languageName: node linkType: hard +"is-buffer@npm:^2.0.0": + version: 2.0.5 + resolution: "is-buffer@npm:2.0.5" + checksum: 3261a8b858edcc6c9566ba1694bf829e126faa88911d1c0a747ea658c5d81b14b6955e3a702d59dabadd58fdd440c01f321aa71d6547105fd21d03f94d0597e7 + languageName: node + linkType: hard + "is-buffer@npm:~1.1.6": version: 1.1.6 resolution: "is-buffer@npm:1.1.6" @@ -24831,6 +24871,13 @@ __metadata: languageName: node linkType: hard +"kleur@npm:^4.0.3": + version: 4.1.5 + resolution: "kleur@npm:4.1.5" + checksum: 44d84cc4eedd4311099402ef6d4acd9b2d16e08e499d6ef3bb92389bd4692d7ef09e35248c26e27f98acac532122acb12a1bfee645994ae3af4f0a37996da7df + languageName: node + linkType: hard + "kolorist@npm:^1.8.0": version: 1.8.0 resolution: "kolorist@npm:1.8.0" @@ -26149,6 +26196,18 @@ __metadata: languageName: node linkType: hard +"mdast-util-find-and-replace@npm:^2.0.0": + version: 2.2.2 + resolution: "mdast-util-find-and-replace@npm:2.2.2" + dependencies: + "@types/mdast": "npm:^3.0.0" + escape-string-regexp: "npm:^5.0.0" + unist-util-is: "npm:^5.0.0" + unist-util-visit-parents: "npm:^5.0.0" + checksum: 59e11e853b74d8f6083950327df39e27287b383930ff836298a5100aeda5568282bb45046c27886d2156ea101580bb0689b890c29623cefa5adc74e95d9ca9ff + languageName: node + linkType: hard + "mdast-util-find-and-replace@npm:^3.0.0": version: 3.0.1 resolution: "mdast-util-find-and-replace@npm:3.0.1" @@ -26161,6 +26220,26 @@ __metadata: languageName: node linkType: hard +"mdast-util-from-markdown@npm:^1.0.0": + version: 1.3.1 + resolution: "mdast-util-from-markdown@npm:1.3.1" + dependencies: + "@types/mdast": "npm:^3.0.0" + "@types/unist": "npm:^2.0.0" + decode-named-character-reference: "npm:^1.0.0" + mdast-util-to-string: "npm:^3.1.0" + micromark: "npm:^3.0.0" + micromark-util-decode-numeric-character-reference: "npm:^1.0.0" + micromark-util-decode-string: "npm:^1.0.0" + micromark-util-normalize-identifier: "npm:^1.0.0" + micromark-util-symbol: "npm:^1.0.0" + micromark-util-types: "npm:^1.0.0" + unist-util-stringify-position: "npm:^3.0.0" + uvu: "npm:^0.5.0" + checksum: 1d334a54ddd6481ec4acf64c2c537b6463bc5113ba5a408f65c228dcc302d46837352814f11307af0f8b51dd7e4a0b887ce692e4d30ff31ff9d578b8ca82810b + languageName: node + linkType: hard + "mdast-util-from-markdown@npm:^2.0.0": version: 2.0.0 resolution: "mdast-util-from-markdown@npm:2.0.0" @@ -26181,6 +26260,18 @@ __metadata: languageName: node linkType: hard +"mdast-util-gfm-autolink-literal@npm:^1.0.0": + version: 1.0.3 + resolution: "mdast-util-gfm-autolink-literal@npm:1.0.3" + dependencies: + "@types/mdast": "npm:^3.0.0" + ccount: "npm:^2.0.0" + mdast-util-find-and-replace: "npm:^2.0.0" + micromark-util-character: "npm:^1.0.0" + checksum: 272d075cdc7937bec0179af4052bd9032a6fbb05608b387b1b075b0491c73ce012f3ff1c718cdb5fb0ed1032c1fa7570d955b59c0ab3c3c72609928754774529 + languageName: node + linkType: hard + "mdast-util-gfm-autolink-literal@npm:^2.0.0": version: 2.0.0 resolution: "mdast-util-gfm-autolink-literal@npm:2.0.0" @@ -26194,6 +26285,17 @@ __metadata: languageName: node linkType: hard +"mdast-util-gfm-footnote@npm:^1.0.0": + version: 1.0.2 + resolution: "mdast-util-gfm-footnote@npm:1.0.2" + dependencies: + "@types/mdast": "npm:^3.0.0" + mdast-util-to-markdown: "npm:^1.3.0" + micromark-util-normalize-identifier: "npm:^1.0.0" + checksum: 825f207afc98fd1daa0acc8adcb5754d1f0d577ccb1749245289bee7c892557668d8ee3a5ab618f42e710646cf018dcda84f3c0c608ae11718e9014e5bf4f9dc + languageName: node + linkType: hard + "mdast-util-gfm-footnote@npm:^2.0.0": version: 2.0.0 resolution: "mdast-util-gfm-footnote@npm:2.0.0" @@ -26207,6 +26309,16 @@ __metadata: languageName: node linkType: hard +"mdast-util-gfm-strikethrough@npm:^1.0.0": + version: 1.0.3 + resolution: "mdast-util-gfm-strikethrough@npm:1.0.3" + dependencies: + "@types/mdast": "npm:^3.0.0" + mdast-util-to-markdown: "npm:^1.3.0" + checksum: a9c2dc3ef46be7952d13b7063a16171bba8aa266bffe6b1e7267df02a60b4fa3734115cca311e9127db8cfcbbcd68fdd92aa26152bcd0c14372c79b254e4df2f + languageName: node + linkType: hard + "mdast-util-gfm-strikethrough@npm:^2.0.0": version: 2.0.0 resolution: "mdast-util-gfm-strikethrough@npm:2.0.0" @@ -26218,6 +26330,18 @@ __metadata: languageName: node linkType: hard +"mdast-util-gfm-table@npm:^1.0.0": + version: 1.0.7 + resolution: "mdast-util-gfm-table@npm:1.0.7" + dependencies: + "@types/mdast": "npm:^3.0.0" + markdown-table: "npm:^3.0.0" + mdast-util-from-markdown: "npm:^1.0.0" + mdast-util-to-markdown: "npm:^1.3.0" + checksum: 167f7f7a9dc17ce852f4f9bd155d7be179588e2ccf4ce3c4f23b12c1c9db5de904cdacc6f41b2d635cb84eb09a7ff5a33497585f2664a7f1e6bd6f7ab7e1197a + languageName: node + linkType: hard + "mdast-util-gfm-table@npm:^2.0.0": version: 2.0.0 resolution: "mdast-util-gfm-table@npm:2.0.0" @@ -26231,6 +26355,16 @@ __metadata: languageName: node linkType: hard +"mdast-util-gfm-task-list-item@npm:^1.0.0": + version: 1.0.2 + resolution: "mdast-util-gfm-task-list-item@npm:1.0.2" + dependencies: + "@types/mdast": "npm:^3.0.0" + mdast-util-to-markdown: "npm:^1.3.0" + checksum: 958417a7d7690728b44d65127ab9189c7feaa17aea924dd56a888c781ab3abaa4eb0c209f05c4dbf203da3d0c4df8fdace4c9471b644268bfc7fc792a018a171 + languageName: node + linkType: hard + "mdast-util-gfm-task-list-item@npm:^2.0.0": version: 2.0.0 resolution: "mdast-util-gfm-task-list-item@npm:2.0.0" @@ -26243,6 +26377,21 @@ __metadata: languageName: node linkType: hard +"mdast-util-gfm@npm:^2.0.0": + version: 2.0.2 + resolution: "mdast-util-gfm@npm:2.0.2" + dependencies: + mdast-util-from-markdown: "npm:^1.0.0" + mdast-util-gfm-autolink-literal: "npm:^1.0.0" + mdast-util-gfm-footnote: "npm:^1.0.0" + mdast-util-gfm-strikethrough: "npm:^1.0.0" + mdast-util-gfm-table: "npm:^1.0.0" + mdast-util-gfm-task-list-item: "npm:^1.0.0" + mdast-util-to-markdown: "npm:^1.0.0" + checksum: 70e6cd32af94181d409f171f984f83fc18b3efe316844c62f31816f5c1612a92517b8ed766340f23e0a6d6cb0f27a8b07d288bab6619cbdbb0c5341006bcdc4d + languageName: node + linkType: hard + "mdast-util-gfm@npm:^3.0.0": version: 3.0.0 resolution: "mdast-util-gfm@npm:3.0.0" @@ -26258,6 +26407,16 @@ __metadata: languageName: node linkType: hard +"mdast-util-phrasing@npm:^3.0.0": + version: 3.0.1 + resolution: "mdast-util-phrasing@npm:3.0.1" + dependencies: + "@types/mdast": "npm:^3.0.0" + unist-util-is: "npm:^5.0.0" + checksum: c5b616d9b1eb76a6b351d195d94318494722525a12a89d9c8a3b091af7db3dd1fc55d294f9d29266d8159a8267b0df4a7a133bda8a3909d5331c383e1e1ff328 + languageName: node + linkType: hard + "mdast-util-phrasing@npm:^4.0.0": version: 4.0.0 resolution: "mdast-util-phrasing@npm:4.0.0" @@ -26268,6 +26427,22 @@ __metadata: languageName: node linkType: hard +"mdast-util-to-markdown@npm:^1.0.0, mdast-util-to-markdown@npm:^1.3.0": + version: 1.5.0 + resolution: "mdast-util-to-markdown@npm:1.5.0" + dependencies: + "@types/mdast": "npm:^3.0.0" + "@types/unist": "npm:^2.0.0" + longest-streak: "npm:^3.0.0" + mdast-util-phrasing: "npm:^3.0.0" + mdast-util-to-string: "npm:^3.0.0" + micromark-util-decode-string: "npm:^1.0.0" + unist-util-visit: "npm:^4.0.0" + zwitch: "npm:^2.0.0" + checksum: 713f674588a01969a2ce524a69985bd57e507377eea2c4ba69800fb305414468b30144ae9b837fbdde8c609877673140e4f56f6cabe9e0e2bc1487291e3c5144 + languageName: node + linkType: hard + "mdast-util-to-markdown@npm:^2.0.0": version: 2.1.0 resolution: "mdast-util-to-markdown@npm:2.1.0" @@ -26291,6 +26466,15 @@ __metadata: languageName: node linkType: hard +"mdast-util-to-string@npm:^3.0.0, mdast-util-to-string@npm:^3.1.0": + version: 3.2.0 + resolution: "mdast-util-to-string@npm:3.2.0" + dependencies: + "@types/mdast": "npm:^3.0.0" + checksum: fafe201c12a0d412a875fe8540bf70b4360f3775fb7f0d19403ba7b59e50f74f730e3b405c72ad940bc8a3ec1ba311f76dfca61c4ce585dce1ccda2168ec244f + languageName: node + linkType: hard + "mdast-util-to-string@npm:^4.0.0": version: 4.0.0 resolution: "mdast-util-to-string@npm:4.0.0" @@ -26449,6 +26633,30 @@ __metadata: languageName: node linkType: hard +"micromark-core-commonmark@npm:^1.0.0, micromark-core-commonmark@npm:^1.0.1": + version: 1.1.0 + resolution: "micromark-core-commonmark@npm:1.1.0" + dependencies: + decode-named-character-reference: "npm:^1.0.0" + micromark-factory-destination: "npm:^1.0.0" + micromark-factory-label: "npm:^1.0.0" + micromark-factory-space: "npm:^1.0.0" + micromark-factory-title: "npm:^1.0.0" + micromark-factory-whitespace: "npm:^1.0.0" + micromark-util-character: "npm:^1.0.0" + micromark-util-chunked: "npm:^1.0.0" + micromark-util-classify-character: "npm:^1.0.0" + micromark-util-html-tag-name: "npm:^1.0.0" + micromark-util-normalize-identifier: "npm:^1.0.0" + micromark-util-resolve-all: "npm:^1.0.0" + micromark-util-subtokenize: "npm:^1.0.0" + micromark-util-symbol: "npm:^1.0.0" + micromark-util-types: "npm:^1.0.1" + uvu: "npm:^0.5.0" + checksum: a73694d223ac8baad8ff00597a3c39d61f5b32bfd56fe4bcf295d75b2a4e8e67fb2edbfc7cc287b362b9d7f6d24fce08b6a7e8b5b155d79bcc1e4d9b2756ffb2 + languageName: node + linkType: hard + "micromark-core-commonmark@npm:^2.0.0": version: 2.0.0 resolution: "micromark-core-commonmark@npm:2.0.0" @@ -26473,6 +26681,18 @@ __metadata: languageName: node linkType: hard +"micromark-extension-gfm-autolink-literal@npm:^1.0.0": + version: 1.0.5 + resolution: "micromark-extension-gfm-autolink-literal@npm:1.0.5" + dependencies: + micromark-util-character: "npm:^1.0.0" + micromark-util-sanitize-uri: "npm:^1.0.0" + micromark-util-symbol: "npm:^1.0.0" + micromark-util-types: "npm:^1.0.0" + checksum: 1e0ccc758baef3cd0478ba84ff86fa1ec2b389042421c7cade9485b775456c1a9c3bd797393002b2c6f6abd9bdf829cb114874557bbcb8e43d16d06a464811c0 + languageName: node + linkType: hard + "micromark-extension-gfm-autolink-literal@npm:^2.0.0": version: 2.0.0 resolution: "micromark-extension-gfm-autolink-literal@npm:2.0.0" @@ -26485,6 +26705,22 @@ __metadata: languageName: node linkType: hard +"micromark-extension-gfm-footnote@npm:^1.0.0": + version: 1.1.2 + resolution: "micromark-extension-gfm-footnote@npm:1.1.2" + dependencies: + micromark-core-commonmark: "npm:^1.0.0" + micromark-factory-space: "npm:^1.0.0" + micromark-util-character: "npm:^1.0.0" + micromark-util-normalize-identifier: "npm:^1.0.0" + micromark-util-sanitize-uri: "npm:^1.0.0" + micromark-util-symbol: "npm:^1.0.0" + micromark-util-types: "npm:^1.0.0" + uvu: "npm:^0.5.0" + checksum: 8777073fb76d2fd01f6b2405106af6c349c1e25660c4d37cadcc61c187d71c8444870f73cefaaa67f12884d5e45c78ee3c5583561a0b330bd91c6d997113584a + languageName: node + linkType: hard + "micromark-extension-gfm-footnote@npm:^2.0.0": version: 2.0.0 resolution: "micromark-extension-gfm-footnote@npm:2.0.0" @@ -26501,6 +26737,20 @@ __metadata: languageName: node linkType: hard +"micromark-extension-gfm-strikethrough@npm:^1.0.0": + version: 1.0.7 + resolution: "micromark-extension-gfm-strikethrough@npm:1.0.7" + dependencies: + micromark-util-chunked: "npm:^1.0.0" + micromark-util-classify-character: "npm:^1.0.0" + micromark-util-resolve-all: "npm:^1.0.0" + micromark-util-symbol: "npm:^1.0.0" + micromark-util-types: "npm:^1.0.0" + uvu: "npm:^0.5.0" + checksum: 8411ef1aa5dc83f662e8b45b085f70ddff29deb3c4259269e8a1ff656397abb755d8ea841a14be23e8585a31d3c0a5de1bd2c05f3453b66670e499d4a0004f5e + languageName: node + linkType: hard + "micromark-extension-gfm-strikethrough@npm:^2.0.0": version: 2.0.0 resolution: "micromark-extension-gfm-strikethrough@npm:2.0.0" @@ -26515,6 +26765,19 @@ __metadata: languageName: node linkType: hard +"micromark-extension-gfm-table@npm:^1.0.0": + version: 1.0.7 + resolution: "micromark-extension-gfm-table@npm:1.0.7" + dependencies: + micromark-factory-space: "npm:^1.0.0" + micromark-util-character: "npm:^1.0.0" + micromark-util-symbol: "npm:^1.0.0" + micromark-util-types: "npm:^1.0.0" + uvu: "npm:^0.5.0" + checksum: f05d86a099c941a2a309d60bf4839d16a00a93cb880cda4ab8faeb831647763fff6e03197ec15b80e1f195002afcca6afe2b95c3622b049b82d7ff8ef1c1c776 + languageName: node + linkType: hard + "micromark-extension-gfm-table@npm:^2.0.0": version: 2.0.0 resolution: "micromark-extension-gfm-table@npm:2.0.0" @@ -26528,6 +26791,15 @@ __metadata: languageName: node linkType: hard +"micromark-extension-gfm-tagfilter@npm:^1.0.0": + version: 1.0.2 + resolution: "micromark-extension-gfm-tagfilter@npm:1.0.2" + dependencies: + micromark-util-types: "npm:^1.0.0" + checksum: 55c7d9019d6a39efaaed2c2e40b0aaa137d2c4f9c94cac82e93f509a806c3a775e4c815b5d8e986617450b68861a19776e4b886307e83db452b393f15a837b39 + languageName: node + linkType: hard + "micromark-extension-gfm-tagfilter@npm:^2.0.0": version: 2.0.0 resolution: "micromark-extension-gfm-tagfilter@npm:2.0.0" @@ -26537,6 +26809,19 @@ __metadata: languageName: node linkType: hard +"micromark-extension-gfm-task-list-item@npm:^1.0.0": + version: 1.0.5 + resolution: "micromark-extension-gfm-task-list-item@npm:1.0.5" + dependencies: + micromark-factory-space: "npm:^1.0.0" + micromark-util-character: "npm:^1.0.0" + micromark-util-symbol: "npm:^1.0.0" + micromark-util-types: "npm:^1.0.0" + uvu: "npm:^0.5.0" + checksum: 46bb1baa10bfb785a2e3e2f975e5509260b9995d5c3aeddf77051957d218ce1af4ea737bcb6a56a930e62d42b05307b20632a400eff25cdb290789ff3170cad5 + languageName: node + linkType: hard + "micromark-extension-gfm-task-list-item@npm:^2.0.0": version: 2.0.1 resolution: "micromark-extension-gfm-task-list-item@npm:2.0.1" @@ -26550,6 +26835,22 @@ __metadata: languageName: node linkType: hard +"micromark-extension-gfm@npm:^2.0.0": + version: 2.0.3 + resolution: "micromark-extension-gfm@npm:2.0.3" + dependencies: + micromark-extension-gfm-autolink-literal: "npm:^1.0.0" + micromark-extension-gfm-footnote: "npm:^1.0.0" + micromark-extension-gfm-strikethrough: "npm:^1.0.0" + micromark-extension-gfm-table: "npm:^1.0.0" + micromark-extension-gfm-tagfilter: "npm:^1.0.0" + micromark-extension-gfm-task-list-item: "npm:^1.0.0" + micromark-util-combine-extensions: "npm:^1.0.0" + micromark-util-types: "npm:^1.0.0" + checksum: 3ffd06ced4314abd0f0c72ec227f034f38dd47facbb62439ef3216d42f32433f3901d14675cf806e8d73689802a11849958b330bb5b55dd4fd5cdc64ebaf345c + languageName: node + linkType: hard + "micromark-extension-gfm@npm:^3.0.0": version: 3.0.0 resolution: "micromark-extension-gfm@npm:3.0.0" @@ -26566,6 +26867,17 @@ __metadata: languageName: node linkType: hard +"micromark-factory-destination@npm:^1.0.0": + version: 1.1.0 + resolution: "micromark-factory-destination@npm:1.1.0" + dependencies: + micromark-util-character: "npm:^1.0.0" + micromark-util-symbol: "npm:^1.0.0" + micromark-util-types: "npm:^1.0.0" + checksum: 9e2b5fb5fedbf622b687e20d51eb3d56ae90c0e7ecc19b37bd5285ec392c1e56f6e21aa7cfcb3c01eda88df88fe528f3acb91a5f57d7f4cba310bc3cd7f824fa + languageName: node + linkType: hard + "micromark-factory-destination@npm:^2.0.0": version: 2.0.0 resolution: "micromark-factory-destination@npm:2.0.0" @@ -26577,6 +26889,18 @@ __metadata: languageName: node linkType: hard +"micromark-factory-label@npm:^1.0.0": + version: 1.1.0 + resolution: "micromark-factory-label@npm:1.1.0" + dependencies: + micromark-util-character: "npm:^1.0.0" + micromark-util-symbol: "npm:^1.0.0" + micromark-util-types: "npm:^1.0.0" + uvu: "npm:^0.5.0" + checksum: fcda48f1287d9b148c562c627418a2ab759cdeae9c8e017910a0cba94bb759a96611e1fc6df33182e97d28fbf191475237298983bb89ef07d5b02464b1ad28d5 + languageName: node + linkType: hard + "micromark-factory-label@npm:^2.0.0": version: 2.0.0 resolution: "micromark-factory-label@npm:2.0.0" @@ -26589,6 +26913,16 @@ __metadata: languageName: node linkType: hard +"micromark-factory-space@npm:^1.0.0": + version: 1.1.0 + resolution: "micromark-factory-space@npm:1.1.0" + dependencies: + micromark-util-character: "npm:^1.0.0" + micromark-util-types: "npm:^1.0.0" + checksum: b58435076b998a7e244259a4694eb83c78915581206b6e7fc07b34c6abd36a1726ade63df8972fbf6c8fa38eecb9074f4e17be8d53f942e3b3d23d1a0ecaa941 + languageName: node + linkType: hard + "micromark-factory-space@npm:^2.0.0": version: 2.0.0 resolution: "micromark-factory-space@npm:2.0.0" @@ -26599,6 +26933,18 @@ __metadata: languageName: node linkType: hard +"micromark-factory-title@npm:^1.0.0": + version: 1.1.0 + resolution: "micromark-factory-title@npm:1.1.0" + dependencies: + micromark-factory-space: "npm:^1.0.0" + micromark-util-character: "npm:^1.0.0" + micromark-util-symbol: "npm:^1.0.0" + micromark-util-types: "npm:^1.0.0" + checksum: 4432d3dbc828c81f483c5901b0c6591a85d65a9e33f7d96ba7c3ae821617a0b3237ff5faf53a9152d00aaf9afb3a9f185b205590f40ed754f1d9232e0e9157b1 + languageName: node + linkType: hard + "micromark-factory-title@npm:^2.0.0": version: 2.0.0 resolution: "micromark-factory-title@npm:2.0.0" @@ -26611,6 +26957,18 @@ __metadata: languageName: node linkType: hard +"micromark-factory-whitespace@npm:^1.0.0": + version: 1.1.0 + resolution: "micromark-factory-whitespace@npm:1.1.0" + dependencies: + micromark-factory-space: "npm:^1.0.0" + micromark-util-character: "npm:^1.0.0" + micromark-util-symbol: "npm:^1.0.0" + micromark-util-types: "npm:^1.0.0" + checksum: ef0fa682c7d593d85a514ee329809dee27d10bc2a2b65217d8ef81173e33b8e83c549049764b1ad851adfe0a204dec5450d9d20a4ca8598f6c94533a73f73fcd + languageName: node + linkType: hard + "micromark-factory-whitespace@npm:^2.0.0": version: 2.0.0 resolution: "micromark-factory-whitespace@npm:2.0.0" @@ -26623,6 +26981,16 @@ __metadata: languageName: node linkType: hard +"micromark-util-character@npm:^1.0.0": + version: 1.2.0 + resolution: "micromark-util-character@npm:1.2.0" + dependencies: + micromark-util-symbol: "npm:^1.0.0" + micromark-util-types: "npm:^1.0.0" + checksum: 88cf80f9b4c95266f24814ef587fb4180454668dcc3be4ac829e1227188cf349c8981bfca29e3eab1682f324c2c47544c0b0b799a26fbf9df5f156c6a84c970c + languageName: node + linkType: hard + "micromark-util-character@npm:^2.0.0": version: 2.0.1 resolution: "micromark-util-character@npm:2.0.1" @@ -26633,6 +27001,15 @@ __metadata: languageName: node linkType: hard +"micromark-util-chunked@npm:^1.0.0": + version: 1.1.0 + resolution: "micromark-util-chunked@npm:1.1.0" + dependencies: + micromark-util-symbol: "npm:^1.0.0" + checksum: c435bde9110cb595e3c61b7f54c2dc28ee03e6a57fa0fc1e67e498ad8bac61ee5a7457a2b6a73022ddc585676ede4b912d28dcf57eb3bd6951e54015e14dc20b + languageName: node + linkType: hard + "micromark-util-chunked@npm:^2.0.0": version: 2.0.0 resolution: "micromark-util-chunked@npm:2.0.0" @@ -26642,6 +27019,17 @@ __metadata: languageName: node linkType: hard +"micromark-util-classify-character@npm:^1.0.0": + version: 1.1.0 + resolution: "micromark-util-classify-character@npm:1.1.0" + dependencies: + micromark-util-character: "npm:^1.0.0" + micromark-util-symbol: "npm:^1.0.0" + micromark-util-types: "npm:^1.0.0" + checksum: 8499cb0bb1f7fb946f5896285fcca65cd742f66cd3e79ba7744792bd413ec46834f932a286de650349914d02e822946df3b55d03e6a8e1d245d1ddbd5102e5b0 + languageName: node + linkType: hard + "micromark-util-classify-character@npm:^2.0.0": version: 2.0.0 resolution: "micromark-util-classify-character@npm:2.0.0" @@ -26653,6 +27041,16 @@ __metadata: languageName: node linkType: hard +"micromark-util-combine-extensions@npm:^1.0.0": + version: 1.1.0 + resolution: "micromark-util-combine-extensions@npm:1.1.0" + dependencies: + micromark-util-chunked: "npm:^1.0.0" + micromark-util-types: "npm:^1.0.0" + checksum: ee78464f5d4b61ccb437850cd2d7da4d690b260bca4ca7a79c4bb70291b84f83988159e373b167181b6716cb197e309bc6e6c96a68cc3ba9d50c13652774aba9 + languageName: node + linkType: hard + "micromark-util-combine-extensions@npm:^2.0.0": version: 2.0.0 resolution: "micromark-util-combine-extensions@npm:2.0.0" @@ -26663,6 +27061,15 @@ __metadata: languageName: node linkType: hard +"micromark-util-decode-numeric-character-reference@npm:^1.0.0": + version: 1.1.0 + resolution: "micromark-util-decode-numeric-character-reference@npm:1.1.0" + dependencies: + micromark-util-symbol: "npm:^1.0.0" + checksum: 4733fe75146e37611243f055fc6847137b66f0cde74d080e33bd26d0408c1d6f44cabc984063eee5968b133cb46855e729d555b9ff8d744652262b7b51feec73 + languageName: node + linkType: hard + "micromark-util-decode-numeric-character-reference@npm:^2.0.0": version: 2.0.1 resolution: "micromark-util-decode-numeric-character-reference@npm:2.0.1" @@ -26672,6 +27079,18 @@ __metadata: languageName: node linkType: hard +"micromark-util-decode-string@npm:^1.0.0": + version: 1.1.0 + resolution: "micromark-util-decode-string@npm:1.1.0" + dependencies: + decode-named-character-reference: "npm:^1.0.0" + micromark-util-character: "npm:^1.0.0" + micromark-util-decode-numeric-character-reference: "npm:^1.0.0" + micromark-util-symbol: "npm:^1.0.0" + checksum: f1625155db452f15aa472918499689ba086b9c49d1322a08b22bfbcabe918c61b230a3002c8bc3ea9b1f52ca7a9bb1c3dd43ccb548c7f5f8b16c24a1ae77a813 + languageName: node + linkType: hard + "micromark-util-decode-string@npm:^2.0.0": version: 2.0.0 resolution: "micromark-util-decode-string@npm:2.0.0" @@ -26684,6 +27103,13 @@ __metadata: languageName: node linkType: hard +"micromark-util-encode@npm:^1.0.0": + version: 1.1.0 + resolution: "micromark-util-encode@npm:1.1.0" + checksum: 4ef29d02b12336918cea6782fa87c8c578c67463925221d4e42183a706bde07f4b8b5f9a5e1c7ce8c73bb5a98b261acd3238fecd152e6dd1cdfa2d1ae11b60a0 + languageName: node + linkType: hard + "micromark-util-encode@npm:^2.0.0": version: 2.0.0 resolution: "micromark-util-encode@npm:2.0.0" @@ -26691,6 +27117,13 @@ __metadata: languageName: node linkType: hard +"micromark-util-html-tag-name@npm:^1.0.0": + version: 1.2.0 + resolution: "micromark-util-html-tag-name@npm:1.2.0" + checksum: ccf0fa99b5c58676dc5192c74665a3bfd1b536fafaf94723bd7f31f96979d589992df6fcf2862eba290ef18e6a8efb30ec8e1e910d9f3fc74f208871e9f84750 + languageName: node + linkType: hard + "micromark-util-html-tag-name@npm:^2.0.0": version: 2.0.0 resolution: "micromark-util-html-tag-name@npm:2.0.0" @@ -26698,6 +27131,15 @@ __metadata: languageName: node linkType: hard +"micromark-util-normalize-identifier@npm:^1.0.0": + version: 1.1.0 + resolution: "micromark-util-normalize-identifier@npm:1.1.0" + dependencies: + micromark-util-symbol: "npm:^1.0.0" + checksum: 8655bea41ffa4333e03fc22462cb42d631bbef9c3c07b625fd852b7eb442a110f9d2e5902a42e65188d85498279569502bf92f3434a1180fc06f7c37edfbaee2 + languageName: node + linkType: hard + "micromark-util-normalize-identifier@npm:^2.0.0": version: 2.0.0 resolution: "micromark-util-normalize-identifier@npm:2.0.0" @@ -26707,6 +27149,15 @@ __metadata: languageName: node linkType: hard +"micromark-util-resolve-all@npm:^1.0.0": + version: 1.1.0 + resolution: "micromark-util-resolve-all@npm:1.1.0" + dependencies: + micromark-util-types: "npm:^1.0.0" + checksum: 1ce6c0237cd3ca061e76fae6602cf95014e764a91be1b9f10d36cb0f21ca88f9a07de8d49ab8101efd0b140a4fbfda6a1efb72027ab3f4d5b54c9543271dc52c + languageName: node + linkType: hard + "micromark-util-resolve-all@npm:^2.0.0": version: 2.0.0 resolution: "micromark-util-resolve-all@npm:2.0.0" @@ -26716,6 +27167,17 @@ __metadata: languageName: node linkType: hard +"micromark-util-sanitize-uri@npm:^1.0.0": + version: 1.2.0 + resolution: "micromark-util-sanitize-uri@npm:1.2.0" + dependencies: + micromark-util-character: "npm:^1.0.0" + micromark-util-encode: "npm:^1.0.0" + micromark-util-symbol: "npm:^1.0.0" + checksum: 0d024100d95ffb88bf75f3360e305b545c1eb745430959b8633f7aa93f37ec401fc7094c90c97298409a9e30d94d53b895bae224e1bb966bea114976cfa0fd48 + languageName: node + linkType: hard + "micromark-util-sanitize-uri@npm:^2.0.0": version: 2.0.0 resolution: "micromark-util-sanitize-uri@npm:2.0.0" @@ -26727,6 +27189,18 @@ __metadata: languageName: node linkType: hard +"micromark-util-subtokenize@npm:^1.0.0": + version: 1.1.0 + resolution: "micromark-util-subtokenize@npm:1.1.0" + dependencies: + micromark-util-chunked: "npm:^1.0.0" + micromark-util-symbol: "npm:^1.0.0" + micromark-util-types: "npm:^1.0.0" + uvu: "npm:^0.5.0" + checksum: 075a1db6ea586d65827d3eead33dbfc520c4e43659c93fcd8fd82f44a7b75cfe61dcde967a3dfcc2ffd999347440ba5aa6698e65a04f3fc627e13e9f12a1a910 + languageName: node + linkType: hard + "micromark-util-subtokenize@npm:^2.0.0": version: 2.0.0 resolution: "micromark-util-subtokenize@npm:2.0.0" @@ -26739,6 +27213,13 @@ __metadata: languageName: node linkType: hard +"micromark-util-symbol@npm:^1.0.0": + version: 1.1.0 + resolution: "micromark-util-symbol@npm:1.1.0" + checksum: a26b6b1efd77a715a4d9bbe0a5338eaf3d04ea5e85733e34fee56dfeabf64495c0afc5438fe5220316884cd3a5eae1f17768e0ff4e117827ea4a653897466f86 + languageName: node + linkType: hard + "micromark-util-symbol@npm:^2.0.0": version: 2.0.0 resolution: "micromark-util-symbol@npm:2.0.0" @@ -26746,6 +27227,13 @@ __metadata: languageName: node linkType: hard +"micromark-util-types@npm:^1.0.0, micromark-util-types@npm:^1.0.1": + version: 1.1.0 + resolution: "micromark-util-types@npm:1.1.0" + checksum: 287ac5de4a3802bb6f6c3842197c294997a488db1c0486e03c7a8e674d9eb7720c17dda1bcb814814b8343b338c4826fcbc0555f3e75463712a60dcdb53a028e + languageName: node + linkType: hard + "micromark-util-types@npm:^2.0.0": version: 2.0.0 resolution: "micromark-util-types@npm:2.0.0" @@ -26753,6 +27241,31 @@ __metadata: languageName: node linkType: hard +"micromark@npm:^3.0.0": + version: 3.2.0 + resolution: "micromark@npm:3.2.0" + dependencies: + "@types/debug": "npm:^4.0.0" + debug: "npm:^4.0.0" + decode-named-character-reference: "npm:^1.0.0" + micromark-core-commonmark: "npm:^1.0.1" + micromark-factory-space: "npm:^1.0.0" + micromark-util-character: "npm:^1.0.0" + micromark-util-chunked: "npm:^1.0.0" + micromark-util-combine-extensions: "npm:^1.0.0" + micromark-util-decode-numeric-character-reference: "npm:^1.0.0" + micromark-util-encode: "npm:^1.0.0" + micromark-util-normalize-identifier: "npm:^1.0.0" + micromark-util-resolve-all: "npm:^1.0.0" + micromark-util-sanitize-uri: "npm:^1.0.0" + micromark-util-subtokenize: "npm:^1.0.0" + micromark-util-symbol: "npm:^1.0.0" + micromark-util-types: "npm:^1.0.1" + uvu: "npm:^0.5.0" + checksum: 560a4a501efc3859d622461aaa9345fb95b99a2f34d3d3f2a775ab04de1dd857cb0f642083a6b28ab01bd817f5f0741a1be9857fd702f45e04a3752927a66719 + languageName: node + linkType: hard + "micromark@npm:^4.0.0": version: 4.0.0 resolution: "micromark@npm:4.0.0" @@ -27199,7 +27712,7 @@ __metadata: languageName: node linkType: hard -"mri@npm:^1.2.0": +"mri@npm:^1.1.0, mri@npm:^1.2.0": version: 1.2.0 resolution: "mri@npm:1.2.0" checksum: 6775a1d2228bb9d191ead4efc220bd6be64f943ad3afd4dcb3b3ac8fc7b87034443f666e38805df38e8d047b29f910c3cc7810da0109af83e42c82c73bd3f6bc @@ -30808,6 +31321,18 @@ __metadata: languageName: node linkType: hard +"remark-gfm@npm:^3.0.1": + version: 3.0.1 + resolution: "remark-gfm@npm:3.0.1" + dependencies: + "@types/mdast": "npm:^3.0.0" + mdast-util-gfm: "npm:^2.0.0" + micromark-extension-gfm: "npm:^2.0.0" + unified: "npm:^10.0.0" + checksum: 8ec301f5fb1f52c548b5a6d7ca6a3422d55db73cd703f147c979d16dca003f065181f55404d6f3f49d33f1faca3fe56ae731ed7fe0acc00cd945a8e605f155f2 + languageName: node + linkType: hard + "remark-gfm@npm:^4.0.0": version: 4.0.0 resolution: "remark-gfm@npm:4.0.0" @@ -31305,6 +31830,15 @@ __metadata: languageName: node linkType: hard +"sade@npm:^1.7.3": + version: 1.8.1 + resolution: "sade@npm:1.8.1" + dependencies: + mri: "npm:^1.1.0" + checksum: 1c67ba03c94083e0ae307ff5564ecb86c2104c0f558042fdaa40ea0054f91a63a9783f14069870f2f784336adabb70f90f22a84dc457b5a25e859aaadefe0910 + languageName: node + linkType: hard + "safe-buffer@npm:5.1.2, safe-buffer@npm:~5.1.0, safe-buffer@npm:~5.1.1": version: 5.1.2 resolution: "safe-buffer@npm:5.1.2" @@ -33706,6 +34240,21 @@ __metadata: languageName: node linkType: hard +"unified@npm:^10.0.0": + version: 10.1.2 + resolution: "unified@npm:10.1.2" + dependencies: + "@types/unist": "npm:^2.0.0" + bail: "npm:^2.0.0" + extend: "npm:^3.0.0" + is-buffer: "npm:^2.0.0" + is-plain-obj: "npm:^4.0.0" + trough: "npm:^2.0.0" + vfile: "npm:^5.0.0" + checksum: 6cffebcefc3290be26d25a58ba714cda943142782baf320fddf374ca3a319bdaabb006f96df4be17b8b367f5e6f6e113b1027c52ef66154846a7a110550f6688 + languageName: node + linkType: hard + "unified@npm:^11.0.0, unified@npm:^11.0.4": version: 11.0.4 resolution: "unified@npm:11.0.4" @@ -33773,6 +34322,15 @@ __metadata: languageName: node linkType: hard +"unist-util-is@npm:^5.0.0": + version: 5.2.1 + resolution: "unist-util-is@npm:5.2.1" + dependencies: + "@types/unist": "npm:^2.0.0" + checksum: c10f6c07aad4f4830ffa8ea82b42a2c8d5cd36c7555e27889e5fee953040af321e4e6f4e52c4edb606604de75d7230a5f4bc7b71b8ac3e874a26ab595c2057e4 + languageName: node + linkType: hard + "unist-util-is@npm:^6.0.0": version: 6.0.0 resolution: "unist-util-is@npm:6.0.0" @@ -33782,6 +34340,15 @@ __metadata: languageName: node linkType: hard +"unist-util-stringify-position@npm:^3.0.0": + version: 3.0.3 + resolution: "unist-util-stringify-position@npm:3.0.3" + dependencies: + "@types/unist": "npm:^2.0.0" + checksum: 07913e4fd77fe57d95f8b2f771354f97a29082229c1ad14ceedce6bbc77b2d784ca8296563335471cdca97915e548204bd6f098ea5b808b822b4b54087662cfb + languageName: node + linkType: hard + "unist-util-stringify-position@npm:^4.0.0": version: 4.0.0 resolution: "unist-util-stringify-position@npm:4.0.0" @@ -33801,6 +34368,16 @@ __metadata: languageName: node linkType: hard +"unist-util-visit-parents@npm:^5.0.0, unist-util-visit-parents@npm:^5.1.1": + version: 5.1.3 + resolution: "unist-util-visit-parents@npm:5.1.3" + dependencies: + "@types/unist": "npm:^2.0.0" + unist-util-is: "npm:^5.0.0" + checksum: 5381fc57a129d478d983b988d86b72a1266d6f91fc608562b00bfa76596128d6e4d1c2b26ced64d96e55eb5d27d620081b4ee9703979bab63e1210789e781372 + languageName: node + linkType: hard + "unist-util-visit-parents@npm:^6.0.0": version: 6.0.1 resolution: "unist-util-visit-parents@npm:6.0.1" @@ -33822,6 +34399,17 @@ __metadata: languageName: node linkType: hard +"unist-util-visit@npm:^4.0.0": + version: 4.1.2 + resolution: "unist-util-visit@npm:4.1.2" + dependencies: + "@types/unist": "npm:^2.0.0" + unist-util-is: "npm:^5.0.0" + unist-util-visit-parents: "npm:^5.1.1" + checksum: e3b20c6b1f5ae1b7b40bbf9be49103a342d98fad98bdf958110c20d72e5923bd3f12966b6702459bc61ab832facb5af418a79af87cefa7a8a41b892369678b13 + languageName: node + linkType: hard + "unist-util-visit@npm:^5.0.0": version: 5.0.0 resolution: "unist-util-visit@npm:5.0.0" @@ -34141,6 +34729,20 @@ __metadata: languageName: node linkType: hard +"uvu@npm:^0.5.0": + version: 0.5.6 + resolution: "uvu@npm:0.5.6" + dependencies: + dequal: "npm:^2.0.0" + diff: "npm:^5.0.0" + kleur: "npm:^4.0.3" + sade: "npm:^1.7.3" + bin: + uvu: bin.js + checksum: 66ba25afc6732249877f9f4f8b6146f3aaa97538c51cf498f55825d602c33dbb903e02c7e1547cbca6bdfbb609e07eb7ea758b5156002ac2dd5072f00606f8d9 + languageName: node + linkType: hard + "v8-compile-cache-lib@npm:^3.0.1": version: 3.0.1 resolution: "v8-compile-cache-lib@npm:3.0.1" @@ -34225,6 +34827,16 @@ __metadata: languageName: node linkType: hard +"vfile-message@npm:^3.0.0": + version: 3.1.4 + resolution: "vfile-message@npm:3.1.4" + dependencies: + "@types/unist": "npm:^2.0.0" + unist-util-stringify-position: "npm:^3.0.0" + checksum: 423ca87f4427a403e4688d7ec663a2e6add694eefac47c945746463377428c7553bc613058841f1da83e18b68af886d3dd11cb96d582b5cc3c98e11efb7e55e9 + languageName: node + linkType: hard + "vfile-message@npm:^4.0.0": version: 4.0.2 resolution: "vfile-message@npm:4.0.2" @@ -34235,6 +34847,18 @@ __metadata: languageName: node linkType: hard +"vfile@npm:^5.0.0": + version: 5.3.7 + resolution: "vfile@npm:5.3.7" + dependencies: + "@types/unist": "npm:^2.0.0" + is-buffer: "npm:^2.0.0" + unist-util-stringify-position: "npm:^3.0.0" + vfile-message: "npm:^3.0.0" + checksum: d8f59b419d4c83b3ed24f500cf02393149b728f8803f88519c18fe0733f62544fa9ab0d8425a8bc7835181d848b9ce29c014168dc45af72f416074bbe475f643 + languageName: node + linkType: hard + "vfile@npm:^6.0.0": version: 6.0.1 resolution: "vfile@npm:6.0.1" From b4b4a3b625e11ae9090c295f9ac1a9e143d2d7b8 Mon Sep 17 00:00:00 2001 From: liuyi Date: Mon, 4 Dec 2023 11:12:15 +0000 Subject: [PATCH 09/68] fix(server): avoid snapshot write conflict (#5174) --- .../backend/server/src/modules/doc/manager.ts | 223 ++++++++++++------ packages/backend/server/tests/doc.spec.ts | 77 +++++- 2 files changed, 230 insertions(+), 70 deletions(-) diff --git a/packages/backend/server/src/modules/doc/manager.ts b/packages/backend/server/src/modules/doc/manager.ts index 326902b35f..a1fd0faf4b 100644 --- a/packages/backend/server/src/modules/doc/manager.ts +++ b/packages/backend/server/src/modules/doc/manager.ts @@ -11,6 +11,7 @@ import { chunk } from 'lodash-es'; import { defer, retry } from 'rxjs'; import { applyUpdate, + decodeStateVector, Doc, encodeStateAsUpdate, encodeStateVector, @@ -40,6 +41,36 @@ function compare(yBinary: Buffer, jwstBinary: Buffer, strict = false): boolean { return compare(yBinary, yBinary2, true); } +/** + * Detect whether rhs state is newer than lhs state. + * + * How could we tell a state is newer: + * + * i. if the state vector size is larger, it's newer + * ii. if the state vector size is same, compare each client's state + */ +function isStateNewer(lhs: Buffer, rhs: Buffer): boolean { + const lhsVector = decodeStateVector(lhs); + const rhsVector = decodeStateVector(rhs); + + if (lhsVector.size < rhsVector.size) { + return true; + } + + for (const [client, state] of lhsVector) { + const rstate = rhsVector.get(client); + if (!rstate) { + return false; + } + + if (state < rstate) { + return true; + } + } + + return false; +} + function isEmptyBuffer(buf: Buffer): boolean { return ( buf.length === 0 || @@ -374,23 +405,17 @@ export class DocManager implements OnModuleInit, OnModuleDestroy { } const { id, workspaceId } = candidate; - // acquire lock - const ok = await this.lockUpdatesForAutoSquash(workspaceId, id); - if (!ok) { - return; - } - - try { - await this._get(workspaceId, id); - } catch (e) { - this.logger.error( - `Failed to apply updates for workspace: ${workspaceId}, guid: ${id}` - ); - this.logger.error(e); - } finally { - await this.unlockUpdatesForAutoSquash(workspaceId, id); - } + await this.lockUpdatesForAutoSquash(workspaceId, id, async () => { + try { + await this._get(workspaceId, id); + } catch (e) { + this.logger.error( + `Failed to apply updates for workspace: ${workspaceId}, guid: ${id}` + ); + this.logger.error(e); + } + }); } private async getAutoSquashCandidate() { @@ -414,34 +439,67 @@ export class DocManager implements OnModuleInit, OnModuleDestroy { doc: Doc, initialSeq?: number ) { - const blob = Buffer.from(encodeStateAsUpdate(doc)); - const state = Buffer.from(encodeStateVector(doc)); + return this.lockSnapshotForUpsert(workspaceId, guid, async () => { + const blob = Buffer.from(encodeStateAsUpdate(doc)); - if (isEmptyBuffer(blob)) { - return; - } + if (isEmptyBuffer(blob)) { + return false; + } - await this.db.snapshot.upsert({ - select: { - seq: true, - }, - where: { - id_workspaceId: { - id: guid, - workspaceId, - }, - }, - create: { - id: guid, - workspaceId, - blob, - state, - seq: initialSeq, - }, - update: { - blob, - state, - }, + const state = Buffer.from(encodeStateVector(doc)); + + return await this.db.$transaction(async db => { + const snapshot = await db.snapshot.findUnique({ + where: { + id_workspaceId: { + id: guid, + workspaceId, + }, + }, + }); + + // update + if (snapshot) { + // only update if state is newer + if (isStateNewer(snapshot.state ?? Buffer.from([0]), state)) { + await db.snapshot.update({ + select: { + seq: true, + }, + where: { + id_workspaceId: { + workspaceId, + id: guid, + }, + }, + data: { + blob, + state, + }, + }); + + return true; + } else { + return false; + } + } else { + // create + await db.snapshot.create({ + select: { + seq: true, + }, + data: { + id: guid, + workspaceId, + blob, + state, + seq: initialSeq, + }, + }); + + return true; + } + }); }); } @@ -484,21 +542,26 @@ export class DocManager implements OnModuleInit, OnModuleDestroy { this.event.emit('doc:manager:snapshot:beforeUpdate', snapshot); } - await this.upsert(workspaceId, id, doc, last.seq); - this.logger.debug( - `Squashed ${updates.length} updates for ${id} in workspace ${workspaceId}` - ); - await this.db.update.deleteMany({ - where: { - id, - workspaceId, - seq: { - in: updates.map(u => u.seq), - }, - }, - }); + const done = await this.upsert(workspaceId, id, doc, last.seq); + + if (done) { + this.logger.debug( + `Squashed ${updates.length} updates for ${id} in workspace ${workspaceId}` + ); + + await this.db.update.deleteMany({ + where: { + id, + workspaceId, + seq: { + in: updates.map(u => u.seq), + }, + }, + }); + + await this.updateCachedUpdatesCount(workspaceId, id, -updates.length); + } - await this.updateCachedUpdatesCount(workspaceId, id, -updates.length); return doc; } @@ -581,22 +644,44 @@ export class DocManager implements OnModuleInit, OnModuleDestroy { return null; } - private async lockUpdatesForAutoSquash(workspaceId: string, guid: string) { - return this.cache.setnx( + private async doWithLock(lock: string, job: () => Promise) { + const acquired = await this.cache.setnx(lock, 1, { + ttl: 60 * 1000, + }); + + if (!acquired) { + return; + } + + try { + return await job(); + } finally { + await this.cache.delete(lock).catch(e => { + // safe, the lock will be expired when ttl ends + this.logger.error(`Failed to release lock ${lock}`, e); + }); + } + } + + private async lockUpdatesForAutoSquash( + workspaceId: string, + guid: string, + job: () => Promise + ) { + return this.doWithLock( `doc:manager:updates-lock:${workspaceId}::${guid}`, - 1, - { - ttl: 60 * 1000, - } + job ); } - private async unlockUpdatesForAutoSquash(workspaceId: string, guid: string) { - return this.cache - .delete(`doc:manager:updates-lock:${workspaceId}::${guid}`) - .catch(e => { - // safe, the lock will be expired when ttl ends - this.logger.error('Failed to release updates lock', e); - }); + async lockSnapshotForUpsert( + workspaceId: string, + guid: string, + job: () => Promise + ) { + return this.doWithLock( + `doc:manager:snapshot-lock:${workspaceId}::${guid}`, + job + ); } } diff --git a/packages/backend/server/tests/doc.spec.ts b/packages/backend/server/tests/doc.spec.ts index 83147b96fe..2fbec0be8a 100644 --- a/packages/backend/server/tests/doc.spec.ts +++ b/packages/backend/server/tests/doc.spec.ts @@ -6,7 +6,12 @@ import { Test, TestingModule } from '@nestjs/testing'; import test from 'ava'; import { register } from 'prom-client'; import * as Sinon from 'sinon'; -import { Doc as YDoc, encodeStateAsUpdate } from 'yjs'; +import { + applyUpdate, + decodeStateVector, + Doc as YDoc, + encodeStateAsUpdate, +} from 'yjs'; import { CacheModule } from '../src/cache'; import { Config, ConfigModule } from '../src/config'; @@ -283,3 +288,73 @@ test('should throw if meet max retry times', async t => { ); t.is(stub.callCount, 5); }); + +test('should not update snapshot if state is outdated', async t => { + const db = m.get(PrismaService); + const manager = m.get(DocManager); + + await db.snapshot.create({ + data: { + id: '2', + workspaceId: '2', + blob: Buffer.from([0, 0]), + seq: 1, + }, + }); + const doc = new YDoc(); + const text = doc.getText('content'); + const updates: Buffer[] = []; + + doc.on('update', update => { + updates.push(Buffer.from(update)); + }); + + text.insert(0, 'hello'); + text.insert(5, 'world'); + text.insert(5, ' '); + + await Promise.all(updates.map(update => manager.push('2', '2', update))); + + const updateWith3Records = await manager.getUpdates('2', '2'); + text.insert(11, '!'); + await manager.push('2', '2', updates[3]); + const updateWith4Records = await manager.getUpdates('2', '2'); + + // Simulation: + // Node A get 3 updates and squash them at time 1, will finish at time 10 + // Node B get 4 updates and squash them at time 3, will finish at time 8 + // Node B finish the squash first, and update the snapshot + // Node A finish the squash later, and update the snapshot to an outdated state + // Time: ----------------------> + // A: ^get ^upsert + // B: ^get ^upsert + // + // We should avoid such situation + // @ts-expect-error private + await manager.squash(updateWith4Records, null); + // @ts-expect-error private + await manager.squash(updateWith3Records, null); + + const result = await db.snapshot.findUnique({ + where: { + id_workspaceId: { + id: '2', + workspaceId: '2', + }, + }, + }); + + if (!result) { + t.fail('snapshot not found'); + return; + } + + const state = decodeStateVector(result.state!); + t.is(state.get(doc.clientID), 12); + + const d = new YDoc(); + applyUpdate(d, result.blob!); + + const dtext = d.getText('content'); + t.is(dtext.toString(), 'hello world!'); +}); From 7878ce5c2c5b974afd464b0c9210cb8d1aaaf7af Mon Sep 17 00:00:00 2001 From: EYHN Date: Mon, 4 Dec 2023 11:32:10 +0000 Subject: [PATCH 10/68] feat(workspace): priority load opened page (#5156) --- .../core/src/pages/workspace/detail-page.tsx | 14 ++++- .../workspace/src/providers/sync/engine.ts | 15 +++++- .../workspace/src/providers/sync/peer.ts | 52 ++++++++++--------- .../src/providers/utils/async-queue.ts | 41 +++++++++++++-- tests/affine-migration/e2e/basic.spec.ts | 2 + 5 files changed, 93 insertions(+), 31 deletions(-) diff --git a/packages/frontend/core/src/pages/workspace/detail-page.tsx b/packages/frontend/core/src/pages/workspace/detail-page.tsx index bc8cd4996c..10ff6ebdff 100644 --- a/packages/frontend/core/src/pages/workspace/detail-page.tsx +++ b/packages/frontend/core/src/pages/workspace/detail-page.tsx @@ -27,7 +27,10 @@ import { AffineErrorBoundary } from '../../components/affine/affine-error-bounda import { GlobalPageHistoryModal } from '../../components/affine/page-history-modal'; import { WorkspaceHeader } from '../../components/workspace-header'; import { useRegisterBlocksuiteEditorCommands } from '../../hooks/affine/use-register-blocksuite-editor-commands'; -import { useCurrentSyncEngineStatus } from '../../hooks/current/use-current-sync-engine'; +import { + useCurrentSyncEngine, + useCurrentSyncEngineStatus, +} from '../../hooks/current/use-current-sync-engine'; import { useCurrentWorkspace } from '../../hooks/current/use-current-workspace'; import { useNavigateHelper } from '../../hooks/use-navigate-helper'; import { performanceRenderLogger } from '../../shared'; @@ -111,9 +114,18 @@ const DetailPageImpl = (): ReactElement => { export const DetailPage = (): ReactElement => { const [currentWorkspace] = useCurrentWorkspace(); const currentSyncEngineStatus = useCurrentSyncEngineStatus(); + const currentSyncEngine = useCurrentSyncEngine(); const currentPageId = useAtomValue(currentPageIdAtom); const [page, setPage] = useState(null); + // set sync engine priority target + useEffect(() => { + if (!currentPageId) { + return; + } + currentSyncEngine?.setPriorityRule(id => id.endsWith(currentPageId)); + }, [currentPageId, currentSyncEngine, currentWorkspace]); + // load page by current page id useEffect(() => { if (!currentPageId) { diff --git a/packages/frontend/workspace/src/providers/sync/engine.ts b/packages/frontend/workspace/src/providers/sync/engine.ts index fca3e2c74a..6acfee83f0 100644 --- a/packages/frontend/workspace/src/providers/sync/engine.ts +++ b/packages/frontend/workspace/src/providers/sync/engine.ts @@ -3,6 +3,7 @@ import { Slot } from '@blocksuite/global/utils'; import type { Doc } from 'yjs'; import type { Storage } from '../storage'; +import { SharedPriorityTarget } from '../utils/async-queue'; import { MANUALLY_STOP, SyncEngineStep } from './consts'; import { SyncPeer, type SyncPeerStatus, SyncPeerStep } from './peer'; @@ -56,6 +57,8 @@ export class SyncEngine { this.onStatusChange.emit(s); } + priorityTarget = new SharedPriorityTarget(); + get status() { return this._status; } @@ -110,7 +113,11 @@ export class SyncEngine { const cleanUp: (() => void)[] = []; try { // Step 1: start local sync peer - state.localPeer = new SyncPeer(this.rootDoc, this.local); + state.localPeer = new SyncPeer( + this.rootDoc, + this.local, + this.priorityTarget + ); cleanUp.push( state.localPeer.onStatusChange.on(() => { @@ -126,7 +133,7 @@ export class SyncEngine { // Step 3: start remote sync peer state.remotePeers = this.remotes.map(remote => { - const peer = new SyncPeer(this.rootDoc, remote); + const peer = new SyncPeer(this.rootDoc, remote, this.priorityTarget); cleanUp.push( peer.onStatusChange.on(() => { if (!signal.aborted) @@ -237,4 +244,8 @@ export class SyncEngine { ]); } } + + setPriorityRule(target: ((id: string) => boolean) | null) { + this.priorityTarget.priorityRule = target; + } } diff --git a/packages/frontend/workspace/src/providers/sync/peer.ts b/packages/frontend/workspace/src/providers/sync/peer.ts index 5597bb8469..6a1955c4d7 100644 --- a/packages/frontend/workspace/src/providers/sync/peer.ts +++ b/packages/frontend/workspace/src/providers/sync/peer.ts @@ -5,7 +5,7 @@ import type { Doc } from 'yjs'; import { applyUpdate, encodeStateAsUpdate, encodeStateVector } from 'yjs'; import { mergeUpdates, type Storage } from '../storage'; -import { AsyncQueue } from '../utils/async-queue'; +import { PriorityAsyncQueue, SharedPriorityTarget } from '../utils/async-queue'; import { throwIfAborted } from '../utils/throw-if-aborted'; import { MANUALLY_STOP } from './consts'; @@ -70,7 +70,8 @@ export class SyncPeer { constructor( private readonly rootDoc: Doc, - private readonly storage: Storage + private readonly storage: Storage, + private readonly priorityTarget = new SharedPriorityTarget() ) { this.logger.debug('peer start'); @@ -152,24 +153,24 @@ export class SyncPeer { private readonly state: { connectedDocs: Map; - pushUpdatesQueue: AsyncQueue<{ - docId: string; + pushUpdatesQueue: PriorityAsyncQueue<{ + id: string; data: Uint8Array[]; }>; pushingUpdate: boolean; - pullUpdatesQueue: AsyncQueue<{ - docId: string; + pullUpdatesQueue: PriorityAsyncQueue<{ + id: string; data: Uint8Array; }>; subdocLoading: boolean; - subdocsLoadQueue: AsyncQueue; + subdocsLoadQueue: PriorityAsyncQueue<{ id: string; doc: Doc }>; } = { connectedDocs: new Map(), - pushUpdatesQueue: new AsyncQueue(), + pushUpdatesQueue: new PriorityAsyncQueue([], this.priorityTarget), pushingUpdate: false, - pullUpdatesQueue: new AsyncQueue(), + pullUpdatesQueue: new PriorityAsyncQueue([], this.priorityTarget), subdocLoading: false, - subdocsLoadQueue: new AsyncQueue(), + subdocsLoadQueue: new PriorityAsyncQueue([], this.priorityTarget), }; initState() { @@ -211,7 +212,10 @@ export class SyncPeer { // Step 2: load subdocs this.state.subdocsLoadQueue.push( - ...Array.from(this.rootDoc.getSubdocs()) + ...Array.from(this.rootDoc.getSubdocs()).map(doc => ({ + id: doc.guid, + doc, + })) ); this.reportSyncStatus(); @@ -227,7 +231,7 @@ export class SyncPeer { ); this.state.subdocLoading = true; this.reportSyncStatus(); - await this.connectDoc(subdoc, abortInner.signal); + await this.connectDoc(subdoc.doc, abortInner.signal); this.state.subdocLoading = false; this.reportSyncStatus(); } @@ -235,7 +239,7 @@ export class SyncPeer { // pull updates (async () => { while (throwIfAborted(abortInner.signal)) { - const { docId, data } = await this.state.pullUpdatesQueue.next( + const { id, data } = await this.state.pullUpdatesQueue.next( abortInner.signal ); // don't apply empty data or Uint8Array([0, 0]) @@ -245,7 +249,7 @@ export class SyncPeer { (data.byteLength === 2 && data[0] === 0 && data[1] === 0) ) ) { - const subdoc = this.state.connectedDocs.get(docId); + const subdoc = this.state.connectedDocs.get(id); if (subdoc) { applyUpdate(subdoc, data, this.name); } @@ -256,7 +260,7 @@ export class SyncPeer { // push updates (async () => { while (throwIfAborted(abortInner.signal)) { - const { docId, data } = await this.state.pushUpdatesQueue.next( + const { id, data } = await this.state.pushUpdatesQueue.next( abortInner.signal ); this.state.pushingUpdate = true; @@ -271,7 +275,7 @@ export class SyncPeer { (merged.byteLength === 2 && merged[0] === 0 && merged[1] === 0) ) ) { - await this.storage.push(docId, merged); + await this.storage.push(id, merged); } this.state.pushingUpdate = false; @@ -299,7 +303,7 @@ export class SyncPeer { // diff root doc and in-storage, save updates to pendingUpdates this.state.pushUpdatesQueue.push({ - docId: doc.guid, + id: doc.guid, data: [encodeStateAsUpdate(doc, inStorageState)], }); @@ -327,14 +331,12 @@ export class SyncPeer { return; } - const exist = this.state.pushUpdatesQueue.find( - ({ docId }) => docId === doc.guid - ); + const exist = this.state.pushUpdatesQueue.find(({ id }) => id === doc.guid); if (exist) { exist.data.push(update); } else { this.state.pushUpdatesQueue.push({ - docId: doc.guid, + id: doc.guid, data: [update], }); } @@ -351,20 +353,20 @@ export class SyncPeer { removed: Set; }) => { for (const subdoc of added) { - this.state.subdocsLoadQueue.push(subdoc); + this.state.subdocsLoadQueue.push({ id: subdoc.guid, doc: subdoc }); } for (const subdoc of removed) { this.disconnectDoc(subdoc); - this.state.subdocsLoadQueue.remove(doc => doc === subdoc); + this.state.subdocsLoadQueue.remove(doc => doc.doc === subdoc); } this.reportSyncStatus(); }; // handle updates from storage - handleStorageUpdates = (docId: string, data: Uint8Array) => { + handleStorageUpdates = (id: string, data: Uint8Array) => { this.state.pullUpdatesQueue.push({ - docId, + id, data, }); this.reportSyncStatus(); diff --git a/packages/frontend/workspace/src/providers/utils/async-queue.ts b/packages/frontend/workspace/src/providers/utils/async-queue.ts index db29b8d43e..e7f994a39b 100644 --- a/packages/frontend/workspace/src/providers/utils/async-queue.ts +++ b/packages/frontend/workspace/src/providers/utils/async-queue.ts @@ -12,8 +12,11 @@ export class AsyncQueue { return this._queue.length; } - async next(abort?: AbortSignal): Promise { - const update = this._queue.shift(); + async next( + abort?: AbortSignal, + dequeue: (arr: T[]) => T | undefined = a => a.shift() + ): Promise { + const update = dequeue(this._queue); if (update) { return update; } else { @@ -35,7 +38,7 @@ export class AsyncQueue { }), ]); - return this.next(abort); + return this.next(abort, dequeue); } } @@ -64,3 +67,35 @@ export class AsyncQueue { this._queue = []; } } + +export class PriorityAsyncQueue< + T extends { id: string }, +> extends AsyncQueue { + constructor( + init: T[] = [], + public readonly priorityTarget: SharedPriorityTarget = new SharedPriorityTarget() + ) { + super(init); + } + + override next(abort?: AbortSignal | undefined): Promise { + return super.next(abort, arr => { + if (this.priorityTarget.priorityRule !== null) { + const index = arr.findIndex( + update => this.priorityTarget.priorityRule?.(update.id) + ); + if (index !== -1) { + return arr.splice(index, 1)[0]; + } + } + return arr.shift(); + }); + } +} + +/** + * Shared priority target can be shared by multiple queues. + */ +export class SharedPriorityTarget { + public priorityRule: ((id: string) => boolean) | null = null; +} diff --git a/tests/affine-migration/e2e/basic.spec.ts b/tests/affine-migration/e2e/basic.spec.ts index 83d302db27..be1916b354 100644 --- a/tests/affine-migration/e2e/basic.spec.ts +++ b/tests/affine-migration/e2e/basic.spec.ts @@ -89,6 +89,8 @@ test('v3 to v4, surface migration', async ({ page }) => { await page.getByTestId('upgrade-workspace-button').click(); await waitForEditorLoad(page); + await page.waitForTimeout(500); + // check edgeless mode is correct await clickEdgelessModeButton(page); await expect(page.locator('edgeless-toolbar')).toBeVisible(); From a2784c352fdc3bbc0f0931aed3d7b12d774df59e Mon Sep 17 00:00:00 2001 From: Flrande <50035259+Flrande@users.noreply.github.com> Date: Mon, 4 Dec 2023 12:02:35 +0000 Subject: [PATCH 11/68] chore: bump blocksuite (#5138) --- packages/common/env/package.json | 4 +- packages/common/env/src/global.ts | 9 +- packages/common/infra/package.json | 10 +- packages/common/sdk/package.json | 10 +- packages/common/y-indexeddb/package.json | 4 +- .../y-indexeddb/src/__tests__/index.spec.ts | 6 +- packages/common/y-provider/package.json | 2 +- packages/frontend/component/package.json | 10 +- .../frontend/core/.webpack/runtime-config.ts | 8 +- packages/frontend/core/package.json | 14 +- .../frontend/core/src/components/bookmark.tsx | 169 ------ .../src/components/page-detail-editor.tsx | 2 - packages/frontend/electron/package.json | 8 +- packages/frontend/hooks/package.json | 12 +- .../hooks/src/use-block-suite-page-preview.ts | 2 +- .../src/use-block-suite-page-references.ts | 11 +- .../frontend/workspace/src/manager/index.ts | 6 - .../providers/sync/__tests__/engine.spec.ts | 8 +- .../src/providers/sync/__tests__/peer.spec.ts | 6 +- tests/affine-legacy/0.6.1-beta.1/package.json | 8 +- .../0.7.0-canary.18/package.json | 8 +- .../affine-legacy/0.8.0-canary.7/package.json | 8 +- tests/affine-legacy/0.8.4/package.json | 8 +- tests/affine-migration/package.json | 8 +- tests/storybook/package.json | 14 +- yarn.lock | 498 +++++++++++++----- 26 files changed, 460 insertions(+), 393 deletions(-) delete mode 100644 packages/frontend/core/src/components/bookmark.tsx diff --git a/packages/common/env/package.json b/packages/common/env/package.json index 0f1ba316dc..7424b6135c 100644 --- a/packages/common/env/package.json +++ b/packages/common/env/package.json @@ -3,8 +3,8 @@ "private": true, "type": "module", "devDependencies": { - "@blocksuite/global": "0.0.0-20231124123613-7c06e95d-nightly", - "@blocksuite/store": "0.0.0-20231124123613-7c06e95d-nightly", + "@blocksuite/global": "0.0.0-20231130092516-0f858b95-nightly", + "@blocksuite/store": "0.0.0-20231130092516-0f858b95-nightly", "react": "18.2.0", "react-dom": "18.2.0", "vitest": "0.34.6", diff --git a/packages/common/env/src/global.ts b/packages/common/env/src/global.ts index 88c86f24ad..e074fac47b 100644 --- a/packages/common/env/src/global.ts +++ b/packages/common/env/src/global.ts @@ -6,12 +6,9 @@ import { isDesktop, isServer } from './constant.js'; import { UaHelper } from './ua-helper.js'; export const blockSuiteFeatureFlags = z.object({ - enable_set_remote_flag: z.boolean(), - enable_block_hub: z.boolean(), - - enable_toggle_block: z.boolean(), - enable_bookmark_operation: z.boolean(), - enable_note_index: z.boolean(), + enable_transformer_clipboard: z.boolean(), + enable_expand_database_block: z.boolean(), + enable_bultin_ledits: z.boolean(), }); export const runtimeFlagsSchema = z.object({ diff --git a/packages/common/infra/package.json b/packages/common/infra/package.json index 4de352fd34..78d85776f6 100644 --- a/packages/common/infra/package.json +++ b/packages/common/infra/package.json @@ -55,9 +55,9 @@ }, "dependencies": { "@affine/sdk": "workspace:*", - "@blocksuite/blocks": "0.0.0-20231124123613-7c06e95d-nightly", - "@blocksuite/global": "0.0.0-20231124123613-7c06e95d-nightly", - "@blocksuite/store": "0.0.0-20231124123613-7c06e95d-nightly", + "@blocksuite/blocks": "0.0.0-20231130092516-0f858b95-nightly", + "@blocksuite/global": "0.0.0-20231130092516-0f858b95-nightly", + "@blocksuite/store": "0.0.0-20231130092516-0f858b95-nightly", "jotai": "^2.5.1", "jotai-effect": "^0.2.3", "tinykeys": "^2.1.0", @@ -66,8 +66,8 @@ "devDependencies": { "@affine-test/fixtures": "workspace:*", "@affine/templates": "workspace:*", - "@blocksuite/editor": "0.0.0-20231124123613-7c06e95d-nightly", - "@blocksuite/lit": "0.0.0-20231124123613-7c06e95d-nightly", + "@blocksuite/editor": "0.0.0-20231130092516-0f858b95-nightly", + "@blocksuite/lit": "0.0.0-20231130092516-0f858b95-nightly", "@testing-library/react": "^14.0.0", "async-call-rpc": "^6.3.1", "electron": "link:../../frontend/electron/node_modules/electron", diff --git a/packages/common/sdk/package.json b/packages/common/sdk/package.json index 2f25006092..84ffa33d51 100644 --- a/packages/common/sdk/package.json +++ b/packages/common/sdk/package.json @@ -22,11 +22,11 @@ "dist" ], "dependencies": { - "@blocksuite/block-std": "0.0.0-20231124123613-7c06e95d-nightly", - "@blocksuite/blocks": "0.0.0-20231124123613-7c06e95d-nightly", - "@blocksuite/editor": "0.0.0-20231124123613-7c06e95d-nightly", - "@blocksuite/global": "0.0.0-20231124123613-7c06e95d-nightly", - "@blocksuite/store": "0.0.0-20231124123613-7c06e95d-nightly", + "@blocksuite/block-std": "0.0.0-20231130092516-0f858b95-nightly", + "@blocksuite/blocks": "0.0.0-20231130092516-0f858b95-nightly", + "@blocksuite/editor": "0.0.0-20231130092516-0f858b95-nightly", + "@blocksuite/global": "0.0.0-20231130092516-0f858b95-nightly", + "@blocksuite/store": "0.0.0-20231130092516-0f858b95-nightly", "jotai": "^2.5.1", "zod": "^3.22.4" }, diff --git a/packages/common/y-indexeddb/package.json b/packages/common/y-indexeddb/package.json index 28bb651424..a748f49d8c 100644 --- a/packages/common/y-indexeddb/package.json +++ b/packages/common/y-indexeddb/package.json @@ -37,8 +37,8 @@ "y-provider": "workspace:*" }, "devDependencies": { - "@blocksuite/blocks": "0.0.0-20231124123613-7c06e95d-nightly", - "@blocksuite/store": "0.0.0-20231124123613-7c06e95d-nightly", + "@blocksuite/blocks": "0.0.0-20231130092516-0f858b95-nightly", + "@blocksuite/store": "0.0.0-20231130092516-0f858b95-nightly", "fake-indexeddb": "^5.0.0", "vite": "^4.4.11", "vite-plugin-dts": "3.6.0", diff --git a/packages/common/y-indexeddb/src/__tests__/index.spec.ts b/packages/common/y-indexeddb/src/__tests__/index.spec.ts index d03ef745ce..2d597dd0cd 100644 --- a/packages/common/y-indexeddb/src/__tests__/index.spec.ts +++ b/packages/common/y-indexeddb/src/__tests__/index.spec.ts @@ -65,7 +65,7 @@ beforeEach(() => { id = nanoid(); workspace = new Workspace({ id, - isSSR: true, + schema, }); vi.useFakeTimers({ toFake: ['requestIdleCallback'] }); @@ -383,7 +383,7 @@ describe('subDoc', () => { { const newWorkspace = new Workspace({ id, - isSSR: true, + schema, }); const provider = createIndexedDBProvider(newWorkspace.doc, rootDBName); @@ -423,7 +423,7 @@ describe('utils', () => { expect(update).toBeInstanceOf(Uint8Array); const newWorkspace = new Workspace({ id, - isSSR: true, + schema, }); applyUpdate(newWorkspace.doc, update); diff --git a/packages/common/y-provider/package.json b/packages/common/y-provider/package.json index d56d14de84..3ba18c528b 100644 --- a/packages/common/y-provider/package.json +++ b/packages/common/y-provider/package.json @@ -24,7 +24,7 @@ "build": "vite build" }, "devDependencies": { - "@blocksuite/store": "0.0.0-20231124123613-7c06e95d-nightly", + "@blocksuite/store": "0.0.0-20231130092516-0f858b95-nightly", "vite": "^4.4.11", "vite-plugin-dts": "3.6.0", "vitest": "0.34.6", diff --git a/packages/frontend/component/package.json b/packages/frontend/component/package.json index 0e6fee3b71..d759a03e96 100644 --- a/packages/frontend/component/package.json +++ b/packages/frontend/component/package.json @@ -71,12 +71,12 @@ "uuid": "^9.0.1" }, "devDependencies": { - "@blocksuite/blocks": "0.0.0-20231124123613-7c06e95d-nightly", - "@blocksuite/editor": "0.0.0-20231124123613-7c06e95d-nightly", - "@blocksuite/global": "0.0.0-20231124123613-7c06e95d-nightly", + "@blocksuite/blocks": "0.0.0-20231130092516-0f858b95-nightly", + "@blocksuite/editor": "0.0.0-20231130092516-0f858b95-nightly", + "@blocksuite/global": "0.0.0-20231130092516-0f858b95-nightly", "@blocksuite/icons": "2.1.36", - "@blocksuite/lit": "0.0.0-20231124123613-7c06e95d-nightly", - "@blocksuite/store": "0.0.0-20231124123613-7c06e95d-nightly", + "@blocksuite/lit": "0.0.0-20231130092516-0f858b95-nightly", + "@blocksuite/store": "0.0.0-20231130092516-0f858b95-nightly", "@storybook/addon-actions": "^7.5.3", "@storybook/addon-essentials": "^7.5.3", "@storybook/addon-interactions": "^7.5.3", diff --git a/packages/frontend/core/.webpack/runtime-config.ts b/packages/frontend/core/.webpack/runtime-config.ts index d613fa11aa..a11c50b35a 100644 --- a/packages/frontend/core/.webpack/runtime-config.ts +++ b/packages/frontend/core/.webpack/runtime-config.ts @@ -6,11 +6,9 @@ const require = createRequire(import.meta.url); const packageJson = require('../package.json'); const editorFlags: BlockSuiteFeatureFlags = { - enable_block_hub: true, - enable_toggle_block: false, - enable_bookmark_operation: false, - enable_note_index: false, - enable_set_remote_flag: false, + enable_transformer_clipboard: false, + enable_expand_database_block: false, + enable_bultin_ledits: false, }; export function getRuntimeConfig(buildFlags: BuildFlags): RuntimeConfig { diff --git a/packages/frontend/core/package.json b/packages/frontend/core/package.json index 64ee8a74fe..847c8c0e26 100644 --- a/packages/frontend/core/package.json +++ b/packages/frontend/core/package.json @@ -25,14 +25,14 @@ "@affine/i18n": "workspace:*", "@affine/templates": "workspace:*", "@affine/workspace": "workspace:*", - "@blocksuite/block-std": "0.0.0-20231124123613-7c06e95d-nightly", - "@blocksuite/blocks": "0.0.0-20231124123613-7c06e95d-nightly", - "@blocksuite/editor": "0.0.0-20231124123613-7c06e95d-nightly", - "@blocksuite/global": "0.0.0-20231124123613-7c06e95d-nightly", + "@blocksuite/block-std": "0.0.0-20231130092516-0f858b95-nightly", + "@blocksuite/blocks": "0.0.0-20231130092516-0f858b95-nightly", + "@blocksuite/editor": "0.0.0-20231130092516-0f858b95-nightly", + "@blocksuite/global": "0.0.0-20231130092516-0f858b95-nightly", "@blocksuite/icons": "2.1.36", - "@blocksuite/lit": "0.0.0-20231124123613-7c06e95d-nightly", - "@blocksuite/store": "0.0.0-20231124123613-7c06e95d-nightly", - "@blocksuite/virgo": "0.0.0-20231124123613-7c06e95d-nightly", + "@blocksuite/lit": "0.0.0-20231130092516-0f858b95-nightly", + "@blocksuite/store": "0.0.0-20231130092516-0f858b95-nightly", + "@blocksuite/virgo": "0.0.0-20231130092516-0f858b95-nightly", "@dnd-kit/core": "^6.0.8", "@dnd-kit/sortable": "^8.0.0", "@emotion/cache": "^11.11.0", diff --git a/packages/frontend/core/src/components/bookmark.tsx b/packages/frontend/core/src/components/bookmark.tsx deleted file mode 100644 index 18705f14b0..0000000000 --- a/packages/frontend/core/src/components/bookmark.tsx +++ /dev/null @@ -1,169 +0,0 @@ -import { Menu, MenuItem } from '@affine/component/ui/menu'; -import type { SerializedBlock } from '@blocksuite/blocks'; -import type { BaseBlockModel } from '@blocksuite/store'; -import type { Page } from '@blocksuite/store'; -import type { VEditor } from '@blocksuite/virgo'; -import { useEffect, useState } from 'react'; -import { createPortal } from 'react-dom'; - -type ShortcutMap = { - [key: string]: (e: KeyboardEvent, page: Page) => void; -}; - -const menuOptions = [ - { - id: 'dismiss', - label: 'Dismiss', - }, - { - id: 'bookmark', - label: 'Create bookmark', - }, -]; - -function getCurrentNativeRange(selection = window.getSelection()) { - if (!selection) { - return null; - } - if (selection.rangeCount === 0) { - return null; - } - if (selection.rangeCount > 1) { - console.warn('getCurrentRange may be wrong, rangeCount > 1'); - } - return selection.getRangeAt(0); -} - -const handleEnter = ({ - page, - selectedOption, - callback, -}: { - page: Page; - selectedOption: keyof ShortcutMap; - callback: () => void; -}) => { - if (selectedOption === 'dismiss') { - return callback(); - } - const native = getCurrentNativeRange(); - if (!native) { - return callback(); - } - const container = native.startContainer; - const element = - container instanceof Element ? container : container?.parentElement; - const virgo = element?.closest( - '[data-virgo-root]' - )?.virgoEditor; - if (!virgo) { - return callback(); - } - const linkInfo = virgo - ?.getDeltasByVRange({ - index: native.startOffset, - length: 0, - }) - .find(delta => delta[0]?.attributes?.link); - if (!linkInfo) { - return; - } - const [, { index, length }] = linkInfo; - const link = linkInfo[0]?.attributes?.link as string; - - const model = element?.closest( - '[data-block-id]' - )?.model; - if (!model) { - return callback(); - } - const parent = page.getParent(model); - if (!parent) { - return callback(); - } - const currentBlockIndex = parent.children.indexOf(model); - page.addBlock( - 'affine:bookmark', - { url: link }, - parent, - currentBlockIndex + 1 - ); - - virgo?.deleteText({ - index, - length, - }); - - if (model.isEmpty()) { - page.deleteBlock(model); - } - return callback(); -}; - -const shouldShowBookmarkMenu = (pastedBlocks: Record[]) => { - if (!pastedBlocks.length || pastedBlocks.length > 1) { - return; - } - const [firstBlock] = pastedBlocks as [SerializedBlock]; - if ( - !firstBlock.text || - !firstBlock.text.length || - firstBlock.text.length > 1 - ) { - return; - } - return !!firstBlock.text[0].attributes?.link; -}; - -export type BookmarkProps = { - page: Page; -}; - -export const Bookmark = ({ page }: BookmarkProps) => { - const [anchor, setAnchor] = useState(null); - - useEffect(() => { - const disposer = page.slots.pasted.on(pastedBlocks => { - if (!shouldShowBookmarkMenu(pastedBlocks)) { - return; - } - window.setTimeout(() => { - setAnchor(getCurrentNativeRange()); - }, 100); - }); - - return () => { - disposer.dispose(); - }; - }, [page]); - - const portalContainer = anchor?.startContainer.parentElement; - - return anchor && portalContainer - ? createPortal( - !e && setAnchor(null), - }} - items={menuOptions.map(({ id, label }) => ( - - handleEnter({ - page, - selectedOption: id, - callback: () => setAnchor(null), - }) - } - > - {label} - - ))} - > - - , - portalContainer - ) - : null; -}; diff --git a/packages/frontend/core/src/components/page-detail-editor.tsx b/packages/frontend/core/src/components/page-detail-editor.tsx index ca3dc916d9..0212d304b8 100644 --- a/packages/frontend/core/src/components/page-detail-editor.tsx +++ b/packages/frontend/core/src/components/page-detail-editor.tsx @@ -36,7 +36,6 @@ import { fontStyleOptions } from '../atoms/settings'; import { useAppSettingHelper } from '../hooks/affine/use-app-setting-helper'; import { useBlockSuiteMetaHelper } from '../hooks/affine/use-block-suite-meta-helper'; import { BlockSuiteEditor as Editor } from './blocksuite/block-suite-editor'; -import { Bookmark } from './bookmark'; import * as styles from './page-detail-editor.css'; import { editorContainer, pluginContainer } from './page-detail-editor.css'; import { TrashButtonGroup } from './pure/trash-button-group'; @@ -212,7 +211,6 @@ const EditorWrapper = memo(function EditorWrapper({ onLoadEditor={onLoadEditor} /> {meta.trash && } - ); }); diff --git a/packages/frontend/electron/package.json b/packages/frontend/electron/package.json index b2345694ed..3e8d55df77 100644 --- a/packages/frontend/electron/package.json +++ b/packages/frontend/electron/package.json @@ -32,10 +32,10 @@ "@affine/sdk": "workspace:*", "@affine/templates": "workspace:*", "@affine/vue-hello-world-plugin": "workspace:*", - "@blocksuite/blocks": "0.0.0-20231124123613-7c06e95d-nightly", - "@blocksuite/editor": "0.0.0-20231124123613-7c06e95d-nightly", - "@blocksuite/lit": "0.0.0-20231124123613-7c06e95d-nightly", - "@blocksuite/store": "0.0.0-20231124123613-7c06e95d-nightly", + "@blocksuite/blocks": "0.0.0-20231130092516-0f858b95-nightly", + "@blocksuite/editor": "0.0.0-20231130092516-0f858b95-nightly", + "@blocksuite/lit": "0.0.0-20231130092516-0f858b95-nightly", + "@blocksuite/store": "0.0.0-20231130092516-0f858b95-nightly", "@electron-forge/cli": "^7.1.0", "@electron-forge/core": "^7.1.0", "@electron-forge/core-utils": "^7.1.0", diff --git a/packages/frontend/hooks/package.json b/packages/frontend/hooks/package.json index 8790d9f708..e4925ccd1a 100644 --- a/packages/frontend/hooks/package.json +++ b/packages/frontend/hooks/package.json @@ -19,12 +19,12 @@ "devDependencies": { "@affine/debug": "workspace:*", "@affine/env": "workspace:*", - "@blocksuite/block-std": "0.0.0-20231124123613-7c06e95d-nightly", - "@blocksuite/blocks": "0.0.0-20231124123613-7c06e95d-nightly", - "@blocksuite/editor": "0.0.0-20231124123613-7c06e95d-nightly", - "@blocksuite/global": "0.0.0-20231124123613-7c06e95d-nightly", - "@blocksuite/lit": "0.0.0-20231124123613-7c06e95d-nightly", - "@blocksuite/store": "0.0.0-20231124123613-7c06e95d-nightly", + "@blocksuite/block-std": "0.0.0-20231130092516-0f858b95-nightly", + "@blocksuite/blocks": "0.0.0-20231130092516-0f858b95-nightly", + "@blocksuite/editor": "0.0.0-20231130092516-0f858b95-nightly", + "@blocksuite/global": "0.0.0-20231130092516-0f858b95-nightly", + "@blocksuite/lit": "0.0.0-20231130092516-0f858b95-nightly", + "@blocksuite/store": "0.0.0-20231130092516-0f858b95-nightly", "@testing-library/react": "^14.0.0", "@types/image-blob-reduce": "^4.1.3", "@types/lodash.debounce": "^4.0.7", diff --git a/packages/frontend/hooks/src/use-block-suite-page-preview.ts b/packages/frontend/hooks/src/use-block-suite-page-preview.ts index 869e56b555..dc4837f845 100644 --- a/packages/frontend/hooks/src/use-block-suite-page-preview.ts +++ b/packages/frontend/hooks/src/use-block-suite-page-preview.ts @@ -60,7 +60,7 @@ export function useBlockSuitePagePreview(page: Page | null): Atom { page.slots.ready.on(() => { set(getPagePreviewText(page)); }), - page.slots.yUpdated.on(() => { + page.slots.blockUpdated.on(() => { set(getPagePreviewText(page)); }), ]; diff --git a/packages/frontend/hooks/src/use-block-suite-page-references.ts b/packages/frontend/hooks/src/use-block-suite-page-references.ts index 6b78117748..1c81d420db 100644 --- a/packages/frontend/hooks/src/use-block-suite-page-references.ts +++ b/packages/frontend/hooks/src/use-block-suite-page-references.ts @@ -5,12 +5,9 @@ import { useBlockSuiteWorkspacePage } from './use-block-suite-workspace-page'; const weakMap = new WeakMap>(); function getPageReferences(page: Page): string[] { - // todo: is there a way to use page indexer to get all references? - return ['affine:paragraph', 'affine:list', 'affine:database'] - .flatMap(f => page.getBlockByFlavour(f)) - .flatMap(b => b.text?.toDelta()) - .map(v => v?.attributes?.reference?.pageId) - .filter(Boolean); + return Object.values( + page.workspace.indexer.backlink.linkIndexMap[page.id] ?? {} + ).flatMap(linkNodes => linkNodes.map(linkNode => linkNode.pageId)); } const getPageReferencesAtom = (page: Page | null) => { @@ -25,7 +22,7 @@ const getPageReferencesAtom = (page: Page | null) => { page.slots.ready.on(() => { set(getPageReferences(page)); }), - page.slots.yUpdated.on(() => { + page.workspace.indexer.backlink.slots.indexUpdated.on(() => { set(getPageReferences(page)); }), ]; diff --git a/packages/frontend/workspace/src/manager/index.ts b/packages/frontend/workspace/src/manager/index.ts index 0c0daec087..bd1266e439 100644 --- a/packages/frontend/workspace/src/manager/index.ts +++ b/packages/frontend/workspace/src/manager/index.ts @@ -1,4 +1,3 @@ -import { isBrowser } from '@affine/env/constant'; import type { BlockSuiteFeatureFlags } from '@affine/env/global'; import { WorkspaceFlavour } from '@affine/env/workspace'; import { createAffinePublicProviders } from '@affine/workspace/providers'; @@ -25,10 +24,6 @@ function setEditorFlags(workspace: Workspace) { value ); }); - workspace.awarenessStore.setFlag( - 'enable_bookmark_operation', - environment.isDesktop - ); } type UpdateCallback = ( @@ -116,7 +111,6 @@ export function getOrCreateWorkspace( const workspace = new Workspace({ id, - isSSR: !isBrowser, providerCreators: typeof window === 'undefined' ? [] : providerCreators, blobStorages: [ () => ({ diff --git a/packages/frontend/workspace/src/providers/sync/__tests__/engine.spec.ts b/packages/frontend/workspace/src/providers/sync/__tests__/engine.spec.ts index 6e9028caa5..3436d8e896 100644 --- a/packages/frontend/workspace/src/providers/sync/__tests__/engine.spec.ts +++ b/packages/frontend/workspace/src/providers/sync/__tests__/engine.spec.ts @@ -25,7 +25,7 @@ describe('SyncEngine', () => { { const workspace = new Workspace({ id: 'test', - isSSR: true, + schema, }); @@ -57,7 +57,7 @@ describe('SyncEngine', () => { { const workspace = new Workspace({ id: 'test', - isSSR: true, + schema, }); const syncEngine = new SyncEngine( @@ -76,7 +76,7 @@ describe('SyncEngine', () => { { const workspace = new Workspace({ id: 'test', - isSSR: true, + schema, }); const syncEngine = new SyncEngine( @@ -95,7 +95,7 @@ describe('SyncEngine', () => { { const workspace = new Workspace({ id: 'test', - isSSR: true, + schema, }); const syncEngine = new SyncEngine( diff --git a/packages/frontend/workspace/src/providers/sync/__tests__/peer.spec.ts b/packages/frontend/workspace/src/providers/sync/__tests__/peer.spec.ts index db605a89a4..7711657c23 100644 --- a/packages/frontend/workspace/src/providers/sync/__tests__/peer.spec.ts +++ b/packages/frontend/workspace/src/providers/sync/__tests__/peer.spec.ts @@ -21,7 +21,7 @@ describe('SyncPeer', () => { { const workspace = new Workspace({ id: 'test', - isSSR: true, + schema, }); @@ -49,7 +49,7 @@ describe('SyncPeer', () => { { const workspace = new Workspace({ id: 'test', - isSSR: true, + schema, }); const syncPeer = new SyncPeer( @@ -67,7 +67,7 @@ describe('SyncPeer', () => { test('status', async () => { const workspace = new Workspace({ id: 'test - status', - isSSR: true, + schema, }); diff --git a/tests/affine-legacy/0.6.1-beta.1/package.json b/tests/affine-legacy/0.6.1-beta.1/package.json index 93313fd020..855dc5a483 100644 --- a/tests/affine-legacy/0.6.1-beta.1/package.json +++ b/tests/affine-legacy/0.6.1-beta.1/package.json @@ -9,10 +9,10 @@ "devDependencies": { "@affine-test/fixtures": "workspace:*", "@affine-test/kit": "workspace:*", - "@blocksuite/block-std": "0.0.0-20231124123613-7c06e95d-nightly", - "@blocksuite/blocks": "0.0.0-20231124123613-7c06e95d-nightly", - "@blocksuite/global": "0.0.0-20231124123613-7c06e95d-nightly", - "@blocksuite/store": "0.0.0-20231124123613-7c06e95d-nightly", + "@blocksuite/block-std": "0.0.0-20231130092516-0f858b95-nightly", + "@blocksuite/blocks": "0.0.0-20231130092516-0f858b95-nightly", + "@blocksuite/global": "0.0.0-20231130092516-0f858b95-nightly", + "@blocksuite/store": "0.0.0-20231130092516-0f858b95-nightly", "@playwright/test": "^1.39.0", "express": "^4.18.2", "http-proxy-middleware": "^3.0.0-beta.1", diff --git a/tests/affine-legacy/0.7.0-canary.18/package.json b/tests/affine-legacy/0.7.0-canary.18/package.json index 5cc05369dd..772734969f 100644 --- a/tests/affine-legacy/0.7.0-canary.18/package.json +++ b/tests/affine-legacy/0.7.0-canary.18/package.json @@ -9,10 +9,10 @@ "devDependencies": { "@affine-test/fixtures": "workspace:*", "@affine-test/kit": "workspace:*", - "@blocksuite/block-std": "0.0.0-20231124123613-7c06e95d-nightly", - "@blocksuite/blocks": "0.0.0-20231124123613-7c06e95d-nightly", - "@blocksuite/global": "0.0.0-20231124123613-7c06e95d-nightly", - "@blocksuite/store": "0.0.0-20231124123613-7c06e95d-nightly", + "@blocksuite/block-std": "0.0.0-20231130092516-0f858b95-nightly", + "@blocksuite/blocks": "0.0.0-20231130092516-0f858b95-nightly", + "@blocksuite/global": "0.0.0-20231130092516-0f858b95-nightly", + "@blocksuite/store": "0.0.0-20231130092516-0f858b95-nightly", "@playwright/test": "^1.39.0", "express": "^4.18.2", "http-proxy-middleware": "^3.0.0-beta.1", diff --git a/tests/affine-legacy/0.8.0-canary.7/package.json b/tests/affine-legacy/0.8.0-canary.7/package.json index 5288701014..ad256aa83f 100644 --- a/tests/affine-legacy/0.8.0-canary.7/package.json +++ b/tests/affine-legacy/0.8.0-canary.7/package.json @@ -9,10 +9,10 @@ "devDependencies": { "@affine-test/fixtures": "workspace:*", "@affine-test/kit": "workspace:*", - "@blocksuite/block-std": "0.0.0-20231124123613-7c06e95d-nightly", - "@blocksuite/blocks": "0.0.0-20231124123613-7c06e95d-nightly", - "@blocksuite/global": "0.0.0-20231124123613-7c06e95d-nightly", - "@blocksuite/store": "0.0.0-20231124123613-7c06e95d-nightly", + "@blocksuite/block-std": "0.0.0-20231130092516-0f858b95-nightly", + "@blocksuite/blocks": "0.0.0-20231130092516-0f858b95-nightly", + "@blocksuite/global": "0.0.0-20231130092516-0f858b95-nightly", + "@blocksuite/store": "0.0.0-20231130092516-0f858b95-nightly", "@playwright/test": "^1.39.0", "express": "^4.18.2", "http-proxy-middleware": "^3.0.0-beta.1", diff --git a/tests/affine-legacy/0.8.4/package.json b/tests/affine-legacy/0.8.4/package.json index 880b598e7d..37b326d295 100644 --- a/tests/affine-legacy/0.8.4/package.json +++ b/tests/affine-legacy/0.8.4/package.json @@ -9,10 +9,10 @@ "devDependencies": { "@affine-test/fixtures": "workspace:*", "@affine-test/kit": "workspace:*", - "@blocksuite/block-std": "0.0.0-20231124123613-7c06e95d-nightly", - "@blocksuite/blocks": "0.0.0-20231124123613-7c06e95d-nightly", - "@blocksuite/global": "0.0.0-20231124123613-7c06e95d-nightly", - "@blocksuite/store": "0.0.0-20231124123613-7c06e95d-nightly", + "@blocksuite/block-std": "0.0.0-20231130092516-0f858b95-nightly", + "@blocksuite/blocks": "0.0.0-20231130092516-0f858b95-nightly", + "@blocksuite/global": "0.0.0-20231130092516-0f858b95-nightly", + "@blocksuite/store": "0.0.0-20231130092516-0f858b95-nightly", "@playwright/test": "^1.39.0", "express": "^4.18.2", "http-proxy-middleware": "^3.0.0-beta.1", diff --git a/tests/affine-migration/package.json b/tests/affine-migration/package.json index d73916db6b..25b2094c89 100644 --- a/tests/affine-migration/package.json +++ b/tests/affine-migration/package.json @@ -7,10 +7,10 @@ "devDependencies": { "@affine-test/fixtures": "workspace:*", "@affine-test/kit": "workspace:*", - "@blocksuite/block-std": "0.0.0-20231124123613-7c06e95d-nightly", - "@blocksuite/blocks": "0.0.0-20231124123613-7c06e95d-nightly", - "@blocksuite/global": "0.0.0-20231124123613-7c06e95d-nightly", - "@blocksuite/store": "0.0.0-20231124123613-7c06e95d-nightly", + "@blocksuite/block-std": "0.0.0-20231130092516-0f858b95-nightly", + "@blocksuite/blocks": "0.0.0-20231130092516-0f858b95-nightly", + "@blocksuite/global": "0.0.0-20231130092516-0f858b95-nightly", + "@blocksuite/store": "0.0.0-20231130092516-0f858b95-nightly", "@playwright/test": "^1.39.0" }, "version": "0.10.3-canary.2" diff --git a/tests/storybook/package.json b/tests/storybook/package.json index 94ea1225aa..86dc8d01f8 100644 --- a/tests/storybook/package.json +++ b/tests/storybook/package.json @@ -31,14 +31,14 @@ "wait-on": "^7.2.0" }, "devDependencies": { - "@blocksuite/block-std": "0.0.0-20231124123613-7c06e95d-nightly", - "@blocksuite/blocks": "0.0.0-20231124123613-7c06e95d-nightly", - "@blocksuite/editor": "0.0.0-20231124123613-7c06e95d-nightly", - "@blocksuite/global": "0.0.0-20231124123613-7c06e95d-nightly", + "@blocksuite/block-std": "0.0.0-20231130092516-0f858b95-nightly", + "@blocksuite/blocks": "0.0.0-20231130092516-0f858b95-nightly", + "@blocksuite/editor": "0.0.0-20231130092516-0f858b95-nightly", + "@blocksuite/global": "0.0.0-20231130092516-0f858b95-nightly", "@blocksuite/icons": "2.1.36", - "@blocksuite/lit": "0.0.0-20231124123613-7c06e95d-nightly", - "@blocksuite/store": "0.0.0-20231124123613-7c06e95d-nightly", - "@blocksuite/virgo": "0.0.0-20231124123613-7c06e95d-nightly", + "@blocksuite/lit": "0.0.0-20231130092516-0f858b95-nightly", + "@blocksuite/store": "0.0.0-20231130092516-0f858b95-nightly", + "@blocksuite/virgo": "0.0.0-20231130092516-0f858b95-nightly", "@dnd-kit/sortable": "^8.0.0", "@tomfreudenberg/next-auth-mock": "^0.5.6", "chromatic": "^9.1.0", diff --git a/yarn.lock b/yarn.lock index 5aaabdcb44..b405502376 100644 --- a/yarn.lock +++ b/yarn.lock @@ -13,9 +13,9 @@ __metadata: linkType: hard "@adobe/css-tools@npm:^4.3.1": - version: 4.3.2 - resolution: "@adobe/css-tools@npm:4.3.2" - checksum: 973dcb7ba5141f57ec726ddec2e94e8947361bb0c5f0e8ebd1e8aa3a84b28e66db4ad843908825f99730d59784ff3c43868b014a7268676a65950cdb850c42cc + version: 4.3.1 + resolution: "@adobe/css-tools@npm:4.3.1" + checksum: 039a42ffdd41ecf3abcaf09c9fef0ffd634ccbe81c04002fc989e74564eba99bb19169a8f48dadf6442aa2c5c9f0925a7b27ec5c36a1ed1a3515fe77d6930996 languageName: node linkType: hard @@ -25,10 +25,10 @@ __metadata: dependencies: "@affine-test/fixtures": "workspace:*" "@affine-test/kit": "workspace:*" - "@blocksuite/block-std": "npm:0.0.0-20231124123613-7c06e95d-nightly" - "@blocksuite/blocks": "npm:0.0.0-20231124123613-7c06e95d-nightly" - "@blocksuite/global": "npm:0.0.0-20231124123613-7c06e95d-nightly" - "@blocksuite/store": "npm:0.0.0-20231124123613-7c06e95d-nightly" + "@blocksuite/block-std": "npm:0.0.0-20231130092516-0f858b95-nightly" + "@blocksuite/blocks": "npm:0.0.0-20231130092516-0f858b95-nightly" + "@blocksuite/global": "npm:0.0.0-20231130092516-0f858b95-nightly" + "@blocksuite/store": "npm:0.0.0-20231130092516-0f858b95-nightly" "@playwright/test": "npm:^1.39.0" express: "npm:^4.18.2" http-proxy-middleware: "npm:^3.0.0-beta.1" @@ -42,10 +42,10 @@ __metadata: dependencies: "@affine-test/fixtures": "workspace:*" "@affine-test/kit": "workspace:*" - "@blocksuite/block-std": "npm:0.0.0-20231124123613-7c06e95d-nightly" - "@blocksuite/blocks": "npm:0.0.0-20231124123613-7c06e95d-nightly" - "@blocksuite/global": "npm:0.0.0-20231124123613-7c06e95d-nightly" - "@blocksuite/store": "npm:0.0.0-20231124123613-7c06e95d-nightly" + "@blocksuite/block-std": "npm:0.0.0-20231130092516-0f858b95-nightly" + "@blocksuite/blocks": "npm:0.0.0-20231130092516-0f858b95-nightly" + "@blocksuite/global": "npm:0.0.0-20231130092516-0f858b95-nightly" + "@blocksuite/store": "npm:0.0.0-20231130092516-0f858b95-nightly" "@playwright/test": "npm:^1.39.0" express: "npm:^4.18.2" http-proxy-middleware: "npm:^3.0.0-beta.1" @@ -59,10 +59,10 @@ __metadata: dependencies: "@affine-test/fixtures": "workspace:*" "@affine-test/kit": "workspace:*" - "@blocksuite/block-std": "npm:0.0.0-20231124123613-7c06e95d-nightly" - "@blocksuite/blocks": "npm:0.0.0-20231124123613-7c06e95d-nightly" - "@blocksuite/global": "npm:0.0.0-20231124123613-7c06e95d-nightly" - "@blocksuite/store": "npm:0.0.0-20231124123613-7c06e95d-nightly" + "@blocksuite/block-std": "npm:0.0.0-20231130092516-0f858b95-nightly" + "@blocksuite/blocks": "npm:0.0.0-20231130092516-0f858b95-nightly" + "@blocksuite/global": "npm:0.0.0-20231130092516-0f858b95-nightly" + "@blocksuite/store": "npm:0.0.0-20231130092516-0f858b95-nightly" "@playwright/test": "npm:^1.39.0" express: "npm:^4.18.2" http-proxy-middleware: "npm:^3.0.0-beta.1" @@ -76,10 +76,10 @@ __metadata: dependencies: "@affine-test/fixtures": "workspace:*" "@affine-test/kit": "workspace:*" - "@blocksuite/block-std": "npm:0.0.0-20231124123613-7c06e95d-nightly" - "@blocksuite/blocks": "npm:0.0.0-20231124123613-7c06e95d-nightly" - "@blocksuite/global": "npm:0.0.0-20231124123613-7c06e95d-nightly" - "@blocksuite/store": "npm:0.0.0-20231124123613-7c06e95d-nightly" + "@blocksuite/block-std": "npm:0.0.0-20231130092516-0f858b95-nightly" + "@blocksuite/blocks": "npm:0.0.0-20231130092516-0f858b95-nightly" + "@blocksuite/global": "npm:0.0.0-20231130092516-0f858b95-nightly" + "@blocksuite/store": "npm:0.0.0-20231130092516-0f858b95-nightly" "@playwright/test": "npm:^1.39.0" express: "npm:^4.18.2" http-proxy-middleware: "npm:^3.0.0-beta.1" @@ -138,10 +138,10 @@ __metadata: dependencies: "@affine-test/fixtures": "workspace:*" "@affine-test/kit": "workspace:*" - "@blocksuite/block-std": "npm:0.0.0-20231124123613-7c06e95d-nightly" - "@blocksuite/blocks": "npm:0.0.0-20231124123613-7c06e95d-nightly" - "@blocksuite/global": "npm:0.0.0-20231124123613-7c06e95d-nightly" - "@blocksuite/store": "npm:0.0.0-20231124123613-7c06e95d-nightly" + "@blocksuite/block-std": "npm:0.0.0-20231130092516-0f858b95-nightly" + "@blocksuite/blocks": "npm:0.0.0-20231130092516-0f858b95-nightly" + "@blocksuite/global": "npm:0.0.0-20231130092516-0f858b95-nightly" + "@blocksuite/store": "npm:0.0.0-20231130092516-0f858b95-nightly" "@playwright/test": "npm:^1.39.0" languageName: unknown linkType: soft @@ -222,12 +222,12 @@ __metadata: "@affine/graphql": "workspace:*" "@affine/i18n": "workspace:*" "@affine/workspace": "workspace:*" - "@blocksuite/blocks": "npm:0.0.0-20231124123613-7c06e95d-nightly" - "@blocksuite/editor": "npm:0.0.0-20231124123613-7c06e95d-nightly" - "@blocksuite/global": "npm:0.0.0-20231124123613-7c06e95d-nightly" + "@blocksuite/blocks": "npm:0.0.0-20231130092516-0f858b95-nightly" + "@blocksuite/editor": "npm:0.0.0-20231130092516-0f858b95-nightly" + "@blocksuite/global": "npm:0.0.0-20231130092516-0f858b95-nightly" "@blocksuite/icons": "npm:2.1.36" - "@blocksuite/lit": "npm:0.0.0-20231124123613-7c06e95d-nightly" - "@blocksuite/store": "npm:0.0.0-20231124123613-7c06e95d-nightly" + "@blocksuite/lit": "npm:0.0.0-20231130092516-0f858b95-nightly" + "@blocksuite/store": "npm:0.0.0-20231130092516-0f858b95-nightly" "@dnd-kit/core": "npm:^6.0.8" "@dnd-kit/modifiers": "npm:^6.0.1" "@dnd-kit/sortable": "npm:^8.0.0" @@ -350,14 +350,14 @@ __metadata: "@affine/templates": "workspace:*" "@affine/workspace": "workspace:*" "@aws-sdk/client-s3": "npm:3.433.0" - "@blocksuite/block-std": "npm:0.0.0-20231124123613-7c06e95d-nightly" - "@blocksuite/blocks": "npm:0.0.0-20231124123613-7c06e95d-nightly" - "@blocksuite/editor": "npm:0.0.0-20231124123613-7c06e95d-nightly" - "@blocksuite/global": "npm:0.0.0-20231124123613-7c06e95d-nightly" + "@blocksuite/block-std": "npm:0.0.0-20231130092516-0f858b95-nightly" + "@blocksuite/blocks": "npm:0.0.0-20231130092516-0f858b95-nightly" + "@blocksuite/editor": "npm:0.0.0-20231130092516-0f858b95-nightly" + "@blocksuite/global": "npm:0.0.0-20231130092516-0f858b95-nightly" "@blocksuite/icons": "npm:2.1.36" - "@blocksuite/lit": "npm:0.0.0-20231124123613-7c06e95d-nightly" - "@blocksuite/store": "npm:0.0.0-20231124123613-7c06e95d-nightly" - "@blocksuite/virgo": "npm:0.0.0-20231124123613-7c06e95d-nightly" + "@blocksuite/lit": "npm:0.0.0-20231130092516-0f858b95-nightly" + "@blocksuite/store": "npm:0.0.0-20231130092516-0f858b95-nightly" + "@blocksuite/virgo": "npm:0.0.0-20231130092516-0f858b95-nightly" "@dnd-kit/core": "npm:^6.0.8" "@dnd-kit/sortable": "npm:^8.0.0" "@emotion/cache": "npm:^11.11.0" @@ -463,10 +463,10 @@ __metadata: "@affine/sdk": "workspace:*" "@affine/templates": "workspace:*" "@affine/vue-hello-world-plugin": "workspace:*" - "@blocksuite/blocks": "npm:0.0.0-20231124123613-7c06e95d-nightly" - "@blocksuite/editor": "npm:0.0.0-20231124123613-7c06e95d-nightly" - "@blocksuite/lit": "npm:0.0.0-20231124123613-7c06e95d-nightly" - "@blocksuite/store": "npm:0.0.0-20231124123613-7c06e95d-nightly" + "@blocksuite/blocks": "npm:0.0.0-20231130092516-0f858b95-nightly" + "@blocksuite/editor": "npm:0.0.0-20231130092516-0f858b95-nightly" + "@blocksuite/lit": "npm:0.0.0-20231130092516-0f858b95-nightly" + "@blocksuite/store": "npm:0.0.0-20231130092516-0f858b95-nightly" "@electron-forge/cli": "npm:^7.1.0" "@electron-forge/core": "npm:^7.1.0" "@electron-forge/core-utils": "npm:^7.1.0" @@ -514,8 +514,8 @@ __metadata: version: 0.0.0-use.local resolution: "@affine/env@workspace:packages/common/env" dependencies: - "@blocksuite/global": "npm:0.0.0-20231124123613-7c06e95d-nightly" - "@blocksuite/store": "npm:0.0.0-20231124123613-7c06e95d-nightly" + "@blocksuite/global": "npm:0.0.0-20231130092516-0f858b95-nightly" + "@blocksuite/store": "npm:0.0.0-20231130092516-0f858b95-nightly" lit: "npm:^3.0.2" react: "npm:18.2.0" react-dom: "npm:18.2.0" @@ -707,11 +707,11 @@ __metadata: version: 0.0.0-use.local resolution: "@affine/sdk@workspace:packages/common/sdk" dependencies: - "@blocksuite/block-std": "npm:0.0.0-20231124123613-7c06e95d-nightly" - "@blocksuite/blocks": "npm:0.0.0-20231124123613-7c06e95d-nightly" - "@blocksuite/editor": "npm:0.0.0-20231124123613-7c06e95d-nightly" - "@blocksuite/global": "npm:0.0.0-20231124123613-7c06e95d-nightly" - "@blocksuite/store": "npm:0.0.0-20231124123613-7c06e95d-nightly" + "@blocksuite/block-std": "npm:0.0.0-20231130092516-0f858b95-nightly" + "@blocksuite/blocks": "npm:0.0.0-20231130092516-0f858b95-nightly" + "@blocksuite/editor": "npm:0.0.0-20231130092516-0f858b95-nightly" + "@blocksuite/global": "npm:0.0.0-20231130092516-0f858b95-nightly" + "@blocksuite/store": "npm:0.0.0-20231130092516-0f858b95-nightly" jotai: "npm:^2.5.1" vite: "npm:^4.4.11" vite-plugin-dts: "npm:3.6.0" @@ -835,14 +835,14 @@ __metadata: dependencies: "@affine/component": "workspace:*" "@affine/i18n": "workspace:*" - "@blocksuite/block-std": "npm:0.0.0-20231124123613-7c06e95d-nightly" - "@blocksuite/blocks": "npm:0.0.0-20231124123613-7c06e95d-nightly" - "@blocksuite/editor": "npm:0.0.0-20231124123613-7c06e95d-nightly" - "@blocksuite/global": "npm:0.0.0-20231124123613-7c06e95d-nightly" + "@blocksuite/block-std": "npm:0.0.0-20231130092516-0f858b95-nightly" + "@blocksuite/blocks": "npm:0.0.0-20231130092516-0f858b95-nightly" + "@blocksuite/editor": "npm:0.0.0-20231130092516-0f858b95-nightly" + "@blocksuite/global": "npm:0.0.0-20231130092516-0f858b95-nightly" "@blocksuite/icons": "npm:2.1.36" - "@blocksuite/lit": "npm:0.0.0-20231124123613-7c06e95d-nightly" - "@blocksuite/store": "npm:0.0.0-20231124123613-7c06e95d-nightly" - "@blocksuite/virgo": "npm:0.0.0-20231124123613-7c06e95d-nightly" + "@blocksuite/lit": "npm:0.0.0-20231130092516-0f858b95-nightly" + "@blocksuite/store": "npm:0.0.0-20231130092516-0f858b95-nightly" + "@blocksuite/virgo": "npm:0.0.0-20231130092516-0f858b95-nightly" "@dnd-kit/sortable": "npm:^8.0.0" "@storybook/addon-actions": "npm:^7.5.3" "@storybook/addon-essentials": "npm:^7.5.3" @@ -4083,31 +4083,33 @@ __metadata: languageName: node linkType: hard -"@blocksuite/block-std@npm:0.0.0-20231124123613-7c06e95d-nightly": - version: 0.0.0-20231124123613-7c06e95d-nightly - resolution: "@blocksuite/block-std@npm:0.0.0-20231124123613-7c06e95d-nightly" +"@blocksuite/block-std@npm:0.0.0-20231130092516-0f858b95-nightly": + version: 0.0.0-20231130092516-0f858b95-nightly + resolution: "@blocksuite/block-std@npm:0.0.0-20231130092516-0f858b95-nightly" dependencies: - "@blocksuite/global": "npm:0.0.0-20231124123613-7c06e95d-nightly" + "@blocksuite/global": "npm:0.0.0-20231130092516-0f858b95-nightly" lz-string: "npm:^1.5.0" w3c-keyname: "npm:^2.2.8" zod: "npm:^3.22.4" peerDependencies: - "@blocksuite/store": 0.0.0-20231124123613-7c06e95d-nightly - checksum: c2fbfdc60c8a6e2c38b8b572522d70543ae89b66283d8e246b8058eb6c8de83ede739dcfd5df204434147eefadbf0aeabc0bd26eb064f2fb771b8bfc32fc5443 + "@blocksuite/store": 0.0.0-20231130092516-0f858b95-nightly + checksum: b530b86fb8f841b63d81a32ce8c76e4b1d02a6f9d48e809881300b9d5c6fe3ea7c047a86dcf662a14e73e794706e397e1091df2b8fcf61524d4934ade2830219 languageName: node linkType: hard -"@blocksuite/blocks@npm:0.0.0-20231124123613-7c06e95d-nightly": - version: 0.0.0-20231124123613-7c06e95d-nightly - resolution: "@blocksuite/blocks@npm:0.0.0-20231124123613-7c06e95d-nightly" +"@blocksuite/blocks@npm:0.0.0-20231130092516-0f858b95-nightly": + version: 0.0.0-20231130092516-0f858b95-nightly + resolution: "@blocksuite/blocks@npm:0.0.0-20231130092516-0f858b95-nightly" dependencies: - "@blocksuite/block-std": "npm:0.0.0-20231124123613-7c06e95d-nightly" - "@blocksuite/global": "npm:0.0.0-20231124123613-7c06e95d-nightly" - "@blocksuite/lit": "npm:0.0.0-20231124123613-7c06e95d-nightly" - "@blocksuite/store": "npm:0.0.0-20231124123613-7c06e95d-nightly" - "@blocksuite/virgo": "npm:0.0.0-20231124123613-7c06e95d-nightly" + "@blocksuite/block-std": "npm:0.0.0-20231130092516-0f858b95-nightly" + "@blocksuite/global": "npm:0.0.0-20231130092516-0f858b95-nightly" + "@blocksuite/lit": "npm:0.0.0-20231130092516-0f858b95-nightly" + "@blocksuite/store": "npm:0.0.0-20231130092516-0f858b95-nightly" + "@blocksuite/virgo": "npm:0.0.0-20231130092516-0f858b95-nightly" "@floating-ui/dom": "npm:^1.5.3" - "@toeverything/theme": "npm:^0.7.26" + "@toeverything/theme": "npm:^0.7.27" + "@types/hast": "npm:^3.0.3" + "@types/mdast": "npm:^4.0.2" "@types/webfontloader": "npm:^1.6.36" buffer: "npm:^6.0.3" date-fns: "npm:^2.30.0" @@ -4119,34 +4121,40 @@ __metadata: marked: "npm:^4.3.0" nanoid: "npm:^5.0.3" pdf-lib: "npm:^1.17.1" + rehype-parse: "npm:^9.0.0" + rehype-stringify: "npm:^10.0.0" + remark-gfm: "npm:^4.0.0" + remark-parse: "npm:^11.0.0" + remark-stringify: "npm:^11.0.0" shiki: "npm:^0.14.5" sortablejs: "npm:^1.15.0" + unified: "npm:^11.0.4" webfontloader: "npm:^1.6.28" zod: "npm:^3.22.4" - checksum: d08b8fae9fd7d5b64d1c0a7f2278ae71608848c9df16aa52be69818868e71ff0d1abf9bd082395e6ec3ccb97ea32e8e3f9483bfec46941105366125a4c2751f3 + checksum: 3cdaddea9e553ec00823eb5facaf774c9b17ec74b33ff58fa50c3c1730a6c679964168ebc9109f9f128f635d243bf642fc9931317a61fc9b01b7414e8567757e languageName: node linkType: hard -"@blocksuite/editor@npm:0.0.0-20231124123613-7c06e95d-nightly": - version: 0.0.0-20231124123613-7c06e95d-nightly - resolution: "@blocksuite/editor@npm:0.0.0-20231124123613-7c06e95d-nightly" +"@blocksuite/editor@npm:0.0.0-20231130092516-0f858b95-nightly": + version: 0.0.0-20231130092516-0f858b95-nightly + resolution: "@blocksuite/editor@npm:0.0.0-20231130092516-0f858b95-nightly" dependencies: - "@blocksuite/blocks": "npm:0.0.0-20231124123613-7c06e95d-nightly" - "@blocksuite/global": "npm:0.0.0-20231124123613-7c06e95d-nightly" - "@blocksuite/lit": "npm:0.0.0-20231124123613-7c06e95d-nightly" - "@blocksuite/store": "npm:0.0.0-20231124123613-7c06e95d-nightly" - "@toeverything/theme": "npm:^0.7.26" + "@blocksuite/blocks": "npm:0.0.0-20231130092516-0f858b95-nightly" + "@blocksuite/global": "npm:0.0.0-20231130092516-0f858b95-nightly" + "@blocksuite/lit": "npm:0.0.0-20231130092516-0f858b95-nightly" + "@blocksuite/store": "npm:0.0.0-20231130092516-0f858b95-nightly" + "@toeverything/theme": "npm:^0.7.27" lit: "npm:^3.0.2" - checksum: 9da41777250311c926c65a4d8812dc9b43709b3822859617542c6ea6afc5092df1a28d37c228e16c8d0089ff2565aadc3ff234f51429f9366e93b8c21bb4aaf3 + checksum: 57ea3318f351fa71357e66ae6e483f6db905a71cc1aeb980e8207c1f9219badc6fde9866d7ccec4b91457f51548c3ee13c019b381a332b814e5c7abcb296ec10 languageName: node linkType: hard -"@blocksuite/global@npm:0.0.0-20231124123613-7c06e95d-nightly": - version: 0.0.0-20231124123613-7c06e95d-nightly - resolution: "@blocksuite/global@npm:0.0.0-20231124123613-7c06e95d-nightly" +"@blocksuite/global@npm:0.0.0-20231130092516-0f858b95-nightly": + version: 0.0.0-20231130092516-0f858b95-nightly + resolution: "@blocksuite/global@npm:0.0.0-20231130092516-0f858b95-nightly" dependencies: zod: "npm:^3.22.4" - checksum: 739e00a63011212a9b74c6af913b6d6d73b3cf2b75fd8abd2680635bb295515f1634ae535334f10d10a8c670e641e5098040c8b5f9d77abdc900bcc058232d03 + checksum: 65099c1dfab920a85107091d272d12ac2dc5dab323011e95238220637ca9c6070320dcf1570edf25a6f39e591e98ccac490932f70a6b9d4a52e38fcd122cad22 languageName: node linkType: hard @@ -4160,57 +4168,52 @@ __metadata: languageName: node linkType: hard -"@blocksuite/lit@npm:0.0.0-20231124123613-7c06e95d-nightly": - version: 0.0.0-20231124123613-7c06e95d-nightly - resolution: "@blocksuite/lit@npm:0.0.0-20231124123613-7c06e95d-nightly" +"@blocksuite/lit@npm:0.0.0-20231130092516-0f858b95-nightly": + version: 0.0.0-20231130092516-0f858b95-nightly + resolution: "@blocksuite/lit@npm:0.0.0-20231130092516-0f858b95-nightly" dependencies: - "@blocksuite/global": "npm:0.0.0-20231124123613-7c06e95d-nightly" - "@blocksuite/virgo": "npm:0.0.0-20231124123613-7c06e95d-nightly" + "@blocksuite/global": "npm:0.0.0-20231130092516-0f858b95-nightly" + "@blocksuite/virgo": "npm:0.0.0-20231130092516-0f858b95-nightly" lit: "npm:^3.0.2" peerDependencies: - "@blocksuite/block-std": 0.0.0-20231124123613-7c06e95d-nightly - "@blocksuite/store": 0.0.0-20231124123613-7c06e95d-nightly - checksum: 8ce5fa1918cf1a39cb8922ba39a4c4248690350a258bf6fdae9f098de7ca9fd45762ee994781626bdea76a02697c2bb972044a02b33ab45f1aecec6ce94260e0 + "@blocksuite/block-std": 0.0.0-20231130092516-0f858b95-nightly + "@blocksuite/store": 0.0.0-20231130092516-0f858b95-nightly + checksum: 08d016c32e22eef507b5f634fdcf21782de19de0d408b130db404ef630e3aa62664a9c53673b932abe53bed56b89eba96851247ca097e1724554c58c1b33b3f7 languageName: node linkType: hard -"@blocksuite/store@npm:0.0.0-20231124123613-7c06e95d-nightly": - version: 0.0.0-20231124123613-7c06e95d-nightly - resolution: "@blocksuite/store@npm:0.0.0-20231124123613-7c06e95d-nightly" +"@blocksuite/store@npm:0.0.0-20231130092516-0f858b95-nightly": + version: 0.0.0-20231130092516-0f858b95-nightly + resolution: "@blocksuite/store@npm:0.0.0-20231130092516-0f858b95-nightly" dependencies: - "@blocksuite/global": "npm:0.0.0-20231124123613-7c06e95d-nightly" - "@blocksuite/virgo": "npm:0.0.0-20231124123613-7c06e95d-nightly" + "@blocksuite/global": "npm:0.0.0-20231130092516-0f858b95-nightly" + "@blocksuite/virgo": "npm:0.0.0-20231130092516-0f858b95-nightly" "@types/flexsearch": "npm:^0.7.3" - "@types/mdast": "npm:^4.0.2" flexsearch: "npm:0.7.21" idb-keyval: "npm:^6.2.1" lib0: "npm:^0.2.87" merge: "npm:^2.1.1" minimatch: "npm:^9.0.3" nanoid: "npm:^5.0.3" - remark-gfm: "npm:^4.0.0" - remark-parse: "npm:^11.0.0" - remark-stringify: "npm:^11.0.0" - unified: "npm:^11.0.4" y-protocols: "npm:^1.0.6" zod: "npm:^3.22.4" peerDependencies: async-call-rpc: ^6 yjs: ^13 - checksum: fb993b2db0f3720c972a341923a6215fb86d2cb48812cc8fc7aecdb04ba2b904236271d18d796e9a7a5eb1a303dc516f91bc78e76d8fa94af1cee3016fb68f73 + checksum: afbc8d10b737e66c6722e853074a9e895af6461922e2dea5f8be5e4f48f93007fe2bf66fc44453c6ccd4d47a02b2d533073d4f8f4936a36c0c40b0452ccb964e languageName: node linkType: hard -"@blocksuite/virgo@npm:0.0.0-20231124123613-7c06e95d-nightly": - version: 0.0.0-20231124123613-7c06e95d-nightly - resolution: "@blocksuite/virgo@npm:0.0.0-20231124123613-7c06e95d-nightly" +"@blocksuite/virgo@npm:0.0.0-20231130092516-0f858b95-nightly": + version: 0.0.0-20231130092516-0f858b95-nightly + resolution: "@blocksuite/virgo@npm:0.0.0-20231130092516-0f858b95-nightly" dependencies: - "@blocksuite/global": "npm:0.0.0-20231124123613-7c06e95d-nightly" + "@blocksuite/global": "npm:0.0.0-20231130092516-0f858b95-nightly" zod: "npm:^3.22.4" peerDependencies: lit: ^3.0.2 yjs: ^13 - checksum: 02732e5ff5c4206e23f473c467c5b786f646af6b67c44bb38f2faf70525513e9571c9b640ff8a20fba221968c0dfd5d05391761d57b297970b9d77eb3aa21b14 + checksum: fdf68e0e8328be3989e2be5dd5fb34d60117f9c5fdf5e01f97235dfdf943970e69daf6a2ea8dd83f5976c50296cdf8ec2b092aff793f803eff1e9825122ca891 languageName: node linkType: hard @@ -13143,12 +13146,12 @@ __metadata: dependencies: "@affine/debug": "workspace:*" "@affine/env": "workspace:*" - "@blocksuite/block-std": "npm:0.0.0-20231124123613-7c06e95d-nightly" - "@blocksuite/blocks": "npm:0.0.0-20231124123613-7c06e95d-nightly" - "@blocksuite/editor": "npm:0.0.0-20231124123613-7c06e95d-nightly" - "@blocksuite/global": "npm:0.0.0-20231124123613-7c06e95d-nightly" - "@blocksuite/lit": "npm:0.0.0-20231124123613-7c06e95d-nightly" - "@blocksuite/store": "npm:0.0.0-20231124123613-7c06e95d-nightly" + "@blocksuite/block-std": "npm:0.0.0-20231130092516-0f858b95-nightly" + "@blocksuite/blocks": "npm:0.0.0-20231130092516-0f858b95-nightly" + "@blocksuite/editor": "npm:0.0.0-20231130092516-0f858b95-nightly" + "@blocksuite/global": "npm:0.0.0-20231130092516-0f858b95-nightly" + "@blocksuite/lit": "npm:0.0.0-20231130092516-0f858b95-nightly" + "@blocksuite/store": "npm:0.0.0-20231130092516-0f858b95-nightly" "@testing-library/react": "npm:^14.0.0" "@types/image-blob-reduce": "npm:^4.1.3" "@types/lodash.debounce": "npm:^4.0.7" @@ -13196,11 +13199,11 @@ __metadata: "@affine-test/fixtures": "workspace:*" "@affine/sdk": "workspace:*" "@affine/templates": "workspace:*" - "@blocksuite/blocks": "npm:0.0.0-20231124123613-7c06e95d-nightly" - "@blocksuite/editor": "npm:0.0.0-20231124123613-7c06e95d-nightly" - "@blocksuite/global": "npm:0.0.0-20231124123613-7c06e95d-nightly" - "@blocksuite/lit": "npm:0.0.0-20231124123613-7c06e95d-nightly" - "@blocksuite/store": "npm:0.0.0-20231124123613-7c06e95d-nightly" + "@blocksuite/blocks": "npm:0.0.0-20231130092516-0f858b95-nightly" + "@blocksuite/editor": "npm:0.0.0-20231130092516-0f858b95-nightly" + "@blocksuite/global": "npm:0.0.0-20231130092516-0f858b95-nightly" + "@blocksuite/lit": "npm:0.0.0-20231130092516-0f858b95-nightly" + "@blocksuite/store": "npm:0.0.0-20231130092516-0f858b95-nightly" "@testing-library/react": "npm:^14.0.0" async-call-rpc: "npm:^6.3.1" electron: "link:../../frontend/electron/node_modules/electron" @@ -13238,7 +13241,7 @@ __metadata: languageName: unknown linkType: soft -"@toeverything/theme@npm:^0.7.20, @toeverything/theme@npm:^0.7.24, @toeverything/theme@npm:^0.7.26": +"@toeverything/theme@npm:^0.7.20, @toeverything/theme@npm:^0.7.24, @toeverything/theme@npm:^0.7.27": version: 0.7.27 resolution: "@toeverything/theme@npm:0.7.27" checksum: 9349d30256d33b5528441dbca09387819225449f97549585b92b33e354d7fbb3d0e5e35001c89b8a7e3033d8f51d3aee75ef9edaaf14fb7dd717dd66bfe96009 @@ -13249,8 +13252,8 @@ __metadata: version: 0.0.0-use.local resolution: "@toeverything/y-indexeddb@workspace:packages/common/y-indexeddb" dependencies: - "@blocksuite/blocks": "npm:0.0.0-20231124123613-7c06e95d-nightly" - "@blocksuite/store": "npm:0.0.0-20231124123613-7c06e95d-nightly" + "@blocksuite/blocks": "npm:0.0.0-20231130092516-0f858b95-nightly" + "@blocksuite/store": "npm:0.0.0-20231130092516-0f858b95-nightly" fake-indexeddb: "npm:^5.0.0" idb: "npm:^7.1.1" nanoid: "npm:^5.0.3" @@ -13738,6 +13741,15 @@ __metadata: languageName: node linkType: hard +"@types/hast@npm:^3.0.0, @types/hast@npm:^3.0.3": + version: 3.0.3 + resolution: "@types/hast@npm:3.0.3" + dependencies: + "@types/unist": "npm:*" + checksum: cf380cb351215847a598b06c10c0139a694fbb9a5cca27e7a836df4c9d616873ff5b01326530907b5a95b6a4b8fc928bcecb46424cc6f9bd1f53ba377f190d86 + languageName: node + linkType: hard + "@types/html-minifier-terser@npm:^6.0.0": version: 6.1.0 resolution: "@types/html-minifier-terser@npm:6.1.0" @@ -14553,7 +14565,7 @@ __metadata: languageName: node linkType: hard -"@ungap/structured-clone@npm:^1.2.0": +"@ungap/structured-clone@npm:^1.0.0, @ungap/structured-clone@npm:^1.2.0": version: 1.2.0 resolution: "@ungap/structured-clone@npm:1.2.0" checksum: c6fe89a505e513a7592e1438280db1c075764793a2397877ff1351721fe8792a966a5359769e30242b3cd023f2efb9e63ca2ca88019d73b564488cc20e3eab12 @@ -17159,6 +17171,13 @@ __metadata: languageName: node linkType: hard +"character-entities-html4@npm:^2.0.0": + version: 2.1.0 + resolution: "character-entities-html4@npm:2.1.0" + checksum: 7034aa7c7fa90309667f6dd50499c8a760c3d3a6fb159adb4e0bada0107d194551cdbad0714302f62d06ce4ed68565c8c2e15fdef2e8f8764eb63fa92b34b11d + languageName: node + linkType: hard + "character-entities-legacy@npm:^1.0.0": version: 1.1.4 resolution: "character-entities-legacy@npm:1.1.4" @@ -17166,6 +17185,13 @@ __metadata: languageName: node linkType: hard +"character-entities-legacy@npm:^3.0.0": + version: 3.0.0 + resolution: "character-entities-legacy@npm:3.0.0" + checksum: 7582af055cb488b626d364b7d7a4e46b06abd526fb63c0e4eb35bcb9c9799cc4f76b39f34fdccef2d1174ac95e53e9ab355aae83227c1a2505877893fce77731 + languageName: node + linkType: hard + "character-entities@npm:^1.0.0": version: 1.2.4 resolution: "character-entities@npm:1.2.4" @@ -17708,6 +17734,13 @@ __metadata: languageName: node linkType: hard +"comma-separated-tokens@npm:^2.0.0": + version: 2.0.3 + resolution: "comma-separated-tokens@npm:2.0.3" + checksum: e3bf9e0332a5c45f49b90e79bcdb4a7a85f28d6a6f0876a94f1bb9b2bfbdbbb9292aac50e1e742d8c0db1e62a0229a106f57917e2d067fca951d81737651700d + languageName: node + linkType: hard + "commander@npm:11.0.0": version: 11.0.0 resolution: "commander@npm:11.0.0" @@ -22409,6 +22442,36 @@ __metadata: languageName: node linkType: hard +"hast-util-from-html@npm:^2.0.0": + version: 2.0.1 + resolution: "hast-util-from-html@npm:2.0.1" + dependencies: + "@types/hast": "npm:^3.0.0" + devlop: "npm:^1.1.0" + hast-util-from-parse5: "npm:^8.0.0" + parse5: "npm:^7.0.0" + vfile: "npm:^6.0.0" + vfile-message: "npm:^4.0.0" + checksum: 5e8111c28fa4aa7cbb2d57b41bf4ff771641332c6e0704900367acbe0b3f5e5c432a82df80815d4fe91ac8137c264f72c8632fd7704992ebbddc6c0712b78582 + languageName: node + linkType: hard + +"hast-util-from-parse5@npm:^8.0.0": + version: 8.0.1 + resolution: "hast-util-from-parse5@npm:8.0.1" + dependencies: + "@types/hast": "npm:^3.0.0" + "@types/unist": "npm:^3.0.0" + devlop: "npm:^1.0.0" + hastscript: "npm:^8.0.0" + property-information: "npm:^6.0.0" + vfile: "npm:^6.0.0" + vfile-location: "npm:^5.0.0" + web-namespaces: "npm:^2.0.0" + checksum: d4105af849bebceac0a641a5f4611a43eeb4b94f9d3958ce6cbbb069dd177edefb9cd31a210689bc9cca9a30db984d622bdf898aed44a2ea99560d81023b0e2d + languageName: node + linkType: hard + "hast-util-parse-selector@npm:^2.0.0": version: 2.2.5 resolution: "hast-util-parse-selector@npm:2.2.5" @@ -22416,6 +22479,80 @@ __metadata: languageName: node linkType: hard +"hast-util-parse-selector@npm:^4.0.0": + version: 4.0.0 + resolution: "hast-util-parse-selector@npm:4.0.0" + dependencies: + "@types/hast": "npm:^3.0.0" + checksum: 76087670d3b0b50b23a6cb70bca53a6176d6608307ccdbb3ed18b650b82e7c3513bfc40348f1389dc0c5ae872b9a768851f4335f44654abd7deafd6974c52402 + languageName: node + linkType: hard + +"hast-util-raw@npm:^9.0.0": + version: 9.0.1 + resolution: "hast-util-raw@npm:9.0.1" + dependencies: + "@types/hast": "npm:^3.0.0" + "@types/unist": "npm:^3.0.0" + "@ungap/structured-clone": "npm:^1.0.0" + hast-util-from-parse5: "npm:^8.0.0" + hast-util-to-parse5: "npm:^8.0.0" + html-void-elements: "npm:^3.0.0" + mdast-util-to-hast: "npm:^13.0.0" + parse5: "npm:^7.0.0" + unist-util-position: "npm:^5.0.0" + unist-util-visit: "npm:^5.0.0" + vfile: "npm:^6.0.0" + web-namespaces: "npm:^2.0.0" + zwitch: "npm:^2.0.0" + checksum: b89a198ec3a3786cef08beac500d27f948124d0f2795e079f775f16c38506719157b9b5cc9a0c781c705b6eff7f66d692f55f0aa5e88530d4ba81e21ca653248 + languageName: node + linkType: hard + +"hast-util-to-html@npm:^9.0.0": + version: 9.0.0 + resolution: "hast-util-to-html@npm:9.0.0" + dependencies: + "@types/hast": "npm:^3.0.0" + "@types/unist": "npm:^3.0.0" + ccount: "npm:^2.0.0" + comma-separated-tokens: "npm:^2.0.0" + hast-util-raw: "npm:^9.0.0" + hast-util-whitespace: "npm:^3.0.0" + html-void-elements: "npm:^3.0.0" + mdast-util-to-hast: "npm:^13.0.0" + property-information: "npm:^6.0.0" + space-separated-tokens: "npm:^2.0.0" + stringify-entities: "npm:^4.0.0" + zwitch: "npm:^2.0.4" + checksum: 4bfa78b681135b9303743b34d7139328ff5dc412a1f6bd372e83192413fd86a5d7e8d55eab4eeb2cd561878218eec07a57df1f92cf0f3272756830738611708a + languageName: node + linkType: hard + +"hast-util-to-parse5@npm:^8.0.0": + version: 8.0.0 + resolution: "hast-util-to-parse5@npm:8.0.0" + dependencies: + "@types/hast": "npm:^3.0.0" + comma-separated-tokens: "npm:^2.0.0" + devlop: "npm:^1.0.0" + property-information: "npm:^6.0.0" + space-separated-tokens: "npm:^2.0.0" + web-namespaces: "npm:^2.0.0" + zwitch: "npm:^2.0.0" + checksum: ba59d0913ba7e914d8b0a50955c06806a6868445c56796ac9129d58185e86d7ff24037246767aba2ea904d9dee8c09b8ff303630bcd854431fdc1bbee2164c36 + languageName: node + linkType: hard + +"hast-util-whitespace@npm:^3.0.0": + version: 3.0.0 + resolution: "hast-util-whitespace@npm:3.0.0" + dependencies: + "@types/hast": "npm:^3.0.0" + checksum: 8c7e9eeb8131fc18702f3a42623eb6b0b09d470347aa8badacac70e6d91f79657ab8c6b57c4c6fee3658cff405fac30e816d1cdfb3ed1fbf6045d0a4555cf4d4 + languageName: node + linkType: hard + "hastscript@npm:^6.0.0": version: 6.0.0 resolution: "hastscript@npm:6.0.0" @@ -22429,6 +22566,19 @@ __metadata: languageName: node linkType: hard +"hastscript@npm:^8.0.0": + version: 8.0.0 + resolution: "hastscript@npm:8.0.0" + dependencies: + "@types/hast": "npm:^3.0.0" + comma-separated-tokens: "npm:^2.0.0" + hast-util-parse-selector: "npm:^4.0.0" + property-information: "npm:^6.0.0" + space-separated-tokens: "npm:^2.0.0" + checksum: cdc3477968ee0161c39615a650203e592d03bbd9a2a0e1d78d37f544fcf8c30f55fcf9e6d27c4372a89fdebeae756452f19c7f5b655a162d54524b39b2dfe0fe + languageName: node + linkType: hard + "he@npm:^1.2.0": version: 1.2.0 resolution: "he@npm:1.2.0" @@ -22595,6 +22745,13 @@ __metadata: languageName: node linkType: hard +"html-void-elements@npm:^3.0.0": + version: 3.0.0 + resolution: "html-void-elements@npm:3.0.0" + checksum: 59be397525465a7489028afa064c55763d9cccd1d7d9f630cca47137317f0e897a9ca26cef7e745e7cff1abc44260cfa407742b243a54261dfacd42230e94fce + languageName: node + linkType: hard + "html-webpack-plugin@npm:^5.5.3": version: 5.5.3 resolution: "html-webpack-plugin@npm:5.5.3" @@ -26427,6 +26584,22 @@ __metadata: languageName: node linkType: hard +"mdast-util-to-hast@npm:^13.0.0": + version: 13.0.2 + resolution: "mdast-util-to-hast@npm:13.0.2" + dependencies: + "@types/hast": "npm:^3.0.0" + "@types/mdast": "npm:^4.0.0" + "@ungap/structured-clone": "npm:^1.0.0" + devlop: "npm:^1.0.0" + micromark-util-sanitize-uri: "npm:^2.0.0" + trim-lines: "npm:^3.0.0" + unist-util-position: "npm:^5.0.0" + unist-util-visit: "npm:^5.0.0" + checksum: 6f91926ca59bc1b048a0f82c21ba6355f7352c3793442c43e3f93ac895af0b9f85881b7a461d23aeed0fbe16d695b419106a48075c79e3b6008fef75ca43a571 + languageName: node + linkType: hard + "mdast-util-to-markdown@npm:^1.0.0, mdast-util-to-markdown@npm:^1.3.0": version: 1.5.0 resolution: "mdast-util-to-markdown@npm:1.5.0" @@ -30286,6 +30459,13 @@ __metadata: languageName: node linkType: hard +"property-information@npm:^6.0.0": + version: 6.4.0 + resolution: "property-information@npm:6.4.0" + checksum: 853302c207586fa26b11c104d0cf1f832d079adda52985fae901eee8c0c1f3d1c3105f3306f5655614f5017f34d0a46664573f5e9d97b108629b1b8f1bf7f110 + languageName: node + linkType: hard + "protobufjs@npm:^7.0.0, protobufjs@npm:^7.2.3, protobufjs@npm:^7.2.4": version: 7.2.5 resolution: "protobufjs@npm:7.2.5" @@ -31281,6 +31461,28 @@ __metadata: languageName: node linkType: hard +"rehype-parse@npm:^9.0.0": + version: 9.0.0 + resolution: "rehype-parse@npm:9.0.0" + dependencies: + "@types/hast": "npm:^3.0.0" + hast-util-from-html: "npm:^2.0.0" + unified: "npm:^11.0.0" + checksum: fe35d7745d7266269f230eed81474e92bda43bd367a01d900926201bb1005e775bcbed9bbba117bd125cab49cf7ac922258927890abffabc96348ce681266372 + languageName: node + linkType: hard + +"rehype-stringify@npm:^10.0.0": + version: 10.0.0 + resolution: "rehype-stringify@npm:10.0.0" + dependencies: + "@types/hast": "npm:^3.0.0" + hast-util-to-html: "npm:^9.0.0" + unified: "npm:^11.0.0" + checksum: d5cf4e0951f5fa6a65c69479fbe974f1b75298170de2c4618e0e91cceba6a52c6094926e26c9501252120572f3daba02fb6d09436cc483282b0b647f1d970b66 + languageName: node + linkType: hard + "relateurl@npm:^0.2.7": version: 0.2.7 resolution: "relateurl@npm:0.2.7" @@ -32566,6 +32768,13 @@ __metadata: languageName: node linkType: hard +"space-separated-tokens@npm:^2.0.0": + version: 2.0.2 + resolution: "space-separated-tokens@npm:2.0.2" + checksum: 202e97d7ca1ba0758a0aa4fe226ff98142073bcceeff2da3aad037968878552c3bbce3b3231970025375bbba5aee00c5b8206eda408da837ab2dc9c0f26be990 + languageName: node + linkType: hard + "spawn-command@npm:0.0.2": version: 0.0.2 resolution: "spawn-command@npm:0.0.2" @@ -32997,6 +33206,16 @@ __metadata: languageName: node linkType: hard +"stringify-entities@npm:^4.0.0": + version: 4.0.3 + resolution: "stringify-entities@npm:4.0.3" + dependencies: + character-entities-html4: "npm:^2.0.0" + character-entities-legacy: "npm:^3.0.0" + checksum: 3dc827fbcc9b5feb252d942a21caca89297272d857260448174ca264018726308b48e02ad492f89a2b5faebf7241be56f5a4d9cbf050cfaf5db607d6e5ceb9e7 + languageName: node + linkType: hard + "strip-ansi-cjs@npm:strip-ansi@^6.0.1, strip-ansi@npm:^6.0.0, strip-ansi@npm:^6.0.1": version: 6.0.1 resolution: "strip-ansi@npm:6.0.1" @@ -33839,6 +34058,13 @@ __metadata: languageName: node linkType: hard +"trim-lines@npm:^3.0.0": + version: 3.0.1 + resolution: "trim-lines@npm:3.0.1" + checksum: 7a1325e4ce8ff7e9e52007600e9c9862a166d0db1f1cf0c9357e359e410acab1278fcd91cc279dfa5123fc37b69f080de02f471e91dbbc61b155b9ca92597929 + languageName: node + linkType: hard + "trim-newlines@npm:^3.0.0": version: 3.0.1 resolution: "trim-newlines@npm:3.0.1" @@ -34340,6 +34566,15 @@ __metadata: languageName: node linkType: hard +"unist-util-position@npm:^5.0.0": + version: 5.0.0 + resolution: "unist-util-position@npm:5.0.0" + dependencies: + "@types/unist": "npm:^3.0.0" + checksum: 89d4da00e74618d7562ac7ac288961df9bcd4ccca6df3b5a90650f018eceb6b95de6e771e88bdbef46cc9d96861d456abe57b7ad1108921e0feb67c6292aa29d + languageName: node + linkType: hard + "unist-util-stringify-position@npm:^3.0.0": version: 3.0.3 resolution: "unist-util-stringify-position@npm:3.0.3" @@ -34827,6 +35062,16 @@ __metadata: languageName: node linkType: hard +"vfile-location@npm:^5.0.0": + version: 5.0.2 + resolution: "vfile-location@npm:5.0.2" + dependencies: + "@types/unist": "npm:^3.0.0" + vfile: "npm:^6.0.0" + checksum: b61c048cedad3555b4f007f390412c6503f58a6a130b58badf4ee340c87e0d7421e9c86bbc1494c57dedfccadb60f5176cc60ba3098209d99fb3a3d8804e4c38 + languageName: node + linkType: hard + "vfile-message@npm:^3.0.0": version: 3.1.4 resolution: "vfile-message@npm:3.1.4" @@ -35299,6 +35544,13 @@ __metadata: languageName: node linkType: hard +"web-namespaces@npm:^2.0.0": + version: 2.0.1 + resolution: "web-namespaces@npm:2.0.1" + checksum: b6d9f02f1a43d0ef0848a812d89c83801d5bbad57d8bb61f02eb6d7eb794c3736f6cc2e1191664bb26136594c8218ac609f4069722c6f56d9fc2d808fa9271c6 + languageName: node + linkType: hard + "web-streams-polyfill@npm:4.0.0-beta.3": version: 4.0.0-beta.3 resolution: "web-streams-polyfill@npm:4.0.0-beta.3" @@ -35949,7 +36201,7 @@ __metadata: version: 0.0.0-use.local resolution: "y-provider@workspace:packages/common/y-provider" dependencies: - "@blocksuite/store": "npm:0.0.0-20231124123613-7c06e95d-nightly" + "@blocksuite/store": "npm:0.0.0-20231130092516-0f858b95-nightly" vite: "npm:^4.4.11" vite-plugin-dts: "npm:3.6.0" vitest: "npm:0.34.6" @@ -36178,7 +36430,7 @@ __metadata: languageName: node linkType: hard -"zwitch@npm:^2.0.0": +"zwitch@npm:^2.0.0, zwitch@npm:^2.0.4": version: 2.0.4 resolution: "zwitch@npm:2.0.4" checksum: f22ec5fc2d5f02c423c93d35cdfa83573a3a3bd98c66b927c368ea4d0e7252a500df2a90a6b45522be536a96a73404393c958e945fdba95e6832c200791702b6 From 56b37c481e21b3f969a34281867df410b86b061f Mon Sep 17 00:00:00 2001 From: LongYinan Date: Mon, 4 Dec 2023 14:59:50 +0000 Subject: [PATCH 12/68] chore: bump @adobe/css-tools from 4.3.1 to 4.3.2 (#5181) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bumps [@adobe/css-tools](https://github.com/adobe/css-tools) from 4.3.1 to 4.3.2.
    Changelog

    Sourced from @​adobe/css-tools's changelog.

    4.3.2 / 2023-11-28

    • Fix redos vulnerability with specific crafted css string - CVE-2023-48631
    • Fix Problem parsing with :is() and nested :nth-child() #211
    Commits

    [![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=@adobe/css-tools&package-manager=npm_and_yarn&previous-version=4.3.1&new-version=4.3.2)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) ---
    Dependabot commands and options
    You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot show ignore conditions` will show all of the ignore conditions of the specified dependency - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself) You can disable automated security fix PRs for this repo from the [Security Alerts page](https://github.com/toeverything/AFFiNE/network/alerts).
    --- yarn.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/yarn.lock b/yarn.lock index b405502376..e21843c0a4 100644 --- a/yarn.lock +++ b/yarn.lock @@ -13,9 +13,9 @@ __metadata: linkType: hard "@adobe/css-tools@npm:^4.3.1": - version: 4.3.1 - resolution: "@adobe/css-tools@npm:4.3.1" - checksum: 039a42ffdd41ecf3abcaf09c9fef0ffd634ccbe81c04002fc989e74564eba99bb19169a8f48dadf6442aa2c5c9f0925a7b27ec5c36a1ed1a3515fe77d6930996 + version: 4.3.2 + resolution: "@adobe/css-tools@npm:4.3.2" + checksum: 973dcb7ba5141f57ec726ddec2e94e8947361bb0c5f0e8ebd1e8aa3a84b28e66db4ad843908825f99730d59784ff3c43868b014a7268676a65950cdb850c42cc languageName: node linkType: hard From a9b021bafe4a8a9a65371f503dda2a335a82fee7 Mon Sep 17 00:00:00 2001 From: LongYinan Date: Tue, 5 Dec 2023 00:47:40 +0000 Subject: [PATCH 13/68] ci: use renovate to replace dependabot since depedabot has never worked (#5182) https://github.com/toeverything/AFFiNE/network/updates/757631626 dependabot update jobs keep timeout --- .github/dependabot.yml | 31 --------------------------- .github/renovate.json | 48 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 48 insertions(+), 31 deletions(-) delete mode 100644 .github/dependabot.yml create mode 100644 .github/renovate.json diff --git a/.github/dependabot.yml b/.github/dependabot.yml deleted file mode 100644 index 5df6aa4e2d..0000000000 --- a/.github/dependabot.yml +++ /dev/null @@ -1,31 +0,0 @@ -version: 2 -updates: - - package-ecosystem: 'npm' - directory: '/' - groups: - all-npm-dependencies: - patterns: - - '*' - schedule: - interval: 'weekly' - versioning-strategy: increase - commit-message: - prefix: 'chore' - - package-ecosystem: 'cargo' - directory: '/' - schedule: - interval: 'weekly' - versioning-strategy: auto - commit-message: - prefix: 'chore' - groups: - all-cargo-dependencies: - patterns: - - '*' - - - package-ecosystem: 'github-actions' - directory: '/' - schedule: - interval: 'daily' - commit-message: - prefix: 'ci' diff --git a/.github/renovate.json b/.github/renovate.json new file mode 100644 index 0000000000..a8adf93761 --- /dev/null +++ b/.github/renovate.json @@ -0,0 +1,48 @@ +{ + "$schema": "https://docs.renovatebot.com/renovate-schema.json", + "extends": [ + "config:base", + "group:allNonMajor", + ":preserveSemverRanges", + ":disablePeerDependencies" + ], + "labels": ["dependencies"], + "packageRules": [ + { + "matchPackageNames": ["napi", "napi-build", "napi-derive"], + "groupName": "napi-rs" + }, + { + "matchPackagePatterns": ["^eslint", "^@typescript-eslint"], + "groupName": "linter" + }, + { + "matchPackagePatterns": ["^@nestjs"], + "groupName": "nestjs" + }, + { + "matchPackagePatterns": ["^@opentelemetry"], + "groupName": "opentelemetry" + }, + { + "matchPackageNames": [ + "@prisma/client", + "@prisma/instrumentation", + "prisma" + ], + "groupName": "prisma" + }, + { + "matchPackagePatterns": ["^@blocksuite"], + "followTag": "nightly" + } + ], + "commitMessagePrefix": "chore: ", + "commitMessageAction": "bump up", + "commitMessageTopic": "{{depName}} version", + "ignoreDeps": [], + "lockFileMaintenance": { + "enabled": true, + "extends": ["schedule:weekly"] + } +} From eb93ae04e08ab9df99220df2286c89b868c0b3c6 Mon Sep 17 00:00:00 2001 From: LongYinan Date: Tue, 5 Dec 2023 02:45:55 +0000 Subject: [PATCH 14/68] ci: exclude @blocksuite/icons from blocksuite nightly update group (#5184) --- .github/renovate.json | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/renovate.json b/.github/renovate.json index a8adf93761..da069e0438 100644 --- a/.github/renovate.json +++ b/.github/renovate.json @@ -34,6 +34,7 @@ }, { "matchPackagePatterns": ["^@blocksuite"], + "excludePackageNames": ["@blocksuite/icons"], "followTag": "nightly" } ], From 9e8668de6b6bb5ae375ad73c19c6733d68245345 Mon Sep 17 00:00:00 2001 From: LongYinan Date: Tue, 5 Dec 2023 03:27:36 +0000 Subject: [PATCH 15/68] ci: add electron-forge deps group (#5185) --- .github/renovate.json | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/renovate.json b/.github/renovate.json index da069e0438..74771bc859 100644 --- a/.github/renovate.json +++ b/.github/renovate.json @@ -32,6 +32,10 @@ ], "groupName": "prisma" }, + { + "matchPackagePatterns": ["^@electron-forge"], + "groupName": "electron-forge" + }, { "matchPackagePatterns": ["^@blocksuite"], "excludePackageNames": ["@blocksuite/icons"], From f3e717ee5ff6186a681f4f48cf910dc016b13d3d Mon Sep 17 00:00:00 2001 From: LongYinan Date: Tue, 5 Dec 2023 03:46:24 +0000 Subject: [PATCH 16/68] chore: bump up @opentelemetry/instrumentation-ioredis version to ^0.36.0 (#5186) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [@opentelemetry/instrumentation-ioredis](https://togithub.com/open-telemetry/opentelemetry-js-contrib/tree/main/plugins/node/opentelemetry-instrumentation-ioredis#readme) ([source](https://togithub.com/open-telemetry/opentelemetry-js-contrib)) | [`^0.35.3` -> `^0.36.0`](https://renovatebot.com/diffs/npm/@opentelemetry%2finstrumentation-ioredis/0.35.3/0.36.0) | [![age](https://developer.mend.io/api/mc/badges/age/npm/@opentelemetry%2finstrumentation-ioredis/0.36.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/@opentelemetry%2finstrumentation-ioredis/0.36.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/@opentelemetry%2finstrumentation-ioredis/0.35.3/0.36.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/@opentelemetry%2finstrumentation-ioredis/0.35.3/0.36.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes
    open-telemetry/opentelemetry-js-contrib (@​opentelemetry/instrumentation-ioredis) ### [`v0.36.0`](https://togithub.com/open-telemetry/opentelemetry-js-contrib/compare/607d375595da3ab51b7f773ac360900121c4361b...a757b5e443dfe1dade090aeb11ec37d0e802f8af) [Compare Source](https://togithub.com/open-telemetry/opentelemetry-js-contrib/compare/607d375595da3ab51b7f773ac360900121c4361b...a757b5e443dfe1dade090aeb11ec37d0e802f8af)
    --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://developer.mend.io/github/toeverything/AFFiNE). --- packages/backend/server/package.json | 2 +- yarn.lock | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/backend/server/package.json b/packages/backend/server/package.json index 301b2599fc..d67f6e9fe1 100644 --- a/packages/backend/server/package.json +++ b/packages/backend/server/package.json @@ -45,7 +45,7 @@ "@opentelemetry/instrumentation": "^0.45.1", "@opentelemetry/instrumentation-graphql": "^0.36.0", "@opentelemetry/instrumentation-http": "^0.45.1", - "@opentelemetry/instrumentation-ioredis": "^0.35.3", + "@opentelemetry/instrumentation-ioredis": "^0.36.0", "@opentelemetry/instrumentation-nestjs-core": "^0.33.3", "@opentelemetry/instrumentation-socket.io": "^0.34.3", "@opentelemetry/resources": "^1.18.1", diff --git a/yarn.lock b/yarn.lock index e21843c0a4..a9fc0ad416 100644 --- a/yarn.lock +++ b/yarn.lock @@ -754,7 +754,7 @@ __metadata: "@opentelemetry/instrumentation": "npm:^0.45.1" "@opentelemetry/instrumentation-graphql": "npm:^0.36.0" "@opentelemetry/instrumentation-http": "npm:^0.45.1" - "@opentelemetry/instrumentation-ioredis": "npm:^0.35.3" + "@opentelemetry/instrumentation-ioredis": "npm:^0.36.0" "@opentelemetry/instrumentation-nestjs-core": "npm:^0.33.3" "@opentelemetry/instrumentation-socket.io": "npm:^0.34.3" "@opentelemetry/resources": "npm:^1.18.1" @@ -8881,9 +8881,9 @@ __metadata: languageName: node linkType: hard -"@opentelemetry/instrumentation-ioredis@npm:^0.35.3": - version: 0.35.3 - resolution: "@opentelemetry/instrumentation-ioredis@npm:0.35.3" +"@opentelemetry/instrumentation-ioredis@npm:^0.36.0": + version: 0.36.0 + resolution: "@opentelemetry/instrumentation-ioredis@npm:0.36.0" dependencies: "@opentelemetry/instrumentation": "npm:^0.45.1" "@opentelemetry/redis-common": "npm:^0.36.1" @@ -8891,7 +8891,7 @@ __metadata: "@types/ioredis4": "npm:@types/ioredis@^4.28.10" peerDependencies: "@opentelemetry/api": ^1.3.0 - checksum: 25cb843ef0315751cae577fa6cf275d0eaae1d7bffa2c723e25ad140e9a505cfef0297db12069b5ed685e6907392e3b048c016691e48a9c49a66001ff16cd9b8 + checksum: c9f07ad9d51eb5aabadb3b190b6810ad28ab58a15ec371ca6e910739ae922c86658bc90127b466c038858f3dd206f6a5e2f51a025d10f92a7f28ee81055b6390 languageName: node linkType: hard From 1dacb21178c60e72fd165eedf6ea74d575450f8a Mon Sep 17 00:00:00 2001 From: LongYinan Date: Tue, 5 Dec 2023 04:05:28 +0000 Subject: [PATCH 17/68] chore: bump up @dnd-kit/modifiers version to v7 (#5189) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [@dnd-kit/modifiers](https://togithub.com/clauderic/dnd-kit) ([source](https://togithub.com/clauderic/dnd-kit/tree/HEAD/packages/modifiers)) | [`^6.0.1` -> `^7.0.0`](https://renovatebot.com/diffs/npm/@dnd-kit%2fmodifiers/6.0.1/7.0.0) | [![age](https://developer.mend.io/api/mc/badges/age/npm/@dnd-kit%2fmodifiers/7.0.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/@dnd-kit%2fmodifiers/7.0.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/@dnd-kit%2fmodifiers/6.0.1/7.0.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/@dnd-kit%2fmodifiers/6.0.1/7.0.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes
    clauderic/dnd-kit (@​dnd-kit/modifiers) ### [`v7.0.0`](https://togithub.com/clauderic/dnd-kit/blob/HEAD/packages/modifiers/CHANGELOG.md#700) [Compare Source](https://togithub.com/clauderic/dnd-kit/compare/@dnd-kit/modifiers@6.0.1...@dnd-kit/modifiers@7.0.0) ##### Patch Changes - Updated dependencies \[[`bc588c7`](https://togithub.com/clauderic/dnd-kit/commit/bc588c7f7b1124514b2834e14f9dad29ce49c8ce), [`b417f0f`](https://togithub.com/clauderic/dnd-kit/commit/b417f0f94bfd8097bdf34eec27b7051dc0f5aa2a), [`f342d5e`](https://togithub.com/clauderic/dnd-kit/commit/f342d5efd98507f173b6a170b35bee1545d40311)]: - [@​dnd-kit/core](https://togithub.com/dnd-kit/core)[@​6](https://togithub.com/6).1.0 - [@​dnd-kit/utilities](https://togithub.com/dnd-kit/utilities)[@​3](https://togithub.com/3).2.2
    --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://developer.mend.io/github/toeverything/AFFiNE). --- packages/frontend/component/package.json | 2 +- yarn.lock | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/packages/frontend/component/package.json b/packages/frontend/component/package.json index d759a03e96..308a849bdd 100644 --- a/packages/frontend/component/package.json +++ b/packages/frontend/component/package.json @@ -24,7 +24,7 @@ "@affine/i18n": "workspace:*", "@affine/workspace": "workspace:*", "@dnd-kit/core": "^6.0.8", - "@dnd-kit/modifiers": "^6.0.1", + "@dnd-kit/modifiers": "^7.0.0", "@dnd-kit/sortable": "^8.0.0", "@emotion/cache": "^11.11.0", "@emotion/react": "^11.11.1", diff --git a/yarn.lock b/yarn.lock index a9fc0ad416..d425929acd 100644 --- a/yarn.lock +++ b/yarn.lock @@ -229,7 +229,7 @@ __metadata: "@blocksuite/lit": "npm:0.0.0-20231130092516-0f858b95-nightly" "@blocksuite/store": "npm:0.0.0-20231130092516-0f858b95-nightly" "@dnd-kit/core": "npm:^6.0.8" - "@dnd-kit/modifiers": "npm:^6.0.1" + "@dnd-kit/modifiers": "npm:^7.0.0" "@dnd-kit/sortable": "npm:^8.0.0" "@emotion/cache": "npm:^11.11.0" "@emotion/react": "npm:^11.11.1" @@ -4560,16 +4560,16 @@ __metadata: languageName: node linkType: hard -"@dnd-kit/modifiers@npm:^6.0.1": - version: 6.0.1 - resolution: "@dnd-kit/modifiers@npm:6.0.1" +"@dnd-kit/modifiers@npm:^7.0.0": + version: 7.0.0 + resolution: "@dnd-kit/modifiers@npm:7.0.0" dependencies: - "@dnd-kit/utilities": "npm:^3.2.1" + "@dnd-kit/utilities": "npm:^3.2.2" tslib: "npm:^2.0.0" peerDependencies: - "@dnd-kit/core": ^6.0.6 + "@dnd-kit/core": ^6.1.0 react: ">=16.8.0" - checksum: fd9b444a6777494bf631fab1fa902172066509c7b060dad2ef53f893590c8a70da9b50c4e5bdba551fe614ff4828cf9f51c8d94f922ff4f275175994f25d0ea2 + checksum: 9ee0b7b86c23c15f6820d76ec398724597abc9d9e31cf58836e7f0b9935e33f9136a60ee9600eb27818447623f07786d4fed3f1d685d9cc6d860d8f6c5354ae3 languageName: node linkType: hard @@ -4586,7 +4586,7 @@ __metadata: languageName: node linkType: hard -"@dnd-kit/utilities@npm:^3.2.1, @dnd-kit/utilities@npm:^3.2.2": +"@dnd-kit/utilities@npm:^3.2.2": version: 3.2.2 resolution: "@dnd-kit/utilities@npm:3.2.2" dependencies: From 2b7c6714eb4b0548cf7063c62210676406f34911 Mon Sep 17 00:00:00 2001 From: LongYinan Date: Tue, 5 Dec 2023 04:26:32 +0000 Subject: [PATCH 18/68] chore: bump up Helm release postgresql to v13 (#5190) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Update | Change | |---|---|---| | [postgresql](https://bitnami.com) ([source](https://togithub.com/bitnami/charts/tree/HEAD/bitnami/postgresql)) | major | `12.5.8` -> `13.2.23` | --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://developer.mend.io/github/toeverything/AFFiNE). --- .github/helm/affine-cloud/Chart.lock | 6 +++--- .github/helm/affine-cloud/Chart.yaml | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/helm/affine-cloud/Chart.lock b/.github/helm/affine-cloud/Chart.lock index e43c19b00a..211ccfd106 100644 --- a/.github/helm/affine-cloud/Chart.lock +++ b/.github/helm/affine-cloud/Chart.lock @@ -1,6 +1,6 @@ dependencies: - name: postgresql repository: https://charts.bitnami.com/bitnami - version: 12.5.8 -digest: sha256:c91c0dc1370e879538dc9d6e435e731a726ef99d6a3b081372318483792b48a7 -generated: "2023-06-27T18:34:12.683806+08:00" + version: 13.2.23 +digest: sha256:5b64538509bd067bb0f67bf082847a2c5d66dc37d0b9d7948a40405d9c446400 +generated: "2023-12-05T03:04:57.997927753Z" diff --git a/.github/helm/affine-cloud/Chart.yaml b/.github/helm/affine-cloud/Chart.yaml index 7eea4ee1af..18465fef65 100644 --- a/.github/helm/affine-cloud/Chart.yaml +++ b/.github/helm/affine-cloud/Chart.yaml @@ -8,5 +8,5 @@ appVersion: '0.6.1' dependencies: - name: postgresql - version: 12.5.8 + version: 13.2.23 repository: https://charts.bitnami.com/bitnami From 56ace4822607c389224ba3c0c4ea667595b15d2b Mon Sep 17 00:00:00 2001 From: Anthony Date: Tue, 5 Dec 2023 14:18:21 +0800 Subject: [PATCH 19/68] feat: add new page to the sidebar #5095 (#5128) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: 李华桥 --- .../components/reference-page.tsx | 4 +- .../favorite/add-favourite-button.tsx | 44 ++++++++++++++++--- .../e2e/local-first-favorites-items.spec.ts | 2 +- 3 files changed, 42 insertions(+), 8 deletions(-) diff --git a/packages/frontend/core/src/components/pure/workspace-slider-bar/components/reference-page.tsx b/packages/frontend/core/src/components/pure/workspace-slider-bar/components/reference-page.tsx index 12f7233c1e..7ffe6c1e0c 100644 --- a/packages/frontend/core/src/components/pure/workspace-slider-bar/components/reference-page.tsx +++ b/packages/frontend/core/src/components/pure/workspace-slider-bar/components/reference-page.tsx @@ -1,7 +1,7 @@ import { MenuLinkItem } from '@affine/component/app-sidebar'; import { useAFFiNEI18N } from '@affine/i18n/hooks'; import { EdgelessIcon, PageIcon } from '@blocksuite/icons'; -import type { PageMeta, Workspace } from '@blocksuite/store'; +import { type PageMeta, type Workspace } from '@blocksuite/store'; import * as Collapsible from '@radix-ui/react-collapsible'; import { useBlockSuitePageReferences } from '@toeverything/hooks/use-block-suite-page-references'; import { useAtomValue } from 'jotai/react'; @@ -9,6 +9,7 @@ import { useMemo, useState } from 'react'; import { useParams } from 'react-router-dom'; import { pageSettingFamily } from '../../../../atoms'; +import { AddFavouriteButton } from '../favorite/add-favourite-button'; import * as styles from '../favorite/styles.css'; interface ReferencePageProps { workspace: Workspace; @@ -54,6 +55,7 @@ export const ReferencePage = ({ icon={icon} collapsed={collapsible ? collapsed : undefined} onCollapsedChange={setCollapsed} + postfix={} > {metaMapping[pageId]?.title || t['Untitled']()} diff --git a/packages/frontend/core/src/components/pure/workspace-slider-bar/favorite/add-favourite-button.tsx b/packages/frontend/core/src/components/pure/workspace-slider-bar/favorite/add-favourite-button.tsx index 4db8ff54b3..05bb8dd869 100644 --- a/packages/frontend/core/src/components/pure/workspace-slider-bar/favorite/add-favourite-button.tsx +++ b/packages/frontend/core/src/components/pure/workspace-slider-bar/favorite/add-favourite-button.tsx @@ -8,16 +8,48 @@ import { usePageHelper } from '../../../blocksuite/block-suite-page-list/utils'; type AddFavouriteButtonProps = { workspace: Workspace; + pageId?: string; }; -export const AddFavouriteButton = ({ workspace }: AddFavouriteButtonProps) => { +export const AddFavouriteButton = ({ + workspace, + pageId, +}: AddFavouriteButtonProps) => { const { createPage } = usePageHelper(workspace); const { setPageMeta } = usePageMetaHelper(workspace); - const handleAddFavorite = useAsyncCallback(async () => { - const page = createPage(); - await page.waitForLoaded(); - setPageMeta(page.id, { favorite: true }); - }, [createPage, setPageMeta]); + const handleAddFavorite = useAsyncCallback( + async e => { + if (pageId) { + e.stopPropagation(); + e.preventDefault(); + const page = createPage(); + await page.load(); + const parentPage = workspace.getPage(pageId); + if (parentPage) { + await parentPage.load(); + const text = parentPage.Text.fromDelta([ + { + insert: ' ', + attributes: { + reference: { + type: 'LinkedPage', + pageId: page.id, + }, + }, + }, + ]); + const [frame] = parentPage.getBlockByFlavour('affine:note'); + frame && parentPage.addBlock('affine:paragraph', { text }, frame.id); + setPageMeta(page.id, {}); + } + } else { + const page = createPage(); + await page.load(); + setPageMeta(page.id, { favorite: true }); + } + }, + [createPage, setPageMeta, workspace, pageId] + ); return ( { await openHomePage(page); await waitForEditorLoad(page); - await page.getByTestId('slider-bar-add-favorite-button').click(); + await page.getByTestId('slider-bar-add-favorite-button').first().click(); await waitForEditorLoad(page); // enter random page title From e4c6db2d0230696fc30abd96db7c261606355515 Mon Sep 17 00:00:00 2001 From: LongYinan Date: Tue, 5 Dec 2023 06:19:00 +0000 Subject: [PATCH 20/68] chore: bump up ava version to v6 (#5195) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [ava](https://avajs.dev) ([source](https://togithub.com/avajs/ava)) | [`^5.3.1` -> `^6.0.0`](https://renovatebot.com/diffs/npm/ava/5.3.1/6.0.0) | [![age](https://developer.mend.io/api/mc/badges/age/npm/ava/6.0.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/ava/6.0.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/ava/5.3.1/6.0.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/ava/5.3.1/6.0.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes
    avajs/ava (ava) ### [`v6.0.0`](https://togithub.com/avajs/ava/releases/tag/v6.0.0) [Compare Source](https://togithub.com/avajs/ava/compare/v5.3.1...v6.0.0) #### Breaking Changes - AVA now requires Node.js versions 18.18, 20.8 or 21. Versions 14 and 16 are no longer supported. [#​3251](https://togithub.com/avajs/ava/issues/3251) [#​3216](https://togithub.com/avajs/ava/issues/3216) - When tests finish, worker threads or child processes are no longer exited through `proces.exit()`. If your test file does not exit on its own, the test run will time out. [#​3260](https://togithub.com/avajs/ava/issues/3260) - Changes to watch mode [#​3218](https://togithub.com/avajs/ava/issues/3218): - Watch mode can no longer be started via the `ava.config.*` or `package.json` configuration. - The `ignoredByWatcher` configuration has moved to the `watchMode` object, under the `ignoreChanges` key. - Watch mode now uses the built-in [`fs.watch()`](https://nodejs.org/api/fs.html#fswatchfilename-options-listener) in recursive mode. This is supported on Linux in Node.js 20 or newer, and MacOS and Windows in Node.js 18 as well. There are [caveats](https://nodejs.org/api/fs.html#caveats) to keep in mind. - Failed assertions now throw, meaning that any subsequent code is not executed. This also impacts the type definitions. [#​3246](https://togithub.com/avajs/ava/issues/3246) - [Only native errors](https://nodejs.org/api/util.html#utiltypesisnativeerrorvalue) are now considered errors by the `t.throws()` and `t.throwsAsync()` assertions. [`Object.create(Error.prototype)` is **not** a native error](Object.create\(Error.prototype\)). [#​3229](https://togithub.com/avajs/ava/issues/3229) - Changes to modules loaded through the `require` configuration [#​3184](https://togithub.com/avajs/ava/issues/3184): - If such modules export a default function, this function is now invoked. - Local files are loaded through `@ava/typescript` if necessary. #### Improvements ##### Rewritten watcher The watcher has been rewritten. It’s now built on [`fs.watch()`](https://nodejs.org/api/fs.html#fswatchfilename-options-listener) in recursive mode. [`@vercel/nft`](https://togithub.com/vercel/nft) is used to perform static dependency analysis, supporting ESM and CJS imports for JavaScript & TypeScript source files. This is a huge improvement over the previous runtime tracking of CJS imports, which did not support ESM. Integration with [`@ava/typescript`](https://togithub.com/avajs/typescript) has been improved. The watcher can now detect a change to a TypeScript source file, then wait for the corresponding build output to change before re-running tests. The ignoredByWatcher configuration has moved to the watchMode object, under the ignoreChanges key. See [#​3218](https://togithub.com/avajs/ava/issues/3218) and [#​3257](https://togithub.com/avajs/ava/issues/3257). ##### Failed assertions now throw Assertions now throw a `TestFailure` error when they fail. This error is not exported or documented and should not be used or thrown manually. You cannot catch this error in order to recover from a failure, use `t.try()` instead. All assertions except for `t.throws()` and `t.throwsAsync()` now return `true` when they pass. This is useful for some of the assertions in TypeScript where they can be used as a type guard. Committing a failed `t.try()` result now also throws. See [#​3246](https://togithub.com/avajs/ava/issues/3246). ##### `t.throws()` and `t.throwsAsync()` can now expect any error By default, the thrown error (or rejection reason) must be a native error. You can change the assertion to expect any kind of error by setting `any: true` in the expectation object: ```js t.throws(() => { throw 'error' }, {any: true}) ``` See [#​3245](https://togithub.com/avajs/ava/issues/3245) by [@​adiSuper94](https://togithub.com/adiSuper94). ##### The `require` configuration is now more powerful It now loads ES modules. Local files are loaded through `@ava/typescript` if necessary, so you can also write these in TypeScript. If there is a default export function, it is invoked after loading. The function is awaited so it can do asynchronous setup before further modules are loaded. Arguments from the configuration can be passed to the function (as a \[[structured clone](https://developer.mozilla.org/en-US/docs/Web/API/structuredClone)]\(https://developer.mozilla.org/en-US/docs/Web/API/structuredClone)). See [#​3184](https://togithub.com/avajs/ava/issues/3184) by [@​sculpt0r](https://togithub.com/sculpt0r). ##### Other changes worth noting - Internal events can now be observed (experimentally). See [#​3247](https://togithub.com/avajs/ava/issues/3247) by [@​codetheweb](https://togithub.com/codetheweb). It’s experimental and undocumented. - You can now use `t.timeout.clear()` to restore a previous `t.timeout()`. [#​3221](https://togithub.com/avajs/ava/issues/3221) - Code coverage is flushed to disk at opportune moments. [#​3220](https://togithub.com/avajs/ava/issues/3220) #### New Contributors - [@​sculpt0r](https://togithub.com/sculpt0r) made their first contribution in [https://github.com/avajs/ava/pull/3184](https://togithub.com/avajs/ava/pull/3184) - [@​ZachHaber](https://togithub.com/ZachHaber) made their first contribution in [https://github.com/avajs/ava/pull/3233](https://togithub.com/avajs/ava/pull/3233) - [@​adiSuper94](https://togithub.com/adiSuper94) made their first contribution in [https://github.com/avajs/ava/pull/3245](https://togithub.com/avajs/ava/pull/3245) - [@​bricker](https://togithub.com/bricker) made their first contribution in [https://github.com/avajs/ava/pull/3250](https://togithub.com/avajs/ava/pull/3250) **Full Changelog**: https://github.com/avajs/ava/compare/v5.3.1...v6.0.0
    --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://developer.mend.io/github/toeverything/AFFiNE). --- packages/backend/server/package.json | 2 +- packages/frontend/native/package.json | 2 +- yarn.lock | 464 ++++++++++++++++---------- 3 files changed, 292 insertions(+), 176 deletions(-) diff --git a/packages/backend/server/package.json b/packages/backend/server/package.json index d67f6e9fe1..d39a8f9cc7 100644 --- a/packages/backend/server/package.json +++ b/packages/backend/server/package.json @@ -102,7 +102,7 @@ "@types/sinon": "^17.0.2", "@types/supertest": "^2.0.16", "@types/ws": "^8.5.10", - "ava": "^5.3.1", + "ava": "^6.0.0", "c8": "^8.0.1", "nodemon": "^3.0.1", "sinon": "^17.0.1", diff --git a/packages/frontend/native/package.json b/packages/frontend/native/package.json index 0805113456..517d362ff2 100644 --- a/packages/frontend/native/package.json +++ b/packages/frontend/native/package.json @@ -38,7 +38,7 @@ "@napi-rs/cli": "^2.16.5", "@types/node": "^20.9.3", "@types/uuid": "^9.0.7", - "ava": "^5.3.1", + "ava": "^6.0.0", "cross-env": "^7.0.3", "nx": "^17.1.3", "nx-cloud": "^16.5.2", diff --git a/yarn.lock b/yarn.lock index d425929acd..a4c7f422b6 100644 --- a/yarn.lock +++ b/yarn.lock @@ -659,7 +659,7 @@ __metadata: "@napi-rs/cli": "npm:^2.16.5" "@types/node": "npm:^20.9.3" "@types/uuid": "npm:^9.0.7" - ava: "npm:^5.3.1" + ava: "npm:^6.0.0" cross-env: "npm:^7.0.3" nx: "npm:^17.1.3" nx-cloud: "npm:^16.5.2" @@ -777,7 +777,7 @@ __metadata: "@types/sinon": "npm:^17.0.2" "@types/supertest": "npm:^2.0.16" "@types/ws": "npm:^8.5.10" - ava: "npm:^5.3.1" + ava: "npm:^6.0.0" c8: "npm:^8.0.1" cookie-parser: "npm:^1.4.6" dotenv: "npm:^16.3.1" @@ -7280,6 +7280,25 @@ __metadata: languageName: node linkType: hard +"@mapbox/node-pre-gyp@npm:^1.0.5": + version: 1.0.11 + resolution: "@mapbox/node-pre-gyp@npm:1.0.11" + dependencies: + detect-libc: "npm:^2.0.0" + https-proxy-agent: "npm:^5.0.0" + make-dir: "npm:^3.1.0" + node-fetch: "npm:^2.6.7" + nopt: "npm:^5.0.0" + npmlog: "npm:^5.0.1" + rimraf: "npm:^3.0.2" + semver: "npm:^7.3.5" + tar: "npm:^6.1.11" + bin: + node-pre-gyp: bin/node-pre-gyp + checksum: 59529a2444e44fddb63057152452b00705aa58059079191126c79ac1388ae4565625afa84ed4dd1bf017d1111ab6e47907f7c5192e06d83c9496f2f3e708680a + languageName: node + linkType: hard + "@marsidev/react-turnstile@npm:^0.3.1": version: 0.3.2 resolution: "@marsidev/react-turnstile@npm:0.3.2" @@ -10797,6 +10816,16 @@ __metadata: languageName: node linkType: hard +"@rollup/pluginutils@npm:^4.0.0": + version: 4.2.1 + resolution: "@rollup/pluginutils@npm:4.2.1" + dependencies: + estree-walker: "npm:^2.0.1" + picomatch: "npm:^2.2.2" + checksum: 503a6f0a449e11a2873ac66cfdfb9a3a0b77ffa84c5cad631f5e4bc1063c850710e8d5cd5dab52477c0d66cda2ec719865726dbe753318cd640bab3fff7ca476 + languageName: node + linkType: hard + "@rollup/pluginutils@npm:^5.0.2, @rollup/pluginutils@npm:^5.0.5": version: 5.0.5 resolution: "@rollup/pluginutils@npm:5.0.5" @@ -11081,6 +11110,13 @@ __metadata: languageName: node linkType: hard +"@sindresorhus/merge-streams@npm:^1.0.0": + version: 1.0.0 + resolution: "@sindresorhus/merge-streams@npm:1.0.0" + checksum: 453c2a28164113a5ec4fd23ba636e291a4112f6ee9e91cd5476b9a96e0fc9ee5ff40d405fe81bbf284c9773b7ed718a3a0f31df7895a0efd413b1f9775d154fe + languageName: node + linkType: hard + "@sinonjs/commons@npm:^2.0.0": version: 2.0.0 resolution: "@sinonjs/commons@npm:2.0.0" @@ -14676,6 +14712,27 @@ __metadata: languageName: node linkType: hard +"@vercel/nft@npm:^0.24.4": + version: 0.24.4 + resolution: "@vercel/nft@npm:0.24.4" + dependencies: + "@mapbox/node-pre-gyp": "npm:^1.0.5" + "@rollup/pluginutils": "npm:^4.0.0" + acorn: "npm:^8.6.0" + async-sema: "npm:^3.1.1" + bindings: "npm:^1.4.0" + estree-walker: "npm:2.0.2" + glob: "npm:^7.1.3" + graceful-fs: "npm:^4.2.9" + micromatch: "npm:^4.0.2" + node-gyp-build: "npm:^4.2.2" + resolve-from: "npm:^5.0.0" + bin: + nft: out/cli.js + checksum: e6614ff91854fd3989e1116dbedca46c9937f1f2086fc4acf8d52d42e1cc13c192fb81d9f6efbdbe19f706565c3a09952e47de96df999be96d6b8a9ff088c41c + languageName: node + linkType: hard + "@vitejs/plugin-react-swc@npm:^3.5.0": version: 3.5.0 resolution: "@vitejs/plugin-react-swc@npm:3.5.0" @@ -15414,7 +15471,7 @@ __metadata: languageName: node linkType: hard -"acorn-walk@npm:^8.1.1, acorn-walk@npm:^8.2.0": +"acorn-walk@npm:^8.1.1, acorn-walk@npm:^8.2.0, acorn-walk@npm:^8.3.0": version: 8.3.0 resolution: "acorn-walk@npm:8.3.0" checksum: 7673f342db939adc16ac3596c374a56be33e6ef84e01dfb3a0b50cc87cf9b8e46d84c337dcd7d5644f75bf219ad5a36bf33795e9f1af15298e6bceacf46c5f1f @@ -15430,7 +15487,7 @@ __metadata: languageName: node linkType: hard -"acorn@npm:^8.10.0, acorn@npm:^8.11.2, acorn@npm:^8.4.1, acorn@npm:^8.7.1, acorn@npm:^8.8.0, acorn@npm:^8.8.1, acorn@npm:^8.8.2, acorn@npm:^8.9.0": +"acorn@npm:^8.10.0, acorn@npm:^8.11.2, acorn@npm:^8.4.1, acorn@npm:^8.6.0, acorn@npm:^8.7.1, acorn@npm:^8.8.0, acorn@npm:^8.8.1, acorn@npm:^8.8.2, acorn@npm:^8.9.0": version: 8.11.2 resolution: "acorn@npm:8.11.2" bin: @@ -15490,16 +15547,6 @@ __metadata: languageName: node linkType: hard -"aggregate-error@npm:^4.0.0": - version: 4.0.1 - resolution: "aggregate-error@npm:4.0.1" - dependencies: - clean-stack: "npm:^4.0.0" - indent-string: "npm:^5.0.0" - checksum: bb3ffdfd13447800fff237c2cba752c59868ee669104bb995dfbbe0b8320e967d679e683dabb640feb32e4882d60258165cde0baafc4cd467cc7d275a13ad6b5 - languageName: node - linkType: hard - "ajv-formats@npm:^2.1.1": version: 2.1.1 resolution: "ajv-formats@npm:2.1.1" @@ -15750,6 +15797,16 @@ __metadata: languageName: node linkType: hard +"are-we-there-yet@npm:^2.0.0": + version: 2.0.0 + resolution: "are-we-there-yet@npm:2.0.0" + dependencies: + delegates: "npm:^1.0.0" + readable-stream: "npm:^3.6.0" + checksum: ea6f47d14fc33ae9cbea3e686eeca021d9d7b9db83a306010dd04ad5f2c8b7675291b127d3fcbfcbd8fec26e47b3324ad5b469a6cc3733a582f2fe4e12fc6756 + languageName: node + linkType: hard + "are-we-there-yet@npm:^3.0.0": version: 3.0.1 resolution: "are-we-there-yet@npm:3.0.1" @@ -16029,6 +16086,13 @@ __metadata: languageName: node linkType: hard +"async-sema@npm:^3.1.1": + version: 3.1.1 + resolution: "async-sema@npm:3.1.1" + checksum: ee0225c2e7b72ae76d66157499f61a881a050824019edc54fa6ec789313076790729557556fbbe237af0083173c66fb2edf1c9cc45c522c5f846b66c0a94ddb3 + languageName: node + linkType: hard + "async-validator@npm:^4.2.5": version: 4.2.5 resolution: "async-validator@npm:4.2.5" @@ -16078,49 +16142,46 @@ __metadata: languageName: node linkType: hard -"ava@npm:^5.3.1": - version: 5.3.1 - resolution: "ava@npm:5.3.1" +"ava@npm:^6.0.0": + version: 6.0.0 + resolution: "ava@npm:6.0.0" dependencies: - acorn: "npm:^8.8.2" - acorn-walk: "npm:^8.2.0" + "@vercel/nft": "npm:^0.24.4" + acorn: "npm:^8.11.2" + acorn-walk: "npm:^8.3.0" ansi-styles: "npm:^6.2.1" arrgv: "npm:^1.0.2" arrify: "npm:^3.0.0" - callsites: "npm:^4.0.0" - cbor: "npm:^8.1.0" - chalk: "npm:^5.2.0" - chokidar: "npm:^3.5.3" + callsites: "npm:^4.1.0" + cbor: "npm:^9.0.1" + chalk: "npm:^5.3.0" chunkd: "npm:^2.0.1" - ci-info: "npm:^3.8.0" + ci-info: "npm:^4.0.0" ci-parallel-vars: "npm:^1.0.1" - clean-yaml-object: "npm:^0.1.0" - cli-truncate: "npm:^3.1.0" + cli-truncate: "npm:^4.0.0" code-excerpt: "npm:^4.0.0" common-path-prefix: "npm:^3.0.0" concordance: "npm:^5.0.4" currently-unhandled: "npm:^0.4.1" debug: "npm:^4.3.4" emittery: "npm:^1.0.1" - figures: "npm:^5.0.0" - globby: "npm:^13.1.4" + figures: "npm:^6.0.1" + globby: "npm:^14.0.0" ignore-by-default: "npm:^2.1.0" indent-string: "npm:^5.0.0" - is-error: "npm:^2.2.2" is-plain-object: "npm:^5.0.0" is-promise: "npm:^4.0.0" matcher: "npm:^5.0.0" - mem: "npm:^9.0.2" + memoize: "npm:^10.0.0" ms: "npm:^2.1.3" - p-event: "npm:^5.0.1" - p-map: "npm:^5.5.0" - picomatch: "npm:^2.3.1" - pkg-conf: "npm:^4.0.0" + p-map: "npm:^6.0.0" + package-config: "npm:^5.0.0" + picomatch: "npm:^3.0.1" plur: "npm:^5.1.0" pretty-ms: "npm:^8.0.0" resolve-cwd: "npm:^3.0.0" stack-utils: "npm:^2.0.6" - strip-ansi: "npm:^7.0.1" + strip-ansi: "npm:^7.1.0" supertap: "npm:^3.0.1" temp-dir: "npm:^3.0.0" write-file-atomic: "npm:^5.0.1" @@ -16132,7 +16193,7 @@ __metadata: optional: true bin: ava: entrypoints/cli.mjs - checksum: 4b59259471b5c9b5e8952db65c5231ce0d906f339d4afa9c9f19927a2e9db1e1b7d4e414082381a3554e6607c36df60762f7cc26ff501a215bc6bac939dc9e77 + checksum: 95b85827b1df666f9159371b22a09706776cd66de67ed2f33bbfd830ce5431fead87ecedae979036049d122aa6de9556b8bd0354d051b3dbae39b684e1fe8a0c languageName: node linkType: hard @@ -16492,6 +16553,15 @@ __metadata: languageName: node linkType: hard +"bindings@npm:^1.4.0": + version: 1.5.0 + resolution: "bindings@npm:1.5.0" + dependencies: + file-uri-to-path: "npm:1.0.0" + checksum: 593d5ae975ffba15fbbb4788fe5abd1e125afbab849ab967ab43691d27d6483751805d98cb92f7ac24a2439a8a8678cd0131c535d5d63de84e383b0ce2786133 + languageName: node + linkType: hard + "bintrees@npm:1.0.2": version: 1.0.2 resolution: "bintrees@npm:1.0.2" @@ -16936,7 +17006,7 @@ __metadata: languageName: node linkType: hard -"callsites@npm:^4.0.0": +"callsites@npm:^4.1.0": version: 4.1.0 resolution: "callsites@npm:4.1.0" checksum: 4ad31de7b7615fa25bdab9c2373865209d2d5190f895cdf2e2f518bd1dafa7ebcda2e6e9cc9640f2dfde6b3893d82fa4359a78ffc27baad2503227553c6882fa @@ -17034,12 +17104,12 @@ __metadata: languageName: node linkType: hard -"cbor@npm:^8.1.0": - version: 8.1.0 - resolution: "cbor@npm:8.1.0" +"cbor@npm:^9.0.1": + version: 9.0.1 + resolution: "cbor@npm:9.0.1" dependencies: nofilter: "npm:^3.1.0" - checksum: fc6c6d4f8d14def3a0f2ef111f4fc14b3b0bc91d22ed8fd0eb005095c4699c723a45721e515d713571148d0d965ceeb771f4ad422953cb4e9658b379991b52c9 + checksum: fa1bdf233b7d8b95b991c7d3861b6bf300b0d62fcebda34e4cca53605d32585021e80ee00b52378f492da011ebde6b21d704ac5117c2c6cce30de0b6419d2372 languageName: node linkType: hard @@ -17081,7 +17151,7 @@ __metadata: languageName: node linkType: hard -"chalk@npm:5.3.0, chalk@npm:^5.0.1, chalk@npm:^5.2.0": +"chalk@npm:5.3.0, chalk@npm:^5.0.1, chalk@npm:^5.2.0, chalk@npm:^5.3.0": version: 5.3.0 resolution: "chalk@npm:5.3.0" checksum: 6373caaab21bd64c405bfc4bd9672b145647fc9482657b5ea1d549b3b2765054e9d3d928870cdf764fb4aad67555f5061538ff247b8310f110c5c888d92397ea @@ -17345,6 +17415,13 @@ __metadata: languageName: node linkType: hard +"ci-info@npm:^4.0.0": + version: 4.0.0 + resolution: "ci-info@npm:4.0.0" + checksum: c983bb7ff1b06648f4a47432201abbd58291147d8ab5043dbb5c03e1a0e3fb2347f40d29b66a3044f28ffeb5dade01ac35aa6bd4e7464a44d9a49a3d7532415a + languageName: node + linkType: hard + "ci-parallel-vars@npm:^1.0.1": version: 1.0.1 resolution: "ci-parallel-vars@npm:1.0.1" @@ -17391,22 +17468,6 @@ __metadata: languageName: node linkType: hard -"clean-stack@npm:^4.0.0": - version: 4.2.0 - resolution: "clean-stack@npm:4.2.0" - dependencies: - escape-string-regexp: "npm:5.0.0" - checksum: 373f656a31face5c615c0839213b9b542a0a48057abfb1df66900eab4dc2a5c6097628e4a0b5aa559cdfc4e66f8a14ea47be9681773165a44470ef5fb8ccc172 - languageName: node - linkType: hard - -"clean-yaml-object@npm:^0.1.0": - version: 0.1.0 - resolution: "clean-yaml-object@npm:0.1.0" - checksum: 0374ad2f1fbd4984ecf56ebc62200092f6372b9ccf1b7971bb979c328fb12fe76e759fb1e8adc491c80b7b1861f9f00c7f19813dd2a0f49c88231422c70451f4 - languageName: node - linkType: hard - "cli-boxes@npm:^3.0.0": version: 3.0.0 resolution: "cli-boxes@npm:3.0.0" @@ -17479,6 +17540,16 @@ __metadata: languageName: node linkType: hard +"cli-truncate@npm:^4.0.0": + version: 4.0.0 + resolution: "cli-truncate@npm:4.0.0" + dependencies: + slice-ansi: "npm:^5.0.0" + string-width: "npm:^7.0.0" + checksum: d5149175fd25ca985731bdeec46a55ec237475cf74c1a5e103baea696aceb45e372ac4acbaabf1316f06bd62e348123060f8191ffadfeedebd2a70a2a7fb199d + languageName: node + linkType: hard + "cli-width@npm:^3.0.0": version: 3.0.0 resolution: "cli-width@npm:3.0.0" @@ -17668,7 +17739,7 @@ __metadata: languageName: node linkType: hard -"color-support@npm:^1.1.3": +"color-support@npm:^1.1.2, color-support@npm:^1.1.3": version: 1.1.3 resolution: "color-support@npm:1.1.3" bin: @@ -17982,7 +18053,7 @@ __metadata: languageName: node linkType: hard -"console-control-strings@npm:^1.1.0": +"console-control-strings@npm:^1.0.0, console-control-strings@npm:^1.1.0": version: 1.1.0 resolution: "console-control-strings@npm:1.1.0" checksum: 27b5fa302bc8e9ae9e98c03c66d76ca289ad0c61ce2fe20ab288d288bee875d217512d2edb2363fc83165e88f1c405180cf3f5413a46e51b4fe1a004840c6cdb @@ -18941,7 +19012,7 @@ __metadata: languageName: node linkType: hard -"detect-libc@npm:^2.0.1": +"detect-libc@npm:^2.0.0, detect-libc@npm:^2.0.1": version: 2.0.2 resolution: "detect-libc@npm:2.0.2" checksum: 6118f30c0c425b1e56b9d2609f29bec50d35a6af0b762b6ad127271478f3bbfda7319ce869230cf1a351f2b219f39332cde290858553336d652c77b970f15de8 @@ -20104,13 +20175,6 @@ __metadata: languageName: node linkType: hard -"escape-string-regexp@npm:5.0.0, escape-string-regexp@npm:^5.0.0": - version: 5.0.0 - resolution: "escape-string-regexp@npm:5.0.0" - checksum: 20daabe197f3cb198ec28546deebcf24b3dbb1a5a269184381b3116d12f0532e06007f4bc8da25669d6a7f8efb68db0758df4cd981f57bc5b57f521a3e12c59e - languageName: node - linkType: hard - "escape-string-regexp@npm:^1.0.2, escape-string-regexp@npm:^1.0.5": version: 1.0.5 resolution: "escape-string-regexp@npm:1.0.5" @@ -20132,6 +20196,13 @@ __metadata: languageName: node linkType: hard +"escape-string-regexp@npm:^5.0.0": + version: 5.0.0 + resolution: "escape-string-regexp@npm:5.0.0" + checksum: 20daabe197f3cb198ec28546deebcf24b3dbb1a5a269184381b3116d12f0532e06007f4bc8da25669d6a7f8efb68db0758df4cd981f57bc5b57f521a3e12c59e + languageName: node + linkType: hard + "escodegen@npm:^2.1.0": version: 2.1.0 resolution: "escodegen@npm:2.1.0" @@ -20447,6 +20518,13 @@ __metadata: languageName: node linkType: hard +"estree-walker@npm:2.0.2, estree-walker@npm:^2.0.1, estree-walker@npm:^2.0.2": + version: 2.0.2 + resolution: "estree-walker@npm:2.0.2" + checksum: b02109c5d46bc2ed47de4990eef770f7457b1159a229f0999a09224d2b85ffeed2d7679cffcff90aeb4448e94b0168feb5265b209cdec29aad50a3d6e93d21e2 + languageName: node + linkType: hard + "estree-walker@npm:^0.6.1": version: 0.6.1 resolution: "estree-walker@npm:0.6.1" @@ -20454,13 +20532,6 @@ __metadata: languageName: node linkType: hard -"estree-walker@npm:^2.0.2": - version: 2.0.2 - resolution: "estree-walker@npm:2.0.2" - checksum: b02109c5d46bc2ed47de4990eef770f7457b1159a229f0999a09224d2b85ffeed2d7679cffcff90aeb4448e94b0168feb5265b209cdec29aad50a3d6e93d21e2 - languageName: node - linkType: hard - "esutils@npm:^2.0.2, esutils@npm:^2.0.3": version: 2.0.3 resolution: "esutils@npm:2.0.3" @@ -20778,7 +20849,7 @@ __metadata: languageName: node linkType: hard -"fast-glob@npm:3.3.2, fast-glob@npm:^3.2.11, fast-glob@npm:^3.2.7, fast-glob@npm:^3.2.9, fast-glob@npm:^3.3.0": +"fast-glob@npm:3.3.2, fast-glob@npm:^3.2.11, fast-glob@npm:^3.2.7, fast-glob@npm:^3.2.9, fast-glob@npm:^3.3.0, fast-glob@npm:^3.3.2": version: 3.3.2 resolution: "fast-glob@npm:3.3.2" dependencies: @@ -20966,13 +21037,12 @@ __metadata: languageName: node linkType: hard -"figures@npm:^5.0.0": - version: 5.0.0 - resolution: "figures@npm:5.0.0" +"figures@npm:^6.0.1": + version: 6.0.1 + resolution: "figures@npm:6.0.1" dependencies: - escape-string-regexp: "npm:^5.0.0" - is-unicode-supported: "npm:^1.2.0" - checksum: 951d18be2f450c90462c484eff9bda705293319bc2f17b250194a0cf1a291600db4cb283a6ce199d49380c95b08d85d822ce4b18d2f9242663fd5895476d667c + is-unicode-supported: "npm:^2.0.0" + checksum: 2fb988f01bed5ae6915a0593342f083bd1b09d0a6bf9aa58d0882c446cf13b59059f8a967acd676763278107b87b762231430d610d8f3be87c90ce87984a32a1 languageName: node linkType: hard @@ -21017,6 +21087,13 @@ __metadata: languageName: node linkType: hard +"file-uri-to-path@npm:1.0.0": + version: 1.0.0 + resolution: "file-uri-to-path@npm:1.0.0" + checksum: b648580bdd893a008c92c7ecc96c3ee57a5e7b6c4c18a9a09b44fb5d36d79146f8e442578bc0e173dc027adf3987e254ba1dfd6e3ec998b7c282873010502144 + languageName: node + linkType: hard + "filelist@npm:^1.0.4": version: 1.0.4 resolution: "filelist@npm:1.0.4" @@ -21136,6 +21213,13 @@ __metadata: languageName: node linkType: hard +"find-up-simple@npm:^1.0.0": + version: 1.0.0 + resolution: "find-up-simple@npm:1.0.0" + checksum: 91c3d51c1111b5eb4e6e6d71d21438f6571a37a69dc288d4222b98996756e2f472fa5393a4dddb5e1a84929405d87e86f4bdce798ba84ee513b79854960ec140 + languageName: node + linkType: hard + "find-up@npm:5.0.0, find-up@npm:^5.0.0": version: 5.0.0 resolution: "find-up@npm:5.0.0" @@ -21174,16 +21258,6 @@ __metadata: languageName: node linkType: hard -"find-up@npm:^6.0.0": - version: 6.3.0 - resolution: "find-up@npm:6.3.0" - dependencies: - locate-path: "npm:^7.1.0" - path-exists: "npm:^5.0.0" - checksum: 4f3bdc30d41778c647e53f4923e72de5e5fb055157031f34501c5b36c2eb59f77b997edf9cb00165c6060cda7eaa2e3da82cb6be2e61d68ad3e07c4bc4cce67e - languageName: node - linkType: hard - "flat-cache@npm:^3.0.4": version: 3.2.0 resolution: "flat-cache@npm:3.2.0" @@ -21593,6 +21667,23 @@ __metadata: languageName: node linkType: hard +"gauge@npm:^3.0.0": + version: 3.0.2 + resolution: "gauge@npm:3.0.2" + dependencies: + aproba: "npm:^1.0.3 || ^2.0.0" + color-support: "npm:^1.1.2" + console-control-strings: "npm:^1.0.0" + has-unicode: "npm:^2.0.1" + object-assign: "npm:^4.1.1" + signal-exit: "npm:^3.0.0" + string-width: "npm:^4.2.3" + strip-ansi: "npm:^6.0.1" + wide-align: "npm:^1.1.2" + checksum: 46df086451672a5fecd58f7ec86da74542c795f8e00153fbef2884286ce0e86653c3eb23be2d0abb0c4a82b9b2a9dec3b09b6a1cf31c28085fa0376599a26589 + languageName: node + linkType: hard + "gauge@npm:^4.0.3": version: 4.0.4 resolution: "gauge@npm:4.0.4" @@ -22082,7 +22173,7 @@ __metadata: languageName: node linkType: hard -"globby@npm:^13.1.1, globby@npm:^13.1.4": +"globby@npm:^13.1.1": version: 13.2.2 resolution: "globby@npm:13.2.2" dependencies: @@ -22095,6 +22186,20 @@ __metadata: languageName: node linkType: hard +"globby@npm:^14.0.0": + version: 14.0.0 + resolution: "globby@npm:14.0.0" + dependencies: + "@sindresorhus/merge-streams": "npm:^1.0.0" + fast-glob: "npm:^3.3.2" + ignore: "npm:^5.2.4" + path-type: "npm:^5.0.0" + slash: "npm:^5.1.0" + unicorn-magic: "npm:^0.1.0" + checksum: 6e7d84bbc69d8d21a07507af090998c6546c385702a350ff14f6fb08207f90ed40bd41c7b19c11a23851c3b86666e79503373e0f8b400a91a29b13952b1e960c + languageName: node + linkType: hard + "globrex@npm:^0.1.2": version: 0.1.2 resolution: "globrex@npm:0.1.2" @@ -23454,13 +23559,6 @@ __metadata: languageName: node linkType: hard -"is-error@npm:^2.2.2": - version: 2.2.2 - resolution: "is-error@npm:2.2.2" - checksum: a97b39587150f0d38f9f93f64699807fe3020fe5edbd63548f234dc2ba96fd7c776d66c062bf031dfeb93c7f48db563ff6bde588418ca041da37c659a416f055 - languageName: node - linkType: hard - "is-extglob@npm:^2.1.1": version: 2.1.1 resolution: "is-extglob@npm:2.1.1" @@ -23738,7 +23836,7 @@ __metadata: languageName: node linkType: hard -"is-unicode-supported@npm:*": +"is-unicode-supported@npm:*, is-unicode-supported@npm:^2.0.0": version: 2.0.0 resolution: "is-unicode-supported@npm:2.0.0" checksum: 000b80639dedaf59a385f1c0a57f97a4d1435e0723716f24cc19ad94253a7a0a9f838bdc9ac49b10a29ac93b01f52ae9b2ed358a8876caf1eb74d73b4ede92b2 @@ -23752,13 +23850,6 @@ __metadata: languageName: node linkType: hard -"is-unicode-supported@npm:^1.2.0": - version: 1.3.0 - resolution: "is-unicode-supported@npm:1.3.0" - checksum: 20a1fc161afafaf49243551a5ac33b6c4cf0bbcce369fcd8f2951fbdd000c30698ce320de3ee6830497310a8f41880f8066d440aa3eb0a853e2aa4836dd89abc - languageName: node - linkType: hard - "is-upper-case@npm:^2.0.2": version: 2.0.2 resolution: "is-upper-case@npm:2.0.2" @@ -25607,7 +25698,7 @@ __metadata: languageName: node linkType: hard -"load-json-file@npm:^7.0.0": +"load-json-file@npm:^7.0.1": version: 7.0.1 resolution: "load-json-file@npm:7.0.1" checksum: a560288da6891778321ef993e4bdbdf05374a4f3a3aeedd5ba6b64672798c830d748cfc59a2ec9891a3db30e78b3d04172e0dcb0d4828168289a393147ca0e74 @@ -25686,15 +25777,6 @@ __metadata: languageName: node linkType: hard -"locate-path@npm:^7.1.0": - version: 7.2.0 - resolution: "locate-path@npm:7.2.0" - dependencies: - p-locate: "npm:^6.0.0" - checksum: 1c6d269d4efec555937081be964e8a9b4a136319c79ca1d45ac6382212a8466113c75bd89e44521ca8ecd1c47fb08523b56eee5c0712bc7d14fec5f729deeb42 - languageName: node - linkType: hard - "lodash-es@npm:^4.17.21": version: 4.17.21 resolution: "lodash-es@npm:4.17.21" @@ -26129,7 +26211,7 @@ __metadata: languageName: node linkType: hard -"make-dir@npm:^3.0.0, make-dir@npm:^3.0.2": +"make-dir@npm:^3.0.0, make-dir@npm:^3.0.2, make-dir@npm:^3.1.0": version: 3.1.0 resolution: "make-dir@npm:3.1.0" dependencies: @@ -26206,7 +26288,7 @@ __metadata: languageName: node linkType: hard -"map-age-cleaner@npm:^0.1.1, map-age-cleaner@npm:^0.1.3": +"map-age-cleaner@npm:^0.1.1": version: 0.1.3 resolution: "map-age-cleaner@npm:0.1.3" dependencies: @@ -26698,16 +26780,6 @@ __metadata: languageName: node linkType: hard -"mem@npm:^9.0.2": - version: 9.0.2 - resolution: "mem@npm:9.0.2" - dependencies: - map-age-cleaner: "npm:^0.1.3" - mimic-fn: "npm:^4.0.0" - checksum: 82f899e73212509c8bccb26399f03c61193e15b796c9e8e10332db6a3eb1cad65edbe4ab144554e88a0db3dc53af3b9e960a2576cb3521fa968ba1ca5a0b6719 - languageName: node - linkType: hard - "memfs@npm:^3.4.3": version: 3.5.3 resolution: "memfs@npm:3.5.3" @@ -26724,6 +26796,15 @@ __metadata: languageName: node linkType: hard +"memoize@npm:^10.0.0": + version: 10.0.0 + resolution: "memoize@npm:10.0.0" + dependencies: + mimic-function: "npm:^5.0.0" + checksum: 2239451cc0b26f9e99e6107c2a24f069b8ccd98877b4fe4f28fe3a1e977521fe23a53fa7fb5e7ad485577e0f30ab61aed97cf29facbc701b88facf27b8f12ce3 + languageName: node + linkType: hard + "memoizerific@npm:^1.11.3": version: 1.11.3 resolution: "memoizerific@npm:1.11.3" @@ -27547,6 +27628,13 @@ __metadata: languageName: node linkType: hard +"mimic-function@npm:^5.0.0": + version: 5.0.0 + resolution: "mimic-function@npm:5.0.0" + checksum: 1cb53bc250e4824544b89322f047ef37b2f70327cac67a9e5d64a192ac2b810dabc6a6e76e528751aae8558adf618de91fa0b69cec8514f96ee3cf1db81c4508 + languageName: node + linkType: hard + "mimic-response@npm:^1.0.0": version: 1.0.1 resolution: "mimic-response@npm:1.0.1" @@ -28291,6 +28379,17 @@ __metadata: languageName: node linkType: hard +"node-gyp-build@npm:^4.2.2": + version: 4.7.1 + resolution: "node-gyp-build@npm:4.7.1" + bin: + node-gyp-build: bin.js + node-gyp-build-optional: optional.js + node-gyp-build-test: build-test.js + checksum: 3f6780a24dc7f6c47870ee1095a3f88aca9ca9c156dfdc390aee8f320fe94ebf8b91a361edd62aff7bf2eae469e25800378ed97533134d8580a8b9bdae75994c + languageName: node + linkType: hard + "node-gyp@npm:^9.0.0": version: 9.4.1 resolution: "node-gyp@npm:9.4.1" @@ -28396,6 +28495,17 @@ __metadata: languageName: node linkType: hard +"nopt@npm:^5.0.0": + version: 5.0.0 + resolution: "nopt@npm:5.0.0" + dependencies: + abbrev: "npm:1" + bin: + nopt: bin/nopt.js + checksum: 00f9bb2d16449469ba8ffcf9b8f0eae6bae285ec74b135fec533e5883563d2400c0cd70902d0a7759e47ac031ccf206ace4e86556da08ed3f1c66dda206e9ccd + languageName: node + linkType: hard + "nopt@npm:^6.0.0": version: 6.0.0 resolution: "nopt@npm:6.0.0" @@ -28529,6 +28639,18 @@ __metadata: languageName: node linkType: hard +"npmlog@npm:^5.0.1": + version: 5.0.1 + resolution: "npmlog@npm:5.0.1" + dependencies: + are-we-there-yet: "npm:^2.0.0" + console-control-strings: "npm:^1.1.0" + gauge: "npm:^3.0.0" + set-blocking: "npm:^2.0.0" + checksum: f42c7b9584cdd26a13c41a21930b6f5912896b6419ab15be88cc5721fc792f1c3dd30eb602b26ae08575694628ba70afdcf3675d86e4f450fc544757e52726ec + languageName: node + linkType: hard + "npmlog@npm:^6.0.0": version: 6.0.2 resolution: "npmlog@npm:6.0.2" @@ -29034,15 +29156,6 @@ __metadata: languageName: node linkType: hard -"p-event@npm:^5.0.1": - version: 5.0.1 - resolution: "p-event@npm:5.0.1" - dependencies: - p-timeout: "npm:^5.0.2" - checksum: 755a737e3d4fe912772daaa7262f7f3a4b45e3dbcfb0212a3a913c2db47b0981ddc2e9b1c5ec5fbbfb0cb622ce5b67bc04751ec8ced7e340398107e536d5aab2 - languageName: node - linkType: hard - "p-finally@npm:^1.0.0": version: 1.0.0 resolution: "p-finally@npm:1.0.0" @@ -29129,15 +29242,6 @@ __metadata: languageName: node linkType: hard -"p-locate@npm:^6.0.0": - version: 6.0.0 - resolution: "p-locate@npm:6.0.0" - dependencies: - p-limit: "npm:^4.0.0" - checksum: 2bfe5234efa5e7a4e74b30a5479a193fdd9236f8f6b4d2f3f69e3d286d9a7d7ab0c118a2a50142efcf4e41625def635bd9332d6cbf9cc65d85eb0718c579ab38 - languageName: node - linkType: hard - "p-map@npm:^3.0.0": version: 3.0.0 resolution: "p-map@npm:3.0.0" @@ -29156,12 +29260,10 @@ __metadata: languageName: node linkType: hard -"p-map@npm:^5.5.0": - version: 5.5.0 - resolution: "p-map@npm:5.5.0" - dependencies: - aggregate-error: "npm:^4.0.0" - checksum: 089a709d2525208a965b7907cc8e58af950542629b538198fc142c40e7f36b3b492dd6a46a1279515ccab58bb6f047e04593c0ab5ef4539d312adf7f761edf55 +"p-map@npm:^6.0.0": + version: 6.0.0 + resolution: "p-map@npm:6.0.0" + checksum: 1fd59257b3828a4c4def676ef64acb0edb7809b161ada25efd9a0c8db312ad81c66bcaa9e5d8fd982fd20d412609aabcb8da9b090e81f6c449bc1203752ba0eb languageName: node linkType: hard @@ -29225,6 +29327,16 @@ __metadata: languageName: node linkType: hard +"package-config@npm:^5.0.0": + version: 5.0.0 + resolution: "package-config@npm:5.0.0" + dependencies: + find-up-simple: "npm:^1.0.0" + load-json-file: "npm:^7.0.1" + checksum: dfff5264c51a0dad7af9a55b02e3b8b6e457075e9c4f02d0ffacfeee9af4dd5db2b566dae41486412161292b8741483cd89d5a8404a5742fc54d718dadacac4a + languageName: node + linkType: hard + "package-hash@npm:^4.0.0": version: 4.0.0 resolution: "package-hash@npm:4.0.0" @@ -29422,13 +29534,6 @@ __metadata: languageName: node linkType: hard -"path-exists@npm:^5.0.0": - version: 5.0.0 - resolution: "path-exists@npm:5.0.0" - checksum: 8ca842868cab09423994596eb2c5ec2a971c17d1a3cb36dbf060592c730c725cd524b9067d7d2a1e031fef9ba7bd2ac6dc5ec9fb92aa693265f7be3987045254 - languageName: node - linkType: hard - "path-is-absolute@npm:^1.0.0": version: 1.0.1 resolution: "path-is-absolute@npm:1.0.1" @@ -29550,6 +29655,13 @@ __metadata: languageName: node linkType: hard +"path-type@npm:^5.0.0": + version: 5.0.0 + resolution: "path-type@npm:5.0.0" + checksum: 15ec24050e8932c2c98d085b72cfa0d6b4eeb4cbde151a0a05726d8afae85784fc5544f733d8dfc68536587d5143d29c0bd793623fad03d7e61cc00067291cd5 + languageName: node + linkType: hard + "pathe@npm:^1.1.0, pathe@npm:^1.1.1": version: 1.1.1 resolution: "pathe@npm:1.1.1" @@ -29627,13 +29739,20 @@ __metadata: languageName: node linkType: hard -"picomatch@npm:^2.0.4, picomatch@npm:^2.2.1, picomatch@npm:^2.2.3, picomatch@npm:^2.3.0, picomatch@npm:^2.3.1": +"picomatch@npm:^2.0.4, picomatch@npm:^2.2.1, picomatch@npm:^2.2.2, picomatch@npm:^2.2.3, picomatch@npm:^2.3.0, picomatch@npm:^2.3.1": version: 2.3.1 resolution: "picomatch@npm:2.3.1" checksum: 60c2595003b05e4535394d1da94850f5372c9427ca4413b71210f437f7b2ca091dbd611c45e8b37d10036fa8eade25c1b8951654f9d3973bfa66a2ff4d3b08bc languageName: node linkType: hard +"picomatch@npm:^3.0.1": + version: 3.0.1 + resolution: "picomatch@npm:3.0.1" + checksum: 65ac837fedbd0640586f7c214f6c7481e1e12f41cdcd22a95eb6a2914d1773707ed0f0b5bd2d1e39b5ec7860b43a4c9150152332a3884cd8dd1d419b2a2fa5b5 + languageName: node + linkType: hard + "pidtree@npm:0.6.0": version: 0.6.0 resolution: "pidtree@npm:0.6.0" @@ -29664,16 +29783,6 @@ __metadata: languageName: node linkType: hard -"pkg-conf@npm:^4.0.0": - version: 4.0.0 - resolution: "pkg-conf@npm:4.0.0" - dependencies: - find-up: "npm:^6.0.0" - load-json-file: "npm:^7.0.0" - checksum: 6da0c064a74f6c7ae80d7d68c5853e14f7e762a2a80c6ca9e0aa827002b90b69c86fefe3bac830b10a6f1739e7f96a1f728637f2a141e50b0fdafe92a2c3eab6 - languageName: node - linkType: hard - "pkg-dir@npm:^3.0.0": version: 3.0.0 resolution: "pkg-dir@npm:3.0.0" @@ -32531,7 +32640,7 @@ __metadata: languageName: node linkType: hard -"slash@npm:^5.0.0": +"slash@npm:^5.0.0, slash@npm:^5.1.0": version: 5.1.0 resolution: "slash@npm:5.1.0" checksum: 2c41ec6fb1414cd9bba0fa6b1dd00e8be739e3fe85d079c69d4b09ca5f2f86eafd18d9ce611c0c0f686428638a36c272a6ac14799146a8295f259c10cc45cde4 @@ -34466,6 +34575,13 @@ __metadata: languageName: node linkType: hard +"unicorn-magic@npm:^0.1.0": + version: 0.1.0 + resolution: "unicorn-magic@npm:0.1.0" + checksum: 9b4d0e9809807823dc91d0920a4a4c0cff2de3ebc54ee87ac1ee9bc75eafd609b09d1f14495e0173aef26e01118706196b6ab06a75fe0841028b3983a8af313f + languageName: node + linkType: hard + "unified@npm:^10.0.0": version: 10.1.2 resolution: "unified@npm:10.1.2" @@ -35881,7 +35997,7 @@ __metadata: languageName: node linkType: hard -"wide-align@npm:^1.1.5": +"wide-align@npm:^1.1.2, wide-align@npm:^1.1.5": version: 1.1.5 resolution: "wide-align@npm:1.1.5" dependencies: From 51e42af317fa9e321e99bfae615a1323c968d68b Mon Sep 17 00:00:00 2001 From: LongYinan Date: Tue, 5 Dec 2023 06:41:21 +0000 Subject: [PATCH 21/68] chore: bump up actions/labeler action to v5 (#5192) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [actions/labeler](https://togithub.com/actions/labeler) | action | major | `v4` -> `v5` | --- ### Release Notes
    actions/labeler (actions/labeler) ### [`v5`](https://togithub.com/actions/labeler/compare/v4...v5) [Compare Source](https://togithub.com/actions/labeler/compare/v4...v5)
    --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://developer.mend.io/github/toeverything/AFFiNE). --- .github/workflows/auto-labeler.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/auto-labeler.yml b/.github/workflows/auto-labeler.yml index 4aa28fe2fd..bf474c4787 100644 --- a/.github/workflows/auto-labeler.yml +++ b/.github/workflows/auto-labeler.yml @@ -9,4 +9,4 @@ jobs: pull-requests: write runs-on: ubuntu-latest steps: - - uses: actions/labeler@v4 + - uses: actions/labeler@v5 From 1cd8de9d60f19a6b88875a8c28720cb0eb174b1b Mon Sep 17 00:00:00 2001 From: Cats Juice Date: Tue, 5 Dec 2023 07:01:42 +0000 Subject: [PATCH 22/68] fix(component): clear page list operation's link style (#5148) - before ![CleanShot 2023-12-01 at 12 03 24@2x](https://github.com/toeverything/AFFiNE/assets/39363750/6951ee61-d3c3-43b3-8949-fe6ed9ceb99e) - after ![CleanShot 2023-12-01 at 12 08 02@2x](https://github.com/toeverything/AFFiNE/assets/39363750/2a85e5f7-9156-4aef-81a2-76d66a673ebd) --- .../src/components/page-list/operation-cell.tsx | 1 + .../src/components/page-list/page-list.css.ts | 11 +++++++++++ 2 files changed, 12 insertions(+) diff --git a/packages/frontend/component/src/components/page-list/operation-cell.tsx b/packages/frontend/component/src/components/page-list/operation-cell.tsx index 9dd04a262f..a8d8d8d08d 100644 --- a/packages/frontend/component/src/components/page-list/operation-cell.tsx +++ b/packages/frontend/component/src/components/page-list/operation-cell.tsx @@ -66,6 +66,7 @@ export const OperationCell = ({ {!environment.isDesktop && ( Date: Tue, 5 Dec 2023 07:21:18 +0000 Subject: [PATCH 23/68] fix(core): unable to create share page link (#5175) For some reasons, our `spaceDoc.guid` and `page.id` may not necessarily be the same, so we switched to using the more accurate `page.id`. --- .../affine/share-page-modal/share-menu/share-menu.tsx | 5 +---- .../affine/share-page-modal/share-menu/share-page.tsx | 2 +- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/packages/frontend/core/src/components/affine/share-page-modal/share-menu/share-menu.tsx b/packages/frontend/core/src/components/affine/share-page-modal/share-menu/share-menu.tsx index aa8f7df5a7..b77f8c1905 100644 --- a/packages/frontend/core/src/components/affine/share-page-modal/share-menu/share-menu.tsx +++ b/packages/frontend/core/src/components/affine/share-page-modal/share-menu/share-menu.tsx @@ -73,10 +73,7 @@ const CloudShareMenu = (props: ShareMenuProps) => { workspace: { id: workspaceId }, currentPage, } = props; - const { isSharedPage } = useIsSharedPage( - workspaceId, - currentPage.spaceDoc.guid - ); + const { isSharedPage } = useIsSharedPage(workspaceId, currentPage.id); return ( { changeShare, currentShareMode, disableShare, - } = useIsSharedPage(workspaceId, currentPage.spaceDoc.guid); + } = useIsSharedPage(workspaceId, currentPage.id); const currentPageMode = useAtomValue(currentModeAtom); const defaultMode = useMemo(() => { From 37b1a54ec632cd493442a4ca99d4347cea5492e7 Mon Sep 17 00:00:00 2001 From: LongYinan Date: Tue, 5 Dec 2023 08:38:03 +0000 Subject: [PATCH 24/68] chore: bump up idb version to v8 (#5198) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [idb](https://togithub.com/jakearchibald/idb) | [`^7.1.1` -> `^8.0.0`](https://renovatebot.com/diffs/npm/idb/7.1.1/8.0.0) | [![age](https://developer.mend.io/api/mc/badges/age/npm/idb/8.0.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/idb/8.0.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/idb/7.1.1/8.0.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/idb/7.1.1/8.0.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes
    jakearchibald/idb (idb) ### [`v8.0.0`](https://togithub.com/jakearchibald/idb/compare/v7.1.1...v8.0.0) [Compare Source](https://togithub.com/jakearchibald/idb/compare/v7.1.1...v8.0.0)
    --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://developer.mend.io/github/toeverything/AFFiNE). --- packages/common/y-indexeddb/package.json | 2 +- packages/frontend/core/package.json | 2 +- packages/frontend/workspace/package.json | 2 +- packages/plugins/copilot/package.json | 2 +- yarn.lock | 16 ++++++++-------- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/packages/common/y-indexeddb/package.json b/packages/common/y-indexeddb/package.json index a748f49d8c..92911fa5c1 100644 --- a/packages/common/y-indexeddb/package.json +++ b/packages/common/y-indexeddb/package.json @@ -32,7 +32,7 @@ } }, "dependencies": { - "idb": "^7.1.1", + "idb": "^8.0.0", "nanoid": "^5.0.3", "y-provider": "workspace:*" }, diff --git a/packages/frontend/core/package.json b/packages/frontend/core/package.json index 847c8c0e26..a06d069ebb 100644 --- a/packages/frontend/core/package.json +++ b/packages/frontend/core/package.json @@ -58,7 +58,7 @@ "dayjs": "^1.11.10", "foxact": "^0.2.20", "graphql": "^16.8.1", - "idb": "^7.1.1", + "idb": "^8.0.0", "intl-segmenter-polyfill-rs": "^0.1.6", "jotai": "^2.5.1", "jotai-devtools": "^0.7.0", diff --git a/packages/frontend/workspace/package.json b/packages/frontend/workspace/package.json index 0662a725a9..2d1fabe467 100644 --- a/packages/frontend/workspace/package.json +++ b/packages/frontend/workspace/package.json @@ -22,7 +22,7 @@ "@toeverything/hooks": "workspace:*", "@toeverything/y-indexeddb": "workspace:*", "async-call-rpc": "^6.3.1", - "idb": "^7.1.1", + "idb": "^8.0.0", "idb-keyval": "^6.2.1", "is-svg": "^5.0.0", "jotai": "^2.5.1", diff --git a/packages/plugins/copilot/package.json b/packages/plugins/copilot/package.json index 76eb4a6635..39950ca5c9 100644 --- a/packages/plugins/copilot/package.json +++ b/packages/plugins/copilot/package.json @@ -19,7 +19,7 @@ "@blocksuite/icons": "2.1.36", "@vanilla-extract/css": "^1.13.0", "clsx": "^2.0.0", - "idb": "^7.1.1", + "idb": "^8.0.0", "langchain": "^0.0.166", "marked": "^9.1.2", "marked-gfm-heading-id": "^3.1.0", diff --git a/yarn.lock b/yarn.lock index a4c7f422b6..845c0ba390 100644 --- a/yarn.lock +++ b/yarn.lock @@ -321,7 +321,7 @@ __metadata: "@types/marked": "npm:^6.0.0" "@vanilla-extract/css": "npm:^1.13.0" clsx: "npm:^2.0.0" - idb: "npm:^7.1.1" + idb: "npm:^8.0.0" jotai: "npm:^2.5.1" langchain: "npm:^0.0.166" marked: "npm:^9.1.2" @@ -398,7 +398,7 @@ __metadata: foxact: "npm:^0.2.20" graphql: "npm:^16.8.1" html-webpack-plugin: "npm:^5.5.3" - idb: "npm:^7.1.1" + idb: "npm:^8.0.0" intl-segmenter-polyfill-rs: "npm:^0.1.6" jotai: "npm:^2.5.1" jotai-devtools: "npm:^0.7.0" @@ -921,7 +921,7 @@ __metadata: "@types/ws": "npm:^8.5.7" async-call-rpc: "npm:^6.3.1" fake-indexeddb: "npm:^5.0.0" - idb: "npm:^7.1.1" + idb: "npm:^8.0.0" idb-keyval: "npm:^6.2.1" is-svg: "npm:^5.0.0" jotai: "npm:^2.5.1" @@ -13291,7 +13291,7 @@ __metadata: "@blocksuite/blocks": "npm:0.0.0-20231130092516-0f858b95-nightly" "@blocksuite/store": "npm:0.0.0-20231130092516-0f858b95-nightly" fake-indexeddb: "npm:^5.0.0" - idb: "npm:^7.1.1" + idb: "npm:^8.0.0" nanoid: "npm:^5.0.3" vite: "npm:^4.4.11" vite-plugin-dts: "npm:3.6.0" @@ -23154,10 +23154,10 @@ __metadata: languageName: node linkType: hard -"idb@npm:^7.1.1": - version: 7.1.1 - resolution: "idb@npm:7.1.1" - checksum: 8e33eaebf21055129864acb89932e0739b8c96788e559df24c253ce114d8c6deb977a3b30ea47a9bb8a2ae8a55964861c3df65f360d95745e341cee40d5c17f4 +"idb@npm:^8.0.0": + version: 8.0.0 + resolution: "idb@npm:8.0.0" + checksum: 6ff47b46ead4bf02ac3a9145bb2f48bac707b950cf33282a72eec8efcda610ffb0a09aab6eea58450f6c87373060bf50998d307085830a302e9e231eee6cd37d languageName: node linkType: hard From 1e01ed0b0fc771d47135656a1ecd305b43517528 Mon Sep 17 00:00:00 2001 From: Peng Xiao Date: Tue, 5 Dec 2023 09:18:49 +0000 Subject: [PATCH 25/68] fix(component): modal blurness (#5177) moved https://github.com/toeverything/design/pull/108 Do not use transform to center the modal. It has know issue to cause modal to have blurred texts. https://github.com/radix-ui/website/issues/383 fix https://github.com/toeverything/AFFiNE/issues/5176 --- .../frontend/component/src/ui/modal/modal.tsx | 74 ++++++++++--------- .../component/src/ui/modal/styles.css.ts | 15 ++-- 2 files changed, 49 insertions(+), 40 deletions(-) diff --git a/packages/frontend/component/src/ui/modal/modal.tsx b/packages/frontend/component/src/ui/modal/modal.tsx index d34de8e6e7..bf14329fce 100644 --- a/packages/frontend/component/src/ui/modal/modal.tsx +++ b/packages/frontend/component/src/ui/modal/modal.tsx @@ -67,42 +67,46 @@ export const Modal = forwardRef( className={clsx(styles.modalOverlay, overlayClassName)} {...otherOverlayOptions} /> - - {withoutCloseButton ? null : ( - - - - - - )} - {title ? ( - {title} - ) : null} - {description ? ( - - {description} - - ) : null} +
    + + {withoutCloseButton ? null : ( + + + + + + )} + {title ? ( + + {title} + + ) : null} + {description ? ( + + {description} + + ) : null} - {children} - + {children} + +
    ) diff --git a/packages/frontend/component/src/ui/modal/styles.css.ts b/packages/frontend/component/src/ui/modal/styles.css.ts index f5e6ef18ec..116e9c1021 100644 --- a/packages/frontend/component/src/ui/modal/styles.css.ts +++ b/packages/frontend/component/src/ui/modal/styles.css.ts @@ -11,6 +11,15 @@ export const modalOverlay = style({ zIndex: 'var(--affine-z-index-modal)', }); +export const modalContentWrapper = style({ + position: 'fixed', + inset: 0, + display: 'flex', + alignItems: 'center', + justifyContent: 'center', + zIndex: 'var(--affine-z-index-modal)', +}); + export const modalContent = style({ vars: { [widthVar]: '', @@ -25,17 +34,13 @@ export const modalContent = style({ fontWeight: '400', lineHeight: '1.6', padding: '20px 24px', + position: 'relative', backgroundColor: 'var(--affine-background-overlay-panel-color)', boxShadow: 'var(--affine-popover-shadow)', borderRadius: '12px', maxHeight: 'calc(100vh - 32px)', // :focus-visible will set outline outline: 'none', - position: 'fixed', - zIndex: 'var(--affine-z-index-modal)', - top: ' 50%', - left: '50%', - transform: 'translate(-50%, -50%)', }); export const closeButton = style({ From bd414b7f44c22c1602117df7f1d7ac5e81233936 Mon Sep 17 00:00:00 2001 From: LongYinan Date: Tue, 5 Dec 2023 18:00:42 +0800 Subject: [PATCH 26/68] ci: fix auto labeler job (#5206) --- .github/workflows/auto-labeler.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/auto-labeler.yml b/.github/workflows/auto-labeler.yml index bf474c4787..1e3fdd376e 100644 --- a/.github/workflows/auto-labeler.yml +++ b/.github/workflows/auto-labeler.yml @@ -9,4 +9,5 @@ jobs: pull-requests: write runs-on: ubuntu-latest steps: + - uses: actions/checkout@v4 - uses: actions/labeler@v5 From 246fbd8d4f4129bfca70600a544c3bc987a0d421 Mon Sep 17 00:00:00 2001 From: LongYinan Date: Tue, 5 Dec 2023 18:21:32 +0800 Subject: [PATCH 27/68] ci: fix auto labeler config --- .github/labeler.yml | 117 ++++++++++++++++++++++++++++++++------------ 1 file changed, 85 insertions(+), 32 deletions(-) diff --git a/.github/labeler.yml b/.github/labeler.yml index 2f50fc2a97..41ed2112f8 100644 --- a/.github/labeler.yml +++ b/.github/labeler.yml @@ -1,62 +1,115 @@ docs: - - 'docs/**/*' - - '**/README.md' - - 'packages/frontend/templates/**/*' + - changed-files: + - any-glob-to-any-file: + - 'docs/**/*' + - '**/README.md' + - 'packages/frontend/templates/**/*' test: - - 'tests/**/*' - - '**/tests/**/*' - - '**/__tests__/**/*' + - changed-files: + - any-glob-to-any-file: + - 'tests/**/*' + - '**/tests/**/*' + - '**/__tests__/**/*' mod:dev: - - 'scripts/**/*' - - 'tools/cli/**/*' - - 'packages/common/debug/**/*' + - changed-files: + - any-glob-to-any-file: + - 'scripts/**/*' + - 'tools/cli/**/*' + - 'packages/common/debug/**/*' mod:plugin: - - 'packages/plugins/**/*' + - changed-files: + - any-glob-to-any-file: + - 'packages/plugins/**/*' plugin:copilot: - - 'packages/plugins/copilot/**/*' + - changed-files: + - any-glob-to-any-file: + - 'packages/plugins/copilot/**/*' mod:infra: - - 'packages/common/infra/**/*' + - changed-files: + - any-glob-to-any-file: + - 'packages/common/infra/**/*' mod:sdk: - - 'packages/common/sdk/**/*' + - changed-files: + - any-glob-to-any-file: + - 'packages/common/sdk/**/*' mod:plugin-cli: - - 'tools/plugin-cli/**/*' + - changed-files: + - any-glob-to-any-file: + - 'tools/plugin-cli/**/*' -mod:workspace: 'packages/frontend/workspace/**/*' +mod:workspace: + - changed-files: + - any-glob-to-any-file: + - 'packages/frontend/workspace/**/*' -mod:i18n: 'packages/frontend/i18n/**/*' +mod:i18n: + - changed-files: + - any-glob-to-any-file: + - 'packages/frontend/i18n/**/*' -mod:env: 'packages/common/env/**/*' +mod:env: + - changed-files: + - any-glob-to-any-file: + - 'packages/common/env/**/*' -mod:hooks: 'packages/frontend/hooks/**/*' +mod:hooks: + - changed-files: + - any-glob-to-any-file: + - 'packages/frontend/hooks/**/*' -mod:component: 'packages/frontend/component/**/*' +mod:component: + - changed-files: + - any-glob-to-any-file: + - 'packages/frontend/component/**/*' -mod:storage: 'packages/backend/storage/**/*' +mod:storage: + - changed-files: + - any-glob-to-any-file: + - 'packages/backend/storage/**/*' -mod:native: 'packages/frontend/native/**/*' +mod:native: + - changed-files: + - any-glob-to-any-file: + - 'packages/frontend/native/**/*' mod:store: - - '**/atoms/**/*' + - changed-files: + - any-glob-to-any-file: + - '**/atoms/**/*' rust: - - '**/*.rs' - - '**/Cargo.toml' - - '**/Cargo.lock' - - '**/rust-toolchain' - - '**/rust-toolchain.toml' - - '**/rustfmt.toml' + - changed-files: + - any-glob-to-any-file: + - '**/*.rs' + - '**/Cargo.toml' + - '**/Cargo.lock' + - '**/rust-toolchain' + - '**/rust-toolchain.toml' + - '**/rustfmt.toml' -package:y-indexeddb: 'packages/common/y-indexeddb/**/*' +package:y-indexeddb: + - changed-files: + - any-glob-to-any-file: + - 'packages/common/y-indexeddb/**/*' -app:core: 'packages/frontend/core/**/*' +app:core: + - changed-files: + - any-glob-to-any-file: + - 'packages/frontend/core/**/*' -app:electron: 'packages/frontend/electron/**/*' +app:electron: + - changed-files: + - any-glob-to-any-file: + - 'packages/frontend/electron/**/*' -app:server: 'packages/backend/server/**/*' +app:server: + - changed-files: + - any-glob-to-any-file: + - 'packages/backend/server/**/*' From 48f4d6a06cd7008b29790ef7f74de1b8e737bb6e Mon Sep 17 00:00:00 2001 From: Joooye_34 Date: Tue, 5 Dec 2023 10:40:48 +0000 Subject: [PATCH 28/68] fix(core): error page 500 status dark mode (#5180) close #5155 --- .../error-assets/dark-500-status.assets.svg | 43 +++++++++++++++++++ ...assets.svg => light-500-status.assets.svg} | 0 .../error-basic/error-detail.tsx | 27 ++++++++++-- 3 files changed, 66 insertions(+), 4 deletions(-) create mode 100644 packages/frontend/core/src/components/affine/affine-error-boundary/error-assets/dark-500-status.assets.svg rename packages/frontend/core/src/components/affine/affine-error-boundary/error-assets/{500-status.assets.svg => light-500-status.assets.svg} (100%) diff --git a/packages/frontend/core/src/components/affine/affine-error-boundary/error-assets/dark-500-status.assets.svg b/packages/frontend/core/src/components/affine/affine-error-boundary/error-assets/dark-500-status.assets.svg new file mode 100644 index 0000000000..f87766bfd6 --- /dev/null +++ b/packages/frontend/core/src/components/affine/affine-error-boundary/error-assets/dark-500-status.assets.svg @@ -0,0 +1,43 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/packages/frontend/core/src/components/affine/affine-error-boundary/error-assets/500-status.assets.svg b/packages/frontend/core/src/components/affine/affine-error-boundary/error-assets/light-500-status.assets.svg similarity index 100% rename from packages/frontend/core/src/components/affine/affine-error-boundary/error-assets/500-status.assets.svg rename to packages/frontend/core/src/components/affine/affine-error-boundary/error-assets/light-500-status.assets.svg diff --git a/packages/frontend/core/src/components/affine/affine-error-boundary/error-basic/error-detail.tsx b/packages/frontend/core/src/components/affine/affine-error-boundary/error-basic/error-detail.tsx index fc481979eb..0e5ffc1e74 100644 --- a/packages/frontend/core/src/components/affine/affine-error-boundary/error-basic/error-detail.tsx +++ b/packages/frontend/core/src/components/affine/affine-error-boundary/error-basic/error-detail.tsx @@ -2,6 +2,7 @@ import { Button } from '@affine/component/ui/button'; import { Trans } from '@affine/i18n'; import { useAFFiNEI18N } from '@affine/i18n/hooks'; import { useAsyncCallback } from '@toeverything/hooks/affine-async-hooks'; +import { useTheme } from 'next-themes'; import { type FC, type PropsWithChildren, @@ -10,7 +11,8 @@ import { } from 'react'; import imageUrlFor404 from '../error-assets/404-status.assets.svg'; -import imageUrlFor500 from '../error-assets/500-status.assets.svg'; +import imageUrlForDark500 from '../error-assets/dark-500-status.assets.svg'; +import imageUrlForLight500 from '../error-assets/light-500-status.assets.svg'; import * as styles from './error-detail.css'; export enum ErrorStatus { @@ -30,8 +32,20 @@ export interface ErrorDetailProps extends PropsWithChildren { } const imageMap = new Map([ - [ErrorStatus.NotFound, imageUrlFor404], - [ErrorStatus.Unexpected, imageUrlFor500], + [ + ErrorStatus.NotFound, + { + light: imageUrlFor404, // TODO: Ask designer for dark/light mode image. + dark: imageUrlFor404, + }, + ], + [ + ErrorStatus.Unexpected, + { + light: imageUrlForLight500, // TODO: Split assets lib and use image hook to handle light and dark. + dark: imageUrlForDark500, + }, + ], ]); /** @@ -49,6 +63,7 @@ export const ErrorDetail: FC = props => { const descriptions = Array.isArray(description) ? description : [description]; const [isBtnLoading, setBtnLoading] = useState(false); const t = useAFFiNEI18N(); + const { resolvedTheme } = useTheme(); const onBtnClick = useAsyncCallback(async () => { try { @@ -83,7 +98,11 @@ export const ErrorDetail: FC = props => { {withoutImage ? null : (
    )}
    From e5f8a583306df40319370f59d8cdad3d4cc08292 Mon Sep 17 00:00:00 2001 From: LongYinan Date: Wed, 6 Dec 2023 08:03:05 +0000 Subject: [PATCH 29/68] ci: refactor workflow (#5139) Merge tests job into single one, reuse job as much as possible --- .github/actions/build-rust/action.yml | 48 +- .github/actions/download-core/action.yml | 22 + .github/actions/setup-node/action.yml | 41 +- .github/workflows/build-desktop.yml | 190 ------ .github/workflows/build-server.yml | 311 ---------- .github/workflows/build-test.yml | 599 ++++++++++++++++++ .github/workflows/build.yml | 199 ------ .github/workflows/cancel.yml | 18 - .github/workflows/codeql.yml | 70 --- packages/backend/storage/index.d.ts | 35 +- packages/backend/storage/package.json | 9 +- packages/frontend/native/index.d.ts | 59 +- packages/frontend/native/index.js | 68 ++- packages/frontend/native/package.json | 6 +- tests/affine-cloud/e2e/basic.spec.ts | 144 ----- tests/affine-cloud/e2e/collaboration.spec.ts | 462 ++++++-------- tests/affine-cloud/e2e/login.spec.ts | 110 +++- tests/affine-cloud/e2e/migration.spec.ts | 111 ++++ tests/affine-cloud/e2e/workspace.spec.ts | 96 +++ yarn.lock | 600 ++++++++++++++++++- 20 files changed, 1837 insertions(+), 1361 deletions(-) create mode 100644 .github/actions/download-core/action.yml delete mode 100644 .github/workflows/build-desktop.yml delete mode 100644 .github/workflows/build-server.yml create mode 100644 .github/workflows/build-test.yml delete mode 100644 .github/workflows/build.yml delete mode 100644 .github/workflows/cancel.yml delete mode 100644 .github/workflows/codeql.yml delete mode 100644 tests/affine-cloud/e2e/basic.spec.ts create mode 100644 tests/affine-cloud/e2e/migration.spec.ts create mode 100644 tests/affine-cloud/e2e/workspace.spec.ts diff --git a/.github/actions/build-rust/action.yml b/.github/actions/build-rust/action.yml index f187641f85..08f230cef9 100644 --- a/.github/actions/build-rust/action.yml +++ b/.github/actions/build-rust/action.yml @@ -29,6 +29,11 @@ runs: env: CARGO_INCREMENTAL: '1' + - name: Set CC + if: ${{ contains(inputs.target, 'linux') && inputs.package != '@affine/native' }} + shell: bash + run: echo "CC=clang" >> "$GITHUB_ENV" + - name: Cache cargo uses: actions/cache@v3 with: @@ -36,51 +41,12 @@ runs: ~/.cargo/registry/index/ ~/.cargo/registry/cache/ ~/.cargo/git/db/ - .cargo-cache + ~/.napi-rs target/${{ inputs.target }} key: stable-${{ inputs.target }}-cargo-cache - name: Build - if: ${{ inputs.target != 'x86_64-unknown-linux-gnu' && inputs.target != 'aarch64-unknown-linux-gnu' }} shell: bash run: | - yarn workspace ${{ inputs.package }} nx build ${{ inputs.package }} --target ${{ inputs.target }} + yarn workspace ${{ inputs.package }} nx build ${{ inputs.package }} --target ${{ inputs.target }} --use-napi-cross env: NX_CLOUD_ACCESS_TOKEN: ${{ inputs.nx_token }} - - - name: Build - if: ${{ inputs.target == 'x86_64-unknown-linux-gnu' }} - uses: addnab/docker-run-action@v3 - with: - image: ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-debian - options: --user 0:0 -v ${{ github.workspace }}/.cargo-cache/git/db:/usr/local/cargo/git/db -v ${{ github.workspace }}/.cargo/registry/cache:/usr/local/cargo/registry/cache -v ${{ github.workspace }}/.cargo/registry/index:/usr/local/cargo/registry/index -v ${{ github.workspace }}:/build -w /build -e NX_CLOUD_ACCESS_TOKEN=${{ inputs.nx_token }} - run: | - export CC=x86_64-unknown-linux-gnu-gcc - export CC_x86_64_unknown_linux_gnu=x86_64-unknown-linux-gnu-gcc - rm -rf /usr/local/rustup/downloads/* - rustup target add x86_64-unknown-linux-gnu - export RUSTFLAGS="-C debuginfo=1" - yarn workspace ${{ inputs.package }} nx build ${{ inputs.package }} --target ${{ inputs.target }} - if [ -d "node_modules/.cache" ]; then - chmod -R 777 node_modules/.cache - fi - if [ -d "target" ]; then - chmod -R 777 target; - fi - - - name: Build - if: ${{ inputs.target == 'aarch64-unknown-linux-gnu' }} - uses: addnab/docker-run-action@v3 - with: - image: ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-debian-aarch64 - options: --user 0:0 -v ${{ github.workspace }}/.cargo-cache/git/db:/usr/local/cargo/git/db -v ${{ github.workspace }}/.cargo/registry/cache:/usr/local/cargo/registry/cache -v ${{ github.workspace }}/.cargo/registry/index:/usr/local/cargo/registry/index -v ${{ github.workspace }}:/build -w /build -e NX_CLOUD_ACCESS_TOKEN=${{ inputs.nx_token }} - run: | - export RUSTFLAGS="-C debuginfo=1" - rm -rf /usr/local/rustup/downloads/* - rustup target add aarch64-unknown-linux-gnu - yarn workspace ${{ inputs.package }} nx build ${{ inputs.package }} --target ${{ inputs.target }} - if [ -d "node_modules/.cache" ]; then - chmod -R 777 node_modules/.cache - fi - if [ -d "target" ]; then - chmod -R 777 target; - fi diff --git a/.github/actions/download-core/action.yml b/.github/actions/download-core/action.yml new file mode 100644 index 0000000000..c70fcfbe9b --- /dev/null +++ b/.github/actions/download-core/action.yml @@ -0,0 +1,22 @@ +name: 'Download core artifacts' +description: 'Download core artifacts and extract to dist' +inputs: + path: + description: 'Path to extract' + required: true + +runs: + using: 'composite' + steps: + - name: Download tar.gz + uses: actions/download-artifact@v3 + with: + name: core + path: . + + - name: Extract core artifacts + shell: bash + run: | + mkdir -p ${{ inputs.path }} + tar -xvf dist.tar.gz --directory ${{ inputs.path }} + rm dist.tar.gz diff --git a/.github/actions/setup-node/action.yml b/.github/actions/setup-node/action.yml index c9dbcdba32..f18caccede 100644 --- a/.github/actions/setup-node/action.yml +++ b/.github/actions/setup-node/action.yml @@ -36,6 +36,9 @@ inputs: description: 'Set enableScripts in .yarnrc.yml' required: false default: 'true' + full-cache: + description: 'Full installation cache' + required: false runs: using: 'composite' @@ -46,7 +49,6 @@ runs: node-version-file: '.nvmrc' registry-url: https://npm.pkg.github.com scope: '@toeverything' - cache: 'yarn' - name: Set nmMode if: ${{ inputs.hard-link-nm == 'false' }} @@ -63,6 +65,29 @@ runs: shell: bash run: yarn config set enableScripts false + - name: Set yarn global cache path + shell: bash + id: yarn-cache + run: node -e "const p = $(yarn config cacheFolder --json).effective; console.log('yarn_global_cache=' + p)" >> $GITHUB_OUTPUT + + - name: Cache non-full yarn cache + uses: actions/cache@v3 + if: ${{ inputs.full-cache != 'true' }} + with: + path: | + node_modules + ${{ steps.yarn-cache.outputs.yarn_global_cache }} + key: node_modules-cache-${{ github.job }}-${{ runner.os }} + + - name: Cache full yarn cache + uses: actions/cache@v3 + if: ${{ inputs.full-cache == 'true' }} + with: + path: | + node_modules + ${{ steps.yarn-cache.outputs.yarn_global_cache }} + key: node_modules-cache-full-${{ runner.os }} + - name: yarn install if: ${{ inputs.package-install == 'true' }} continue-on-error: true @@ -102,8 +127,8 @@ runs: id: playwright-cache if: ${{ inputs.playwright-install == 'true' }} with: - path: '~/.cache/ms-playwright' - key: '${{ runner.os }}-${{ runner.arch }}-playwright-${{ steps.playwright-version.outputs.version }}' + path: ${{ github.workspace }}/node_modules/.cache/ms-playwright + key: '${{ runner.os }}-playwright-${{ steps.playwright-version.outputs.version }}' # As a fallback, if the Playwright version has changed, try use the # most recently cached version. There's a good chance that at least one # of the browser binary versions haven't been updated, so Playwright can @@ -113,7 +138,7 @@ runs: # date cache, but still let Playwright decide if it needs to download # new binaries or not. restore-keys: | - ${{ runner.os }}-${{ runner.arch }}-playwright- + ${{ runner.os }}-playwright- # If the Playwright browser binaries weren't able to be restored, we tell # playwright to install everything for us. @@ -121,6 +146,8 @@ runs: shell: bash if: inputs.playwright-install == 'true' run: yarn playwright install --with-deps chromium + env: + PLAYWRIGHT_BROWSERS_PATH: ${{ github.workspace }}/node_modules/.cache/ms-playwright - name: Get installed Electron version id: electron-version @@ -134,16 +161,16 @@ runs: if: ${{ inputs.electron-install == 'true' }} with: path: 'node_modules/.cache/electron' - key: '${{ runner.os }}-{{ runner.arch }}-electron-${{ steps.electron-version.outputs.version }}' + key: '${{ runner.os }}-electron-${{ steps.electron-version.outputs.version }}' restore-keys: | - ${{ runner.os }}-{{ runner.arch }}-electron- + ${{ runner.os }}-electron- - name: Install Electron binary shell: bash if: inputs.electron-install == 'true' run: node ./node_modules/electron/install.js env: - ELECTRON_OVERRIDE_DIST_PATH: ./node_modules/.cache/electron + electron_config_cache: ./node_modules/.cache/electron - name: Build Infra shell: bash diff --git a/.github/workflows/build-desktop.yml b/.github/workflows/build-desktop.yml deleted file mode 100644 index 8017e0edf7..0000000000 --- a/.github/workflows/build-desktop.yml +++ /dev/null @@ -1,190 +0,0 @@ -name: Build(Desktop) & Test - -on: - push: - branches: - - canary - - v[0-9]+.[0-9]+.x-staging - - v[0-9]+.[0-9]+.x - paths-ignore: - - README.md - - .github/** - - '!.github/workflows/build-desktop.yml' - - '!.github/actions/build-rust/action.yml' - - '!.github/actions/setup-node/action.yml' - pull_request: - merge_group: - branches: - - canary - - v[0-9]+.[0-9]+.x-staging - - v[0-9]+.[0-9]+.x - paths-ignore: - - README.md - - .github/** - - '!.github/workflows/build-desktop.yml' - - '!.github/actions/build-rust/action.yml' - - '!.github/actions/setup-node/action.yml' - -env: - DEBUG: napi:* - BUILD_TYPE: canary - APP_NAME: affine - COVERAGE: true - DISTRIBUTION: desktop - MACOSX_DEPLOYMENT_TARGET: '10.13' - NX_CLOUD_ACCESS_TOKEN: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }} - -jobs: - build-core: - name: Build @affine/core - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v4 - - name: Setup Node.js - uses: ./.github/actions/setup-node - with: - electron-install: false - - name: Build Core - run: yarn nx build @affine/core - - name: Upload core artifact - uses: actions/upload-artifact@v3 - with: - name: core - path: ./packages/frontend/core/dist - if-no-files-found: error - - build-native: - name: Build Native - runs-on: ubuntu-latest - needs: build-core - steps: - - uses: actions/checkout@v4 - - name: Setup Node.js - uses: ./.github/actions/setup-node - - name: Build AFFiNE native - uses: ./.github/actions/build-rust - with: - target: x86_64-unknown-linux-gnu - package: '@affine/native' - nx_token: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }} - - name: Run tests - run: yarn test - working-directory: ./packages/frontend/native - - desktop-test: - name: Desktop Test - runs-on: ${{ matrix.spec.os }} - strategy: - fail-fast: false - # all combinations: macos-latest x64, macos-latest arm64, windows-latest x64, ubuntu-latest x64 - matrix: - spec: - - { - os: macos-latest, - platform: macos, - arch: x64, - target: x86_64-apple-darwin, - test: true, - } - - { - os: macos-latest, - platform: macos, - arch: arm64, - target: aarch64-apple-darwin, - test: false, - } - - { - os: ubuntu-latest, - platform: linux, - arch: x64, - target: x86_64-unknown-linux-gnu, - test: true, - } - - { - os: windows-latest, - platform: windows, - arch: x64, - target: x86_64-pc-windows-msvc, - test: true, - } - needs: build-core - steps: - - uses: actions/checkout@v4 - - name: Setup Node.js - uses: ./.github/actions/setup-node - timeout-minutes: 10 - with: - extra-flags: workspaces focus @affine/electron @affine/monorepo @affine-test/affine-desktop - playwright-install: true - hard-link-nm: false - enableScripts: false - - - name: Build AFFiNE native - uses: ./.github/actions/build-rust - with: - target: ${{ matrix.spec.target }} - package: '@affine/native' - nx_token: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }} - - - name: Run unit tests - if: ${{ matrix.spec.test }} - shell: bash - run: yarn vitest - working-directory: packages/frontend/electron - - - name: Download core artifact - uses: actions/download-artifact@v3 - with: - name: core - path: packages/frontend/electron/resources/web-static - - - name: Build Desktop Layers - run: yarn workspace @affine/electron build - - - name: Run desktop tests - if: ${{ matrix.spec.test && matrix.spec.os == 'ubuntu-latest' }} - run: xvfb-run --auto-servernum --server-args="-screen 0 1280x960x24" -- yarn workspace @affine-test/affine-desktop e2e - env: - COVERAGE: true - - - name: Run desktop tests - if: ${{ matrix.spec.test && matrix.spec.os != 'ubuntu-latest' }} - run: yarn workspace @affine-test/affine-desktop e2e - env: - COVERAGE: true - - - name: Make bundle - if: ${{ matrix.spec.os == 'macos-latest' && matrix.spec.arch == 'arm64' }} - env: - SKIP_BUNDLE: true - SKIP_WEB_BUILD: true - HOIST_NODE_MODULES: 1 - run: yarn workspace @affine/electron package --platform=darwin --arch=arm64 - - - name: Output check - if: ${{ matrix.spec.os == 'macos-latest' && matrix.spec.arch == 'arm64' }} - run: | - yarn workspace @affine/electron ts-node ./scripts/macos-arm64-output-check.ts - - - name: Collect code coverage report - if: ${{ matrix.spec.test }} - run: yarn exec nyc report -t .nyc_output --report-dir .coverage --reporter=lcov - - - name: Upload e2e test coverage results - if: ${{ matrix.spec.test }} - uses: codecov/codecov-action@v3 - with: - token: ${{ secrets.CODECOV_TOKEN }} - files: ./.coverage/lcov.info - flags: e2etest-${{ matrix.spec.os }}-${{ matrix.spec.arch }} - name: affine - fail_ci_if_error: false - - - name: Upload test results - if: ${{ failure() }} - uses: actions/upload-artifact@v3 - with: - name: test-results-e2e-${{ matrix.spec.os }}-${{ matrix.spec.arch }} - path: ./test-results - if-no-files-found: ignore diff --git a/.github/workflows/build-server.yml b/.github/workflows/build-server.yml deleted file mode 100644 index 9fb88605c4..0000000000 --- a/.github/workflows/build-server.yml +++ /dev/null @@ -1,311 +0,0 @@ -name: Build(Server) & Test - -on: - push: - branches: - - canary - - v[0-9]+.[0-9]+.x-staging - - v[0-9]+.[0-9]+.x - paths-ignore: - - README.md - - .github/** - - '!.github/workflows/build-server.yml' - - '!.github/actions/build-rust/action.yml' - - '!.github/actions/setup-node/action.yml' - pull_request: - merge_group: - branches: - - canary - - v[0-9]+.[0-9]+.x-staging - - v[0-9]+.[0-9]+.x - paths-ignore: - - README.md - - .github/** - - '!.github/workflows/build-server.yml' - - '!.github/actions/build-rust/action.yml' - - '!.github/actions/setup-node/action.yml' - -env: - DEBUG: napi:* - BUILD_TYPE: canary - APP_NAME: affine - COVERAGE: true - DISTRIBUTION: browser - NX_CLOUD_ACCESS_TOKEN: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }} - -jobs: - build-storage: - name: Build Storage - runs-on: ubuntu-latest - env: - RUSTFLAGS: '-C debuginfo=1' - - steps: - - uses: actions/checkout@v4 - - name: Setup Node.js - uses: ./.github/actions/setup-node - with: - extra-flags: workspaces focus @affine/storage - electron-install: false - build-infra: false - build-plugins: false - - name: Build Rust - uses: ./.github/actions/build-rust - with: - target: 'x86_64-unknown-linux-gnu' - package: '@affine/storage' - nx_token: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }} - - name: Upload storage.node - uses: actions/upload-artifact@v3 - with: - name: storage.node - path: ./packages/backend/storage/storage.node - if-no-files-found: error - - server-test: - name: Server Test - runs-on: ubuntu-latest - needs: build-storage - services: - postgres: - image: postgres - env: - POSTGRES_PASSWORD: affine - options: >- - --health-cmd pg_isready - --health-interval 10s - --health-timeout 5s - --health-retries 5 - ports: - - 5432:5432 - mailer: - image: mailhog/mailhog - ports: - - 1025:1025 - - 8025:8025 - steps: - - uses: actions/checkout@v4 - - - name: Setup Node.js - uses: ./.github/actions/setup-node - with: - electron-install: false - - - name: Initialize database - run: | - psql -h localhost -U postgres -c "CREATE DATABASE affine;" - psql -h localhost -U postgres -c "CREATE USER affine WITH PASSWORD 'affine';" - psql -h localhost -U postgres -c "ALTER USER affine WITH SUPERUSER;" - env: - PGPASSWORD: affine - - - name: Generate prisma client - run: | - yarn workspace @affine/server exec prisma generate - yarn workspace @affine/server exec prisma db push - env: - DATABASE_URL: postgresql://affine:affine@localhost:5432/affine - - - name: Run init-db script - run: yarn workspace @affine/server exec ts-node ./scripts/init-db.ts - env: - DATABASE_URL: postgresql://affine:affine@localhost:5432/affine - - - name: Download storage.node - uses: actions/download-artifact@v3 - with: - name: storage.node - path: ./packages/backend/server - - - name: Run server tests - run: yarn workspace @affine/server test:coverage - env: - CARGO_TARGET_DIR: '${{ github.workspace }}/target' - DATABASE_URL: postgresql://affine:affine@localhost:5432/affine - - - name: Upload server test coverage results - uses: codecov/codecov-action@v3 - with: - token: ${{ secrets.CODECOV_TOKEN }} - files: ./packages/backend/server/.coverage/lcov.info - flags: server-test - name: affine - fail_ci_if_error: false - - server-e2e-test: - name: Server E2E Test - runs-on: ubuntu-latest - needs: build-storage - services: - postgres: - image: postgres - env: - POSTGRES_PASSWORD: affine - options: >- - --health-cmd pg_isready - --health-interval 10s - --health-timeout 5s - --health-retries 5 - ports: - - 5432:5432 - mailer: - image: mailhog/mailhog - ports: - - 1025:1025 - - 8025:8025 - steps: - - uses: actions/checkout@v4 - - - name: Setup Node.js - uses: ./.github/actions/setup-node - with: - playwright-install: true - - - name: Initialize database - run: | - psql -h localhost -U postgres -c "CREATE DATABASE affine;" - psql -h localhost -U postgres -c "CREATE USER affine WITH PASSWORD 'affine';" - psql -h localhost -U postgres -c "ALTER USER affine WITH SUPERUSER;" - env: - PGPASSWORD: affine - - - name: Generate prisma client - run: | - yarn workspace @affine/server exec prisma generate - yarn workspace @affine/server exec prisma db push - env: - DATABASE_URL: postgresql://affine:affine@localhost:5432/affine - - - name: Run init-db script - run: yarn workspace @affine/server exec ts-node ./scripts/init-db.ts - env: - DATABASE_URL: postgresql://affine:affine@localhost:5432/affine - - - name: Download storage.node - uses: actions/download-artifact@v3 - with: - name: storage.node - path: ./packages/backend/server - - - name: Run playwright tests - run: xvfb-run --auto-servernum --server-args="-screen 0 1280x960x24" -- yarn workspace @affine-test/affine-cloud e2e --forbid-only - env: - COVERAGE: true - DATABASE_URL: postgresql://affine:affine@localhost:5432/affine - - - name: Collect code coverage report - run: yarn exec nyc report -t .nyc_output --report-dir .coverage --reporter=lcov - - - name: Upload e2e test coverage results - uses: codecov/codecov-action@v3 - with: - token: ${{ secrets.CODECOV_TOKEN }} - files: ./.coverage/lcov.info - flags: server-e2etest - name: affine - fail_ci_if_error: false - - - name: Upload test results - if: ${{ failure() }} - uses: actions/upload-artifact@v3 - with: - name: test-results-e2e-server - path: ./tests/affine-cloud/test-results - if-no-files-found: ignore - - server-desktop-e2e-test: - name: Server Desktop E2E Test - runs-on: ubuntu-latest - needs: build-storage - services: - postgres: - image: postgres - env: - POSTGRES_PASSWORD: affine - options: >- - --health-cmd pg_isready - --health-interval 10s - --health-timeout 5s - --health-retries 5 - ports: - - 5432:5432 - mailer: - image: mailhog/mailhog - ports: - - 1025:1025 - - 8025:8025 - steps: - - uses: actions/checkout@v4 - - - name: Setup Node.js - uses: ./.github/actions/setup-node - with: - playwright-install: true - hard-link-nm: false - - - name: Build AFFiNE native - uses: ./.github/actions/build-rust - with: - target: x86_64-unknown-linux-gnu - package: '@affine/native' - nx_token: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }} - - - name: Initialize database - run: | - psql -h localhost -U postgres -c "CREATE DATABASE affine;" - psql -h localhost -U postgres -c "CREATE USER affine WITH PASSWORD 'affine';" - psql -h localhost -U postgres -c "ALTER USER affine WITH SUPERUSER;" - env: - PGPASSWORD: affine - - - name: Generate prisma client - run: | - yarn workspace @affine/server exec prisma generate - yarn workspace @affine/server prisma db push - env: - DATABASE_URL: postgresql://affine:affine@localhost:5432/affine - - - name: Run init-db script - run: yarn workspace @affine/server exec ts-node ./scripts/init-db.ts - env: - DATABASE_URL: postgresql://affine:affine@localhost:5432/affine - - - name: Download storage.node - uses: actions/download-artifact@v3 - with: - name: storage.node - path: ./packages/backend/server - - - name: Build Plugins - run: yarn run build:plugins - - - name: Build Desktop Layers - run: yarn workspace @affine/electron build:dev - - - name: Run playwright tests - run: xvfb-run --auto-servernum --server-args="-screen 0 1280x960x24" yarn workspace @affine-test/affine-desktop-cloud e2e - env: - COVERAGE: true - DEV_SERVER_URL: http://localhost:8080 - DATABASE_URL: postgresql://affine:affine@localhost:5432/affine - ENABLE_LOCAL_EMAIL: true - - - name: Collect code coverage report - run: yarn exec nyc report -t .nyc_output --report-dir .coverage --reporter=lcov - - - name: Upload e2e test coverage results - uses: codecov/codecov-action@v3 - with: - token: ${{ secrets.CODECOV_TOKEN }} - files: ./.coverage/lcov.info - flags: server-e2etest - name: affine - fail_ci_if_error: false - - - name: Upload test results - if: ${{ failure() }} - uses: actions/upload-artifact@v3 - with: - name: test-results-e2e-server - path: ./tests/affine-cloud/test-results - if-no-files-found: ignore diff --git a/.github/workflows/build-test.yml b/.github/workflows/build-test.yml new file mode 100644 index 0000000000..7b76cb92cb --- /dev/null +++ b/.github/workflows/build-test.yml @@ -0,0 +1,599 @@ +name: Build & Test + +on: + push: + branches: + - canary + - v[0-9]+.[0-9]+.x-staging + - v[0-9]+.[0-9]+.x + paths-ignore: + - README.md + pull_request: + +env: + DEBUG: napi:* + BUILD_TYPE: canary + APP_NAME: affine + AFFINE_ENV: dev + COVERAGE: true + MACOSX_DEPLOYMENT_TARGET: '10.13' + NX_CLOUD_ACCESS_TOKEN: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }} + PLAYWRIGHT_BROWSERS_PATH: ${{ github.workspace }}/node_modules/.cache/ms-playwright + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + analyze: + name: Analyze + runs-on: ubuntu-latest + permissions: + actions: read + contents: read + security-events: write + + strategy: + fail-fast: false + matrix: + language: ['javascript', 'typescript'] + # Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + # Initializes the CodeQL tools for scanning. + - name: Initialize CodeQL + uses: github/codeql-action/init@v2 + with: + languages: ${{ matrix.language }} + # If you wish to specify custom queries, you can do so here or in a config file. + # By default, queries listed here will override any specified in a config file. + # Prefix the list here with "+" to use these queries and those in the config file. + + # Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs + # queries: security-extended,security-and-quality + + # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). + # If this step fails, then you should remove it and run the build manually (see below) + - name: Autobuild + uses: github/codeql-action/autobuild@v2 + + # ℹ️ Command-line programs to run using the OS shell. + # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun + + # If the Autobuild fails above, remove it and uncomment the following three lines. + # modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance. + + # - run: | + # echo "Run, Build Application using script" + # ./location_of_script_within_repo/buildscript.sh + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v2 + lint: + name: Lint + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + - name: Run oxlint + # oxlint is fast, so wrong code will fail quickly + run: yarn dlx $(node -e "console.log(require('./package.json').scripts['lint:ox'])") + - name: Setup Node.js + uses: ./.github/actions/setup-node + with: + electron-install: false + full-cache: true + - name: Run i18n codegen + run: yarn i18n-codegen gen + - name: Run ESLint + run: yarn lint:eslint --max-warnings=0 + - name: Run Prettier + # Set nmMode in `actions/setup-node` will modify the .yarnrc.yml + run: | + git checkout .yarnrc.yml + yarn lint:prettier + - name: Run Type Check + run: yarn typecheck + + check-yarn-binary: + name: Check yarn binary + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Run check + run: | + yarn set version $(node -e "console.log(require('./package.json').packageManager.split('@')[1])") + git diff --exit-code + + e2e-plugin-test: + name: E2E Plugin Test + runs-on: ubuntu-latest + env: + DISTRIBUTION: browser + steps: + - uses: actions/checkout@v4 + - name: Setup Node.js + uses: ./.github/actions/setup-node + with: + playwright-install: true + electron-install: false + full-cache: true + - name: Run playwright tests + run: yarn e2e --forbid-only + working-directory: tests/affine-plugin + env: + COVERAGE: true + - name: Collect code coverage report + run: yarn exec nyc report -t .nyc_output --report-dir .coverage --reporter=lcov + + - name: Upload e2e test coverage results + uses: codecov/codecov-action@v3 + with: + token: ${{ secrets.CODECOV_TOKEN }} + files: ./.coverage/lcov.info + flags: e2e-plugin-test + name: affine + fail_ci_if_error: false + + - name: Upload test results + if: ${{ failure() }} + uses: actions/upload-artifact@v3 + with: + name: test-results-e2e-plugin + path: ./test-results + if-no-files-found: ignore + + e2e-test: + name: E2E Test + runs-on: ubuntu-latest + env: + DISTRIBUTION: browser + strategy: + fail-fast: false + matrix: + shard: [1, 2, 3, 4, 5] + steps: + - uses: actions/checkout@v4 + - name: Setup Node.js + uses: ./.github/actions/setup-node + with: + playwright-install: true + electron-install: false + full-cache: true + + - name: Run playwright tests + run: yarn workspace @affine-test/affine-local e2e --forbid-only --shard=${{ matrix.shard }}/${{ strategy.job-total }} + + - name: Upload test results + if: ${{ failure() }} + uses: actions/upload-artifact@v3 + with: + name: test-results-e2e-${{ matrix.shard }} + path: ./test-results + if-no-files-found: ignore + + e2e-migration-test: + name: E2E Migration Test + runs-on: ubuntu-latest + env: + DISTRIBUTION: browser + steps: + - uses: actions/checkout@v4 + - name: Setup Node.js + uses: ./.github/actions/setup-node + with: + playwright-install: true + electron-install: false + full-cache: true + + - name: Run playwright tests + run: yarn workspace @affine-test/affine-migration e2e --forbid-only + + - name: Upload test results + if: ${{ failure() }} + uses: actions/upload-artifact@v3 + with: + name: test-results-e2e-migration + path: ./tests/affine-migration/test-results + if-no-files-found: ignore + + unit-test: + name: Unit Test + runs-on: ubuntu-latest + needs: + - build-native + env: + DISTRIBUTION: browser + steps: + - uses: actions/checkout@v4 + - name: Setup Node.js + uses: ./.github/actions/setup-node + with: + electron-install: false + full-cache: true + + - name: Download affine.linux-x64-gnu.node + uses: actions/download-artifact@v3 + with: + name: affine.linux-x64-gnu.node + path: ./packages/frontend/native + + - name: Unit Test + run: yarn nx test:coverage @affine/monorepo + + - name: Upload unit test coverage results + uses: codecov/codecov-action@v3 + with: + token: ${{ secrets.CODECOV_TOKEN }} + files: ./.coverage/store/lcov.info + flags: unittest + name: affine + fail_ci_if_error: false + + build-native: + name: Build AFFiNE native (${{ matrix.spec.target }}) + runs-on: ${{ matrix.spec.os }} + env: + CARGO_PROFILE_RELEASE_DEBUG: '1' + strategy: + fail-fast: false + matrix: + spec: + - { os: ubuntu-latest, target: x86_64-unknown-linux-gnu } + - { os: windows-latest, target: x86_64-pc-windows-msvc } + - { os: macos-latest, target: x86_64-apple-darwin } + - { os: macos-latest, target: aarch64-apple-darwin } + + steps: + - uses: actions/checkout@v4 + - name: Setup Node.js + uses: ./.github/actions/setup-node + with: + extra-flags: workspaces focus @affine/native + electron-install: false + build-infra: false + build-plugins: false + - name: Setup filename + id: filename + shell: bash + run: | + export PLATFORM_ARCH_ABI=$(node -e "console.log(require('@napi-rs/cli').parseTriple('${{ matrix.spec.target }}').platformArchABI)") + echo "filename=affine.$PLATFORM_ARCH_ABI.node" >> "$GITHUB_OUTPUT" + - name: Build AFFiNE native + uses: ./.github/actions/build-rust + with: + target: ${{ matrix.spec.target }} + package: '@affine/native' + nx_token: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }} + - name: Upload ${{ steps.filename.outputs.filename }} + uses: actions/upload-artifact@v3 + with: + name: ${{ steps.filename.outputs.filename }} + path: ./packages/frontend/native/${{ steps.filename.outputs.filename }} + if-no-files-found: error + + build-storage: + name: Build Storage + runs-on: ubuntu-latest + env: + CARGO_PROFILE_RELEASE_DEBUG: '1' + steps: + - uses: actions/checkout@v4 + - name: Setup Node.js + uses: ./.github/actions/setup-node + with: + extra-flags: workspaces focus @affine/storage + electron-install: false + build-infra: false + build-plugins: false + - name: Build Rust + uses: ./.github/actions/build-rust + with: + target: 'x86_64-unknown-linux-gnu' + package: '@affine/storage' + nx_token: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }} + - name: Upload storage.node + uses: actions/upload-artifact@v3 + with: + name: storage.node + path: ./packages/backend/storage/storage.node + if-no-files-found: error + + build-core: + name: Build @affine/core + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + - name: Setup Node.js + uses: ./.github/actions/setup-node + with: + electron-install: false + build-plugins: false + full-cache: true + - name: Build Core + # always skip cache because its fast, and cache configuration is always changing + run: yarn nx build @affine/core --skip-nx-cache + - name: zip core + run: tar -czf dist.tar.gz --directory=packages/frontend/core/dist . + - name: Upload core artifact + uses: actions/upload-artifact@v3 + with: + name: core + path: dist.tar.gz + if-no-files-found: error + + server-test: + name: Server Test + runs-on: ubuntu-latest + needs: build-storage + env: + DISTRIBUTION: browser + services: + postgres: + image: postgres + env: + POSTGRES_PASSWORD: affine + options: >- + --health-cmd pg_isready + --health-interval 10s + --health-timeout 5s + --health-retries 5 + ports: + - 5432:5432 + mailer: + image: mailhog/mailhog + ports: + - 1025:1025 + - 8025:8025 + steps: + - uses: actions/checkout@v4 + + - name: Setup Node.js + uses: ./.github/actions/setup-node + with: + electron-install: false + full-cache: true + + - name: Initialize database + run: | + psql -h localhost -U postgres -c "CREATE DATABASE affine;" + psql -h localhost -U postgres -c "CREATE USER affine WITH PASSWORD 'affine';" + psql -h localhost -U postgres -c "ALTER USER affine WITH SUPERUSER;" + env: + PGPASSWORD: affine + + - name: Generate prisma client + run: | + yarn workspace @affine/server exec prisma generate + yarn workspace @affine/server exec prisma db push + env: + DATABASE_URL: postgresql://affine:affine@localhost:5432/affine + + - name: Run init-db script + run: yarn workspace @affine/server exec ts-node ./scripts/init-db.ts + env: + DATABASE_URL: postgresql://affine:affine@localhost:5432/affine + + - name: Download storage.node + uses: actions/download-artifact@v3 + with: + name: storage.node + path: ./packages/backend/server + + - name: Run server tests + run: yarn workspace @affine/server test:coverage + env: + CARGO_TARGET_DIR: '${{ github.workspace }}/target' + DATABASE_URL: postgresql://affine:affine@localhost:5432/affine + + - name: Upload server test coverage results + uses: codecov/codecov-action@v3 + with: + token: ${{ secrets.CODECOV_TOKEN }} + files: ./packages/backend/server/.coverage/lcov.info + flags: server-test + name: affine + fail_ci_if_error: false + + server-e2e-test: + name: ${{ matrix.tests.name }} + runs-on: ubuntu-latest + env: + DISTRIBUTION: browser + DATABASE_URL: postgresql://affine:affine@localhost:5432/affine + strategy: + fail-fast: false + matrix: + tests: + - name: 'Server E2E Test 1/3' + script: yarn workspace @affine-test/affine-cloud e2e --forbid-only --shard=1/3 + - name: 'Server E2E Test 2/3' + script: yarn workspace @affine-test/affine-cloud e2e --forbid-only --shard=2/3 + - name: 'Server E2E Test 3/3' + script: yarn workspace @affine-test/affine-cloud e2e --forbid-only --shard=3/3 + - name: 'Server Desktop E2E Test' + script: | + yarn workspace @affine/electron build:dev + xvfb-run --auto-servernum --server-args="-screen 0 1280x960x24" -- yarn workspace @affine-test/affine-desktop-cloud e2e + needs: + - build-storage + - build-native + services: + postgres: + image: postgres + env: + POSTGRES_PASSWORD: affine + options: >- + --health-cmd pg_isready + --health-interval 10s + --health-timeout 5s + --health-retries 5 + ports: + - 5432:5432 + mailer: + image: mailhog/mailhog + ports: + - 1025:1025 + - 8025:8025 + steps: + - uses: actions/checkout@v4 + + - name: Setup Node.js + uses: ./.github/actions/setup-node + with: + playwright-install: true + hard-link-nm: false + + - name: Initialize database + run: | + psql -h localhost -U postgres -c "CREATE DATABASE affine;" + psql -h localhost -U postgres -c "CREATE USER affine WITH PASSWORD 'affine';" + psql -h localhost -U postgres -c "ALTER USER affine WITH SUPERUSER;" + env: + PGPASSWORD: affine + + - name: Generate prisma client + run: | + yarn workspace @affine/server exec prisma generate + yarn workspace @affine/server exec prisma db push + env: + DATABASE_URL: postgresql://affine:affine@localhost:5432/affine + + - name: Run init-db script + run: yarn workspace @affine/server exec ts-node ./scripts/init-db.ts + - name: Download storage.node + uses: actions/download-artifact@v3 + with: + name: storage.node + path: ./packages/backend/server + + - name: Download affine.linux-x64-gnu.node + uses: actions/download-artifact@v3 + with: + name: affine.linux-x64-gnu.node + path: ./packages/frontend/native + + - name: ${{ matrix.tests.name }} + run: | + ${{ matrix.tests.script }} + env: + DEV_SERVER_URL: http://localhost:8080 + ENABLE_LOCAL_EMAIL: true + + - name: Upload test results + if: ${{ failure() }} + uses: actions/upload-artifact@v3 + with: + name: test-results-e2e-server + path: ./tests/affine-cloud/test-results + if-no-files-found: ignore + + desktop-test: + name: Desktop Test (${{ matrix.spec.os }}, ${{ matrix.spec.platform }}, ${{ matrix.spec.arch }}, ${{ matrix.spec.target }}, ${{ matrix.spec.test }}) + runs-on: ${{ matrix.spec.os }} + strategy: + fail-fast: false + # all combinations: macos-latest x64, macos-latest arm64, windows-latest x64, ubuntu-latest x64 + matrix: + spec: + - { + os: macos-latest, + platform: macos, + arch: x64, + target: x86_64-apple-darwin, + test: true, + } + - { + os: macos-latest, + platform: macos, + arch: arm64, + target: aarch64-apple-darwin, + test: false, + } + - { + os: ubuntu-latest, + platform: linux, + arch: x64, + target: x86_64-unknown-linux-gnu, + test: true, + } + - { + os: windows-latest, + platform: windows, + arch: x64, + target: x86_64-pc-windows-msvc, + test: true, + } + needs: + - build-core + - build-native + steps: + - uses: actions/checkout@v4 + - name: Setup Node.js + uses: ./.github/actions/setup-node + timeout-minutes: 10 + with: + extra-flags: workspaces focus @affine/electron @affine/monorepo @affine-test/affine-desktop + playwright-install: true + hard-link-nm: false + enableScripts: false + + - name: Setup filename + id: filename + shell: bash + run: | + export PLATFORM_ARCH_ABI=$(node -e "console.log(require('@napi-rs/cli').parseTriple('${{ matrix.spec.target }}').platformArchABI)") + echo "filename=affine.$PLATFORM_ARCH_ABI.node" >> "$GITHUB_OUTPUT" + + - name: Download ${{ steps.filename.outputs.filename }} + uses: actions/download-artifact@v3 + with: + name: ${{ steps.filename.outputs.filename }} + path: ./packages/frontend/native + + - name: Run unit tests + if: ${{ matrix.spec.test }} + shell: bash + run: yarn vitest + working-directory: packages/frontend/electron + + - name: Download core artifact + uses: ./.github/actions/download-core + with: + path: packages/frontend/electron/resources/web-static + + - name: Build Desktop Layers + run: yarn workspace @affine/electron build + + - name: Run desktop tests + if: ${{ matrix.spec.test && matrix.spec.os == 'ubuntu-latest' }} + run: xvfb-run --auto-servernum --server-args="-screen 0 1280x960x24" -- yarn workspace @affine-test/affine-desktop e2e + + - name: Run desktop tests + if: ${{ matrix.spec.test && matrix.spec.os != 'ubuntu-latest' }} + run: yarn workspace @affine-test/affine-desktop e2e + + - name: Make bundle + if: ${{ matrix.spec.os == 'macos-latest' && matrix.spec.arch == 'arm64' }} + env: + SKIP_BUNDLE: true + SKIP_WEB_BUILD: true + HOIST_NODE_MODULES: 1 + run: yarn workspace @affine/electron package --platform=darwin --arch=arm64 + + - name: Output check + if: ${{ matrix.spec.os == 'macos-latest' && matrix.spec.arch == 'arm64' }} + run: | + yarn workspace @affine/electron ts-node ./scripts/macos-arm64-output-check.ts + + - name: Upload test results + if: ${{ failure() }} + uses: actions/upload-artifact@v3 + with: + name: test-results-e2e-${{ matrix.spec.os }}-${{ matrix.spec.arch }} + path: ./test-results + if-no-files-found: ignore diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml deleted file mode 100644 index ee01a2e891..0000000000 --- a/.github/workflows/build.yml +++ /dev/null @@ -1,199 +0,0 @@ -name: Build & Test - -on: - push: - branches: - - canary - - v[0-9]+.[0-9]+.x-staging - - v[0-9]+.[0-9]+.x - paths-ignore: - - README.md - - .github/** - - '!.github/workflows/build.yml' - - '!.github/actions/build-rust/action.yml' - - '!.github/actions/setup-node/action.yml' - pull_request: - merge_group: - branches: - - canary - - v[0-9]+.[0-9]+.x-staging - - v[0-9]+.[0-9]+.x - paths-ignore: - - README.md - - .github/** - - '!.github/workflows/build.yml' - - '!.github/actions/build-rust/action.yml' - - '!.github/actions/setup-node/action.yml' - -env: - DEBUG: napi:* - BUILD_TYPE: canary - APP_NAME: affine - AFFINE_ENV: dev - COVERAGE: true - DISTRIBUTION: browser - MACOSX_DEPLOYMENT_TARGET: '10.13' - NX_CLOUD_ACCESS_TOKEN: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }} - -jobs: - lint: - name: Lint - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v4 - - name: Run oxlint - # oxlint is fast, so wrong code will fail quickly - run: yarn dlx $(node -e "console.log(require('./package.json').scripts['lint:ox'])") - - name: Setup Node.js - uses: ./.github/actions/setup-node - with: - electron-install: false - - name: Run i18n codegen - run: yarn i18n-codegen gen - - name: Run ESLint - run: yarn lint:eslint --max-warnings=0 - - name: Run Prettier - # Set nmMode in `actions/setup-node` will modify the .yarnrc.yml - run: | - git checkout .yarnrc.yml - yarn lint:prettier - - name: Run Type Check - run: yarn typecheck - - check-yarn-binary: - name: Check yarn binary - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - name: Run check - run: | - yarn set version $(node -e "console.log(require('./package.json').packageManager.split('@')[1])") - git diff --exit-code - - e2e-plugin-test: - name: E2E Plugin Test - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - name: Setup Node.js - uses: ./.github/actions/setup-node - with: - playwright-install: true - electron-install: false - - name: Run playwright tests - run: yarn e2e --forbid-only - working-directory: tests/affine-plugin - env: - COVERAGE: true - - name: Collect code coverage report - run: yarn exec nyc report -t .nyc_output --report-dir .coverage --reporter=lcov - - - name: Upload e2e test coverage results - uses: codecov/codecov-action@v3 - with: - token: ${{ secrets.CODECOV_TOKEN }} - files: ./.coverage/lcov.info - flags: e2e-plugin-test - name: affine - fail_ci_if_error: false - - - name: Upload test results - if: ${{ failure() }} - uses: actions/upload-artifact@v3 - with: - name: test-results-e2e-plugin - path: ./test-results - if-no-files-found: ignore - - e2e-test: - name: E2E Test - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - shard: [1, 2, 3, 4, 5] - steps: - - uses: actions/checkout@v4 - - name: Setup Node.js - uses: ./.github/actions/setup-node - with: - playwright-install: true - electron-install: false - - - name: Run playwright tests - run: yarn e2e --forbid-only --shard=${{ matrix.shard }}/${{ strategy.job-total }} - working-directory: tests/affine-local - env: - COVERAGE: true - - - name: Collect code coverage report - run: yarn exec nyc report -t .nyc_output --report-dir .coverage --reporter=lcov - - - name: Upload e2e test coverage results - uses: codecov/codecov-action@v3 - with: - token: ${{ secrets.CODECOV_TOKEN }} - files: ./.coverage/lcov.info - flags: e2etest - name: affine - fail_ci_if_error: false - - - name: Upload test results - if: ${{ failure() }} - uses: actions/upload-artifact@v3 - with: - name: test-results-e2e-${{ matrix.shard }} - path: ./test-results - if-no-files-found: ignore - - e2e-migration-test: - name: E2E Migration Test - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - name: Setup Node.js - uses: ./.github/actions/setup-node - with: - playwright-install: true - electron-install: false - - - name: Run playwright tests - run: yarn workspace @affine-test/affine-migration e2e --forbid-only - - - name: Upload test results - if: ${{ failure() }} - uses: actions/upload-artifact@v3 - with: - name: test-results-e2e-migration - path: ./tests/affine-migration/test-results - if-no-files-found: ignore - - unit-test: - name: Unit Test - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - name: Setup Node.js - uses: ./.github/actions/setup-node - with: - electron-install: false - - - name: Build AFFiNE native - uses: ./.github/actions/build-rust - with: - target: x86_64-unknown-linux-gnu - package: '@affine/native' - nx_token: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }} - - - name: Unit Test - run: yarn nx test:coverage @affine/monorepo - - - name: Upload unit test coverage results - uses: codecov/codecov-action@v3 - with: - token: ${{ secrets.CODECOV_TOKEN }} - files: ./.coverage/store/lcov.info - flags: unittest - name: affine - fail_ci_if_error: false diff --git a/.github/workflows/cancel.yml b/.github/workflows/cancel.yml deleted file mode 100644 index 4924afafe0..0000000000 --- a/.github/workflows/cancel.yml +++ /dev/null @@ -1,18 +0,0 @@ -name: Cancel -on: - pull_request_target: - types: - - edited - - synchronize - -jobs: - cancel: - name: 'Cancel Previous Runs' - runs-on: ubuntu-latest - timeout-minutes: 2 - steps: - - uses: styfle/cancel-workflow-action@0.12.0 - with: - # See https://api.github.com/repos/toeverything/AFFiNE/actions/workflows - workflow_id: 44038251, 61883931, 65188160, 66789140 - access_token: ${{ github.token }} diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml deleted file mode 100644 index 3e219c0dce..0000000000 --- a/.github/workflows/codeql.yml +++ /dev/null @@ -1,70 +0,0 @@ -# For most projects, this workflow file will not need changing; you simply need -# to commit it to your repository. -# -# You may wish to alter this file to override the set of languages analyzed, -# or to provide custom queries or build logic. -# -# ******** NOTE ******** -# We have attempted to detect the languages in your repository. Please check -# the `language` matrix defined below to confirm you have the correct set of -# supported CodeQL languages. -# -name: 'CodeQL' - -on: - push: - branches: [canary] - pull_request: - merge_group: - # The branches below must be a subset of the branches above - branches: [canary] - -jobs: - analyze: - name: Analyze - runs-on: ubuntu-latest - permissions: - actions: read - contents: read - security-events: write - - strategy: - fail-fast: false - matrix: - language: ['javascript'] - # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ] - # Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support - - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - # Initializes the CodeQL tools for scanning. - - name: Initialize CodeQL - uses: github/codeql-action/init@v2 - with: - languages: ${{ matrix.language }} - # If you wish to specify custom queries, you can do so here or in a config file. - # By default, queries listed here will override any specified in a config file. - # Prefix the list here with "+" to use these queries and those in the config file. - - # Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs - # queries: security-extended,security-and-quality - - # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). - # If this step fails, then you should remove it and run the build manually (see below) - - name: Autobuild - uses: github/codeql-action/autobuild@v2 - - # ℹ️ Command-line programs to run using the OS shell. - # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun - - # If the Autobuild fails above, remove it and uncomment the following three lines. - # modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance. - - # - run: | - # echo "Run, Build Application using script" - # ./location_of_script_within_repo/buildscript.sh - - - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v2 diff --git a/packages/backend/storage/index.d.ts b/packages/backend/storage/index.d.ts index bd6060f9fb..28e5de90c0 100644 --- a/packages/backend/storage/index.d.ts +++ b/packages/backend/storage/index.d.ts @@ -1,21 +1,6 @@ -/* tslint:disable */ +/* auto-generated by NAPI-RS */ /* eslint-disable */ -/* auto-generated by NAPI-RS */ - -export function verifyChallengeResponse(response: string, bits: number, resource: string): Promise -export function mintChallengeResponse(resource: string, bits?: number | undefined | null): Promise -export interface Blob { - contentType: string - lastModified: string - size: number - data: Buffer -} -/** - * Merge updates in form like `Y.applyUpdate(doc, update)` way and return the - * result binary. - */ -export function mergeUpdatesInApplyWay(updates: Array): Buffer export class Storage { /** Create a storage instance and establish connection to persist store. */ static connect(database: string, debugOnlyAutoMigrate?: boolean | undefined | null): Promise @@ -30,3 +15,21 @@ export class Storage { /** Workspace size taken by blobs. */ blobsSize(workspaces: Array): Promise } + +export interface Blob { + contentType: string + lastModified: string + size: number + data: Buffer +} + +/** + * Merge updates in form like `Y.applyUpdate(doc, update)` way and return the + * result binary. + */ +export function mergeUpdatesInApplyWay(updates: Array): Buffer + +export function mintChallengeResponse(resource: string, bits?: number | undefined | null): Promise + +export function verifyChallengeResponse(response: string, bits: number, resource: string): Promise + diff --git a/packages/backend/storage/package.json b/packages/backend/storage/package.json index 874f5fc0f4..87f4002f67 100644 --- a/packages/backend/storage/package.json +++ b/packages/backend/storage/package.json @@ -16,27 +16,26 @@ } }, "napi": { - "name": "storage", + "binaryName": "storage", "targets": [ "aarch64-apple-darwin", "aarch64-unknown-linux-gnu", "aarch64-pc-windows-msvc", "x86_64-apple-darwin", "x86_64-pc-windows-msvc", - "x86_64-unknown-linux-gnu", - "universal-apple-darwin" + "x86_64-unknown-linux-gnu" ] }, "scripts": { "test": "node --test ./__tests__/**/*.spec.js", - "build": "napi build --release --strip", + "build": "napi build --release --strip --no-const-enum", "build:debug": "napi build", "prepublishOnly": "napi prepublish -t npm", "artifacts": "napi artifacts", "version": "napi version" }, "devDependencies": { - "@napi-rs/cli": "^2.16.5", + "@napi-rs/cli": "3.0.0-alpha.12", "lib0": "^0.2.87", "nx": "^17.1.3", "nx-cloud": "^16.5.2", diff --git a/packages/frontend/native/index.d.ts b/packages/frontend/native/index.d.ts index 47c9a16d5a..3446100ebc 100644 --- a/packages/frontend/native/index.d.ts +++ b/packages/frontend/native/index.d.ts @@ -1,32 +1,6 @@ -/* tslint:disable */ +/* auto-generated by NAPI-RS */ /* eslint-disable */ -/* auto-generated by NAPI-RS */ - -export interface BlobRow { - key: string - data: Buffer - timestamp: Date -} -export interface UpdateRow { - id: number - timestamp: Date - data: Buffer - docId?: string -} -export interface InsertRow { - docId?: string - data: Uint8Array -} -export enum ValidationResult { - MissingTables = 0, - MissingDocIdColumn = 1, - MissingVersionColumn = 2, - GeneralError = 3, - Valid = 4 -} -export function verifyChallengeResponse(response: string, bits: number, resource: string): Promise -export function mintChallengeResponse(resource: string, bits?: number | undefined | null): Promise export class SqliteConnection { constructor(path: string) connect(): Promise @@ -47,3 +21,34 @@ export class SqliteConnection { static validate(path: string): Promise migrateAddDocId(): Promise } + +export interface BlobRow { + key: string + data: Buffer + timestamp: Date +} + +export interface InsertRow { + docId?: string + data: Uint8Array +} + +export function mintChallengeResponse(resource: string, bits?: number | undefined | null): Promise + +export interface UpdateRow { + id: number + timestamp: Date + data: Buffer + docId?: string +} + +export enum ValidationResult { + MissingTables = 0, + MissingDocIdColumn = 1, + MissingVersionColumn = 2, + GeneralError = 3, + Valid = 4 +} + +export function verifyChallengeResponse(response: string, bits: number, resource: string): Promise + diff --git a/packages/frontend/native/index.js b/packages/frontend/native/index.js index 5773485893..0f5779e9f2 100644 --- a/packages/frontend/native/index.js +++ b/packages/frontend/native/index.js @@ -1,7 +1,5 @@ -/* tslint:disable */ +// prettier-ignore /* eslint-disable */ -/* prettier-ignore */ - /* auto-generated by NAPI-RS */ const { existsSync, readFileSync } = require('fs') @@ -13,18 +11,52 @@ let nativeBinding = null let localFileExisted = false let loadError = null -function isMusl() { - // For Node 10 - if (!process.report || typeof process.report.getReport !== 'function') { - try { - const lddPath = require('child_process').execSync('which ldd').toString().trim() - return readFileSync(lddPath, 'utf8').includes('musl') - } catch (e) { +const isMusl = () => { + let musl = false + if (process.platform === 'linux') { + musl = isMuslFromFilesystem() + if (musl === null) { + musl = isMuslFromReport() + } + if (musl === null) { + musl = isMuslFromChildProcess() + } + } + return musl +} + +const isFileMusl = (f) => f.includes('libc.musl-') || f.includes('ld-musl-') + +const isMuslFromFilesystem = () => { + try { + return readFileSync('/usr/bin/ldd', 'utf-8').includes('musl') + } catch { + return null + } +} + +const isMuslFromReport = () => { + const report = typeof process.report.getReport === 'function' ? process.report.getReport() : null + if (!report) { + return null + } + if (report.header && report.header.glibcVersionRuntime) { + return false + } + if (Array.isArray(report.sharedObjects)) { + if (report.sharedObjects.some(isFileMusl)) { return true } - } else { - const { glibcVersionRuntime } = process.report.getReport().header - return !glibcVersionRuntime + } + return false +} + +const isMuslFromChildProcess = () => { + try { + return require('child_process').execSync('ldd --version', { encoding: 'utf8' }).includes('musl') + } catch (e) { + // If we reach this case, we don't know if the system is musl or not, so is better to just fallback to false + return false } } @@ -252,9 +284,7 @@ if (!nativeBinding) { throw new Error(`Failed to load native binding`) } -const { SqliteConnection, ValidationResult, verifyChallengeResponse, mintChallengeResponse } = nativeBinding - -module.exports.SqliteConnection = SqliteConnection -module.exports.ValidationResult = ValidationResult -module.exports.verifyChallengeResponse = verifyChallengeResponse -module.exports.mintChallengeResponse = mintChallengeResponse +module.exports.SqliteConnection = nativeBinding.SqliteConnection +module.exports.mintChallengeResponse = nativeBinding.mintChallengeResponse +module.exports.ValidationResult = nativeBinding.ValidationResult +module.exports.verifyChallengeResponse = nativeBinding.verifyChallengeResponse diff --git a/packages/frontend/native/package.json b/packages/frontend/native/package.json index 517d362ff2..eb01946abe 100644 --- a/packages/frontend/native/package.json +++ b/packages/frontend/native/package.json @@ -4,7 +4,7 @@ "main": "index.js", "types": "index.d.ts", "napi": { - "name": "affine", + "binaryName": "affine", "triples": { "additional": [ "aarch64-apple-darwin", @@ -35,7 +35,7 @@ } }, "devDependencies": { - "@napi-rs/cli": "^2.16.5", + "@napi-rs/cli": "3.0.0-alpha.12", "@types/node": "^20.9.3", "@types/uuid": "^9.0.7", "ava": "^6.0.0", @@ -53,7 +53,7 @@ "scripts": { "artifacts": "napi artifacts", "build": "napi build --platform --release --no-const-enum", - "build:debug": "napi build --platform --no-const-enum", + "build:debug": "napi build --platform", "universal": "napi universal", "test": "ava", "version": "napi version" diff --git a/tests/affine-cloud/e2e/basic.spec.ts b/tests/affine-cloud/e2e/basic.spec.ts deleted file mode 100644 index 291fa07de5..0000000000 --- a/tests/affine-cloud/e2e/basic.spec.ts +++ /dev/null @@ -1,144 +0,0 @@ -import { readFile } from 'node:fs/promises'; -import { resolve } from 'node:path'; - -import { test } from '@affine-test/kit/playwright'; -import { - createRandomUser, - deleteUser, - enableCloudWorkspace, - getLoginCookie, - loginUser, - runPrisma, -} from '@affine-test/kit/utils/cloud'; -import { clickEdgelessModeButton } from '@affine-test/kit/utils/editor'; -import { coreUrl } from '@affine-test/kit/utils/load-page'; -import { - clickNewPageButton, - waitForEditorLoad, -} from '@affine-test/kit/utils/page-logic'; -import { clickSideBarSettingButton } from '@affine-test/kit/utils/sidebar'; -import { createLocalWorkspace } from '@affine-test/kit/utils/workspace'; -import { expect } from '@playwright/test'; - -let user: { - id: string; - name: string; - email: string; - password: string; -}; - -test.beforeEach(async () => { - user = await createRandomUser(); -}); - -test.beforeEach(async ({ page, context }) => { - await loginUser(page, user.email, { - beforeLogin: async () => { - expect(await getLoginCookie(context)).toBeUndefined(); - }, - afterLogin: async () => { - expect(await getLoginCookie(context)).toBeTruthy(); - await page.reload(); - await waitForEditorLoad(page); - expect(await getLoginCookie(context)).toBeTruthy(); - }, - }); -}); - -test.afterEach(async () => { - // if you want to keep the user in the database for debugging, - // comment this line - await deleteUser(user.email); -}); - -test.describe('basic', () => { - test('migration', async ({ page, browser }) => { - let workspaceId: string; - { - // create the old cloud workspace in another browser - const context = await browser.newContext(); - const page = await context.newPage(); - await loginUser(page, user.email); - await page.reload(); - await createLocalWorkspace( - { - name: 'test', - }, - page - ); - await enableCloudWorkspace(page); - await clickNewPageButton(page); - await waitForEditorLoad(page); - // http://localhost:8080/workspace/2bc0b6c8-f68d-4dd3-98a8-be746754f9e1/xxx - workspaceId = page.url().split('/')[4]; - await runPrisma(async client => { - const sqls = ( - await readFile( - resolve(__dirname, 'fixtures', '0.9.0-canary.9-snapshots.sql'), - 'utf-8' - ) - ) - .replaceAll('2bc0b6c8-f68d-4dd3-98a8-be746754f9e1', workspaceId) - .split('\n'); - await client.snapshot.deleteMany({ - where: { - workspaceId, - }, - }); - - for (const sql of sqls) { - await client.$executeRawUnsafe(sql); - } - }); - await page.close(); - } - await page.reload(); - await page.waitForTimeout(1000); - await page.goto(`${coreUrl}/workspace/${workspaceId}/all`); - await page.getByTestId('upgrade-workspace-button').click(); - await expect(page.getByText('Refresh Current Page')).toBeVisible({ - timeout: 60000, - }); - await page.goto( - // page 'F1SX6cgNxy' has edgeless mode - `${coreUrl}/workspace/${workspaceId}/F1SX6cgNxy` - ); - await page.waitForTimeout(5000); - await page.reload(); - await waitForEditorLoad(page); - await clickEdgelessModeButton(page); - await expect(page.locator('affine-edgeless-page')).toBeVisible({ - timeout: 1000, - }); - }); - - test('can see and change email and password in setting panel', async ({ - page, - }) => { - const newName = 'test name'; - { - await clickSideBarSettingButton(page); - const locator = page.getByTestId('user-info-card'); - expect(locator.getByText(user.email)).toBeTruthy(); - expect(locator.getByText(user.name)).toBeTruthy(); - await locator.click({ - delay: 50, - }); - const nameInput = page.getByPlaceholder('Input account name'); - await nameInput.clear(); - await nameInput.pressSequentially(newName, { - delay: 50, - }); - await page.getByTestId('save-user-name').click({ - delay: 50, - }); - } - await page.reload(); - { - await clickSideBarSettingButton(page); - const locator = page.getByTestId('user-info-card'); - expect(locator.getByText(user.email)).toBeTruthy(); - expect(locator.getByText(newName)).toBeTruthy(); - } - }); -}); diff --git a/tests/affine-cloud/e2e/collaboration.spec.ts b/tests/affine-cloud/e2e/collaboration.spec.ts index a592bc494c..06a89657d1 100644 --- a/tests/affine-cloud/e2e/collaboration.spec.ts +++ b/tests/affine-cloud/e2e/collaboration.spec.ts @@ -13,16 +13,8 @@ import { getBlockSuiteEditorTitle, waitForEditorLoad, } from '@affine-test/kit/utils/page-logic'; -import { - clickUserInfoCard, - openSettingModal, - openWorkspaceSettingPanel, -} from '@affine-test/kit/utils/setting'; -import { - clickSideBarAllPageButton, - clickSideBarCurrentWorkspaceBanner, - clickSideBarSettingButton, -} from '@affine-test/kit/utils/sidebar'; +import { clickUserInfoCard } from '@affine-test/kit/utils/setting'; +import { clickSideBarSettingButton } from '@affine-test/kit/utils/sidebar'; import { createLocalWorkspace } from '@affine-test/kit/utils/workspace'; import { expect } from '@playwright/test'; @@ -41,298 +33,184 @@ test.beforeEach(async ({ page }) => { await loginUser(page, user.email); }); -test.describe('collaboration', () => { - test('can enable share page', async ({ page, browser }) => { - await page.reload(); - await waitForEditorLoad(page); - await createLocalWorkspace( - { - name: 'test', - }, - page - ); - await enableCloudWorkspaceFromShareButton(page); - const title = getBlockSuiteEditorTitle(page); - await title.pressSequentially('TEST TITLE', { - delay: 50, - }); - await page.keyboard.press('Enter', { delay: 50 }); - await page.keyboard.type('TEST CONTENT', { delay: 50 }); - await page.getByTestId('cloud-share-menu-button').click(); - await page.getByTestId('share-menu-create-link-button').click(); - await page.getByTestId('share-menu-copy-link-button').click(); - - // check share page is accessible +test('can enable share page', async ({ page, browser }) => { + await page.reload(); + await waitForEditorLoad(page); + await createLocalWorkspace( { - const context = await browser.newContext(); - const url: string = await page.evaluate(() => - navigator.clipboard.readText() - ); - const page2 = await context.newPage(); - await page2.goto(url); - await waitForEditorLoad(page2); - const title = getBlockSuiteEditorTitle(page2); - expect(await title.innerText()).toBe('TEST TITLE'); - expect(await page2.textContent('affine-paragraph')).toContain( - 'TEST CONTENT' - ); - } + name: 'test', + }, + page + ); + await enableCloudWorkspaceFromShareButton(page); + const title = getBlockSuiteEditorTitle(page); + await title.pressSequentially('TEST TITLE', { + delay: 50, }); + await page.keyboard.press('Enter', { delay: 50 }); + await page.keyboard.type('TEST CONTENT', { delay: 50 }); + await page.getByTestId('cloud-share-menu-button').click(); + await page.getByTestId('share-menu-create-link-button').click(); + await page.getByTestId('share-menu-copy-link-button').click(); - test('share page with default edgeless', async ({ page, browser }) => { - await page.reload(); - await waitForEditorLoad(page); - await createLocalWorkspace( - { - name: 'test', - }, - page + // check share page is accessible + { + const context = await browser.newContext(); + const url: string = await page.evaluate(() => + navigator.clipboard.readText() ); - await enableCloudWorkspaceFromShareButton(page); - const title = getBlockSuiteEditorTitle(page); - await title.pressSequentially('TEST TITLE', { - delay: 50, - }); - await page.keyboard.press('Enter', { delay: 50 }); - await page.keyboard.type('TEST CONTENT', { delay: 50 }); - await clickEdgelessModeButton(page); + const page2 = await context.newPage(); + await page2.goto(url); + await waitForEditorLoad(page2); + const title = getBlockSuiteEditorTitle(page2); + expect(await title.innerText()).toBe('TEST TITLE'); + expect(await page2.textContent('affine-paragraph')).toContain( + 'TEST CONTENT' + ); + } +}); + +test('share page with default edgeless', async ({ page, browser }) => { + await page.reload(); + await waitForEditorLoad(page); + await createLocalWorkspace( + { + name: 'test', + }, + page + ); + await enableCloudWorkspaceFromShareButton(page); + const title = getBlockSuiteEditorTitle(page); + await title.pressSequentially('TEST TITLE', { + delay: 50, + }); + await page.keyboard.press('Enter', { delay: 50 }); + await page.keyboard.type('TEST CONTENT', { delay: 50 }); + await clickEdgelessModeButton(page); + await expect(page.locator('affine-edgeless-page')).toBeVisible({ + timeout: 1000, + }); + await page.getByTestId('cloud-share-menu-button').click(); + await page.getByTestId('share-menu-create-link-button').click(); + await page.getByTestId('share-menu-copy-link-button').click(); + + // check share page is accessible + { + const context = await browser.newContext(); + const url: string = await page.evaluate(() => + navigator.clipboard.readText() + ); + const page2 = await context.newPage(); + await page2.goto(url); + await waitForEditorLoad(page2); await expect(page.locator('affine-edgeless-page')).toBeVisible({ timeout: 1000, }); - await page.getByTestId('cloud-share-menu-button').click(); - await page.getByTestId('share-menu-create-link-button').click(); - await page.getByTestId('share-menu-copy-link-button').click(); - - // check share page is accessible - { - const context = await browser.newContext(); - const url: string = await page.evaluate(() => - navigator.clipboard.readText() - ); - const page2 = await context.newPage(); - await page2.goto(url); - await waitForEditorLoad(page2); - await expect(page.locator('affine-edgeless-page')).toBeVisible({ - timeout: 1000, - }); - expect(await page2.textContent('affine-paragraph')).toContain( - 'TEST CONTENT' - ); - const logo = page2.getByTestId('share-page-logo'); - const editButton = page2.getByTestId('share-page-edit-button'); - await expect(editButton).not.toBeVisible(); - await expect(logo).toBeVisible(); - } - }); - - test('can collaborate with other user and name should display when editing', async ({ - page, - browser, - }) => { - await page.reload(); - await waitForEditorLoad(page); - await createLocalWorkspace( - { - name: 'test', - }, - page + expect(await page2.textContent('affine-paragraph')).toContain( + 'TEST CONTENT' ); - await enableCloudWorkspace(page); - await clickNewPageButton(page); - const currentUrl = page.url(); - // format: http://localhost:8080/workspace/${workspaceId}/xxx - const workspaceId = currentUrl.split('/')[4]; - const userB = await createRandomUser(); + const logo = page2.getByTestId('share-page-logo'); + const editButton = page2.getByTestId('share-page-edit-button'); + await expect(editButton).not.toBeVisible(); + await expect(logo).toBeVisible(); + } +}); + +test('can collaborate with other user and name should display when editing', async ({ + page, + browser, +}) => { + await page.reload(); + await waitForEditorLoad(page); + await createLocalWorkspace( + { + name: 'test', + }, + page + ); + await enableCloudWorkspace(page); + await clickNewPageButton(page); + const currentUrl = page.url(); + // format: http://localhost:8080/workspace/${workspaceId}/xxx + const workspaceId = currentUrl.split('/')[4]; + const userB = await createRandomUser(); + const context = await browser.newContext(); + const page2 = await context.newPage(); + await loginUser(page2, userB.email); + await addUserToWorkspace(workspaceId, userB.id, 1 /* READ */); + await page2.reload(); + await waitForEditorLoad(page2); + await page2.goto(currentUrl); + { + const title = getBlockSuiteEditorTitle(page); + await title.pressSequentially('TEST TITLE', { + delay: 50, + }); + } + await page2.waitForTimeout(200); + { + const title = getBlockSuiteEditorTitle(page2); + expect(await title.innerText()).toBe('TEST TITLE'); + const typingPromise = Promise.all([ + page.keyboard.press('Enter', { delay: 50 }), + page.keyboard.type('TEST CONTENT', { delay: 50 }), + ]); + // username should be visible when editing + await expect(page2.getByText(user.name)).toBeVisible(); + await typingPromise; + } + + // change username + await clickSideBarSettingButton(page); + await clickUserInfoCard(page); + const input = page.getByTestId('user-name-input'); + await input.clear(); + await input.pressSequentially('TEST USER', { + delay: 50, + }); + await page.getByTestId('save-user-name').click({ + delay: 50, + }); + await page.keyboard.press('Escape', { + delay: 50, + }); + const title = getBlockSuiteEditorTitle(page); + await title.focus(); + + { + await expect(page2.getByText('TEST USER')).toBeVisible({ + timeout: 2000, + }); + } +}); + +test('can sync collections between different browser', async ({ + page, + browser, +}) => { + await page.reload(); + await waitForEditorLoad(page); + await createLocalWorkspace( + { + name: 'test', + }, + page + ); + await enableCloudWorkspace(page); + await page.getByTestId('slider-bar-add-collection-button').click(); + const title = page.getByTestId('input-collection-title'); + await title.isVisible(); + await title.fill('test collection'); + await page.getByTestId('save-collection').click(); + + { const context = await browser.newContext(); const page2 = await context.newPage(); - await loginUser(page2, userB.email); - await addUserToWorkspace(workspaceId, userB.id, 1 /* READ */); - await page2.reload(); - await waitForEditorLoad(page2); - await page2.goto(currentUrl); - { - const title = getBlockSuiteEditorTitle(page); - await title.pressSequentially('TEST TITLE', { - delay: 50, - }); - } - await page2.waitForTimeout(200); - { - const title = getBlockSuiteEditorTitle(page2); - expect(await title.innerText()).toBe('TEST TITLE'); - const typingPromise = Promise.all([ - page.keyboard.press('Enter', { delay: 50 }), - page.keyboard.type('TEST CONTENT', { delay: 50 }), - ]); - // username should be visible when editing - await expect(page2.getByText(user.name)).toBeVisible(); - await typingPromise; - } - - // change username - await clickSideBarSettingButton(page); - await clickUserInfoCard(page); - const input = page.getByTestId('user-name-input'); - await input.clear(); - await input.pressSequentially('TEST USER', { - delay: 50, - }); - await page.getByTestId('save-user-name').click({ - delay: 50, - }); - await page.keyboard.press('Escape', { - delay: 50, - }); - const title = getBlockSuiteEditorTitle(page); - await title.focus(); - - { - await expect(page2.getByText('TEST USER')).toBeVisible({ - timeout: 2000, - }); - } - }); - - test('can sync collections between different browser', async ({ - page, - browser, - }) => { - await page.reload(); - await waitForEditorLoad(page); - await createLocalWorkspace( - { - name: 'test', - }, - page - ); - await enableCloudWorkspace(page); - await page.getByTestId('slider-bar-add-collection-button').click(); - const title = page.getByTestId('input-collection-title'); - await title.isVisible(); - await title.fill('test collection'); - await page.getByTestId('save-collection').click(); - - { - const context = await browser.newContext(); - const page2 = await context.newPage(); - await loginUser(page2, user.email); - await page2.goto(page.url()); - const collections = page2.getByTestId('collections'); - await expect(collections.getByText('test collection')).toBeVisible(); - } - }); - - test('exit successfully and re-login', async ({ page }) => { - await page.reload(); - await clickSideBarAllPageButton(page); - await page.waitForTimeout(200); - const url = page.url(); - await createLocalWorkspace( - { - name: 'test', - }, - page - ); - await enableCloudWorkspace(page); - await clickSideBarSettingButton(page); - await clickUserInfoCard(page); - await page.getByTestId('sign-out-button').click(); - await page.getByTestId('confirm-sign-out-button').click(); - await page.waitForTimeout(5000); - expect(page.url()).toBe(url); - }); -}); - -test.describe('collaboration members', () => { - test('should have pagination in member list', async ({ page }) => { - await page.reload(); - await waitForEditorLoad(page); - await createLocalWorkspace( - { - name: 'test', - }, - page - ); - await enableCloudWorkspace(page); - await clickNewPageButton(page); - const currentUrl = page.url(); - // format: http://localhost:8080/workspace/${workspaceId}/xxx - const workspaceId = currentUrl.split('/')[4]; - - // create 10 user and add to workspace - const createUserAndAddToWorkspace = async () => { - const userB = await createRandomUser(); - await addUserToWorkspace(workspaceId, userB.id, 1 /* READ */); - }; - await Promise.all( - Array.from({ length: 10 }) - .fill(1) - .map(() => createUserAndAddToWorkspace()) - ); - - await openSettingModal(page); - await openWorkspaceSettingPanel(page, 'test'); - - await page.waitForTimeout(1000); - - const firstPageMemberItemCount = await page - .locator('[data-testid="member-item"]') - .count(); - - expect(firstPageMemberItemCount).toBe(8); - - const navigationItems = await page - .getByRole('navigation') - .getByRole('button') - .all(); - - // make sure the first member is the owner - await expect(page.getByTestId('member-item').first()).toContainText( - 'Workspace Owner' - ); - - // There have four pagination items: < 1 2 > - expect(navigationItems.length).toBe(4); - // Click second page - await navigationItems[2].click(); - await page.waitForTimeout(500); - // There should have other three members in second page - const secondPageMemberItemCount = await page - .locator('[data-testid="member-item"]') - .count(); - expect(secondPageMemberItemCount).toBe(3); - // Click left arrow to back to first page - await navigationItems[0].click(); - await page.waitForTimeout(500); - expect(await page.locator('[data-testid="member-item"]').count()).toBe(8); - // Click right arrow to second page - await navigationItems[3].click(); - await page.waitForTimeout(500); - expect(await page.locator('[data-testid="member-item"]').count()).toBe(3); - }); -}); - -test.describe('sign out', () => { - test('can sign out', async ({ page }) => { - await page.reload(); - await waitForEditorLoad(page); - await createLocalWorkspace( - { - name: 'test', - }, - page - ); - await clickSideBarAllPageButton(page); - const currentUrl = page.url(); - await clickSideBarCurrentWorkspaceBanner(page); - await page.getByTestId('workspace-modal-account-option').click(); - await page.getByTestId('workspace-modal-sign-out-option').click(); - await page.getByTestId('confirm-sign-out-button').click(); - await clickSideBarCurrentWorkspaceBanner(page); - const signInButton = page.getByTestId('cloud-signin-button'); - await expect(signInButton).toBeVisible(); - expect(page.url()).toBe(currentUrl); - }); + await loginUser(page2, user.email); + await page2.goto(page.url()); + const collections = page2.getByTestId('collections'); + await expect(collections.getByText('test collection')).toBeVisible(); + } }); test('can sync svg between different browsers', async ({ page, browser }) => { diff --git a/tests/affine-cloud/e2e/login.spec.ts b/tests/affine-cloud/e2e/login.spec.ts index 0cc007a477..6bfca65460 100644 --- a/tests/affine-cloud/e2e/login.spec.ts +++ b/tests/affine-cloud/e2e/login.spec.ts @@ -1,17 +1,111 @@ import { test } from '@affine-test/kit/playwright'; +import { + createRandomUser, + enableCloudWorkspace, + loginUser, +} from '@affine-test/kit/utils/cloud'; import { openHomePage } from '@affine-test/kit/utils/load-page'; import { waitForEditorLoad } from '@affine-test/kit/utils/page-logic'; -import { clickSideBarCurrentWorkspaceBanner } from '@affine-test/kit/utils/sidebar'; +import { clickUserInfoCard } from '@affine-test/kit/utils/setting'; +import { + clickSideBarAllPageButton, + clickSideBarCurrentWorkspaceBanner, + clickSideBarSettingButton, +} from '@affine-test/kit/utils/sidebar'; +import { createLocalWorkspace } from '@affine-test/kit/utils/workspace'; import { expect } from '@playwright/test'; -test.describe('login', () => { - test('can open login modal in workspace list', async ({ page }) => { - await openHomePage(page); +test('can open login modal in workspace list', async ({ page }) => { + await openHomePage(page); + await waitForEditorLoad(page); + await clickSideBarCurrentWorkspaceBanner(page); + await page.getByTestId('cloud-signin-button').click({ + delay: 200, + }); + await expect(page.getByTestId('auth-modal')).toBeVisible(); +}); + +test.describe('login first', () => { + let user: { + id: string; + name: string; + email: string; + password: string; + }; + + test.beforeEach(async ({ page }) => { + user = await createRandomUser(); + await loginUser(page, user.email); + }); + + test('exit successfully and re-login', async ({ page }) => { + await page.reload(); + await clickSideBarAllPageButton(page); + await page.waitForTimeout(200); + const url = page.url(); + await createLocalWorkspace( + { + name: 'test', + }, + page + ); + await enableCloudWorkspace(page); + await clickSideBarSettingButton(page); + await clickUserInfoCard(page); + await page.getByTestId('sign-out-button').click(); + await page.getByTestId('confirm-sign-out-button').click(); + await page.waitForTimeout(5000); + expect(page.url()).toBe(url); + }); + + test('can sign out', async ({ page }) => { + await page.reload(); await waitForEditorLoad(page); + await createLocalWorkspace( + { + name: 'test', + }, + page + ); + await clickSideBarAllPageButton(page); + const currentUrl = page.url(); await clickSideBarCurrentWorkspaceBanner(page); - await page.getByTestId('cloud-signin-button').click({ - delay: 200, - }); - await expect(page.getByTestId('auth-modal')).toBeVisible(); + await page.getByTestId('workspace-modal-account-option').click(); + await page.getByTestId('workspace-modal-sign-out-option').click(); + await page.getByTestId('confirm-sign-out-button').click(); + await clickSideBarCurrentWorkspaceBanner(page); + const signInButton = page.getByTestId('cloud-signin-button'); + await expect(signInButton).toBeVisible(); + expect(page.url()).toBe(currentUrl); + }); + + test('can see and change email and password in setting panel', async ({ + page, + }) => { + const newName = 'test name'; + { + await clickSideBarSettingButton(page); + const locator = page.getByTestId('user-info-card'); + expect(locator.getByText(user.email)).toBeTruthy(); + expect(locator.getByText(user.name)).toBeTruthy(); + await locator.click({ + delay: 50, + }); + const nameInput = page.getByPlaceholder('Input account name'); + await nameInput.clear(); + await nameInput.pressSequentially(newName, { + delay: 50, + }); + await page.getByTestId('save-user-name').click({ + delay: 50, + }); + } + await page.reload(); + { + await clickSideBarSettingButton(page); + const locator = page.getByTestId('user-info-card'); + expect(locator.getByText(user.email)).toBeTruthy(); + expect(locator.getByText(newName)).toBeTruthy(); + } }); }); diff --git a/tests/affine-cloud/e2e/migration.spec.ts b/tests/affine-cloud/e2e/migration.spec.ts new file mode 100644 index 0000000000..f5db86fb57 --- /dev/null +++ b/tests/affine-cloud/e2e/migration.spec.ts @@ -0,0 +1,111 @@ +import { readFile } from 'node:fs/promises'; +import { resolve } from 'node:path'; + +import { test } from '@affine-test/kit/playwright'; +import { + createRandomUser, + deleteUser, + enableCloudWorkspace, + getLoginCookie, + loginUser, + runPrisma, +} from '@affine-test/kit/utils/cloud'; +import { clickEdgelessModeButton } from '@affine-test/kit/utils/editor'; +import { coreUrl } from '@affine-test/kit/utils/load-page'; +import { + clickNewPageButton, + waitForEditorLoad, +} from '@affine-test/kit/utils/page-logic'; +import { createLocalWorkspace } from '@affine-test/kit/utils/workspace'; +import { expect } from '@playwright/test'; + +let user: { + id: string; + name: string; + email: string; + password: string; +}; + +test.beforeEach(async () => { + user = await createRandomUser(); +}); + +test.beforeEach(async ({ page, context }) => { + await loginUser(page, user.email, { + beforeLogin: async () => { + expect(await getLoginCookie(context)).toBeUndefined(); + }, + afterLogin: async () => { + expect(await getLoginCookie(context)).toBeTruthy(); + await page.reload(); + await waitForEditorLoad(page); + expect(await getLoginCookie(context)).toBeTruthy(); + }, + }); +}); + +test.afterEach(async () => { + // if you want to keep the user in the database for debugging, + // comment this line + await deleteUser(user.email); +}); + +test('migration', async ({ page, browser }) => { + let workspaceId: string; + { + // create the old cloud workspace in another browser + const context = await browser.newContext(); + const page = await context.newPage(); + await loginUser(page, user.email); + await page.reload(); + await createLocalWorkspace( + { + name: 'test', + }, + page + ); + await enableCloudWorkspace(page); + await clickNewPageButton(page); + await waitForEditorLoad(page); + // http://localhost:8080/workspace/2bc0b6c8-f68d-4dd3-98a8-be746754f9e1/xxx + workspaceId = page.url().split('/')[4]; + await runPrisma(async client => { + const sqls = ( + await readFile( + resolve(__dirname, 'fixtures', '0.9.0-canary.9-snapshots.sql'), + 'utf-8' + ) + ) + .replaceAll('2bc0b6c8-f68d-4dd3-98a8-be746754f9e1', workspaceId) + .split('\n'); + await client.snapshot.deleteMany({ + where: { + workspaceId, + }, + }); + + for (const sql of sqls) { + await client.$executeRawUnsafe(sql); + } + }); + await page.close(); + } + await page.reload(); + await page.waitForTimeout(1000); + await page.goto(`${coreUrl}/workspace/${workspaceId}/all`); + await page.getByTestId('upgrade-workspace-button').click(); + await expect(page.getByText('Refresh Current Page')).toBeVisible({ + timeout: 60000, + }); + await page.goto( + // page 'F1SX6cgNxy' has edgeless mode + `${coreUrl}/workspace/${workspaceId}/F1SX6cgNxy` + ); + await page.waitForTimeout(5000); + await page.reload(); + await waitForEditorLoad(page); + await clickEdgelessModeButton(page); + await expect(page.locator('affine-edgeless-page')).toBeVisible({ + timeout: 1000, + }); +}); diff --git a/tests/affine-cloud/e2e/workspace.spec.ts b/tests/affine-cloud/e2e/workspace.spec.ts new file mode 100644 index 0000000000..31d00f1769 --- /dev/null +++ b/tests/affine-cloud/e2e/workspace.spec.ts @@ -0,0 +1,96 @@ +import { test } from '@affine-test/kit/playwright'; +import { + addUserToWorkspace, + createRandomUser, + enableCloudWorkspace, + loginUser, +} from '@affine-test/kit/utils/cloud'; +import { + clickNewPageButton, + waitForEditorLoad, +} from '@affine-test/kit/utils/page-logic'; +import { + openSettingModal, + openWorkspaceSettingPanel, +} from '@affine-test/kit/utils/setting'; +import { createLocalWorkspace } from '@affine-test/kit/utils/workspace'; +import { expect } from '@playwright/test'; + +let user: { + id: string; + name: string; + email: string; + password: string; +}; + +test.beforeEach(async ({ page }) => { + user = await createRandomUser(); + await loginUser(page, user.email); +}); + +test('should have pagination in member list', async ({ page }) => { + await page.reload(); + await waitForEditorLoad(page); + await createLocalWorkspace( + { + name: 'test', + }, + page + ); + await enableCloudWorkspace(page); + await clickNewPageButton(page); + const currentUrl = page.url(); + // format: http://localhost:8080/workspace/${workspaceId}/xxx + const workspaceId = currentUrl.split('/')[4]; + + // create 10 user and add to workspace + const createUserAndAddToWorkspace = async () => { + const userB = await createRandomUser(); + await addUserToWorkspace(workspaceId, userB.id, 1 /* READ */); + }; + await Promise.all( + Array.from({ length: 10 }) + .fill(1) + .map(() => createUserAndAddToWorkspace()) + ); + + await openSettingModal(page); + await openWorkspaceSettingPanel(page, 'test'); + + await page.waitForTimeout(1000); + + const firstPageMemberItemCount = await page + .locator('[data-testid="member-item"]') + .count(); + + expect(firstPageMemberItemCount).toBe(8); + + const navigationItems = await page + .getByRole('navigation') + .getByRole('button') + .all(); + + // make sure the first member is the owner + await expect(page.getByTestId('member-item').first()).toContainText( + 'Workspace Owner' + ); + + // There have four pagination items: < 1 2 > + expect(navigationItems.length).toBe(4); + // Click second page + await navigationItems[2].click(); + await page.waitForTimeout(500); + // There should have other three members in second page + const secondPageMemberItemCount = await page + .locator('[data-testid="member-item"]') + .count(); + expect(secondPageMemberItemCount).toBe(3); + // Click left arrow to back to first page + await navigationItems[0].click(); + await page.waitForTimeout(500); + expect(await page.locator('[data-testid="member-item"]').count()).toBe(8); + // Click right arrow to second page + await navigationItems[3].click(); + await page.waitForTimeout(500); + expect(await page.locator('[data-testid="member-item"]').count()).toBe(3); +}); diff --git a/yarn.lock b/yarn.lock index 845c0ba390..df72e76b7a 100644 --- a/yarn.lock +++ b/yarn.lock @@ -656,7 +656,7 @@ __metadata: version: 0.0.0-use.local resolution: "@affine/native@workspace:packages/frontend/native" dependencies: - "@napi-rs/cli": "npm:^2.16.5" + "@napi-rs/cli": "npm:3.0.0-alpha.12" "@types/node": "npm:^20.9.3" "@types/uuid": "npm:^9.0.7" ava: "npm:^6.0.0" @@ -821,7 +821,7 @@ __metadata: version: 0.0.0-use.local resolution: "@affine/storage@workspace:packages/backend/storage" dependencies: - "@napi-rs/cli": "npm:^2.16.5" + "@napi-rs/cli": "npm:3.0.0-alpha.12" lib0: "npm:^0.2.87" nx: "npm:^17.1.3" nx-cloud: "npm:^16.5.2" @@ -7175,6 +7175,15 @@ __metadata: languageName: node linkType: hard +"@ljharb/through@npm:^2.3.11": + version: 2.3.11 + resolution: "@ljharb/through@npm:2.3.11" + dependencies: + call-bind: "npm:^1.0.2" + checksum: 45bcc0681b89bbaf4c814473f3dcb89ba8c6d259becce36d21aafde8959c2fb0e3e640bd735fa00ac68b13e2947b165225bf56a70609f697b20c91a6982bfbd1 + languageName: node + linkType: hard + "@lukeed/csprng@npm:^1.0.0": version: 1.1.0 resolution: "@lukeed/csprng@npm:1.1.0" @@ -7394,12 +7403,68 @@ __metadata: languageName: node linkType: hard -"@napi-rs/cli@npm:^2.16.5": - version: 2.16.5 - resolution: "@napi-rs/cli@npm:2.16.5" +"@napi-rs/cli@npm:3.0.0-alpha.12": + version: 3.0.0-alpha.12 + resolution: "@napi-rs/cli@npm:3.0.0-alpha.12" + dependencies: + "@napi-rs/cross-toolchain": "npm:^0.0.12" + "@octokit/rest": "npm:^20.0.2" + "@tybys/wasm-util": "npm:0.8.0" + clipanion: "npm:^3.2.1" + colorette: "npm:^2.0.20" + debug: "npm:^4.3.4" + emnapi: "npm:0.44.0" + inquirer: "npm:^9.2.12" + js-yaml: "npm:^4.1.0" + lodash-es: "npm:^4.17.21" + toml: "npm:^3.0.0" + typanion: "npm:^3.14.0" + peerDependencies: + "@emnapi/runtime": 0.44.0 + "@tybys/wasm-util": 0.8.0 + emnapi: 0.44.0 + peerDependenciesMeta: + "@emnapi/runtime": + optional: true + "@tybys/wasm-util": + optional: true + emnapi: + optional: true bin: - napi: scripts/index.js - checksum: 37c16d900887970d080e5a3dd5656463d27e5d4c78f3c50d8382af0b4c51752c705e4713c18b46a83ff54a3c58d5d146aabc82ac7b7bbda8134adb7325bb9fa1 + napi: dist/cli.js + napi-raw: cli.mjs + checksum: 50911df427f970f6926dc62e083c740b8b342e2181c65a56f4f0758d96995d110b5762fffafc1124628b6192987986b3bba93adf25921eda39c81034cd1dff54 + languageName: node + linkType: hard + +"@napi-rs/cross-toolchain@npm:^0.0.12": + version: 0.0.12 + resolution: "@napi-rs/cross-toolchain@npm:0.0.12" + dependencies: + "@napi-rs/lzma": "npm:^1.2.1" + "@napi-rs/tar": "npm:^0.0.1" + debug: "npm:^4.3.4" + peerDependencies: + "@napi-rs/cross-toolchain-arm64-target-aarch64": ^0.0.12 + "@napi-rs/cross-toolchain-arm64-target-armv7": ^0.0.12 + "@napi-rs/cross-toolchain-arm64-target-x86_64": ^0.0.12 + "@napi-rs/cross-toolchain-x64-target-aarch64": ^0.0.12 + "@napi-rs/cross-toolchain-x64-target-armv7": ^0.0.12 + "@napi-rs/cross-toolchain-x64-target-x86_64": ^0.0.12 + peerDependenciesMeta: + "@napi-rs/cross-toolchain-arm64-target-aarch64": + optional: true + "@napi-rs/cross-toolchain-arm64-target-armv7": + optional: true + "@napi-rs/cross-toolchain-arm64-target-x86_64": + optional: true + "@napi-rs/cross-toolchain-x64-target-aarch64": + optional: true + "@napi-rs/cross-toolchain-x64-target-armv7": + optional: true + "@napi-rs/cross-toolchain-x64-target-x86_64": + optional: true + checksum: 7631a0d72f4264ab46b8792519284aa9f8dd6bf922a27dd598c4eec398c83730950454a5f36ceb502fe7c018e89d99f2186ed16416d21e35f6d120c2a6ea48fc languageName: node linkType: hard @@ -7532,6 +7597,145 @@ __metadata: languageName: node linkType: hard +"@napi-rs/lzma-android-arm-eabi@npm:1.2.1": + version: 1.2.1 + resolution: "@napi-rs/lzma-android-arm-eabi@npm:1.2.1" + conditions: os=android & cpu=arm + languageName: node + linkType: hard + +"@napi-rs/lzma-android-arm64@npm:1.2.1": + version: 1.2.1 + resolution: "@napi-rs/lzma-android-arm64@npm:1.2.1" + conditions: os=android & cpu=arm64 + languageName: node + linkType: hard + +"@napi-rs/lzma-darwin-arm64@npm:1.2.1": + version: 1.2.1 + resolution: "@napi-rs/lzma-darwin-arm64@npm:1.2.1" + conditions: os=darwin & cpu=arm64 + languageName: node + linkType: hard + +"@napi-rs/lzma-darwin-x64@npm:1.2.1": + version: 1.2.1 + resolution: "@napi-rs/lzma-darwin-x64@npm:1.2.1" + conditions: os=darwin & cpu=x64 + languageName: node + linkType: hard + +"@napi-rs/lzma-freebsd-x64@npm:1.2.1": + version: 1.2.1 + resolution: "@napi-rs/lzma-freebsd-x64@npm:1.2.1" + conditions: os=freebsd & cpu=x64 + languageName: node + linkType: hard + +"@napi-rs/lzma-linux-arm-gnueabihf@npm:1.2.1": + version: 1.2.1 + resolution: "@napi-rs/lzma-linux-arm-gnueabihf@npm:1.2.1" + conditions: os=linux & cpu=arm + languageName: node + linkType: hard + +"@napi-rs/lzma-linux-arm64-gnu@npm:1.2.1": + version: 1.2.1 + resolution: "@napi-rs/lzma-linux-arm64-gnu@npm:1.2.1" + conditions: os=linux & cpu=arm64 & libc=glibc + languageName: node + linkType: hard + +"@napi-rs/lzma-linux-arm64-musl@npm:1.2.1": + version: 1.2.1 + resolution: "@napi-rs/lzma-linux-arm64-musl@npm:1.2.1" + conditions: os=linux & cpu=arm64 & libc=musl + languageName: node + linkType: hard + +"@napi-rs/lzma-linux-x64-gnu@npm:1.2.1": + version: 1.2.1 + resolution: "@napi-rs/lzma-linux-x64-gnu@npm:1.2.1" + conditions: os=linux & cpu=x64 & libc=glibc + languageName: node + linkType: hard + +"@napi-rs/lzma-linux-x64-musl@npm:1.2.1": + version: 1.2.1 + resolution: "@napi-rs/lzma-linux-x64-musl@npm:1.2.1" + conditions: os=linux & cpu=x64 & libc=musl + languageName: node + linkType: hard + +"@napi-rs/lzma-win32-arm64-msvc@npm:1.2.1": + version: 1.2.1 + resolution: "@napi-rs/lzma-win32-arm64-msvc@npm:1.2.1" + conditions: os=win32 & cpu=arm64 + languageName: node + linkType: hard + +"@napi-rs/lzma-win32-ia32-msvc@npm:1.2.1": + version: 1.2.1 + resolution: "@napi-rs/lzma-win32-ia32-msvc@npm:1.2.1" + conditions: os=win32 & cpu=ia32 + languageName: node + linkType: hard + +"@napi-rs/lzma-win32-x64-msvc@npm:1.2.1": + version: 1.2.1 + resolution: "@napi-rs/lzma-win32-x64-msvc@npm:1.2.1" + conditions: os=win32 & cpu=x64 + languageName: node + linkType: hard + +"@napi-rs/lzma@npm:^1.2.1": + version: 1.2.1 + resolution: "@napi-rs/lzma@npm:1.2.1" + dependencies: + "@napi-rs/lzma-android-arm-eabi": "npm:1.2.1" + "@napi-rs/lzma-android-arm64": "npm:1.2.1" + "@napi-rs/lzma-darwin-arm64": "npm:1.2.1" + "@napi-rs/lzma-darwin-x64": "npm:1.2.1" + "@napi-rs/lzma-freebsd-x64": "npm:1.2.1" + "@napi-rs/lzma-linux-arm-gnueabihf": "npm:1.2.1" + "@napi-rs/lzma-linux-arm64-gnu": "npm:1.2.1" + "@napi-rs/lzma-linux-arm64-musl": "npm:1.2.1" + "@napi-rs/lzma-linux-x64-gnu": "npm:1.2.1" + "@napi-rs/lzma-linux-x64-musl": "npm:1.2.1" + "@napi-rs/lzma-win32-arm64-msvc": "npm:1.2.1" + "@napi-rs/lzma-win32-ia32-msvc": "npm:1.2.1" + "@napi-rs/lzma-win32-x64-msvc": "npm:1.2.1" + dependenciesMeta: + "@napi-rs/lzma-android-arm-eabi": + optional: true + "@napi-rs/lzma-android-arm64": + optional: true + "@napi-rs/lzma-darwin-arm64": + optional: true + "@napi-rs/lzma-darwin-x64": + optional: true + "@napi-rs/lzma-freebsd-x64": + optional: true + "@napi-rs/lzma-linux-arm-gnueabihf": + optional: true + "@napi-rs/lzma-linux-arm64-gnu": + optional: true + "@napi-rs/lzma-linux-arm64-musl": + optional: true + "@napi-rs/lzma-linux-x64-gnu": + optional: true + "@napi-rs/lzma-linux-x64-musl": + optional: true + "@napi-rs/lzma-win32-arm64-msvc": + optional: true + "@napi-rs/lzma-win32-ia32-msvc": + optional: true + "@napi-rs/lzma-win32-x64-msvc": + optional: true + checksum: 5e6d9bee5e359227f7bb3616b3b2a8b064bde0f5aebf4b885df23954cc2f35b1ae44595405733e54826ab9896c02309eac5ff2b340592b698ef2aa135a44288c + languageName: node + linkType: hard + "@napi-rs/magic-string-android-arm-eabi@npm:0.3.4": version: 0.3.4 resolution: "@napi-rs/magic-string-android-arm-eabi@npm:0.3.4" @@ -7671,6 +7875,145 @@ __metadata: languageName: node linkType: hard +"@napi-rs/tar-android-arm-eabi@npm:0.0.1": + version: 0.0.1 + resolution: "@napi-rs/tar-android-arm-eabi@npm:0.0.1" + conditions: os=android & cpu=arm + languageName: node + linkType: hard + +"@napi-rs/tar-android-arm64@npm:0.0.1": + version: 0.0.1 + resolution: "@napi-rs/tar-android-arm64@npm:0.0.1" + conditions: os=android & cpu=arm64 + languageName: node + linkType: hard + +"@napi-rs/tar-darwin-arm64@npm:0.0.1": + version: 0.0.1 + resolution: "@napi-rs/tar-darwin-arm64@npm:0.0.1" + conditions: os=darwin & cpu=arm64 + languageName: node + linkType: hard + +"@napi-rs/tar-darwin-x64@npm:0.0.1": + version: 0.0.1 + resolution: "@napi-rs/tar-darwin-x64@npm:0.0.1" + conditions: os=darwin & cpu=x64 + languageName: node + linkType: hard + +"@napi-rs/tar-freebsd-x64@npm:0.0.1": + version: 0.0.1 + resolution: "@napi-rs/tar-freebsd-x64@npm:0.0.1" + conditions: os=freebsd & cpu=x64 + languageName: node + linkType: hard + +"@napi-rs/tar-linux-arm-gnueabihf@npm:0.0.1": + version: 0.0.1 + resolution: "@napi-rs/tar-linux-arm-gnueabihf@npm:0.0.1" + conditions: os=linux & cpu=arm + languageName: node + linkType: hard + +"@napi-rs/tar-linux-arm64-gnu@npm:0.0.1": + version: 0.0.1 + resolution: "@napi-rs/tar-linux-arm64-gnu@npm:0.0.1" + conditions: os=linux & cpu=arm64 & libc=glibc + languageName: node + linkType: hard + +"@napi-rs/tar-linux-arm64-musl@npm:0.0.1": + version: 0.0.1 + resolution: "@napi-rs/tar-linux-arm64-musl@npm:0.0.1" + conditions: os=linux & cpu=arm64 & libc=musl + languageName: node + linkType: hard + +"@napi-rs/tar-linux-x64-gnu@npm:0.0.1": + version: 0.0.1 + resolution: "@napi-rs/tar-linux-x64-gnu@npm:0.0.1" + conditions: os=linux & cpu=x64 & libc=glibc + languageName: node + linkType: hard + +"@napi-rs/tar-linux-x64-musl@npm:0.0.1": + version: 0.0.1 + resolution: "@napi-rs/tar-linux-x64-musl@npm:0.0.1" + conditions: os=linux & cpu=x64 & libc=musl + languageName: node + linkType: hard + +"@napi-rs/tar-win32-arm64-msvc@npm:0.0.1": + version: 0.0.1 + resolution: "@napi-rs/tar-win32-arm64-msvc@npm:0.0.1" + conditions: os=win32 & cpu=arm64 + languageName: node + linkType: hard + +"@napi-rs/tar-win32-ia32-msvc@npm:0.0.1": + version: 0.0.1 + resolution: "@napi-rs/tar-win32-ia32-msvc@npm:0.0.1" + conditions: os=win32 & cpu=ia32 + languageName: node + linkType: hard + +"@napi-rs/tar-win32-x64-msvc@npm:0.0.1": + version: 0.0.1 + resolution: "@napi-rs/tar-win32-x64-msvc@npm:0.0.1" + conditions: os=win32 & cpu=x64 + languageName: node + linkType: hard + +"@napi-rs/tar@npm:^0.0.1": + version: 0.0.1 + resolution: "@napi-rs/tar@npm:0.0.1" + dependencies: + "@napi-rs/tar-android-arm-eabi": "npm:0.0.1" + "@napi-rs/tar-android-arm64": "npm:0.0.1" + "@napi-rs/tar-darwin-arm64": "npm:0.0.1" + "@napi-rs/tar-darwin-x64": "npm:0.0.1" + "@napi-rs/tar-freebsd-x64": "npm:0.0.1" + "@napi-rs/tar-linux-arm-gnueabihf": "npm:0.0.1" + "@napi-rs/tar-linux-arm64-gnu": "npm:0.0.1" + "@napi-rs/tar-linux-arm64-musl": "npm:0.0.1" + "@napi-rs/tar-linux-x64-gnu": "npm:0.0.1" + "@napi-rs/tar-linux-x64-musl": "npm:0.0.1" + "@napi-rs/tar-win32-arm64-msvc": "npm:0.0.1" + "@napi-rs/tar-win32-ia32-msvc": "npm:0.0.1" + "@napi-rs/tar-win32-x64-msvc": "npm:0.0.1" + dependenciesMeta: + "@napi-rs/tar-android-arm-eabi": + optional: true + "@napi-rs/tar-android-arm64": + optional: true + "@napi-rs/tar-darwin-arm64": + optional: true + "@napi-rs/tar-darwin-x64": + optional: true + "@napi-rs/tar-freebsd-x64": + optional: true + "@napi-rs/tar-linux-arm-gnueabihf": + optional: true + "@napi-rs/tar-linux-arm64-gnu": + optional: true + "@napi-rs/tar-linux-arm64-musl": + optional: true + "@napi-rs/tar-linux-x64-gnu": + optional: true + "@napi-rs/tar-linux-x64-musl": + optional: true + "@napi-rs/tar-win32-arm64-msvc": + optional: true + "@napi-rs/tar-win32-ia32-msvc": + optional: true + "@napi-rs/tar-win32-x64-msvc": + optional: true + checksum: b0a80a08641c05a2fa035cc8e8e642fad0c25e781f292fc541daecedde3921aa96c6ae7785aea733ab6a08983e740dff1b7eefc36546ad939fdaa23e0fab5d70 + languageName: node + linkType: hard + "@napi-rs/xattr-android-arm-eabi@npm:1.0.1": version: 1.0.1 resolution: "@napi-rs/xattr-android-arm-eabi@npm:1.0.1" @@ -8718,6 +9061,131 @@ __metadata: languageName: node linkType: hard +"@octokit/auth-token@npm:^4.0.0": + version: 4.0.0 + resolution: "@octokit/auth-token@npm:4.0.0" + checksum: 60e42701e341d700f73c518c7a35675d36d79fa9d5e838cc3ade96d147e49f5ba74db2e07b2337c2b95aaa540aa42088116df2122daa25633f9e70a2c8785c44 + languageName: node + linkType: hard + +"@octokit/core@npm:^5.0.0": + version: 5.0.2 + resolution: "@octokit/core@npm:5.0.2" + dependencies: + "@octokit/auth-token": "npm:^4.0.0" + "@octokit/graphql": "npm:^7.0.0" + "@octokit/request": "npm:^8.0.2" + "@octokit/request-error": "npm:^5.0.0" + "@octokit/types": "npm:^12.0.0" + before-after-hook: "npm:^2.2.0" + universal-user-agent: "npm:^6.0.0" + checksum: bb991f88793fab043c4c09f9441432596fe0e6448caf42cd2209f52c1f26807418be488ad2cea7a8293e58e79e5c0019f38dda46e8cf96af5e89e43cca37ec3e + languageName: node + linkType: hard + +"@octokit/endpoint@npm:^9.0.0": + version: 9.0.4 + resolution: "@octokit/endpoint@npm:9.0.4" + dependencies: + "@octokit/types": "npm:^12.0.0" + universal-user-agent: "npm:^6.0.0" + checksum: 7df35c96f2b5628fe5b3f44a72614be9b439779c06b4dd1bb72283b3cb2ea53e59e1f9a108798efe5404b6856f4380a4c5be12d93255d854f0683cd6e22f3a27 + languageName: node + linkType: hard + +"@octokit/graphql@npm:^7.0.0": + version: 7.0.2 + resolution: "@octokit/graphql@npm:7.0.2" + dependencies: + "@octokit/request": "npm:^8.0.1" + "@octokit/types": "npm:^12.0.0" + universal-user-agent: "npm:^6.0.0" + checksum: f5dcc51fed5304f65dab83fcea4c2a569107d3b71e8d084199dc44f0d0cfc852c9e1f341b06ae66601f9da4af3aad416b0c62dcd0567ac7568f072d8d90d502e + languageName: node + linkType: hard + +"@octokit/openapi-types@npm:^19.0.2": + version: 19.1.0 + resolution: "@octokit/openapi-types@npm:19.1.0" + checksum: 3abedc09baa91bb4de00a2b82bf519401c2b6388913b7caa98541002c9e9612eba8256926323b1e40782ac700309a3373bb8c13520af325cef1accc40cb4566b + languageName: node + linkType: hard + +"@octokit/plugin-paginate-rest@npm:^9.0.0": + version: 9.1.4 + resolution: "@octokit/plugin-paginate-rest@npm:9.1.4" + dependencies: + "@octokit/types": "npm:^12.3.0" + peerDependencies: + "@octokit/core": ">=5" + checksum: 1573934e0c2a99e3512cd21a0dbb17f6ca1d5faffdffb499cb80519b1219da4d56f814a30c68c0961fcccf152895bdced478709195f53a6e4c32e71a3235f888 + languageName: node + linkType: hard + +"@octokit/plugin-request-log@npm:^4.0.0": + version: 4.0.0 + resolution: "@octokit/plugin-request-log@npm:4.0.0" + peerDependencies: + "@octokit/core": ">=5" + checksum: 2a8a6619640942092009a9248ceeb163ce01c978e2d7b2a7eb8686bd09a04b783c4cd9071eebb16652d233587abcde449a02ce4feabc652f0a171615fb3e9946 + languageName: node + linkType: hard + +"@octokit/plugin-rest-endpoint-methods@npm:^10.0.0": + version: 10.2.0 + resolution: "@octokit/plugin-rest-endpoint-methods@npm:10.2.0" + dependencies: + "@octokit/types": "npm:^12.3.0" + peerDependencies: + "@octokit/core": ">=5" + checksum: 0f8ca73b3e582b366b400278f19df6309f263efa3809a9d6ba613063e7a26f16d6f8d69c413bf9b23c2431ad4c795e4e06a43717b6acc1367186fb55347cfb69 + languageName: node + linkType: hard + +"@octokit/request-error@npm:^5.0.0": + version: 5.0.1 + resolution: "@octokit/request-error@npm:5.0.1" + dependencies: + "@octokit/types": "npm:^12.0.0" + deprecation: "npm:^2.0.0" + once: "npm:^1.4.0" + checksum: a21a4614c46cb173e4ba73fa048576204f1ddc541dee3e7c938ef36088566e3b25e04ca1f96f375ec2e3cc29b7ba970b3b078a89a20bc50cdcdbed879db94573 + languageName: node + linkType: hard + +"@octokit/request@npm:^8.0.1, @octokit/request@npm:^8.0.2": + version: 8.1.6 + resolution: "@octokit/request@npm:8.1.6" + dependencies: + "@octokit/endpoint": "npm:^9.0.0" + "@octokit/request-error": "npm:^5.0.0" + "@octokit/types": "npm:^12.0.0" + universal-user-agent: "npm:^6.0.0" + checksum: aebea1c33d607d23c70f663cd5f8279a8bd932ab77b4ca5cca3b33968a347b4adb47476c886086f3a9aa1acefab3b79adac78ee7aa2dacd67eb1f2a05e272618 + languageName: node + linkType: hard + +"@octokit/rest@npm:^20.0.2": + version: 20.0.2 + resolution: "@octokit/rest@npm:20.0.2" + dependencies: + "@octokit/core": "npm:^5.0.0" + "@octokit/plugin-paginate-rest": "npm:^9.0.0" + "@octokit/plugin-request-log": "npm:^4.0.0" + "@octokit/plugin-rest-endpoint-methods": "npm:^10.0.0" + checksum: 527e1806ca274209a2a7daa485010dafb2ebb6c9b0b44c1d33a8f1f16f10e54a96386a4f642dc416160842a4b367d3953d27f8b827b9a94600709d2ac5e95d21 + languageName: node + linkType: hard + +"@octokit/types@npm:^12.0.0, @octokit/types@npm:^12.3.0": + version: 12.3.0 + resolution: "@octokit/types@npm:12.3.0" + dependencies: + "@octokit/openapi-types": "npm:^19.0.2" + checksum: ab78fd25490f995f79e341b00c375bade64eedb44d4c76fa3da85961003ba1efcac3cf168ea221bf4f9f5761afe91738412737acf30f1f41f3f2dbad14b872e4 + languageName: node + linkType: hard + "@open-draft/deferred-promise@npm:^2.2.0": version: 2.2.0 resolution: "@open-draft/deferred-promise@npm:2.2.0" @@ -13363,6 +13831,15 @@ __metadata: languageName: node linkType: hard +"@tybys/wasm-util@npm:0.8.0": + version: 0.8.0 + resolution: "@tybys/wasm-util@npm:0.8.0" + dependencies: + tslib: "npm:^2.4.0" + checksum: 7fa650acfc3fdcaf103f0f7acdf6f4cf67125632eb0f91c92d826375e262547d69de28838cf7a4b69fb665d2fb6f153558528fa1fddd5615a5aa838a87ed7d16 + languageName: node + linkType: hard + "@types/accepts@npm:*": version: 1.3.7 resolution: "@types/accepts@npm:1.3.7" @@ -15633,7 +16110,7 @@ __metadata: languageName: node linkType: hard -"ansi-escapes@npm:^4.2.1, ansi-escapes@npm:^4.3.0": +"ansi-escapes@npm:^4.2.1, ansi-escapes@npm:^4.3.0, ansi-escapes@npm:^4.3.2": version: 4.3.2 resolution: "ansi-escapes@npm:4.3.2" dependencies: @@ -16509,6 +16986,13 @@ __metadata: languageName: node linkType: hard +"before-after-hook@npm:^2.2.0": + version: 2.2.3 + resolution: "before-after-hook@npm:2.2.3" + checksum: e676f769dbc4abcf4b3317db2fd2badb4a92c0710e0a7da12cf14b59c3482d4febf835ad7de7874499060fd4e13adf0191628e504728b3c5bb4ec7a878c09940 + languageName: node + linkType: hard + "better-opn@npm:^3.0.2": version: 3.0.2 resolution: "better-opn@npm:3.0.2" @@ -17557,6 +18041,13 @@ __metadata: languageName: node linkType: hard +"cli-width@npm:^4.1.0": + version: 4.1.0 + resolution: "cli-width@npm:4.1.0" + checksum: b58876fbf0310a8a35c79b72ecfcf579b354e18ad04e6b20588724ea2b522799a758507a37dfe132fafaf93a9922cafd9514d9e1598e6b2cd46694853aed099f + languageName: node + linkType: hard + "client-only@npm:^0.0.1": version: 0.0.1 resolution: "client-only@npm:0.0.1" @@ -17564,7 +18055,7 @@ __metadata: languageName: node linkType: hard -"clipanion@npm:^3.1.0": +"clipanion@npm:^3.1.0, clipanion@npm:^3.2.1": version: 3.2.1 resolution: "clipanion@npm:3.2.1" dependencies: @@ -18982,6 +19473,13 @@ __metadata: languageName: node linkType: hard +"deprecation@npm:^2.0.0": + version: 2.3.1 + resolution: "deprecation@npm:2.3.1" + checksum: f56a05e182c2c195071385455956b0c4106fe14e36245b00c689ceef8e8ab639235176a96977ba7c74afb173317fac2e0ec6ec7a1c6d1e6eaa401c586c714132 + languageName: node + linkType: hard + "dequal@npm:2.0.3, dequal@npm:^2.0.0, dequal@npm:^2.0.2, dequal@npm:^2.0.3": version: 2.0.3 resolution: "dequal@npm:2.0.3" @@ -19615,6 +20113,18 @@ __metadata: languageName: node linkType: hard +"emnapi@npm:0.44.0": + version: 0.44.0 + resolution: "emnapi@npm:0.44.0" + peerDependencies: + node-addon-api: ">= 6.1.0" + peerDependenciesMeta: + node-addon-api: + optional: true + checksum: c0177b08bbca8c815e5b15c544d431cd270975bc5831bad03691eba271de5ad7cff78be431ae1b5e3816a622951a9ed525b83a1a3707b9f9c70ecc8aece7344d + languageName: node + linkType: hard + "emoji-regex@npm:^10.3.0": version: 10.3.0 resolution: "emoji-regex@npm:10.3.0" @@ -20759,7 +21269,7 @@ __metadata: languageName: node linkType: hard -"external-editor@npm:^3.0.3": +"external-editor@npm:^3.0.3, external-editor@npm:^3.1.0": version: 3.1.0 resolution: "external-editor@npm:3.1.0" dependencies: @@ -21037,6 +21547,16 @@ __metadata: languageName: node linkType: hard +"figures@npm:^5.0.0": + version: 5.0.0 + resolution: "figures@npm:5.0.0" + dependencies: + escape-string-regexp: "npm:^5.0.0" + is-unicode-supported: "npm:^1.2.0" + checksum: 951d18be2f450c90462c484eff9bda705293319bc2f17b250194a0cf1a291600db4cb283a6ce199d49380c95b08d85d822ce4b18d2f9242663fd5895476d667c + languageName: node + linkType: hard + "figures@npm:^6.0.1": version: 6.0.1 resolution: "figures@npm:6.0.1" @@ -23365,6 +23885,29 @@ __metadata: languageName: node linkType: hard +"inquirer@npm:^9.2.12": + version: 9.2.12 + resolution: "inquirer@npm:9.2.12" + dependencies: + "@ljharb/through": "npm:^2.3.11" + ansi-escapes: "npm:^4.3.2" + chalk: "npm:^5.3.0" + cli-cursor: "npm:^3.1.0" + cli-width: "npm:^4.1.0" + external-editor: "npm:^3.1.0" + figures: "npm:^5.0.0" + lodash: "npm:^4.17.21" + mute-stream: "npm:1.0.0" + ora: "npm:^5.4.1" + run-async: "npm:^3.0.0" + rxjs: "npm:^7.8.1" + string-width: "npm:^4.2.3" + strip-ansi: "npm:^6.0.1" + wrap-ansi: "npm:^6.2.0" + checksum: 02b259c641fd6c6b88c0c530aced23389d586bd5360799bab0ae11d2a965ac5ce9c587402faefad70f08b8b56ccae56fb973da3a8deb6e17ba4577f803d427c5 + languageName: node + linkType: hard + "interpret@npm:^3.1.1": version: 3.1.1 resolution: "interpret@npm:3.1.1" @@ -23850,6 +24393,13 @@ __metadata: languageName: node linkType: hard +"is-unicode-supported@npm:^1.2.0": + version: 1.3.0 + resolution: "is-unicode-supported@npm:1.3.0" + checksum: 20a1fc161afafaf49243551a5ac33b6c4cf0bbcce369fcd8f2951fbdd000c30698ce320de3ee6830497310a8f41880f8066d440aa3eb0a853e2aa4836dd89abc + languageName: node + linkType: hard + "is-upper-case@npm:^2.0.2": version: 2.0.2 resolution: "is-upper-case@npm:2.0.2" @@ -28125,6 +28675,13 @@ __metadata: languageName: node linkType: hard +"mute-stream@npm:1.0.0": + version: 1.0.0 + resolution: "mute-stream@npm:1.0.0" + checksum: 36fc968b0e9c9c63029d4f9dc63911950a3bdf55c9a87f58d3a266289b67180201cade911e7699f8b2fa596b34c9db43dad37649e3f7fdd13c3bb9edb0017ee7 + languageName: node + linkType: hard + "nanoid@npm:^3.3.3, nanoid@npm:^3.3.6": version: 3.3.7 resolution: "nanoid@npm:3.3.7" @@ -32114,6 +32671,13 @@ __metadata: languageName: node linkType: hard +"run-async@npm:^3.0.0": + version: 3.0.0 + resolution: "run-async@npm:3.0.0" + checksum: 97fb8747f7765b77ebcd311d3a33548099336f04c6434e0763039b98c1de0f1b4421000695aff8751f309c0b995d8dfd620c1f1e4c35572da38c101488165305 + languageName: node + linkType: hard + "run-parallel@npm:^1.1.9": version: 1.2.0 resolution: "run-parallel@npm:1.2.0" @@ -34133,6 +34697,13 @@ __metadata: languageName: node linkType: hard +"toml@npm:^3.0.0": + version: 3.0.0 + resolution: "toml@npm:3.0.0" + checksum: cfef0966868d552bd02e741f30945a611f70841b7cddb07ea2b17441fe32543985bc0a7c0dcf7971af26fcaf8a17712a485d911f46bfe28644536e9a71a2bd09 + languageName: node + linkType: hard + "totalist@npm:^3.0.0": version: 3.0.1 resolution: "totalist@npm:3.0.1" @@ -34316,7 +34887,7 @@ __metadata: languageName: node linkType: hard -"typanion@npm:^3.8.0": +"typanion@npm:^3.14.0, typanion@npm:^3.8.0": version: 3.14.0 resolution: "typanion@npm:3.14.0" checksum: 5e88d9e6121ff0ec543f572152fdd1b70e9cca35406d79013ec8e08defa8ef96de5fec9e98da3afbd1eb4426b9e8e8fe423163d0b482e34a40103cab1ef29abd @@ -34772,6 +35343,13 @@ __metadata: languageName: node linkType: hard +"universal-user-agent@npm:^6.0.0": + version: 6.0.1 + resolution: "universal-user-agent@npm:6.0.1" + checksum: fdc8e1ae48a05decfc7ded09b62071f571c7fe0bd793d700704c80cea316101d4eac15cc27ed2bb64f4ce166d2684777c3198b9ab16034f547abea0d3aa1c93c + languageName: node + linkType: hard + "universalify@npm:^0.1.0": version: 0.1.2 resolution: "universalify@npm:0.1.2" From b32a427ecd29cb74da541de03d8d1137b4f40d99 Mon Sep 17 00:00:00 2001 From: JimmFly <447268514@qq.com> Date: Wed, 6 Dec 2023 08:13:56 +0000 Subject: [PATCH 30/68] chore: adjust banner content text (#5153) ![image](https://github.com/toeverything/AFFiNE/assets/102217452/86a77f1f-1be5-4d05-bdfa-9e1b321c0d9e) --- .../components/affine-banner/local-demo-tips.tsx | 14 +++++++------- packages/frontend/i18n/src/resources/en.json | 1 + 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/packages/frontend/component/src/components/affine-banner/local-demo-tips.tsx b/packages/frontend/component/src/components/affine-banner/local-demo-tips.tsx index ea251d895a..770ab3340a 100644 --- a/packages/frontend/component/src/components/affine-banner/local-demo-tips.tsx +++ b/packages/frontend/component/src/components/affine-banner/local-demo-tips.tsx @@ -1,4 +1,5 @@ import { Button, IconButton } from '@affine/component/ui/button'; +import { useAFFiNEI18N } from '@affine/i18n/hooks'; import { CloseIcon } from '@blocksuite/icons'; import { useCallback } from 'react'; @@ -17,13 +18,10 @@ export const LocalDemoTips = ({ onLogin, onEnableCloud, }: LocalDemoTipsProps) => { - const content = isLoggedIn - ? 'This is a local demo workspace, and the data is stored locally. We recommend enabling AFFiNE Cloud.' - : 'This is a local demo workspace, and the data is stored locally in the browser. We recommend Enabling AFFiNE Cloud or downloading the client for a better experience.'; - + const t = useAFFiNEI18N(); const buttonLabel = isLoggedIn - ? 'Enable AFFiNE Cloud' - : 'Sign in with AFFiNE Cloud'; + ? t['Enable AFFiNE Cloud']() + : t['Sign in and Enable'](); const handleClick = useCallback(() => { if (isLoggedIn) { @@ -34,7 +32,9 @@ export const LocalDemoTips = ({ return (
    -
    {content}
    +
    + {t['com.affine.banner.local-warning']()} +
    diff --git a/packages/frontend/i18n/src/resources/en.json b/packages/frontend/i18n/src/resources/en.json index 22f5d6072f..70ede531fa 100644 --- a/packages/frontend/i18n/src/resources/en.json +++ b/packages/frontend/i18n/src/resources/en.json @@ -480,6 +480,7 @@ "com.affine.auth.toast.title.signed-in": "Signed in", "com.affine.backButton": "Back", "com.affine.banner.content": "This demo is limited. <1>Download the AFFiNE Client for the latest features and Performance.", + "com.affine.banner.local-warning": "Your local data is stored in the browser and may be lost. Don't risk it - enable cloud now!", "com.affine.brand.affineCloud": "AFFiNE Cloud", "com.affine.cloudTempDisable.description": "We are upgrading the AFFiNE Cloud service and it is temporarily unavailable on the client side. If you wish to stay updated on the progress and be notified on availability, you can fill out the <1>AFFiNE Cloud Signup.", "com.affine.cloudTempDisable.title": "AFFiNE Cloud is upgrading now.", From 4cb26cd3e5690746b627a1778a3ee0ffbc17e836 Mon Sep 17 00:00:00 2001 From: liuyi Date: Wed, 6 Dec 2023 08:35:45 +0000 Subject: [PATCH 31/68] feat(server): events system (#5145) --- packages/backend/server/src/app.ts | 2 + packages/backend/server/src/event/events.ts | 28 +++++++++++++ packages/backend/server/src/event/index.ts | 44 ++++++++++++++++++++ packages/backend/server/src/event/types.ts | 38 +++++++++++++++++ packages/backend/server/src/modules/index.ts | 7 +--- 5 files changed, 113 insertions(+), 6 deletions(-) create mode 100644 packages/backend/server/src/event/events.ts create mode 100644 packages/backend/server/src/event/index.ts create mode 100644 packages/backend/server/src/event/types.ts diff --git a/packages/backend/server/src/app.ts b/packages/backend/server/src/app.ts index cab18af060..afc5ab7b1a 100644 --- a/packages/backend/server/src/app.ts +++ b/packages/backend/server/src/app.ts @@ -3,6 +3,7 @@ import { Module } from '@nestjs/common'; import { AppController } from './app.controller'; import { CacheModule } from './cache'; import { ConfigModule } from './config'; +import { EventModule } from './event'; import { BusinessModules } from './modules'; import { AuthModule } from './modules/auth'; import { PrismaModule } from './prisma'; @@ -14,6 +15,7 @@ const BasicModules = [ PrismaModule, ConfigModule.forRoot(), CacheModule, + EventModule, StorageModule.forRoot(), SessionModule, RateLimiterModule, diff --git a/packages/backend/server/src/event/events.ts b/packages/backend/server/src/event/events.ts new file mode 100644 index 0000000000..e98bb72440 --- /dev/null +++ b/packages/backend/server/src/event/events.ts @@ -0,0 +1,28 @@ +import type { Snapshot, User, Workspace } from '@prisma/client'; + +import { ChangePayload, Flatten, Payload } from './types'; + +interface EventDefinitions { + user: { + created: Payload; + updated: Payload>; + deleted: Payload; + }; + + workspace: { + created: Payload; + updated: Payload>; + deleted: Payload; + }; + + snapshot: { + created: Payload; + updated: Payload>; + deleted: Payload>; + }; +} + +export type EventKV = Flatten; + +export type Event = keyof EventKV; +export type EventPayload = EventKV[E]; diff --git a/packages/backend/server/src/event/index.ts b/packages/backend/server/src/event/index.ts new file mode 100644 index 0000000000..06b398ad04 --- /dev/null +++ b/packages/backend/server/src/event/index.ts @@ -0,0 +1,44 @@ +import { Global, Injectable, Module } from '@nestjs/common'; +import { + EventEmitter2, + EventEmitterModule, + OnEvent as RawOnEvent, +} from '@nestjs/event-emitter'; + +import { Event, EventPayload } from './events'; + +@Injectable() +export class EventEmitter { + constructor(private readonly emitter: EventEmitter2) {} + + emit(event: E, payload: EventPayload) { + return this.emitter.emit(event, payload); + } + + emitAsync(event: E, payload: EventPayload) { + return this.emitter.emitAsync(event, payload); + } + + on(event: E, handler: (payload: EventPayload) => void) { + return this.emitter.on(event, handler); + } + + once(event: E, handler: (payload: EventPayload) => void) { + return this.emitter.once(event, handler); + } +} + +export const OnEvent = ( + event: Event, + opts?: Parameters[1] +) => { + return RawOnEvent(event, opts); +}; + +@Global() +@Module({ + imports: [EventEmitterModule.forRoot()], + providers: [EventEmitter], + exports: [EventEmitter], +}) +export class EventModule {} diff --git a/packages/backend/server/src/event/types.ts b/packages/backend/server/src/event/types.ts new file mode 100644 index 0000000000..2a4bb5771c --- /dev/null +++ b/packages/backend/server/src/event/types.ts @@ -0,0 +1,38 @@ +export type Payload = { + __payload: true; + data: T; +}; + +export type ChangePayload = { + from: Partial; + to: Partial; +}; + +export type Join = A extends '' + ? B + : `${A}.${B}`; + +export type PathType = string extends Path + ? unknown + : Path extends keyof T + ? T[Path] + : Path extends `${infer K}.${infer R}` + ? K extends keyof T + ? PathType + : unknown + : unknown; + +export type Leaves = T extends Payload + ? P + : T extends Record + ? { + [K in keyof T]: K extends string ? Leaves> : never; + }[keyof T] + : never; + +export type Flatten = Leaves extends infer R + ? { + // @ts-expect-error yo, ts can't make it + [K in R]: PathType extends Payload ? { data: U } : never; + } + : never; diff --git a/packages/backend/server/src/modules/index.ts b/packages/backend/server/src/modules/index.ts index d021dd8bfa..422b276265 100644 --- a/packages/backend/server/src/modules/index.ts +++ b/packages/backend/server/src/modules/index.ts @@ -1,5 +1,4 @@ import { DynamicModule, Type } from '@nestjs/common'; -import { EventEmitterModule } from '@nestjs/event-emitter'; import { ScheduleModule } from '@nestjs/schedule'; import { GqlModule } from '../graphql.module'; @@ -11,11 +10,7 @@ import { SyncModule } from './sync'; import { UsersModule } from './users'; import { WorkspaceModule } from './workspaces'; -const BusinessModules: (Type | DynamicModule)[] = [ - EventEmitterModule.forRoot({ - global: true, - }), -]; +const BusinessModules: (Type | DynamicModule)[] = []; switch (SERVER_FLAVOR) { case 'sync': From e0cada49f5ba4b97805bbc22d8940cc253c742fa Mon Sep 17 00:00:00 2001 From: liuyi Date: Wed, 6 Dec 2023 08:35:48 +0000 Subject: [PATCH 32/68] refactor(server): do not force init binary when creating workspace (#5146) --- .../src/modules/sync/events/events.gateway.ts | 5 +- .../server/src/modules/workspaces/resolver.ts | 50 +++++++++++-------- packages/backend/server/src/schema.gql | 2 +- .../graphql/src/graphql/create-workspace.gql | 4 +- .../frontend/graphql/src/graphql/index.ts | 6 +-- packages/frontend/graphql/src/schema.ts | 4 +- .../frontend/workspace/src/affine/crud.ts | 7 +-- 7 files changed, 37 insertions(+), 41 deletions(-) diff --git a/packages/backend/server/src/modules/sync/events/events.gateway.ts b/packages/backend/server/src/modules/sync/events/events.gateway.ts index f847842c1c..4953241185 100644 --- a/packages/backend/server/src/modules/sync/events/events.gateway.ts +++ b/packages/backend/server/src/modules/sync/events/events.gateway.ts @@ -25,7 +25,6 @@ import { EventError, InternalError, NotInWorkspaceError, - WorkspaceNotFoundError, } from './error'; export const GatewayErrorWrapper = (): MethodDecorator => { @@ -319,9 +318,7 @@ export class EventsGateway implements OnGatewayConnection, OnGatewayDisconnect { if (!doc) { return { - error: docId.isWorkspace - ? new WorkspaceNotFoundError(workspaceId) - : new DocNotFoundError(workspaceId, docId.guid), + error: new DocNotFoundError(workspaceId, docId.guid), }; } diff --git a/packages/backend/server/src/modules/workspaces/resolver.ts b/packages/backend/server/src/modules/workspaces/resolver.ts index 6b83076e3a..e1aae88a19 100644 --- a/packages/backend/server/src/modules/workspaces/resolver.ts +++ b/packages/backend/server/src/modules/workspaces/resolver.ts @@ -308,22 +308,11 @@ export class WorkspaceResolver { }) async createWorkspace( @CurrentUser() user: UserType, - @Args({ name: 'init', type: () => GraphQLUpload }) - update: FileUpload + // we no longer support init workspace with a preload file + // use sync system to uploading them once created + @Args({ name: 'init', type: () => GraphQLUpload, nullable: true }) + init: FileUpload | null ) { - // convert stream to buffer - const buffer = await new Promise((resolve, reject) => { - const stream = update.createReadStream(); - const chunks: Uint8Array[] = []; - stream.on('data', chunk => { - chunks.push(chunk); - }); - stream.on('error', reject); - stream.on('end', () => { - resolve(Buffer.concat(chunks)); - }); - }); - const workspace = await this.prisma.workspace.create({ data: { public: false, @@ -341,14 +330,31 @@ export class WorkspaceResolver { }, }); - if (buffer.length) { - await this.prisma.snapshot.create({ - data: { - id: workspace.id, - workspaceId: workspace.id, - blob: buffer, - }, + if (init) { + // convert stream to buffer + const buffer = await new Promise(resolve => { + const stream = init.createReadStream(); + const chunks: Uint8Array[] = []; + stream.on('data', chunk => { + chunks.push(chunk); + }); + stream.on('error', () => { + resolve(Buffer.from([])); + }); + stream.on('end', () => { + resolve(Buffer.concat(chunks)); + }); }); + + if (buffer.length) { + await this.prisma.snapshot.create({ + data: { + id: workspace.id, + workspaceId: workspace.id, + blob: buffer, + }, + }); + } } return workspace; diff --git a/packages/backend/server/src/schema.gql b/packages/backend/server/src/schema.gql index 68dc28c522..c6ee591b28 100644 --- a/packages/backend/server/src/schema.gql +++ b/packages/backend/server/src/schema.gql @@ -292,7 +292,7 @@ type Mutation { sendVerifyChangeEmail(token: String!, email: String!, callbackUrl: String!): Boolean! """Create a new workspace""" - createWorkspace(init: Upload!): WorkspaceType! + createWorkspace(init: Upload): WorkspaceType! """Update workspace""" updateWorkspace(input: UpdateWorkspaceInput!): WorkspaceType! diff --git a/packages/frontend/graphql/src/graphql/create-workspace.gql b/packages/frontend/graphql/src/graphql/create-workspace.gql index 315768c16f..2b849ad97d 100644 --- a/packages/frontend/graphql/src/graphql/create-workspace.gql +++ b/packages/frontend/graphql/src/graphql/create-workspace.gql @@ -1,5 +1,5 @@ -mutation createWorkspace($init: Upload!) { - createWorkspace(init: $init) { +mutation createWorkspace { + createWorkspace { id public createdAt diff --git a/packages/frontend/graphql/src/graphql/index.ts b/packages/frontend/graphql/src/graphql/index.ts index 9f543e0569..bc2d22c79b 100644 --- a/packages/frontend/graphql/src/graphql/index.ts +++ b/packages/frontend/graphql/src/graphql/index.ts @@ -153,10 +153,10 @@ export const createWorkspaceMutation = { id: 'createWorkspaceMutation' as const, operationName: 'createWorkspace', definitionName: 'createWorkspace', - containsFile: true, + containsFile: false, query: ` -mutation createWorkspace($init: Upload!) { - createWorkspace(init: $init) { +mutation createWorkspace { + createWorkspace { id public createdAt diff --git a/packages/frontend/graphql/src/schema.ts b/packages/frontend/graphql/src/schema.ts index b0243ca909..7010647b6c 100644 --- a/packages/frontend/graphql/src/schema.ts +++ b/packages/frontend/graphql/src/schema.ts @@ -199,9 +199,7 @@ export type CreateCustomerPortalMutation = { createCustomerPortal: string; }; -export type CreateWorkspaceMutationVariables = Exact<{ - init: Scalars['Upload']['input']; -}>; +export type CreateWorkspaceMutationVariables = Exact<{ [key: string]: never }>; export type CreateWorkspaceMutation = { __typename?: 'Mutation'; diff --git a/packages/frontend/workspace/src/affine/crud.ts b/packages/frontend/workspace/src/affine/crud.ts index e4a656c409..434cd729b2 100644 --- a/packages/frontend/workspace/src/affine/crud.ts +++ b/packages/frontend/workspace/src/affine/crud.ts @@ -40,13 +40,8 @@ export const CRUD: WorkspaceCRUD = { } const { createWorkspace } = await fetcher({ query: createWorkspaceMutation, - variables: { - init: new File( - [Y.encodeStateAsUpdate(upstreamWorkspace.doc)], - 'initBinary.yDoc' - ), - }, }); + createdWorkspaces.push(upstreamWorkspace.id); const newBlockSuiteWorkspace = getOrCreateWorkspace( createWorkspace.id, From 2b53430539480d7835209412f59a14e21c3b7cd7 Mon Sep 17 00:00:00 2001 From: Peng Xiao Date: Wed, 6 Dec 2023 08:45:54 +0000 Subject: [PATCH 33/68] feat(core): allow core modules to import itself (#5207) --- packages/frontend/core/package.json | 2 +- .../pure/workspace-slider-bar/workspace-card/index.tsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/frontend/core/package.json b/packages/frontend/core/package.json index a06d069ebb..a208f2b125 100644 --- a/packages/frontend/core/package.json +++ b/packages/frontend/core/package.json @@ -13,7 +13,7 @@ "./router": "./src/router.ts", "./bootstrap/setup": "./src/bootstrap/setup.ts", "./bootstrap/register-plugins": "./src/bootstrap/register-plugins.ts", - "./components/pure/*": "./src/components/pure/*/index.tsx" + "./*": "./src/*" }, "dependencies": { "@affine-test/fixtures": "workspace:*", diff --git a/packages/frontend/core/src/components/pure/workspace-slider-bar/workspace-card/index.tsx b/packages/frontend/core/src/components/pure/workspace-slider-bar/workspace-card/index.tsx index d34b79e522..ce005f65b9 100644 --- a/packages/frontend/core/src/components/pure/workspace-slider-bar/workspace-card/index.tsx +++ b/packages/frontend/core/src/components/pure/workspace-slider-bar/workspace-card/index.tsx @@ -1,5 +1,6 @@ import { Avatar } from '@affine/component/ui/avatar'; import { Tooltip } from '@affine/component/ui/tooltip'; +import { useCurrentSyncEngine } from '@affine/core/hooks/current/use-current-sync-engine'; import { WorkspaceFlavour } from '@affine/env/workspace'; import { type SyncEngineStatus, @@ -24,7 +25,6 @@ import { useState, } from 'react'; -import { useCurrentSyncEngine } from '../../../../hooks/current/use-current-sync-engine'; import { useSystemOnline } from '../../../../hooks/use-system-online'; import type { AllWorkspace } from '../../../../shared'; import { Loading } from './loading-icon'; From 93a0349fbce0aa7cb0cc4d5200d62a80d26276d5 Mon Sep 17 00:00:00 2001 From: LongYinan Date: Wed, 6 Dec 2023 08:55:32 +0000 Subject: [PATCH 34/68] chore: bump up vite version to v4.5.1 [SECURITY] (#5211) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [vite](https://vitejs.dev) ([source](https://togithub.com/vitejs/vite/tree/HEAD/packages/vite)) | [`4.5.0` -> `4.5.1`](https://renovatebot.com/diffs/npm/vite/4.5.0/4.5.1) | [![age](https://developer.mend.io/api/mc/badges/age/npm/vite/4.5.1?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/vite/4.5.1?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/vite/4.5.0/4.5.1?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/vite/4.5.0/4.5.1?slim=true)](https://docs.renovatebot.com/merge-confidence/) | ### GitHub Vulnerability Alerts #### [CVE-2023-49293](https://togithub.com/vitejs/vite/security/advisories/GHSA-92r3-m2mg-pj97) ### Summary When Vite's HTML transformation is invoked manually via `server.transformIndexHtml`, the original request URL is passed in unmodified, and the `html` being transformed contains inline module scripts (``), it is possible to inject arbitrary HTML into the transformed output by supplying a malicious URL query string to `server.transformIndexHtml`. ### Impact Only apps using `appType: 'custom'` and using the default Vite HTML middleware are affected. The HTML entry must also contain an inline script. The attack requires a user to click on a malicious URL while running the dev server. Restricted files aren't exposed to the attacker. ### Patches Fixed in vite@5.0.5, vite@4.5.1, vite@4.4.12 ### Details Suppose `index.html` contains an inline module script: ```html ``` This script is transformed into a proxy script like ```html ``` due to Vite's HTML plugin: https://github.com/vitejs/vite/blob/7fd7c6cebfcad34ae7021ebee28f97b1f28ef3f3/packages/vite/src/node/plugins/html.ts#L429-L465 When `appType: 'spa' | 'mpa'`, Vite serves HTML itself, and `htmlFallbackMiddleware` rewrites `req.url` to the canonical path of `index.html`, https://github.com/vitejs/vite/blob/73ef074b80fa7252e0c46a37a2c94ba8cba46504/packages/vite/src/node/server/middlewares/htmlFallback.ts#L44-L47 so the `url` passed to `server.transformIndexHtml` is `/index.html`. However, if `appType: 'custom'`, HTML is served manually, and if `server.transformIndexHtml` is called with the unmodified request URL (as the SSR docs suggest), then the path of the transformed `html-proxy` script varies with the request URL. For example, a request with path `/` produces ```html ``` It is possible to abuse this behavior by crafting a request URL to contain a malicious payload like ``` "> ``` so a request to http://localhost:5173/?%22%3E%3C/script%3E%3Cscript%3Ealert(%27boom%27)%3C/script%3E produces HTML output like ```html ?html-proxy&index=0.js"> ``` which demonstrates XSS. ### PoC - Example 1. Serving HTML from `vite dev` middleware with `appType: 'custom'` - Go to https://stackblitz.com/edit/vitejs-vite-9xhma4?file=main.js&terminal=dev-html - "Open in New Tab" - Edit URL to set query string to `?%22%3E%3C/script%3E%3Cscript%3Ealert(%27boom%27)%3C/script%3E` and navigate - Witness XSS: - ![image](https://user-images.githubusercontent.com/2456381/287434281-13757894-7a63-4a73-b1e9-d2b024c19d14.png) - Example 2. Serving HTML from SSR-style Express server (Vite dev server runs in middleware mode): - Go to https://stackblitz.com/edit/vitejs-vite-9xhma4?file=main.js&terminal=server - (Same steps as above) - Example 3. Plain `vite dev` (this shows that vanilla `vite dev` is _not_ vulnerable, provided `htmlFallbackMiddleware` is used) - Go to https://stackblitz.com/edit/vitejs-vite-9xhma4?file=main.js&terminal=dev - (Same steps as above) - You should _not_ see the alert box in this case ### Detailed Impact This will probably predominantly affect [development-mode SSR](https://vitejs.dev/guide/ssr#setting-up-the-dev-server), where `vite.transformHtml` is called using the original `req.url`, per the docs: https://github.com/vitejs/vite/blob/7fd7c6cebfcad34ae7021ebee28f97b1f28ef3f3/docs/guide/ssr.md?plain=1#L114-L126 However, since this vulnerability affects `server.transformIndexHtml`, the scope of impact may be higher to also include other ad-hoc calls to `server.transformIndexHtml` from outside of Vite's own codebase. My best guess at bisecting which versions are vulnerable involves the following test script ```js import fs from 'node:fs/promises'; import * as vite from 'vite'; const html = ` `; const server = await vite.createServer({ appType: 'custom' }); const transformed = await server.transformIndexHtml('/?%22%3E%3C/script%3E%3Cscript%3Ealert(%27boom%27)%3C/script%3E', html); console.log(transformed); await server.close(); ``` and using it I was able to narrow down to #​13581. If this is correct, then vulnerable Vite versions are 4.4.0-beta.2 and higher (which includes 4.4.0). --- ### Release Notes
    vitejs/vite (vite) ### [`v4.5.1`](https://togithub.com/vitejs/vite/releases/tag/v4.5.1) [Compare Source](https://togithub.com/vitejs/vite/compare/v4.5.0...v4.5.1) Please refer to [CHANGELOG.md](https://togithub.com/vitejs/vite/blob/v4.5.1/packages/vite/CHANGELOG.md) for details.
    --- ### Configuration 📅 **Schedule**: Branch creation - "" (UTC), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about these updates again. --- - [ ] If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://developer.mend.io/github/toeverything/AFFiNE). --- yarn.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/yarn.lock b/yarn.lock index df72e76b7a..1dade839d0 100644 --- a/yarn.lock +++ b/yarn.lock @@ -35909,8 +35909,8 @@ __metadata: linkType: hard "vite@npm:^4.4.11": - version: 4.5.0 - resolution: "vite@npm:4.5.0" + version: 4.5.1 + resolution: "vite@npm:4.5.1" dependencies: esbuild: "npm:^0.18.10" fsevents: "npm:~2.3.2" @@ -35944,7 +35944,7 @@ __metadata: optional: true bin: vite: bin/vite.js - checksum: b262ea4880ba7de8a77b0a665c771561ae3cb7f0d6c5b90e65298039755192550bf90cb96a2910d564506e2d499aa20e9becd330b835c34d414249083ac6e40c + checksum: 2ea9c030a5718ca0adaaa0ecc54402a725cff59131cf80bc84d0237f59c98168803ee59d23e697b98b1184be3af6c6edc2e81517f769c62159f11531b3341a4e languageName: node linkType: hard From 2dcb5a30304f22db5f5daa0cb168edccf2427d51 Mon Sep 17 00:00:00 2001 From: LongYinan Date: Wed, 6 Dec 2023 09:57:17 +0000 Subject: [PATCH 35/68] chore: bump up google-github-actions/auth action to v2 (#5197) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [google-github-actions/auth](https://togithub.com/google-github-actions/auth) | action | major | `v1` -> `v2` | --- ### Release Notes
    google-github-actions/auth (google-github-actions/auth) ### [`v2`](https://togithub.com/google-github-actions/auth/releases/tag/v2) [Compare Source](https://togithub.com/google-github-actions/auth/compare/v1...v2) Floating v2 alias
    --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://developer.mend.io/github/toeverything/AFFiNE). --- .github/actions/deploy/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/deploy/action.yml b/.github/actions/deploy/action.yml index 703d058721..58213a8673 100644 --- a/.github/actions/deploy/action.yml +++ b/.github/actions/deploy/action.yml @@ -26,7 +26,7 @@ runs: echo "GIT_SHORT_HASH=$(git rev-parse --short HEAD)" >> "$GITHUB_ENV" - uses: azure/setup-helm@v3 - id: auth - uses: google-github-actions/auth@v1 + uses: google-github-actions/auth@v2 with: workload_identity_provider: 'projects/${{ inputs.gcp-project-number }}/locations/global/workloadIdentityPools/github-actions/providers/github-actions-helm-deploy' service_account: '${{ inputs.service-account }}' From 6cbf5b2a9291b29f910b262ad99534d05c143569 Mon Sep 17 00:00:00 2001 From: Yifeng Wang Date: Wed, 6 Dec 2023 18:15:03 +0800 Subject: [PATCH 36/68] feat: bump blocksuite (#5194) Co-authored-by: AyushAgrawal-A2 --- packages/common/env/package.json | 4 +- packages/common/env/src/workspace.ts | 2 +- packages/common/infra/package.json | 14 +- packages/common/sdk/package.json | 10 +- packages/common/sdk/src/entry.ts | 2 +- packages/common/y-indexeddb/package.json | 4 +- packages/common/y-provider/package.json | 2 +- packages/frontend/component/package.json | 12 +- .../src/components/block-hub/index.tsx | 20 - .../components/block-suite-editor/index.tsx | 2 +- packages/frontend/core/.webpack/config.ts | 6 +- .../frontend/core/.webpack/runtime-config.ts | 4 +- packages/frontend/core/package.json | 14 +- .../src/components/page-detail-editor.tsx | 37 +- .../core/src/layouts/workspace-layout.tsx | 2 - .../core/src/pages/workspace/detail-page.tsx | 2 +- .../core/src/pages/workspace/index.tsx | 6 +- packages/frontend/electron/package.json | 8 +- packages/frontend/hooks/package.json | 18 +- packages/frontend/workspace/src/atom.ts | 4 - scripts/bump-blocksuite.sh | 4 +- scripts/setup/lottie-web.ts | 2 +- tests/affine-cloud/e2e/collaboration.spec.ts | 69 +++- tests/affine-cloud/e2e/logo.svg | 1 + tests/affine-cloud/playwright.config.ts | 2 +- tests/affine-legacy/0.6.1-beta.1/package.json | 8 +- .../0.7.0-canary.18/package.json | 8 +- .../affine-legacy/0.8.0-canary.7/package.json | 8 +- tests/affine-legacy/0.8.4/package.json | 8 +- .../e2e/blocksuite/block-hub.spec.ts | 10 - .../e2e/local-first-trash-page.spec.ts | 19 - tests/affine-migration/e2e/basic.spec.ts | 4 +- tests/affine-migration/package.json | 8 +- tests/kit/utils/editor.ts | 11 - tests/storybook/package.json | 16 +- .../stories/image-preview-modal.stories.tsx | 30 +- yarn.lock | 341 +++++++----------- 37 files changed, 292 insertions(+), 430 deletions(-) delete mode 100644 packages/frontend/component/src/components/block-hub/index.tsx create mode 100644 tests/affine-cloud/e2e/logo.svg delete mode 100644 tests/affine-local/e2e/blocksuite/block-hub.spec.ts diff --git a/packages/common/env/package.json b/packages/common/env/package.json index 7424b6135c..e44b5b78f8 100644 --- a/packages/common/env/package.json +++ b/packages/common/env/package.json @@ -3,8 +3,8 @@ "private": true, "type": "module", "devDependencies": { - "@blocksuite/global": "0.0.0-20231130092516-0f858b95-nightly", - "@blocksuite/store": "0.0.0-20231130092516-0f858b95-nightly", + "@blocksuite/global": "0.0.0-20231205045113-03964196-nightly", + "@blocksuite/store": "0.0.0-20231205045113-03964196-nightly", "react": "18.2.0", "react-dom": "18.2.0", "vitest": "0.34.6", diff --git a/packages/common/env/src/workspace.ts b/packages/common/env/src/workspace.ts index 32ea9b1eca..91ed56f6a0 100644 --- a/packages/common/env/src/workspace.ts +++ b/packages/common/env/src/workspace.ts @@ -1,4 +1,4 @@ -import type { EditorContainer } from '@blocksuite/editor'; +import type { EditorContainer } from '@blocksuite/presets'; import type { Page } from '@blocksuite/store'; import type { ActiveDocProvider, diff --git a/packages/common/infra/package.json b/packages/common/infra/package.json index 78d85776f6..99e7e3c16a 100644 --- a/packages/common/infra/package.json +++ b/packages/common/infra/package.json @@ -55,9 +55,9 @@ }, "dependencies": { "@affine/sdk": "workspace:*", - "@blocksuite/blocks": "0.0.0-20231130092516-0f858b95-nightly", - "@blocksuite/global": "0.0.0-20231130092516-0f858b95-nightly", - "@blocksuite/store": "0.0.0-20231130092516-0f858b95-nightly", + "@blocksuite/blocks": "0.0.0-20231205045113-03964196-nightly", + "@blocksuite/global": "0.0.0-20231205045113-03964196-nightly", + "@blocksuite/store": "0.0.0-20231205045113-03964196-nightly", "jotai": "^2.5.1", "jotai-effect": "^0.2.3", "tinykeys": "^2.1.0", @@ -66,8 +66,8 @@ "devDependencies": { "@affine-test/fixtures": "workspace:*", "@affine/templates": "workspace:*", - "@blocksuite/editor": "0.0.0-20231130092516-0f858b95-nightly", - "@blocksuite/lit": "0.0.0-20231130092516-0f858b95-nightly", + "@blocksuite/lit": "0.0.0-20231205045113-03964196-nightly", + "@blocksuite/presets": "0.0.0-20231205045113-03964196-nightly", "@testing-library/react": "^14.0.0", "async-call-rpc": "^6.3.1", "electron": "link:../../frontend/electron/node_modules/electron", @@ -81,7 +81,7 @@ }, "peerDependencies": { "@affine/templates": "*", - "@blocksuite/editor": "*", + "@blocksuite/presets": "*", "async-call-rpc": "*", "electron": "*", "react": "*", @@ -91,7 +91,7 @@ "@affine/templates": { "optional": true }, - "@blocksuite/editor": { + "@blocksuite/presets": { "optional": true }, "async-call-rpc": { diff --git a/packages/common/sdk/package.json b/packages/common/sdk/package.json index 84ffa33d51..bc68907830 100644 --- a/packages/common/sdk/package.json +++ b/packages/common/sdk/package.json @@ -22,11 +22,11 @@ "dist" ], "dependencies": { - "@blocksuite/block-std": "0.0.0-20231130092516-0f858b95-nightly", - "@blocksuite/blocks": "0.0.0-20231130092516-0f858b95-nightly", - "@blocksuite/editor": "0.0.0-20231130092516-0f858b95-nightly", - "@blocksuite/global": "0.0.0-20231130092516-0f858b95-nightly", - "@blocksuite/store": "0.0.0-20231130092516-0f858b95-nightly", + "@blocksuite/block-std": "0.0.0-20231205045113-03964196-nightly", + "@blocksuite/blocks": "0.0.0-20231205045113-03964196-nightly", + "@blocksuite/global": "0.0.0-20231205045113-03964196-nightly", + "@blocksuite/presets": "0.0.0-20231205045113-03964196-nightly", + "@blocksuite/store": "0.0.0-20231205045113-03964196-nightly", "jotai": "^2.5.1", "zod": "^3.22.4" }, diff --git a/packages/common/sdk/src/entry.ts b/packages/common/sdk/src/entry.ts index 5288cb3260..2e4025a229 100644 --- a/packages/common/sdk/src/entry.ts +++ b/packages/common/sdk/src/entry.ts @@ -1,5 +1,5 @@ import type { BaseSelection } from '@blocksuite/block-std'; -import type { EditorContainer } from '@blocksuite/editor'; +import type { EditorContainer } from '@blocksuite/presets'; import type { Page } from '@blocksuite/store'; import type { Workspace } from '@blocksuite/store'; import type { Atom, getDefaultStore } from 'jotai/vanilla'; diff --git a/packages/common/y-indexeddb/package.json b/packages/common/y-indexeddb/package.json index 92911fa5c1..aeea5cf03d 100644 --- a/packages/common/y-indexeddb/package.json +++ b/packages/common/y-indexeddb/package.json @@ -37,8 +37,8 @@ "y-provider": "workspace:*" }, "devDependencies": { - "@blocksuite/blocks": "0.0.0-20231130092516-0f858b95-nightly", - "@blocksuite/store": "0.0.0-20231130092516-0f858b95-nightly", + "@blocksuite/blocks": "0.0.0-20231205045113-03964196-nightly", + "@blocksuite/store": "0.0.0-20231205045113-03964196-nightly", "fake-indexeddb": "^5.0.0", "vite": "^4.4.11", "vite-plugin-dts": "3.6.0", diff --git a/packages/common/y-provider/package.json b/packages/common/y-provider/package.json index 3ba18c528b..413140db6a 100644 --- a/packages/common/y-provider/package.json +++ b/packages/common/y-provider/package.json @@ -24,7 +24,7 @@ "build": "vite build" }, "devDependencies": { - "@blocksuite/store": "0.0.0-20231130092516-0f858b95-nightly", + "@blocksuite/store": "0.0.0-20231205045113-03964196-nightly", "vite": "^4.4.11", "vite-plugin-dts": "3.6.0", "vitest": "0.34.6", diff --git a/packages/frontend/component/package.json b/packages/frontend/component/package.json index 308a849bdd..428e2e7ad0 100644 --- a/packages/frontend/component/package.json +++ b/packages/frontend/component/package.json @@ -13,9 +13,9 @@ }, "peerDependencies": { "@blocksuite/blocks": "*", - "@blocksuite/editor": "*", "@blocksuite/global": "*", "@blocksuite/icons": "2.1.34", + "@blocksuite/presets": "*", "@blocksuite/store": "*" }, "dependencies": { @@ -71,12 +71,12 @@ "uuid": "^9.0.1" }, "devDependencies": { - "@blocksuite/blocks": "0.0.0-20231130092516-0f858b95-nightly", - "@blocksuite/editor": "0.0.0-20231130092516-0f858b95-nightly", - "@blocksuite/global": "0.0.0-20231130092516-0f858b95-nightly", + "@blocksuite/blocks": "0.0.0-20231205045113-03964196-nightly", + "@blocksuite/global": "0.0.0-20231205045113-03964196-nightly", "@blocksuite/icons": "2.1.36", - "@blocksuite/lit": "0.0.0-20231130092516-0f858b95-nightly", - "@blocksuite/store": "0.0.0-20231130092516-0f858b95-nightly", + "@blocksuite/lit": "0.0.0-20231205045113-03964196-nightly", + "@blocksuite/presets": "0.0.0-20231205045113-03964196-nightly", + "@blocksuite/store": "0.0.0-20231205045113-03964196-nightly", "@storybook/addon-actions": "^7.5.3", "@storybook/addon-essentials": "^7.5.3", "@storybook/addon-interactions": "^7.5.3", diff --git a/packages/frontend/component/src/components/block-hub/index.tsx b/packages/frontend/component/src/components/block-hub/index.tsx deleted file mode 100644 index a6f27b9937..0000000000 --- a/packages/frontend/component/src/components/block-hub/index.tsx +++ /dev/null @@ -1,20 +0,0 @@ -import { rootBlockHubAtom } from '@affine/workspace/atom'; -import { useAtomValue } from 'jotai'; -import { useEffect, useRef } from 'react'; - -export const RootBlockHub = () => { - const ref = useRef(null); - const blockHub = useAtomValue(rootBlockHubAtom); - useEffect(() => { - if (ref.current) { - const div = ref.current; - if (blockHub) { - if (div.hasChildNodes()) { - (div.firstChild as ChildNode).remove(); - } - div.append(blockHub); - } - } - }, [blockHub]); - return
    ; -}; diff --git a/packages/frontend/component/src/components/block-suite-editor/index.tsx b/packages/frontend/component/src/components/block-suite-editor/index.tsx index 41a4b26c51..e0f0a0b1d5 100644 --- a/packages/frontend/component/src/components/block-suite-editor/index.tsx +++ b/packages/frontend/component/src/components/block-suite-editor/index.tsx @@ -1,5 +1,5 @@ -import { EditorContainer } from '@blocksuite/editor'; import { assertExists } from '@blocksuite/global/utils'; +import { EditorContainer } from '@blocksuite/presets'; import type { Page } from '@blocksuite/store'; import clsx from 'clsx'; import { use } from 'foxact/use'; diff --git a/packages/frontend/core/.webpack/config.ts b/packages/frontend/core/.webpack/config.ts index 15e1c1e46c..7b1be2f05b 100644 --- a/packages/frontend/core/.webpack/config.ts +++ b/packages/frontend/core/.webpack/config.ts @@ -168,13 +168,13 @@ export const createConfiguration: ( 'blocks', 'dist' ), - '@blocksuite/editor': blocksuiteBaseDir - ? join(blocksuiteBaseDir, 'packages', 'editor', 'src') + '@blocksuite/presets': blocksuiteBaseDir + ? join(blocksuiteBaseDir, 'packages', 'presets', 'src') : join( workspaceRoot, 'node_modules', '@blocksuite', - 'editor', + 'presets', 'dist' ), '@blocksuite/global': blocksuiteBaseDir diff --git a/packages/frontend/core/.webpack/runtime-config.ts b/packages/frontend/core/.webpack/runtime-config.ts index a11c50b35a..f660d9fa30 100644 --- a/packages/frontend/core/.webpack/runtime-config.ts +++ b/packages/frontend/core/.webpack/runtime-config.ts @@ -35,7 +35,7 @@ export function getRuntimeConfig(buildFlags: BuildFlags): RuntimeConfig { serverUrlPrefix: 'https://insider.affine.pro', // Let insider be stable environment temporarily. editorFlags, appVersion: packageJson.version, - editorVersion: packageJson.dependencies['@blocksuite/editor'], + editorVersion: packageJson.dependencies['@blocksuite/presets'], appBuildType: 'stable', }, get beta() { @@ -82,7 +82,7 @@ export function getRuntimeConfig(buildFlags: BuildFlags): RuntimeConfig { serverUrlPrefix: 'https://affine.fail', editorFlags, appVersion: packageJson.version, - editorVersion: packageJson.dependencies['@blocksuite/editor'], + editorVersion: packageJson.dependencies['@blocksuite/presets'], appBuildType: 'canary', }, }; diff --git a/packages/frontend/core/package.json b/packages/frontend/core/package.json index a208f2b125..c71e4d9e0c 100644 --- a/packages/frontend/core/package.json +++ b/packages/frontend/core/package.json @@ -25,14 +25,14 @@ "@affine/i18n": "workspace:*", "@affine/templates": "workspace:*", "@affine/workspace": "workspace:*", - "@blocksuite/block-std": "0.0.0-20231130092516-0f858b95-nightly", - "@blocksuite/blocks": "0.0.0-20231130092516-0f858b95-nightly", - "@blocksuite/editor": "0.0.0-20231130092516-0f858b95-nightly", - "@blocksuite/global": "0.0.0-20231130092516-0f858b95-nightly", + "@blocksuite/block-std": "0.0.0-20231205045113-03964196-nightly", + "@blocksuite/blocks": "0.0.0-20231205045113-03964196-nightly", + "@blocksuite/global": "0.0.0-20231205045113-03964196-nightly", "@blocksuite/icons": "2.1.36", - "@blocksuite/lit": "0.0.0-20231130092516-0f858b95-nightly", - "@blocksuite/store": "0.0.0-20231130092516-0f858b95-nightly", - "@blocksuite/virgo": "0.0.0-20231130092516-0f858b95-nightly", + "@blocksuite/lit": "0.0.0-20231205045113-03964196-nightly", + "@blocksuite/presets": "0.0.0-20231205045113-03964196-nightly", + "@blocksuite/store": "0.0.0-20231205045113-03964196-nightly", + "@blocksuite/virgo": "0.0.0-20231205045113-03964196-nightly", "@dnd-kit/core": "^6.0.8", "@dnd-kit/sortable": "^8.0.0", "@emotion/cache": "^11.11.0", diff --git a/packages/frontend/core/src/components/page-detail-editor.tsx b/packages/frontend/core/src/components/page-detail-editor.tsx index 0212d304b8..7d10095bcf 100644 --- a/packages/frontend/core/src/components/page-detail-editor.tsx +++ b/packages/frontend/core/src/components/page-detail-editor.tsx @@ -2,10 +2,8 @@ import './page-detail-editor.css'; import { PageNotFoundError } from '@affine/env/constant'; import type { LayoutNode } from '@affine/sdk/entry'; -import { rootBlockHubAtom } from '@affine/workspace/atom'; -import type { BlockHub } from '@blocksuite/blocks'; -import type { EditorContainer } from '@blocksuite/editor'; import { assertExists, DisposableGroup } from '@blocksuite/global/utils'; +import type { EditorContainer } from '@blocksuite/presets'; import type { Page, Workspace } from '@blocksuite/store'; import { useBlockSuitePageMeta } from '@toeverything/hooks/use-block-suite-page-meta'; import { useBlockSuiteWorkspacePage } from '@toeverything/hooks/use-block-suite-workspace-page'; @@ -16,7 +14,7 @@ import { } from '@toeverything/infra/__internal__/plugin'; import { contentLayoutAtom, getCurrentStore } from '@toeverything/infra/atom'; import clsx from 'clsx'; -import { useAtomValue, useSetAtom } from 'jotai'; +import { useAtomValue } from 'jotai'; import type { CSSProperties, ReactElement } from 'react'; import { memo, @@ -59,33 +57,6 @@ function useRouterHash() { return useLocation().hash.substring(1); } -function useCreateAndSetRootBlockHub( - editor?: EditorContainer, - showBlockHub?: boolean -) { - const setBlockHub = useSetAtom(rootBlockHubAtom); - useEffect(() => { - let canceled = false; - let blockHub: BlockHub | undefined; - if (editor && showBlockHub) { - editor - .createBlockHub() - .then(bh => { - if (canceled) { - return; - } - blockHub = bh; - setBlockHub(blockHub); - }) - .catch(console.error); - } - return () => { - canceled = true; - blockHub?.remove(); - }; - }, [editor, showBlockHub, setBlockHub]); -} - const EditorWrapper = memo(function EditorWrapper({ workspace, pageId, @@ -142,11 +113,9 @@ const EditorWrapper = memo(function EditorWrapper({ [isPublic, switchToEdgelessMode, pageId, switchToPageMode] ); - const [editor, setEditor] = useState(); + const [, setEditor] = useState(); const blockId = useRouterHash(); - useCreateAndSetRootBlockHub(editor, !meta.trash); - const onLoadEditor = useCallback( (editor: EditorContainer) => { // debug current detail editor diff --git a/packages/frontend/core/src/layouts/workspace-layout.tsx b/packages/frontend/core/src/layouts/workspace-layout.tsx index 3c4a8d3498..d9603b7e91 100644 --- a/packages/frontend/core/src/layouts/workspace-layout.tsx +++ b/packages/frontend/core/src/layouts/workspace-layout.tsx @@ -2,7 +2,6 @@ import { AppSidebarFallback, appSidebarResizingAtom, } from '@affine/component/app-sidebar'; -import { RootBlockHub } from '@affine/component/block-hub'; import { type DraggableTitleCellData, PageListDragOverlay, @@ -305,7 +304,6 @@ export const WorkspaceLayoutInner = ({ children )} - diff --git a/packages/frontend/core/src/pages/workspace/detail-page.tsx b/packages/frontend/core/src/pages/workspace/detail-page.tsx index 10ff6ebdff..e270ad26f8 100644 --- a/packages/frontend/core/src/pages/workspace/detail-page.tsx +++ b/packages/frontend/core/src/pages/workspace/detail-page.tsx @@ -6,8 +6,8 @@ import { import { WorkspaceSubPath } from '@affine/env/workspace'; import { globalBlockSuiteSchema } from '@affine/workspace/manager'; import { SyncEngineStep } from '@affine/workspace/providers'; -import type { EditorContainer } from '@blocksuite/editor'; import { assertExists } from '@blocksuite/global/utils'; +import type { EditorContainer } from '@blocksuite/presets'; import type { Page } from '@blocksuite/store'; import { contentLayoutAtom, diff --git a/packages/frontend/core/src/pages/workspace/index.tsx b/packages/frontend/core/src/pages/workspace/index.tsx index a9b20a7f45..bd70b0e2b3 100644 --- a/packages/frontend/core/src/pages/workspace/index.tsx +++ b/packages/frontend/core/src/pages/workspace/index.tsx @@ -45,9 +45,13 @@ export const loader: LoaderFunction = async args => { return redirect('/404'); } - if (!args.params.pageId) { + if (args.params.pageId) { + localStorage.setItem('last_page_id', args.params.pageId); + rootStore.set(currentPageIdAtom, args.params.pageId); + } else { rootStore.set(currentPageIdAtom, null); } + const [workspaceAtom] = getBlockSuiteWorkspaceAtom(currentMetadata.id); workspaceLoaderLogger.info('get cloud workspace atom'); diff --git a/packages/frontend/electron/package.json b/packages/frontend/electron/package.json index 3e8d55df77..cfa5bce56c 100644 --- a/packages/frontend/electron/package.json +++ b/packages/frontend/electron/package.json @@ -32,10 +32,10 @@ "@affine/sdk": "workspace:*", "@affine/templates": "workspace:*", "@affine/vue-hello-world-plugin": "workspace:*", - "@blocksuite/blocks": "0.0.0-20231130092516-0f858b95-nightly", - "@blocksuite/editor": "0.0.0-20231130092516-0f858b95-nightly", - "@blocksuite/lit": "0.0.0-20231130092516-0f858b95-nightly", - "@blocksuite/store": "0.0.0-20231130092516-0f858b95-nightly", + "@blocksuite/blocks": "0.0.0-20231205045113-03964196-nightly", + "@blocksuite/lit": "0.0.0-20231205045113-03964196-nightly", + "@blocksuite/presets": "0.0.0-20231205045113-03964196-nightly", + "@blocksuite/store": "0.0.0-20231205045113-03964196-nightly", "@electron-forge/cli": "^7.1.0", "@electron-forge/core": "^7.1.0", "@electron-forge/core-utils": "^7.1.0", diff --git a/packages/frontend/hooks/package.json b/packages/frontend/hooks/package.json index e4925ccd1a..ac38ca7240 100644 --- a/packages/frontend/hooks/package.json +++ b/packages/frontend/hooks/package.json @@ -19,12 +19,12 @@ "devDependencies": { "@affine/debug": "workspace:*", "@affine/env": "workspace:*", - "@blocksuite/block-std": "0.0.0-20231130092516-0f858b95-nightly", - "@blocksuite/blocks": "0.0.0-20231130092516-0f858b95-nightly", - "@blocksuite/editor": "0.0.0-20231130092516-0f858b95-nightly", - "@blocksuite/global": "0.0.0-20231130092516-0f858b95-nightly", - "@blocksuite/lit": "0.0.0-20231130092516-0f858b95-nightly", - "@blocksuite/store": "0.0.0-20231130092516-0f858b95-nightly", + "@blocksuite/block-std": "0.0.0-20231205045113-03964196-nightly", + "@blocksuite/blocks": "0.0.0-20231205045113-03964196-nightly", + "@blocksuite/global": "0.0.0-20231205045113-03964196-nightly", + "@blocksuite/lit": "0.0.0-20231205045113-03964196-nightly", + "@blocksuite/presets": "0.0.0-20231205045113-03964196-nightly", + "@blocksuite/store": "0.0.0-20231205045113-03964196-nightly", "@testing-library/react": "^14.0.0", "@types/image-blob-reduce": "^4.1.3", "@types/lodash.debounce": "^4.0.7", @@ -35,8 +35,8 @@ "peerDependencies": { "@blocksuite/block-std": "*", "@blocksuite/blocks": "*", - "@blocksuite/editor": "*", "@blocksuite/global": "*", + "@blocksuite/presets": "*", "@blocksuite/store": "*", "y-provider": "workspace:*" }, @@ -50,10 +50,10 @@ "@blocksuite/blocks": { "optional": true }, - "@blocksuite/editor": { + "@blocksuite/global": { "optional": true }, - "@blocksuite/global": { + "@blocksuite/presets": { "optional": true }, "@blocksuite/store": { diff --git a/packages/frontend/workspace/src/atom.ts b/packages/frontend/workspace/src/atom.ts index 4a63b6e2d9..881726723d 100644 --- a/packages/frontend/workspace/src/atom.ts +++ b/packages/frontend/workspace/src/atom.ts @@ -1,7 +1,6 @@ import { DebugLogger } from '@affine/debug'; import type { WorkspaceAdapter } from '@affine/env/workspace'; import { WorkspaceFlavour } from '@affine/env/workspace'; -import type { BlockHub } from '@blocksuite/blocks'; import { assertEquals, assertExists } from '@blocksuite/global/utils'; import { currentPageIdAtom, @@ -259,7 +258,4 @@ export const refreshRootMetadataAtom = atom(null, (get, set) => { set(rootWorkspacesMetadataPrimitiveAtom, fetchMetadata(get)); }); -// blocksuite atoms, -// each app should have only one block-hub in the same time -export const rootBlockHubAtom = atom | null>(null); //#endregion diff --git a/scripts/bump-blocksuite.sh b/scripts/bump-blocksuite.sh index eaf6d275e3..8d63044bc6 100755 --- a/scripts/bump-blocksuite.sh +++ b/scripts/bump-blocksuite.sh @@ -1,11 +1,11 @@ #!/bin/bash -LATEST_NIGHTLY=$(npm view @blocksuite/editor@nightly version | cut -d ':' -f 2 | tr -d '[:space:]') +LATEST_NIGHTLY=$(npm view @blocksuite/presets@nightly version | cut -d ':' -f 2 | tr -d '[:space:]') echo "Bump to latest BlockSuite nightly version: $LATEST_NIGHTLY" yarn up "@blocksuite/store@${LATEST_NIGHTLY}" yarn up "@blocksuite/blocks@${LATEST_NIGHTLY}" -yarn up "@blocksuite/editor@${LATEST_NIGHTLY}" +yarn up "@blocksuite/presets@${LATEST_NIGHTLY}" yarn up "@blocksuite/global@${LATEST_NIGHTLY}" yarn up "@blocksuite/block-std@${LATEST_NIGHTLY}" yarn up "@blocksuite/virgo@${LATEST_NIGHTLY}" diff --git a/scripts/setup/lottie-web.ts b/scripts/setup/lottie-web.ts index f4a5b8ebbb..4c68a3719b 100644 --- a/scripts/setup/lottie-web.ts +++ b/scripts/setup/lottie-web.ts @@ -4,7 +4,7 @@ vi.mock('lottie-web', () => ({ default: {}, })); -vi.mock('@blocksuite/editor', () => ({ +vi.mock('@blocksuite/presets', () => ({ EditorContainer: vi.fn(), })); diff --git a/tests/affine-cloud/e2e/collaboration.spec.ts b/tests/affine-cloud/e2e/collaboration.spec.ts index 06a89657d1..349efeec2f 100644 --- a/tests/affine-cloud/e2e/collaboration.spec.ts +++ b/tests/affine-cloud/e2e/collaboration.spec.ts @@ -6,7 +6,6 @@ import { enableCloudWorkspaceFromShareButton, loginUser, } from '@affine-test/kit/utils/cloud'; -import { dropFile } from '@affine-test/kit/utils/drop-file'; import { clickEdgelessModeButton } from '@affine-test/kit/utils/editor'; import { clickNewPageButton, @@ -17,6 +16,7 @@ import { clickUserInfoCard } from '@affine-test/kit/utils/setting'; import { clickSideBarSettingButton } from '@affine-test/kit/utils/sidebar'; import { createLocalWorkspace } from '@affine-test/kit/utils/workspace'; import { expect } from '@playwright/test'; +import { resolve } from 'path'; let user: { id: string; @@ -226,12 +226,45 @@ test('can sync svg between different browsers', async ({ page, browser }) => { await clickNewPageButton(page); await waitForEditorLoad(page); - // drop an svg file - const svg = ` - - `; + // upload local svg - await dropFile(page, 'affine-paragraph', svg, 'test.svg', 'image/svg+xml'); + const slashMenu = page.locator(`.slash-menu`); + const image = page.locator('affine-image'); + + page.evaluate(async () => { + window.showOpenFilePicker = undefined; + }); + + const title = getBlockSuiteEditorTitle(page); + await title.pressSequentially('TEST TITLE', { + delay: 50, + }); + await page.keyboard.press('Enter', { delay: 50 }); + await page.waitForTimeout(100); + await page.keyboard.type('/', { delay: 50 }); + await expect(slashMenu).toBeVisible(); + await page.keyboard.type('image', { delay: 100 }); + await expect(slashMenu).toBeVisible(); + await page.keyboard.press('Enter', { delay: 50 }); + await page.setInputFiles( + "input[type='file']", + resolve(__dirname, 'logo.svg') + ); + await expect(image).toBeVisible(); + + // the user should see the svg + // get the image src under "affine-image img" + const src1 = await page.locator('affine-image img').getAttribute('src'); + expect(src1).not.toBeNull(); + + // fetch the actual src1 resource in the browser + const svg1 = await page.evaluate( + src => + fetch(src!) + .then(res => res.blob()) + .then(blob => blob.text()), + src1 + ); { const context = await browser.newContext(); @@ -239,20 +272,20 @@ test('can sync svg between different browsers', async ({ page, browser }) => { await loginUser(page2, user.email); await page2.goto(page.url()); - // the user should see the svg + // second user should see the svg // get the image src under "affine-image img" - const src = await page2.locator('affine-image img').getAttribute('src'); + const src2 = await page2.locator('affine-image img').getAttribute('src'); + expect(src2).not.toBeNull(); - expect(src).not.toBeNull(); + // fetch the actual src2 resource in the browser + const svg2 = await page2.evaluate( + src => + fetch(src!) + .then(res => res.blob()) + .then(blob => blob.text()), + src2 + ); - // fetch the src resource in the browser - const svg2 = await page2.evaluate(src => { - return fetch(src!) - .then(res => res.blob()) - .then(blob => blob.text()); - }, src); - - // turn the blob into string and check if it contains the svg - expect(svg2).toContain(svg); + expect(svg2).toEqual(svg1); } }); diff --git a/tests/affine-cloud/e2e/logo.svg b/tests/affine-cloud/e2e/logo.svg new file mode 100644 index 0000000000..0fda3514a3 --- /dev/null +++ b/tests/affine-cloud/e2e/logo.svg @@ -0,0 +1 @@ + diff --git a/tests/affine-cloud/playwright.config.ts b/tests/affine-cloud/playwright.config.ts index 772dfecf37..fcd64a0b00 100644 --- a/tests/affine-cloud/playwright.config.ts +++ b/tests/affine-cloud/playwright.config.ts @@ -6,7 +6,7 @@ import type { const config: PlaywrightTestConfig = { testDir: './e2e', fullyParallel: !process.env.CI, - timeout: process.env.CI ? 120_000 : 30_000, + timeout: 120_000, use: { baseURL: 'http://localhost:8081/', browserName: diff --git a/tests/affine-legacy/0.6.1-beta.1/package.json b/tests/affine-legacy/0.6.1-beta.1/package.json index 855dc5a483..5b285ceab3 100644 --- a/tests/affine-legacy/0.6.1-beta.1/package.json +++ b/tests/affine-legacy/0.6.1-beta.1/package.json @@ -9,10 +9,10 @@ "devDependencies": { "@affine-test/fixtures": "workspace:*", "@affine-test/kit": "workspace:*", - "@blocksuite/block-std": "0.0.0-20231130092516-0f858b95-nightly", - "@blocksuite/blocks": "0.0.0-20231130092516-0f858b95-nightly", - "@blocksuite/global": "0.0.0-20231130092516-0f858b95-nightly", - "@blocksuite/store": "0.0.0-20231130092516-0f858b95-nightly", + "@blocksuite/block-std": "0.0.0-20231205045113-03964196-nightly", + "@blocksuite/blocks": "0.0.0-20231205045113-03964196-nightly", + "@blocksuite/global": "0.0.0-20231205045113-03964196-nightly", + "@blocksuite/store": "0.0.0-20231205045113-03964196-nightly", "@playwright/test": "^1.39.0", "express": "^4.18.2", "http-proxy-middleware": "^3.0.0-beta.1", diff --git a/tests/affine-legacy/0.7.0-canary.18/package.json b/tests/affine-legacy/0.7.0-canary.18/package.json index 772734969f..ca84a213eb 100644 --- a/tests/affine-legacy/0.7.0-canary.18/package.json +++ b/tests/affine-legacy/0.7.0-canary.18/package.json @@ -9,10 +9,10 @@ "devDependencies": { "@affine-test/fixtures": "workspace:*", "@affine-test/kit": "workspace:*", - "@blocksuite/block-std": "0.0.0-20231130092516-0f858b95-nightly", - "@blocksuite/blocks": "0.0.0-20231130092516-0f858b95-nightly", - "@blocksuite/global": "0.0.0-20231130092516-0f858b95-nightly", - "@blocksuite/store": "0.0.0-20231130092516-0f858b95-nightly", + "@blocksuite/block-std": "0.0.0-20231205045113-03964196-nightly", + "@blocksuite/blocks": "0.0.0-20231205045113-03964196-nightly", + "@blocksuite/global": "0.0.0-20231205045113-03964196-nightly", + "@blocksuite/store": "0.0.0-20231205045113-03964196-nightly", "@playwright/test": "^1.39.0", "express": "^4.18.2", "http-proxy-middleware": "^3.0.0-beta.1", diff --git a/tests/affine-legacy/0.8.0-canary.7/package.json b/tests/affine-legacy/0.8.0-canary.7/package.json index ad256aa83f..3df0a628bb 100644 --- a/tests/affine-legacy/0.8.0-canary.7/package.json +++ b/tests/affine-legacy/0.8.0-canary.7/package.json @@ -9,10 +9,10 @@ "devDependencies": { "@affine-test/fixtures": "workspace:*", "@affine-test/kit": "workspace:*", - "@blocksuite/block-std": "0.0.0-20231130092516-0f858b95-nightly", - "@blocksuite/blocks": "0.0.0-20231130092516-0f858b95-nightly", - "@blocksuite/global": "0.0.0-20231130092516-0f858b95-nightly", - "@blocksuite/store": "0.0.0-20231130092516-0f858b95-nightly", + "@blocksuite/block-std": "0.0.0-20231205045113-03964196-nightly", + "@blocksuite/blocks": "0.0.0-20231205045113-03964196-nightly", + "@blocksuite/global": "0.0.0-20231205045113-03964196-nightly", + "@blocksuite/store": "0.0.0-20231205045113-03964196-nightly", "@playwright/test": "^1.39.0", "express": "^4.18.2", "http-proxy-middleware": "^3.0.0-beta.1", diff --git a/tests/affine-legacy/0.8.4/package.json b/tests/affine-legacy/0.8.4/package.json index 37b326d295..780449708a 100644 --- a/tests/affine-legacy/0.8.4/package.json +++ b/tests/affine-legacy/0.8.4/package.json @@ -9,10 +9,10 @@ "devDependencies": { "@affine-test/fixtures": "workspace:*", "@affine-test/kit": "workspace:*", - "@blocksuite/block-std": "0.0.0-20231130092516-0f858b95-nightly", - "@blocksuite/blocks": "0.0.0-20231130092516-0f858b95-nightly", - "@blocksuite/global": "0.0.0-20231130092516-0f858b95-nightly", - "@blocksuite/store": "0.0.0-20231130092516-0f858b95-nightly", + "@blocksuite/block-std": "0.0.0-20231205045113-03964196-nightly", + "@blocksuite/blocks": "0.0.0-20231205045113-03964196-nightly", + "@blocksuite/global": "0.0.0-20231205045113-03964196-nightly", + "@blocksuite/store": "0.0.0-20231205045113-03964196-nightly", "@playwright/test": "^1.39.0", "express": "^4.18.2", "http-proxy-middleware": "^3.0.0-beta.1", diff --git a/tests/affine-local/e2e/blocksuite/block-hub.spec.ts b/tests/affine-local/e2e/blocksuite/block-hub.spec.ts deleted file mode 100644 index b4c13a0760..0000000000 --- a/tests/affine-local/e2e/blocksuite/block-hub.spec.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { test } from '@affine-test/kit/playwright'; -import { checkBlockHub } from '@affine-test/kit/utils/editor'; -import { openHomePage } from '@affine-test/kit/utils/load-page'; -import { waitForEditorLoad } from '@affine-test/kit/utils/page-logic'; - -test('block-hub should work', async ({ page }) => { - await openHomePage(page); - await waitForEditorLoad(page); - await checkBlockHub(page); -}); diff --git a/tests/affine-local/e2e/local-first-trash-page.spec.ts b/tests/affine-local/e2e/local-first-trash-page.spec.ts index ba9248db61..6e8797b222 100644 --- a/tests/affine-local/e2e/local-first-trash-page.spec.ts +++ b/tests/affine-local/e2e/local-first-trash-page.spec.ts @@ -2,7 +2,6 @@ import { test } from '@affine-test/kit/playwright'; import { openHomePage } from '@affine-test/kit/utils/load-page'; import { clickNewPageButton, - clickPageMoreActions, getBlockSuiteEditorTitle, getPageOperationButton, waitForEditorLoad, @@ -41,21 +40,3 @@ test('New a page , then delete it in all pages, finally find it in trash', async expect(currentWorkspace.flavour).toContain('local'); }); - -test('New a page , then delete it in page, blockHub and option menu will not appear ', async ({ - page, -}) => { - await openHomePage(page); - await waitForEditorLoad(page); - await clickNewPageButton(page); - const title = getBlockSuiteEditorTitle(page); - await title.pressSequentially('test'); - await clickPageMoreActions(page); - await page.getByTestId('editor-option-menu-delete').click(); - await page.getByTestId('confirm-delete-page').click(); - await expect(page.getByTestId('header-dropDownButton')).not.toBeVisible(); - await expect(page.getByTestId('block-hub')).not.toBeVisible(); - await page.getByTestId('page-restore-button').click(); - await expect(page.getByTestId('header-dropDownButton')).toBeVisible(); - await expect(page.getByTestId('block-hub')).toBeVisible(); -}); diff --git a/tests/affine-migration/e2e/basic.spec.ts b/tests/affine-migration/e2e/basic.spec.ts index be1916b354..9e26655cd5 100644 --- a/tests/affine-migration/e2e/basic.spec.ts +++ b/tests/affine-migration/e2e/basic.spec.ts @@ -93,7 +93,7 @@ test('v3 to v4, surface migration', async ({ page }) => { // check edgeless mode is correct await clickEdgelessModeButton(page); - await expect(page.locator('edgeless-toolbar')).toBeVisible(); + await expect(page.locator('.edgeless-toolbar-container')).toBeVisible(); await expect(page.locator('affine-edgeless-page')).toBeVisible(); }); @@ -123,6 +123,6 @@ test('v0 to v4, subdoc migration', async ({ page }) => { // check edgeless mode is correct await clickEdgelessModeButton(page); - await expect(page.locator('edgeless-toolbar')).toBeVisible(); + await expect(page.locator('.edgeless-toolbar-container')).toBeVisible(); await expect(page.locator('affine-edgeless-page')).toBeVisible(); }); diff --git a/tests/affine-migration/package.json b/tests/affine-migration/package.json index 25b2094c89..be1082584f 100644 --- a/tests/affine-migration/package.json +++ b/tests/affine-migration/package.json @@ -7,10 +7,10 @@ "devDependencies": { "@affine-test/fixtures": "workspace:*", "@affine-test/kit": "workspace:*", - "@blocksuite/block-std": "0.0.0-20231130092516-0f858b95-nightly", - "@blocksuite/blocks": "0.0.0-20231130092516-0f858b95-nightly", - "@blocksuite/global": "0.0.0-20231130092516-0f858b95-nightly", - "@blocksuite/store": "0.0.0-20231130092516-0f858b95-nightly", + "@blocksuite/block-std": "0.0.0-20231205045113-03964196-nightly", + "@blocksuite/blocks": "0.0.0-20231205045113-03964196-nightly", + "@blocksuite/global": "0.0.0-20231205045113-03964196-nightly", + "@blocksuite/store": "0.0.0-20231205045113-03964196-nightly", "@playwright/test": "^1.39.0" }, "version": "0.10.3-canary.2" diff --git a/tests/kit/utils/editor.ts b/tests/kit/utils/editor.ts index 4a2425605d..d10c73e2cc 100644 --- a/tests/kit/utils/editor.ts +++ b/tests/kit/utils/editor.ts @@ -1,15 +1,4 @@ import type { Page } from '@playwright/test'; -import { expect } from '@playwright/test'; - -export async function checkBlockHub(page: Page) { - const box = await page.locator('affine-block-hub').boundingBox(); - if (!box) throw new Error('block-hub not found'); - await page.getByTestId('block-hub').click(); - await page.waitForTimeout(500); - const box2 = await page.locator('affine-block-hub').boundingBox(); - if (!box2) throw new Error('block-hub not found'); - expect(box2.height).toBeGreaterThan(box.height); -} export async function clickEdgelessModeButton(page: Page) { await page.getByTestId('switch-edgeless-mode-button').click({ diff --git a/tests/storybook/package.json b/tests/storybook/package.json index 86dc8d01f8..741ef28f3b 100644 --- a/tests/storybook/package.json +++ b/tests/storybook/package.json @@ -31,14 +31,14 @@ "wait-on": "^7.2.0" }, "devDependencies": { - "@blocksuite/block-std": "0.0.0-20231130092516-0f858b95-nightly", - "@blocksuite/blocks": "0.0.0-20231130092516-0f858b95-nightly", - "@blocksuite/editor": "0.0.0-20231130092516-0f858b95-nightly", - "@blocksuite/global": "0.0.0-20231130092516-0f858b95-nightly", + "@blocksuite/block-std": "0.0.0-20231205045113-03964196-nightly", + "@blocksuite/blocks": "0.0.0-20231205045113-03964196-nightly", + "@blocksuite/global": "0.0.0-20231205045113-03964196-nightly", "@blocksuite/icons": "2.1.36", - "@blocksuite/lit": "0.0.0-20231130092516-0f858b95-nightly", - "@blocksuite/store": "0.0.0-20231130092516-0f858b95-nightly", - "@blocksuite/virgo": "0.0.0-20231130092516-0f858b95-nightly", + "@blocksuite/lit": "0.0.0-20231205045113-03964196-nightly", + "@blocksuite/presets": "0.0.0-20231205045113-03964196-nightly", + "@blocksuite/store": "0.0.0-20231205045113-03964196-nightly", + "@blocksuite/virgo": "0.0.0-20231205045113-03964196-nightly", "@dnd-kit/sortable": "^8.0.0", "@tomfreudenberg/next-auth-mock": "^0.5.6", "chromatic": "^9.1.0", @@ -51,9 +51,9 @@ }, "peerDependencies": { "@blocksuite/blocks": "*", - "@blocksuite/editor": "*", "@blocksuite/global": "*", "@blocksuite/icons": "2.1.34", + "@blocksuite/presets": "*", "@blocksuite/store": "*" }, "version": "0.10.3-canary.2" diff --git a/tests/storybook/src/stories/image-preview-modal.stories.tsx b/tests/storybook/src/stories/image-preview-modal.stories.tsx index 26f798495c..c914129996 100644 --- a/tests/storybook/src/stories/image-preview-modal.stories.tsx +++ b/tests/storybook/src/stories/image-preview-modal.stories.tsx @@ -1,4 +1,3 @@ -import { RootBlockHub } from '@affine/component/block-hub'; import { BlockSuiteEditor } from '@affine/component/block-suite-editor'; import { WorkspaceFlavour } from '@affine/env/workspace'; // eslint-disable-next-line @typescript-eslint/no-restricted-imports @@ -44,21 +43,18 @@ fetch(new URL('@affine-test/fixtures/large-image.png', import.meta.url)) export const Default = () => { return ( - <> -
    - - {createPortal( - , - document.body - )} -
    - - +
    + + {createPortal( + , + document.body + )} +
    ); }; diff --git a/yarn.lock b/yarn.lock index 1dade839d0..6034dbd693 100644 --- a/yarn.lock +++ b/yarn.lock @@ -25,10 +25,10 @@ __metadata: dependencies: "@affine-test/fixtures": "workspace:*" "@affine-test/kit": "workspace:*" - "@blocksuite/block-std": "npm:0.0.0-20231130092516-0f858b95-nightly" - "@blocksuite/blocks": "npm:0.0.0-20231130092516-0f858b95-nightly" - "@blocksuite/global": "npm:0.0.0-20231130092516-0f858b95-nightly" - "@blocksuite/store": "npm:0.0.0-20231130092516-0f858b95-nightly" + "@blocksuite/block-std": "npm:0.0.0-20231205045113-03964196-nightly" + "@blocksuite/blocks": "npm:0.0.0-20231205045113-03964196-nightly" + "@blocksuite/global": "npm:0.0.0-20231205045113-03964196-nightly" + "@blocksuite/store": "npm:0.0.0-20231205045113-03964196-nightly" "@playwright/test": "npm:^1.39.0" express: "npm:^4.18.2" http-proxy-middleware: "npm:^3.0.0-beta.1" @@ -42,10 +42,10 @@ __metadata: dependencies: "@affine-test/fixtures": "workspace:*" "@affine-test/kit": "workspace:*" - "@blocksuite/block-std": "npm:0.0.0-20231130092516-0f858b95-nightly" - "@blocksuite/blocks": "npm:0.0.0-20231130092516-0f858b95-nightly" - "@blocksuite/global": "npm:0.0.0-20231130092516-0f858b95-nightly" - "@blocksuite/store": "npm:0.0.0-20231130092516-0f858b95-nightly" + "@blocksuite/block-std": "npm:0.0.0-20231205045113-03964196-nightly" + "@blocksuite/blocks": "npm:0.0.0-20231205045113-03964196-nightly" + "@blocksuite/global": "npm:0.0.0-20231205045113-03964196-nightly" + "@blocksuite/store": "npm:0.0.0-20231205045113-03964196-nightly" "@playwright/test": "npm:^1.39.0" express: "npm:^4.18.2" http-proxy-middleware: "npm:^3.0.0-beta.1" @@ -59,10 +59,10 @@ __metadata: dependencies: "@affine-test/fixtures": "workspace:*" "@affine-test/kit": "workspace:*" - "@blocksuite/block-std": "npm:0.0.0-20231130092516-0f858b95-nightly" - "@blocksuite/blocks": "npm:0.0.0-20231130092516-0f858b95-nightly" - "@blocksuite/global": "npm:0.0.0-20231130092516-0f858b95-nightly" - "@blocksuite/store": "npm:0.0.0-20231130092516-0f858b95-nightly" + "@blocksuite/block-std": "npm:0.0.0-20231205045113-03964196-nightly" + "@blocksuite/blocks": "npm:0.0.0-20231205045113-03964196-nightly" + "@blocksuite/global": "npm:0.0.0-20231205045113-03964196-nightly" + "@blocksuite/store": "npm:0.0.0-20231205045113-03964196-nightly" "@playwright/test": "npm:^1.39.0" express: "npm:^4.18.2" http-proxy-middleware: "npm:^3.0.0-beta.1" @@ -76,10 +76,10 @@ __metadata: dependencies: "@affine-test/fixtures": "workspace:*" "@affine-test/kit": "workspace:*" - "@blocksuite/block-std": "npm:0.0.0-20231130092516-0f858b95-nightly" - "@blocksuite/blocks": "npm:0.0.0-20231130092516-0f858b95-nightly" - "@blocksuite/global": "npm:0.0.0-20231130092516-0f858b95-nightly" - "@blocksuite/store": "npm:0.0.0-20231130092516-0f858b95-nightly" + "@blocksuite/block-std": "npm:0.0.0-20231205045113-03964196-nightly" + "@blocksuite/blocks": "npm:0.0.0-20231205045113-03964196-nightly" + "@blocksuite/global": "npm:0.0.0-20231205045113-03964196-nightly" + "@blocksuite/store": "npm:0.0.0-20231205045113-03964196-nightly" "@playwright/test": "npm:^1.39.0" express: "npm:^4.18.2" http-proxy-middleware: "npm:^3.0.0-beta.1" @@ -138,10 +138,10 @@ __metadata: dependencies: "@affine-test/fixtures": "workspace:*" "@affine-test/kit": "workspace:*" - "@blocksuite/block-std": "npm:0.0.0-20231130092516-0f858b95-nightly" - "@blocksuite/blocks": "npm:0.0.0-20231130092516-0f858b95-nightly" - "@blocksuite/global": "npm:0.0.0-20231130092516-0f858b95-nightly" - "@blocksuite/store": "npm:0.0.0-20231130092516-0f858b95-nightly" + "@blocksuite/block-std": "npm:0.0.0-20231205045113-03964196-nightly" + "@blocksuite/blocks": "npm:0.0.0-20231205045113-03964196-nightly" + "@blocksuite/global": "npm:0.0.0-20231205045113-03964196-nightly" + "@blocksuite/store": "npm:0.0.0-20231205045113-03964196-nightly" "@playwright/test": "npm:^1.39.0" languageName: unknown linkType: soft @@ -222,12 +222,12 @@ __metadata: "@affine/graphql": "workspace:*" "@affine/i18n": "workspace:*" "@affine/workspace": "workspace:*" - "@blocksuite/blocks": "npm:0.0.0-20231130092516-0f858b95-nightly" - "@blocksuite/editor": "npm:0.0.0-20231130092516-0f858b95-nightly" - "@blocksuite/global": "npm:0.0.0-20231130092516-0f858b95-nightly" + "@blocksuite/blocks": "npm:0.0.0-20231205045113-03964196-nightly" + "@blocksuite/global": "npm:0.0.0-20231205045113-03964196-nightly" "@blocksuite/icons": "npm:2.1.36" - "@blocksuite/lit": "npm:0.0.0-20231130092516-0f858b95-nightly" - "@blocksuite/store": "npm:0.0.0-20231130092516-0f858b95-nightly" + "@blocksuite/lit": "npm:0.0.0-20231205045113-03964196-nightly" + "@blocksuite/presets": "npm:0.0.0-20231205045113-03964196-nightly" + "@blocksuite/store": "npm:0.0.0-20231205045113-03964196-nightly" "@dnd-kit/core": "npm:^6.0.8" "@dnd-kit/modifiers": "npm:^7.0.0" "@dnd-kit/sortable": "npm:^8.0.0" @@ -303,9 +303,9 @@ __metadata: yjs: "npm:^13.6.10" peerDependencies: "@blocksuite/blocks": "*" - "@blocksuite/editor": "*" "@blocksuite/global": "*" "@blocksuite/icons": 2.1.34 + "@blocksuite/presets": "*" "@blocksuite/store": "*" languageName: unknown linkType: soft @@ -350,14 +350,14 @@ __metadata: "@affine/templates": "workspace:*" "@affine/workspace": "workspace:*" "@aws-sdk/client-s3": "npm:3.433.0" - "@blocksuite/block-std": "npm:0.0.0-20231130092516-0f858b95-nightly" - "@blocksuite/blocks": "npm:0.0.0-20231130092516-0f858b95-nightly" - "@blocksuite/editor": "npm:0.0.0-20231130092516-0f858b95-nightly" - "@blocksuite/global": "npm:0.0.0-20231130092516-0f858b95-nightly" + "@blocksuite/block-std": "npm:0.0.0-20231205045113-03964196-nightly" + "@blocksuite/blocks": "npm:0.0.0-20231205045113-03964196-nightly" + "@blocksuite/global": "npm:0.0.0-20231205045113-03964196-nightly" "@blocksuite/icons": "npm:2.1.36" - "@blocksuite/lit": "npm:0.0.0-20231130092516-0f858b95-nightly" - "@blocksuite/store": "npm:0.0.0-20231130092516-0f858b95-nightly" - "@blocksuite/virgo": "npm:0.0.0-20231130092516-0f858b95-nightly" + "@blocksuite/lit": "npm:0.0.0-20231205045113-03964196-nightly" + "@blocksuite/presets": "npm:0.0.0-20231205045113-03964196-nightly" + "@blocksuite/store": "npm:0.0.0-20231205045113-03964196-nightly" + "@blocksuite/virgo": "npm:0.0.0-20231205045113-03964196-nightly" "@dnd-kit/core": "npm:^6.0.8" "@dnd-kit/sortable": "npm:^8.0.0" "@emotion/cache": "npm:^11.11.0" @@ -463,10 +463,10 @@ __metadata: "@affine/sdk": "workspace:*" "@affine/templates": "workspace:*" "@affine/vue-hello-world-plugin": "workspace:*" - "@blocksuite/blocks": "npm:0.0.0-20231130092516-0f858b95-nightly" - "@blocksuite/editor": "npm:0.0.0-20231130092516-0f858b95-nightly" - "@blocksuite/lit": "npm:0.0.0-20231130092516-0f858b95-nightly" - "@blocksuite/store": "npm:0.0.0-20231130092516-0f858b95-nightly" + "@blocksuite/blocks": "npm:0.0.0-20231205045113-03964196-nightly" + "@blocksuite/lit": "npm:0.0.0-20231205045113-03964196-nightly" + "@blocksuite/presets": "npm:0.0.0-20231205045113-03964196-nightly" + "@blocksuite/store": "npm:0.0.0-20231205045113-03964196-nightly" "@electron-forge/cli": "npm:^7.1.0" "@electron-forge/core": "npm:^7.1.0" "@electron-forge/core-utils": "npm:^7.1.0" @@ -514,8 +514,8 @@ __metadata: version: 0.0.0-use.local resolution: "@affine/env@workspace:packages/common/env" dependencies: - "@blocksuite/global": "npm:0.0.0-20231130092516-0f858b95-nightly" - "@blocksuite/store": "npm:0.0.0-20231130092516-0f858b95-nightly" + "@blocksuite/global": "npm:0.0.0-20231205045113-03964196-nightly" + "@blocksuite/store": "npm:0.0.0-20231205045113-03964196-nightly" lit: "npm:^3.0.2" react: "npm:18.2.0" react-dom: "npm:18.2.0" @@ -707,11 +707,11 @@ __metadata: version: 0.0.0-use.local resolution: "@affine/sdk@workspace:packages/common/sdk" dependencies: - "@blocksuite/block-std": "npm:0.0.0-20231130092516-0f858b95-nightly" - "@blocksuite/blocks": "npm:0.0.0-20231130092516-0f858b95-nightly" - "@blocksuite/editor": "npm:0.0.0-20231130092516-0f858b95-nightly" - "@blocksuite/global": "npm:0.0.0-20231130092516-0f858b95-nightly" - "@blocksuite/store": "npm:0.0.0-20231130092516-0f858b95-nightly" + "@blocksuite/block-std": "npm:0.0.0-20231205045113-03964196-nightly" + "@blocksuite/blocks": "npm:0.0.0-20231205045113-03964196-nightly" + "@blocksuite/global": "npm:0.0.0-20231205045113-03964196-nightly" + "@blocksuite/presets": "npm:0.0.0-20231205045113-03964196-nightly" + "@blocksuite/store": "npm:0.0.0-20231205045113-03964196-nightly" jotai: "npm:^2.5.1" vite: "npm:^4.4.11" vite-plugin-dts: "npm:3.6.0" @@ -835,14 +835,14 @@ __metadata: dependencies: "@affine/component": "workspace:*" "@affine/i18n": "workspace:*" - "@blocksuite/block-std": "npm:0.0.0-20231130092516-0f858b95-nightly" - "@blocksuite/blocks": "npm:0.0.0-20231130092516-0f858b95-nightly" - "@blocksuite/editor": "npm:0.0.0-20231130092516-0f858b95-nightly" - "@blocksuite/global": "npm:0.0.0-20231130092516-0f858b95-nightly" + "@blocksuite/block-std": "npm:0.0.0-20231205045113-03964196-nightly" + "@blocksuite/blocks": "npm:0.0.0-20231205045113-03964196-nightly" + "@blocksuite/global": "npm:0.0.0-20231205045113-03964196-nightly" "@blocksuite/icons": "npm:2.1.36" - "@blocksuite/lit": "npm:0.0.0-20231130092516-0f858b95-nightly" - "@blocksuite/store": "npm:0.0.0-20231130092516-0f858b95-nightly" - "@blocksuite/virgo": "npm:0.0.0-20231130092516-0f858b95-nightly" + "@blocksuite/lit": "npm:0.0.0-20231205045113-03964196-nightly" + "@blocksuite/presets": "npm:0.0.0-20231205045113-03964196-nightly" + "@blocksuite/store": "npm:0.0.0-20231205045113-03964196-nightly" + "@blocksuite/virgo": "npm:0.0.0-20231205045113-03964196-nightly" "@dnd-kit/sortable": "npm:^8.0.0" "@storybook/addon-actions": "npm:^7.5.3" "@storybook/addon-essentials": "npm:^7.5.3" @@ -874,9 +874,9 @@ __metadata: wait-on: "npm:^7.2.0" peerDependencies: "@blocksuite/blocks": "*" - "@blocksuite/editor": "*" "@blocksuite/global": "*" "@blocksuite/icons": 2.1.34 + "@blocksuite/presets": "*" "@blocksuite/store": "*" languageName: unknown linkType: soft @@ -4083,29 +4083,29 @@ __metadata: languageName: node linkType: hard -"@blocksuite/block-std@npm:0.0.0-20231130092516-0f858b95-nightly": - version: 0.0.0-20231130092516-0f858b95-nightly - resolution: "@blocksuite/block-std@npm:0.0.0-20231130092516-0f858b95-nightly" +"@blocksuite/block-std@npm:0.0.0-20231205045113-03964196-nightly": + version: 0.0.0-20231205045113-03964196-nightly + resolution: "@blocksuite/block-std@npm:0.0.0-20231205045113-03964196-nightly" dependencies: - "@blocksuite/global": "npm:0.0.0-20231130092516-0f858b95-nightly" + "@blocksuite/global": "npm:0.0.0-20231205045113-03964196-nightly" lz-string: "npm:^1.5.0" w3c-keyname: "npm:^2.2.8" zod: "npm:^3.22.4" peerDependencies: - "@blocksuite/store": 0.0.0-20231130092516-0f858b95-nightly - checksum: b530b86fb8f841b63d81a32ce8c76e4b1d02a6f9d48e809881300b9d5c6fe3ea7c047a86dcf662a14e73e794706e397e1091df2b8fcf61524d4934ade2830219 + "@blocksuite/store": 0.0.0-20231205045113-03964196-nightly + checksum: bfe59fa67bc37f5fafdb57b0a59bd4e94858cfe6939cb7ca556c92944e3c59486fd832103510c490583354138d5d82f00823ad74803d8c223ebe3f4c035b30f7 languageName: node linkType: hard -"@blocksuite/blocks@npm:0.0.0-20231130092516-0f858b95-nightly": - version: 0.0.0-20231130092516-0f858b95-nightly - resolution: "@blocksuite/blocks@npm:0.0.0-20231130092516-0f858b95-nightly" +"@blocksuite/blocks@npm:0.0.0-20231205045113-03964196-nightly": + version: 0.0.0-20231205045113-03964196-nightly + resolution: "@blocksuite/blocks@npm:0.0.0-20231205045113-03964196-nightly" dependencies: - "@blocksuite/block-std": "npm:0.0.0-20231130092516-0f858b95-nightly" - "@blocksuite/global": "npm:0.0.0-20231130092516-0f858b95-nightly" - "@blocksuite/lit": "npm:0.0.0-20231130092516-0f858b95-nightly" - "@blocksuite/store": "npm:0.0.0-20231130092516-0f858b95-nightly" - "@blocksuite/virgo": "npm:0.0.0-20231130092516-0f858b95-nightly" + "@blocksuite/block-std": "npm:0.0.0-20231205045113-03964196-nightly" + "@blocksuite/global": "npm:0.0.0-20231205045113-03964196-nightly" + "@blocksuite/lit": "npm:0.0.0-20231205045113-03964196-nightly" + "@blocksuite/store": "npm:0.0.0-20231205045113-03964196-nightly" + "@blocksuite/virgo": "npm:0.0.0-20231205045113-03964196-nightly" "@floating-ui/dom": "npm:^1.5.3" "@toeverything/theme": "npm:^0.7.27" "@types/hast": "npm:^3.0.3" @@ -4119,11 +4119,19 @@ __metadata: jszip: "npm:^3.10.1" lit: "npm:^3.0.2" marked: "npm:^4.3.0" + mdast-util-gfm-autolink-literal: "npm:^2.0.0" + mdast-util-gfm-strikethrough: "npm:^2.0.0" + mdast-util-gfm-table: "npm:^2.0.0" + mdast-util-gfm-task-list-item: "npm:^2.0.0" + micromark-extension-gfm-autolink-literal: "npm:^2.0.0" + micromark-extension-gfm-strikethrough: "npm:^2.0.0" + micromark-extension-gfm-table: "npm:^2.0.0" + micromark-extension-gfm-task-list-item: "npm:^2.0.1" + micromark-util-combine-extensions: "npm:^2.0.0" nanoid: "npm:^5.0.3" pdf-lib: "npm:^1.17.1" rehype-parse: "npm:^9.0.0" rehype-stringify: "npm:^10.0.0" - remark-gfm: "npm:^4.0.0" remark-parse: "npm:^11.0.0" remark-stringify: "npm:^11.0.0" shiki: "npm:^0.14.5" @@ -4131,30 +4139,16 @@ __metadata: unified: "npm:^11.0.4" webfontloader: "npm:^1.6.28" zod: "npm:^3.22.4" - checksum: 3cdaddea9e553ec00823eb5facaf774c9b17ec74b33ff58fa50c3c1730a6c679964168ebc9109f9f128f635d243bf642fc9931317a61fc9b01b7414e8567757e + checksum: 3b3fc3cd3ddc7cc0bf9b064ce804788e8fae66f9034008a73bfa8565fe1e9123c16af2582de3a28a343e1915ee11c0dccca8eb4bbde5732df1a4dafda0b3ed6d languageName: node linkType: hard -"@blocksuite/editor@npm:0.0.0-20231130092516-0f858b95-nightly": - version: 0.0.0-20231130092516-0f858b95-nightly - resolution: "@blocksuite/editor@npm:0.0.0-20231130092516-0f858b95-nightly" - dependencies: - "@blocksuite/blocks": "npm:0.0.0-20231130092516-0f858b95-nightly" - "@blocksuite/global": "npm:0.0.0-20231130092516-0f858b95-nightly" - "@blocksuite/lit": "npm:0.0.0-20231130092516-0f858b95-nightly" - "@blocksuite/store": "npm:0.0.0-20231130092516-0f858b95-nightly" - "@toeverything/theme": "npm:^0.7.27" - lit: "npm:^3.0.2" - checksum: 57ea3318f351fa71357e66ae6e483f6db905a71cc1aeb980e8207c1f9219badc6fde9866d7ccec4b91457f51548c3ee13c019b381a332b814e5c7abcb296ec10 - languageName: node - linkType: hard - -"@blocksuite/global@npm:0.0.0-20231130092516-0f858b95-nightly": - version: 0.0.0-20231130092516-0f858b95-nightly - resolution: "@blocksuite/global@npm:0.0.0-20231130092516-0f858b95-nightly" +"@blocksuite/global@npm:0.0.0-20231205045113-03964196-nightly": + version: 0.0.0-20231205045113-03964196-nightly + resolution: "@blocksuite/global@npm:0.0.0-20231205045113-03964196-nightly" dependencies: zod: "npm:^3.22.4" - checksum: 65099c1dfab920a85107091d272d12ac2dc5dab323011e95238220637ca9c6070320dcf1570edf25a6f39e591e98ccac490932f70a6b9d4a52e38fcd122cad22 + checksum: e676b8ab6d7207cc5781bd7d3b1b31809d70bd7a0662f876479206cc45f6ecb54beff7839e9d30981e9af475aa9f5b33e8721927cae0ab1bd6af22d8f398f698 languageName: node linkType: hard @@ -4168,26 +4162,40 @@ __metadata: languageName: node linkType: hard -"@blocksuite/lit@npm:0.0.0-20231130092516-0f858b95-nightly": - version: 0.0.0-20231130092516-0f858b95-nightly - resolution: "@blocksuite/lit@npm:0.0.0-20231130092516-0f858b95-nightly" +"@blocksuite/lit@npm:0.0.0-20231205045113-03964196-nightly": + version: 0.0.0-20231205045113-03964196-nightly + resolution: "@blocksuite/lit@npm:0.0.0-20231205045113-03964196-nightly" dependencies: - "@blocksuite/global": "npm:0.0.0-20231130092516-0f858b95-nightly" - "@blocksuite/virgo": "npm:0.0.0-20231130092516-0f858b95-nightly" + "@blocksuite/global": "npm:0.0.0-20231205045113-03964196-nightly" + "@blocksuite/virgo": "npm:0.0.0-20231205045113-03964196-nightly" lit: "npm:^3.0.2" peerDependencies: - "@blocksuite/block-std": 0.0.0-20231130092516-0f858b95-nightly - "@blocksuite/store": 0.0.0-20231130092516-0f858b95-nightly - checksum: 08d016c32e22eef507b5f634fdcf21782de19de0d408b130db404ef630e3aa62664a9c53673b932abe53bed56b89eba96851247ca097e1724554c58c1b33b3f7 + "@blocksuite/block-std": 0.0.0-20231205045113-03964196-nightly + "@blocksuite/store": 0.0.0-20231205045113-03964196-nightly + checksum: a055dfb8ec205af791f6589a8f44b642975b7637d6fe26d8c79b5abfe748dd5ee1381a4519b966fc2b1d9a97003f25e0a00fd47da60cf827f40b045be4ed03c2 languageName: node linkType: hard -"@blocksuite/store@npm:0.0.0-20231130092516-0f858b95-nightly": - version: 0.0.0-20231130092516-0f858b95-nightly - resolution: "@blocksuite/store@npm:0.0.0-20231130092516-0f858b95-nightly" +"@blocksuite/presets@npm:0.0.0-20231205045113-03964196-nightly": + version: 0.0.0-20231205045113-03964196-nightly + resolution: "@blocksuite/presets@npm:0.0.0-20231205045113-03964196-nightly" dependencies: - "@blocksuite/global": "npm:0.0.0-20231130092516-0f858b95-nightly" - "@blocksuite/virgo": "npm:0.0.0-20231130092516-0f858b95-nightly" + "@blocksuite/blocks": "npm:0.0.0-20231205045113-03964196-nightly" + "@blocksuite/global": "npm:0.0.0-20231205045113-03964196-nightly" + "@blocksuite/lit": "npm:0.0.0-20231205045113-03964196-nightly" + "@blocksuite/store": "npm:0.0.0-20231205045113-03964196-nightly" + "@toeverything/theme": "npm:^0.7.27" + lit: "npm:^3.0.2" + checksum: 87369243342c96070c99eb11e9e0ca880e851ad67a8bedc6cf26c58f3bd9a554fcf471c7edca3f54b44eb60baa3bfc1b4fcaf475b4d94f836f0cb75b4bec0e96 + languageName: node + linkType: hard + +"@blocksuite/store@npm:0.0.0-20231205045113-03964196-nightly": + version: 0.0.0-20231205045113-03964196-nightly + resolution: "@blocksuite/store@npm:0.0.0-20231205045113-03964196-nightly" + dependencies: + "@blocksuite/global": "npm:0.0.0-20231205045113-03964196-nightly" + "@blocksuite/virgo": "npm:0.0.0-20231205045113-03964196-nightly" "@types/flexsearch": "npm:^0.7.3" flexsearch: "npm:0.7.21" idb-keyval: "npm:^6.2.1" @@ -4200,20 +4208,20 @@ __metadata: peerDependencies: async-call-rpc: ^6 yjs: ^13 - checksum: afbc8d10b737e66c6722e853074a9e895af6461922e2dea5f8be5e4f48f93007fe2bf66fc44453c6ccd4d47a02b2d533073d4f8f4936a36c0c40b0452ccb964e + checksum: 5763df05b5516c1c02d65621fede517602ac50145adb4ceed3e573f6b8c72f5010861fdc916028c75b1b9b5367dc0345f489d954c25ccc2f792574a6e15eaeee languageName: node linkType: hard -"@blocksuite/virgo@npm:0.0.0-20231130092516-0f858b95-nightly": - version: 0.0.0-20231130092516-0f858b95-nightly - resolution: "@blocksuite/virgo@npm:0.0.0-20231130092516-0f858b95-nightly" +"@blocksuite/virgo@npm:0.0.0-20231205045113-03964196-nightly": + version: 0.0.0-20231205045113-03964196-nightly + resolution: "@blocksuite/virgo@npm:0.0.0-20231205045113-03964196-nightly" dependencies: - "@blocksuite/global": "npm:0.0.0-20231130092516-0f858b95-nightly" + "@blocksuite/global": "npm:0.0.0-20231205045113-03964196-nightly" zod: "npm:^3.22.4" peerDependencies: lit: ^3.0.2 yjs: ^13 - checksum: fdf68e0e8328be3989e2be5dd5fb34d60117f9c5fdf5e01f97235dfdf943970e69daf6a2ea8dd83f5976c50296cdf8ec2b092aff793f803eff1e9825122ca891 + checksum: befba6e7784e87fc37548a8b6f1203af5959fa0c8477e6dae8222c46726942bbdf5d931c0fc66f87794f20b9354d1e40fe0df5710090d03e5c02d9392050a34a languageName: node linkType: hard @@ -13650,12 +13658,12 @@ __metadata: dependencies: "@affine/debug": "workspace:*" "@affine/env": "workspace:*" - "@blocksuite/block-std": "npm:0.0.0-20231130092516-0f858b95-nightly" - "@blocksuite/blocks": "npm:0.0.0-20231130092516-0f858b95-nightly" - "@blocksuite/editor": "npm:0.0.0-20231130092516-0f858b95-nightly" - "@blocksuite/global": "npm:0.0.0-20231130092516-0f858b95-nightly" - "@blocksuite/lit": "npm:0.0.0-20231130092516-0f858b95-nightly" - "@blocksuite/store": "npm:0.0.0-20231130092516-0f858b95-nightly" + "@blocksuite/block-std": "npm:0.0.0-20231205045113-03964196-nightly" + "@blocksuite/blocks": "npm:0.0.0-20231205045113-03964196-nightly" + "@blocksuite/global": "npm:0.0.0-20231205045113-03964196-nightly" + "@blocksuite/lit": "npm:0.0.0-20231205045113-03964196-nightly" + "@blocksuite/presets": "npm:0.0.0-20231205045113-03964196-nightly" + "@blocksuite/store": "npm:0.0.0-20231205045113-03964196-nightly" "@testing-library/react": "npm:^14.0.0" "@types/image-blob-reduce": "npm:^4.1.3" "@types/lodash.debounce": "npm:^4.0.7" @@ -13674,8 +13682,8 @@ __metadata: peerDependencies: "@blocksuite/block-std": "*" "@blocksuite/blocks": "*" - "@blocksuite/editor": "*" "@blocksuite/global": "*" + "@blocksuite/presets": "*" "@blocksuite/store": "*" y-provider: "workspace:*" peerDependenciesMeta: @@ -13685,10 +13693,10 @@ __metadata: optional: true "@blocksuite/blocks": optional: true - "@blocksuite/editor": - optional: true "@blocksuite/global": optional: true + "@blocksuite/presets": + optional: true "@blocksuite/store": optional: true y-provider: @@ -13703,11 +13711,11 @@ __metadata: "@affine-test/fixtures": "workspace:*" "@affine/sdk": "workspace:*" "@affine/templates": "workspace:*" - "@blocksuite/blocks": "npm:0.0.0-20231130092516-0f858b95-nightly" - "@blocksuite/editor": "npm:0.0.0-20231130092516-0f858b95-nightly" - "@blocksuite/global": "npm:0.0.0-20231130092516-0f858b95-nightly" - "@blocksuite/lit": "npm:0.0.0-20231130092516-0f858b95-nightly" - "@blocksuite/store": "npm:0.0.0-20231130092516-0f858b95-nightly" + "@blocksuite/blocks": "npm:0.0.0-20231205045113-03964196-nightly" + "@blocksuite/global": "npm:0.0.0-20231205045113-03964196-nightly" + "@blocksuite/lit": "npm:0.0.0-20231205045113-03964196-nightly" + "@blocksuite/presets": "npm:0.0.0-20231205045113-03964196-nightly" + "@blocksuite/store": "npm:0.0.0-20231205045113-03964196-nightly" "@testing-library/react": "npm:^14.0.0" async-call-rpc: "npm:^6.3.1" electron: "link:../../frontend/electron/node_modules/electron" @@ -13724,7 +13732,7 @@ __metadata: zod: "npm:^3.22.4" peerDependencies: "@affine/templates": "*" - "@blocksuite/editor": "*" + "@blocksuite/presets": "*" async-call-rpc: "*" electron: "*" react: "*" @@ -13732,7 +13740,7 @@ __metadata: peerDependenciesMeta: "@affine/templates": optional: true - "@blocksuite/editor": + "@blocksuite/presets": optional: true async-call-rpc: optional: true @@ -13756,8 +13764,8 @@ __metadata: version: 0.0.0-use.local resolution: "@toeverything/y-indexeddb@workspace:packages/common/y-indexeddb" dependencies: - "@blocksuite/blocks": "npm:0.0.0-20231130092516-0f858b95-nightly" - "@blocksuite/store": "npm:0.0.0-20231130092516-0f858b95-nightly" + "@blocksuite/blocks": "npm:0.0.0-20231205045113-03964196-nightly" + "@blocksuite/store": "npm:0.0.0-20231205045113-03964196-nightly" fake-indexeddb: "npm:^5.0.0" idb: "npm:^8.0.0" nanoid: "npm:^5.0.3" @@ -27085,19 +27093,6 @@ __metadata: languageName: node linkType: hard -"mdast-util-gfm-footnote@npm:^2.0.0": - version: 2.0.0 - resolution: "mdast-util-gfm-footnote@npm:2.0.0" - dependencies: - "@types/mdast": "npm:^4.0.0" - devlop: "npm:^1.1.0" - mdast-util-from-markdown: "npm:^2.0.0" - mdast-util-to-markdown: "npm:^2.0.0" - micromark-util-normalize-identifier: "npm:^2.0.0" - checksum: 9a820ce66575f1dc5bcc1e3269f27777a96f462f84651e72a74319d313f8fe4043fe329169bcc80ec2f210dabb84c832c77fa386ab9b4d23c31379d9bf0f8ff6 - languageName: node - linkType: hard - "mdast-util-gfm-strikethrough@npm:^1.0.0": version: 1.0.3 resolution: "mdast-util-gfm-strikethrough@npm:1.0.3" @@ -27181,21 +27176,6 @@ __metadata: languageName: node linkType: hard -"mdast-util-gfm@npm:^3.0.0": - version: 3.0.0 - resolution: "mdast-util-gfm@npm:3.0.0" - dependencies: - mdast-util-from-markdown: "npm:^2.0.0" - mdast-util-gfm-autolink-literal: "npm:^2.0.0" - mdast-util-gfm-footnote: "npm:^2.0.0" - mdast-util-gfm-strikethrough: "npm:^2.0.0" - mdast-util-gfm-table: "npm:^2.0.0" - mdast-util-gfm-task-list-item: "npm:^2.0.0" - mdast-util-to-markdown: "npm:^2.0.0" - checksum: 3e0c8e9982d3df6e9235d862cb4a2a02cf54d11e9e65f9d139d217e9b7973bb49ef4b8ee49ec05d29bdd9fe3e5f7efe1c3ebdf40a950e9f553dfc25235ebbcc2 - languageName: node - linkType: hard - "mdast-util-phrasing@npm:^3.0.0": version: 3.0.1 resolution: "mdast-util-phrasing@npm:3.0.1" @@ -27525,22 +27505,6 @@ __metadata: languageName: node linkType: hard -"micromark-extension-gfm-footnote@npm:^2.0.0": - version: 2.0.0 - resolution: "micromark-extension-gfm-footnote@npm:2.0.0" - dependencies: - devlop: "npm:^1.0.0" - micromark-core-commonmark: "npm:^2.0.0" - micromark-factory-space: "npm:^2.0.0" - micromark-util-character: "npm:^2.0.0" - micromark-util-normalize-identifier: "npm:^2.0.0" - micromark-util-sanitize-uri: "npm:^2.0.0" - micromark-util-symbol: "npm:^2.0.0" - micromark-util-types: "npm:^2.0.0" - checksum: 7813d226b862f84d417ff890f263961c1fdceaf4b02d543bf754e21b46b834bf524962acc9bb058af26edc65c838c194735fd858079c6340a0f217d031e0932d - languageName: node - linkType: hard - "micromark-extension-gfm-strikethrough@npm:^1.0.0": version: 1.0.7 resolution: "micromark-extension-gfm-strikethrough@npm:1.0.7" @@ -27604,15 +27568,6 @@ __metadata: languageName: node linkType: hard -"micromark-extension-gfm-tagfilter@npm:^2.0.0": - version: 2.0.0 - resolution: "micromark-extension-gfm-tagfilter@npm:2.0.0" - dependencies: - micromark-util-types: "npm:^2.0.0" - checksum: c5e3f8cdf22e184de3f55968e6b010876a100dff31f509b7d2975f2b981a7fdda6c2d9e452238b9fe54dc51f5d7b069e86de509d421d4efbdfc9194749b3f132 - languageName: node - linkType: hard - "micromark-extension-gfm-task-list-item@npm:^1.0.0": version: 1.0.5 resolution: "micromark-extension-gfm-task-list-item@npm:1.0.5" @@ -27626,7 +27581,7 @@ __metadata: languageName: node linkType: hard -"micromark-extension-gfm-task-list-item@npm:^2.0.0": +"micromark-extension-gfm-task-list-item@npm:^2.0.1": version: 2.0.1 resolution: "micromark-extension-gfm-task-list-item@npm:2.0.1" dependencies: @@ -27655,22 +27610,6 @@ __metadata: languageName: node linkType: hard -"micromark-extension-gfm@npm:^3.0.0": - version: 3.0.0 - resolution: "micromark-extension-gfm@npm:3.0.0" - dependencies: - micromark-extension-gfm-autolink-literal: "npm:^2.0.0" - micromark-extension-gfm-footnote: "npm:^2.0.0" - micromark-extension-gfm-strikethrough: "npm:^2.0.0" - micromark-extension-gfm-table: "npm:^2.0.0" - micromark-extension-gfm-tagfilter: "npm:^2.0.0" - micromark-extension-gfm-task-list-item: "npm:^2.0.0" - micromark-util-combine-extensions: "npm:^2.0.0" - micromark-util-types: "npm:^2.0.0" - checksum: 8493d1041756bf21f9421fa6d357056bff6112aeccebc20595604686cdd908a6816765de297206457ae4c00f85fc58672bdbcbbc36820c25d561b1737af89055 - languageName: node - linkType: hard - "micromark-factory-destination@npm:^1.0.0": version: 1.1.0 resolution: "micromark-factory-destination@npm:1.1.0" @@ -32201,20 +32140,6 @@ __metadata: languageName: node linkType: hard -"remark-gfm@npm:^4.0.0": - version: 4.0.0 - resolution: "remark-gfm@npm:4.0.0" - dependencies: - "@types/mdast": "npm:^4.0.0" - mdast-util-gfm: "npm:^3.0.0" - micromark-extension-gfm: "npm:^3.0.0" - remark-parse: "npm:^11.0.0" - remark-stringify: "npm:^11.0.0" - unified: "npm:^11.0.0" - checksum: 9f7b17aae0e9dc79ba9c989c2a679baff7161e1831a87307cfa2e0e9b0c492bd8c1900cdf7305855b898a2a9fab9aa8e586d71ce49cbc1ea90f68b714c249c0d - languageName: node - linkType: hard - "remark-parse@npm:^11.0.0": version: 11.0.0 resolution: "remark-parse@npm:11.0.0" @@ -36895,7 +36820,7 @@ __metadata: version: 0.0.0-use.local resolution: "y-provider@workspace:packages/common/y-provider" dependencies: - "@blocksuite/store": "npm:0.0.0-20231130092516-0f858b95-nightly" + "@blocksuite/store": "npm:0.0.0-20231205045113-03964196-nightly" vite: "npm:^4.4.11" vite-plugin-dts: "npm:3.6.0" vitest: "npm:0.34.6" From 1d9454118a9be12642b8ec3ebeea5e23cbd4c70d Mon Sep 17 00:00:00 2001 From: LongYinan Date: Wed, 6 Dec 2023 10:32:18 +0000 Subject: [PATCH 37/68] ci: reduce cache pressure on non-Linux platform (#5213) --- .github/actions/setup-node/action.yml | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/.github/actions/setup-node/action.yml b/.github/actions/setup-node/action.yml index f18caccede..79d2602c77 100644 --- a/.github/actions/setup-node/action.yml +++ b/.github/actions/setup-node/action.yml @@ -70,24 +70,43 @@ runs: id: yarn-cache run: node -e "const p = $(yarn config cacheFolder --json).effective; console.log('yarn_global_cache=' + p)" >> $GITHUB_OUTPUT - - name: Cache non-full yarn cache + - name: Cache non-full yarn cache on Linux uses: actions/cache@v3 - if: ${{ inputs.full-cache != 'true' }} + if: ${{ inputs.full-cache != 'true' && runner.os == 'Linux' }} with: path: | node_modules ${{ steps.yarn-cache.outputs.yarn_global_cache }} key: node_modules-cache-${{ github.job }}-${{ runner.os }} - - name: Cache full yarn cache + # The network performance on macOS is very poor + # and the decompression performance on Windows is very terrible + # so we reduce the number of cached files on non-Linux systems by remove node_modules from cache path. + - name: Cache non-full yarn cache on non-Linux uses: actions/cache@v3 - if: ${{ inputs.full-cache == 'true' }} + if: ${{ inputs.full-cache != 'true' && runner.os != 'Linux' }} + with: + path: | + ${{ steps.yarn-cache.outputs.yarn_global_cache }} + key: node_modules-cache-${{ github.job }}-${{ runner.os }} + + - name: Cache full yarn cache on Linux + uses: actions/cache@v3 + if: ${{ inputs.full-cache == 'true' && runner.os == 'Linux' }} with: path: | node_modules ${{ steps.yarn-cache.outputs.yarn_global_cache }} key: node_modules-cache-full-${{ runner.os }} + - name: Cache full yarn cache on non-Linux + uses: actions/cache@v3 + if: ${{ inputs.full-cache == 'true' && runner.os != 'Linux' }} + with: + path: | + ${{ steps.yarn-cache.outputs.yarn_global_cache }} + key: node_modules-cache-full-${{ runner.os }} + - name: yarn install if: ${{ inputs.package-install == 'true' }} continue-on-error: true From 3e92942bb5d87b7a2beaefccc6f7c9fbb78fd32e Mon Sep 17 00:00:00 2001 From: LongYinan Date: Wed, 6 Dec 2023 10:32:21 +0000 Subject: [PATCH 38/68] ci: remove cache cleanup job because we are sharing cache cross branches (#5214) --- .github/workflows/cache-cleanup.yml | 36 ----------------------------- 1 file changed, 36 deletions(-) delete mode 100644 .github/workflows/cache-cleanup.yml diff --git a/.github/workflows/cache-cleanup.yml b/.github/workflows/cache-cleanup.yml deleted file mode 100644 index 87d8415d49..0000000000 --- a/.github/workflows/cache-cleanup.yml +++ /dev/null @@ -1,36 +0,0 @@ -# https://docs.github.com/en/actions/using-workflows/caching-dependencies-to-speed-up-workflows#force-deleting-cache-entries -name: Cleanup caches for closed branches - -on: - pull_request: - types: - - closed - workflow_dispatch: - -jobs: - cleanup: - runs-on: ubuntu-latest - steps: - - name: Check out code - uses: actions/checkout@v4 - - - name: Cleanup - run: | - gh extension install actions/gh-actions-cache - - REPO=${{ github.repository }} - BRANCH="refs/pull/${{ github.event.pull_request.number }}/merge" - - echo "Fetching list of cache key" - cacheKeysForPR=$(gh actions-cache list -R $REPO -B $BRANCH | cut -f 1 ) - - ## Setting this to not fail the workflow while deleting cache keys. - set +e - echo "Deleting caches..." - for cacheKey in $cacheKeysForPR - do - gh actions-cache delete $cacheKey -R $REPO -B $BRANCH --confirm - done - echo "Done" - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} From 7ec8e49b3ba7115c7e38d6c2cb97c9e1fdc76cb6 Mon Sep 17 00:00:00 2001 From: JimmFly <447268514@qq.com> Date: Wed, 6 Dec 2023 10:43:13 +0000 Subject: [PATCH 39/68] feat(core): add responsive styles to registration page (#5044) The responsive style of the login and registration page has been adjusted, with special treatment given to the input. work for #4843 --- packages/common/env/src/global.ts | 1 + .../src/components/affine-banner/index.css.ts | 10 ++ .../desktop-navbar.tsx | 24 ++++ .../affine-other-page-layout/index.css.ts | 89 +++++++++++++++ .../affine-other-page-layout/index.tsx | 1 + .../affine-other-page-layout/layout.tsx | 49 ++++++++ .../mobile-navbar.tsx | 50 +++++++++ .../use-nav-config.ts | 27 +++++ .../components/auth-components/auth-input.tsx | 7 +- .../auth-components/auth-page-container.tsx | 49 ++++---- .../auth-components/change-email-page.tsx | 1 - .../auth-components/password-input/index.tsx | 3 + .../auth-components/set-password.tsx | 1 - .../components/auth-components/share.css.ts | 22 +++- .../components/not-found-page/styles.css.ts | 1 + .../frontend/core/.webpack/runtime-config.ts | 2 + .../core/src/pages/upgrade-success.css.ts | 80 +------------ .../core/src/pages/upgrade-success.tsx | 106 +++++------------- 18 files changed, 338 insertions(+), 185 deletions(-) create mode 100644 packages/frontend/component/src/components/affine-other-page-layout/desktop-navbar.tsx create mode 100644 packages/frontend/component/src/components/affine-other-page-layout/index.css.ts create mode 100644 packages/frontend/component/src/components/affine-other-page-layout/index.tsx create mode 100644 packages/frontend/component/src/components/affine-other-page-layout/layout.tsx create mode 100644 packages/frontend/component/src/components/affine-other-page-layout/mobile-navbar.tsx create mode 100644 packages/frontend/component/src/components/affine-other-page-layout/use-nav-config.ts diff --git a/packages/common/env/src/global.ts b/packages/common/env/src/global.ts index e074fac47b..0532ff1248 100644 --- a/packages/common/env/src/global.ts +++ b/packages/common/env/src/global.ts @@ -18,6 +18,7 @@ export const runtimeFlagsSchema = z.object({ enableBroadcastChannelProvider: z.boolean(), enableDebugPage: z.boolean(), changelogUrl: z.string(), + downloadUrl: z.string(), // see: tools/workers imageProxyUrl: z.string(), enablePreloading: z.boolean(), diff --git a/packages/frontend/component/src/components/affine-banner/index.css.ts b/packages/frontend/component/src/components/affine-banner/index.css.ts index 345f9eb30f..b105bdeef1 100644 --- a/packages/frontend/component/src/components/affine-banner/index.css.ts +++ b/packages/frontend/component/src/components/affine-banner/index.css.ts @@ -40,6 +40,11 @@ export const tipsContainer = style({ position: 'sticky', gap: '16px', containerType: 'inline-size', + '@media': { + 'screen and (max-width: 520px)': { + flexWrap: 'wrap', + }, + }, }); export const tipsMessage = style({ @@ -54,4 +59,9 @@ export const tipsRightItem = style({ justifyContent: 'space-between', alignItems: 'center', gap: '16px', + '@media': { + 'screen and (max-width: 520px)': { + width: '100%', + }, + }, }); diff --git a/packages/frontend/component/src/components/affine-other-page-layout/desktop-navbar.tsx b/packages/frontend/component/src/components/affine-other-page-layout/desktop-navbar.tsx new file mode 100644 index 0000000000..5b8aeb860b --- /dev/null +++ b/packages/frontend/component/src/components/affine-other-page-layout/desktop-navbar.tsx @@ -0,0 +1,24 @@ +import * as styles from './index.css'; +import { useNavConfig } from './use-nav-config'; + +export const DesktopNavbar = () => { + const config = useNavConfig(); + + return ( +
    + ); +}; diff --git a/packages/frontend/component/src/components/affine-other-page-layout/index.css.ts b/packages/frontend/component/src/components/affine-other-page-layout/index.css.ts new file mode 100644 index 0000000000..0910728906 --- /dev/null +++ b/packages/frontend/component/src/components/affine-other-page-layout/index.css.ts @@ -0,0 +1,89 @@ +import { style } from '@vanilla-extract/css'; + +export const root = style({ + height: '100vh', + width: '100vw', + display: 'flex', + flexDirection: 'column', + fontSize: 'var(--affine-font-base)', + position: 'relative', + background: 'var(--affine-background-primary-color)', +}); + +export const affineLogo = style({ + color: 'inherit', +}); + +export const topNav = style({ + top: 0, + left: 0, + right: 0, + display: 'flex', + alignItems: 'center', + justifyContent: 'space-between', + padding: '16px 120px', + selectors: { + '&.mobile': { + padding: '16px 20px', + }, + }, +}); + +export const topNavLinks = style({ + display: 'flex', + columnGap: 4, +}); + +export const topNavLink = style({ + color: 'var(--affine-text-primary-color)', + fontSize: 'var(--affine-font-sm)', + fontWeight: 500, + textDecoration: 'none', + padding: '4px 18px', +}); + +export const iconButton = style({ + fontSize: '24px', + pointerEvents: 'auto', + selectors: { + '&.plain': { + color: 'var(--affine-text-primary-color)', + }, + }, +}); + +export const menu = style({ + width: '100vw', + height: '100vh', + padding: '0', + background: 'var(--affine-background-primary-color)', + borderRadius: '0', + border: 'none', + boxShadow: 'none', +}); + +export const menuItem = style({ + color: 'var(--affine-text-primary-color)', + fontSize: 'var(--affine-font-sm)', + fontWeight: 500, + textDecoration: 'none', + padding: '12px 20px', + maxWidth: '100%', + position: 'relative', + borderRadius: '0', + transition: 'background 0.3s ease', + selectors: { + '&:after': { + position: 'absolute', + content: '""', + bottom: 0, + display: 'block', + width: 'calc(100% - 40px)', + height: '0.5px', + background: 'var(--affine-black-10)', + }, + '&:not(:last-of-type)': { + marginBottom: '0', + }, + }, +}); diff --git a/packages/frontend/component/src/components/affine-other-page-layout/index.tsx b/packages/frontend/component/src/components/affine-other-page-layout/index.tsx new file mode 100644 index 0000000000..5d15fe1b3c --- /dev/null +++ b/packages/frontend/component/src/components/affine-other-page-layout/index.tsx @@ -0,0 +1 @@ +export * from './layout'; diff --git a/packages/frontend/component/src/components/affine-other-page-layout/layout.tsx b/packages/frontend/component/src/components/affine-other-page-layout/layout.tsx new file mode 100644 index 0000000000..c58891324c --- /dev/null +++ b/packages/frontend/component/src/components/affine-other-page-layout/layout.tsx @@ -0,0 +1,49 @@ +import { Button } from '@affine/component/ui/button'; +import { useAFFiNEI18N } from '@affine/i18n/hooks'; +import { Logo1Icon } from '@blocksuite/icons'; +import clsx from 'clsx'; +import { useCallback } from 'react'; + +import { DesktopNavbar } from './desktop-navbar'; +import * as styles from './index.css'; +import { MobileNavbar } from './mobile-navbar'; + +export const AffineOtherPageLayout = ({ + isSmallScreen, + children, +}: { + isSmallScreen: boolean; + children: React.ReactNode; +}) => { + const t = useAFFiNEI18N(); + + const openDownloadLink = useCallback(() => { + open(runtimeConfig.downloadUrl, '_blank'); + }, []); + + return ( +
    +
    + + + + {isSmallScreen ? ( + + ) : ( + <> + + + + )} +
    + + {children} +
    + ); +}; diff --git a/packages/frontend/component/src/components/affine-other-page-layout/mobile-navbar.tsx b/packages/frontend/component/src/components/affine-other-page-layout/mobile-navbar.tsx new file mode 100644 index 0000000000..1d544b27fd --- /dev/null +++ b/packages/frontend/component/src/components/affine-other-page-layout/mobile-navbar.tsx @@ -0,0 +1,50 @@ +import { IconButton } from '@affine/component/ui/button'; +import { Menu, MenuItem } from '@affine/component/ui/menu'; +import { CloseIcon, PropertyIcon } from '@blocksuite/icons'; +import { useState } from 'react'; + +import * as styles from './index.css'; +import { useNavConfig } from './use-nav-config'; + +export const MobileNavbar = () => { + const [openMenu, setOpenMenu] = useState(false); + const navConfig = useNavConfig(); + + const menuItems = ( + <> + {navConfig.map(item => { + return ( + { + open(item.path, '_blank'); + }} + className={styles.menuItem} + > + {item.title} + + ); + })} + + ); + + return ( +
    + + + {openMenu ? : } + + +
    + ); +}; diff --git a/packages/frontend/component/src/components/affine-other-page-layout/use-nav-config.ts b/packages/frontend/component/src/components/affine-other-page-layout/use-nav-config.ts new file mode 100644 index 0000000000..379da19bf7 --- /dev/null +++ b/packages/frontend/component/src/components/affine-other-page-layout/use-nav-config.ts @@ -0,0 +1,27 @@ +import { useAFFiNEI18N } from '@affine/i18n/hooks'; +import { useMemo } from 'react'; + +export const useNavConfig = () => { + const t = useAFFiNEI18N(); + return useMemo( + () => [ + { + title: t['com.affine.other-page.nav.official-website'](), + path: 'https://affine.pro', + }, + { + title: t['com.affine.other-page.nav.affine-community'](), + path: 'https://community.affine.pro/home', + }, + { + title: t['com.affine.other-page.nav.blog'](), + path: 'https://affine.pro/blog', + }, + { + title: t['com.affine.other-page.nav.contact-us'](), + path: 'https://affine.pro/about-us', + }, + ], + [t] + ); +}; diff --git a/packages/frontend/component/src/components/auth-components/auth-input.tsx b/packages/frontend/component/src/components/auth-components/auth-input.tsx index c2565f1f74..523b47cb43 100644 --- a/packages/frontend/component/src/components/auth-components/auth-input.tsx +++ b/packages/frontend/component/src/components/auth-components/auth-input.tsx @@ -2,7 +2,7 @@ import clsx from 'clsx'; import type { FC, HTMLAttributes } from 'react'; import { Input, type InputProps } from '../../ui/input'; -import { authInputWrapper, formHint } from './share.css'; +import * as styles from './share.css'; export type AuthInputProps = InputProps & { label?: string; error?: boolean; @@ -22,13 +22,14 @@ export const AuthInput: FC = ({ }) => { return (
    {label ? : null} { @@ -40,7 +41,7 @@ export const AuthInput: FC = ({ /> {error && errorHint && !withoutHint ? (
    diff --git a/packages/frontend/component/src/components/auth-components/auth-page-container.tsx b/packages/frontend/component/src/components/auth-components/auth-page-container.tsx index 10f6d29ba6..5cea173e53 100644 --- a/packages/frontend/component/src/components/auth-components/auth-page-container.tsx +++ b/packages/frontend/component/src/components/auth-components/auth-page-container.tsx @@ -1,32 +1,41 @@ -import type { FC, PropsWithChildren, ReactNode } from 'react'; +import { + type FC, + type PropsWithChildren, + type ReactNode, + useEffect, + useState, +} from 'react'; import { Empty } from '../../ui/empty'; -import { Wrapper } from '../../ui/layout'; -import { Logo } from './logo'; +import { AffineOtherPageLayout } from '../affine-other-page-layout'; import { authPageContainer } from './share.css'; export const AuthPageContainer: FC< PropsWithChildren<{ title?: ReactNode; subtitle?: ReactNode }> > = ({ children, title, subtitle }) => { + const [isSmallScreen, setIsSmallScreen] = useState(false); + + useEffect(() => { + const checkScreenSize = () => { + setIsSmallScreen(window.innerWidth <= 1024); + }; + checkScreenSize(); + window.addEventListener('resize', checkScreenSize); + return () => window.removeEventListener('resize', checkScreenSize); + }, []); + return ( -
    - - - -
    -
    -

    {title}

    -

    {subtitle}

    - {children} + +
    +
    +
    +

    {title}

    +

    {subtitle}

    + {children} +
    + {isSmallScreen ? null : }
    -
    -
    + ); }; diff --git a/packages/frontend/component/src/components/auth-components/change-email-page.tsx b/packages/frontend/component/src/components/auth-components/change-email-page.tsx index e8560c2df9..c7b6291eb4 100644 --- a/packages/frontend/component/src/components/auth-components/change-email-page.tsx +++ b/packages/frontend/component/src/components/auth-components/change-email-page.tsx @@ -44,7 +44,6 @@ export const ChangeEmailPage = ({ > <> { setPasswordPass(true); passwordRef.current = password; diff --git a/packages/frontend/component/src/components/auth-components/share.css.ts b/packages/frontend/component/src/components/auth-components/share.css.ts index 0f5d8bcc5d..a1fde37f4d 100644 --- a/packages/frontend/component/src/components/auth-components/share.css.ts +++ b/packages/frontend/component/src/components/auth-components/share.css.ts @@ -151,14 +151,25 @@ export const authPageContainer = style({ justifyContent: 'center', alignItems: 'center', fontSize: 'var(--affine-font-base)', + '@media': { + 'screen and (max-width: 1024px)': { + flexDirection: 'column', + padding: '100px 20px', + justifyContent: 'flex-start', + }, + }, }); globalStyle(`${authPageContainer} .wrapper`, { display: 'flex', alignItems: 'center', + '@media': { + 'screen and (max-width: 1024px)': { + flexDirection: 'column', + }, + }, }); globalStyle(`${authPageContainer} .content`, { maxWidth: '700px', - minWidth: '550px', }); globalStyle(`${authPageContainer} .title`, { @@ -178,3 +189,12 @@ export const signInPageContainer = style({ width: '400px', margin: '205px auto 0', }); + +export const input = style({ + width: '330px', + '@media': { + 'screen and (max-width: 520px)': { + width: '100%', + }, + }, +}); diff --git a/packages/frontend/component/src/components/not-found-page/styles.css.ts b/packages/frontend/component/src/components/not-found-page/styles.css.ts index c1f4467c34..7ecf6cb4ac 100644 --- a/packages/frontend/component/src/components/not-found-page/styles.css.ts +++ b/packages/frontend/component/src/components/not-found-page/styles.css.ts @@ -8,6 +8,7 @@ export const notFoundPageContainer = style({ alignItems: 'center', justifyContent: 'center', width: '100vw', + padding: '0 20px', }); export const wrapper = style({ diff --git a/packages/frontend/core/.webpack/runtime-config.ts b/packages/frontend/core/.webpack/runtime-config.ts index f660d9fa30..459f5ec857 100644 --- a/packages/frontend/core/.webpack/runtime-config.ts +++ b/packages/frontend/core/.webpack/runtime-config.ts @@ -20,6 +20,7 @@ export function getRuntimeConfig(buildFlags: BuildFlags): RuntimeConfig { enableBroadcastChannelProvider: true, enableDebugPage: true, changelogUrl: 'https://affine.pro/what-is-new', + downloadUrl: 'https://affine.pro/download', imageProxyUrl: 'https://workers.toeverything.workers.dev/proxy/image', enablePreloading: true, enableNewSettingModal: true, @@ -67,6 +68,7 @@ export function getRuntimeConfig(buildFlags: BuildFlags): RuntimeConfig { enableBroadcastChannelProvider: true, enableDebugPage: true, changelogUrl: 'https://github.com/toeverything/AFFiNE/releases', + downloadUrl: 'https://affine.pro/download', imageProxyUrl: 'https://workers.toeverything.workers.dev/proxy/image', enablePreloading: true, enableNewSettingModal: true, diff --git a/packages/frontend/core/src/pages/upgrade-success.css.ts b/packages/frontend/core/src/pages/upgrade-success.css.ts index 4183c5ae7f..654f56d424 100644 --- a/packages/frontend/core/src/pages/upgrade-success.css.ts +++ b/packages/frontend/core/src/pages/upgrade-success.css.ts @@ -1,87 +1,9 @@ import { style } from '@vanilla-extract/css'; - -export const root = style({ - height: '100vh', - width: '100vw', - display: 'flex', - justifyContent: 'center', - alignItems: 'center', - fontSize: 'var(--affine-font-base)', - position: 'relative', -}); - -export const affineLogo = style({ - color: 'inherit', -}); - -export const topNav = style({ - position: 'absolute', - top: 0, - left: 0, - right: 0, - display: 'flex', - alignItems: 'center', - justifyContent: 'space-between', - padding: '16px 120px', -}); - -export const topNavLinks = style({ - display: 'flex', - columnGap: 4, -}); - -export const topNavLink = style({ - color: 'var(--affine-text-primary-color)', - fontSize: 'var(--affine-font-sm)', - fontWeight: 500, - textDecoration: 'none', - padding: '4px 18px', -}); - -export const tryAgainLink = style({ - color: 'var(--affine-link-color)', - fontWeight: 500, - textDecoration: 'none', - fontSize: 'var(--affine-font-sm)', -}); - -export const centerContent = style({ - display: 'flex', - flexDirection: 'column', - alignItems: 'center', - marginTop: 40, -}); - -export const prompt = style({ - marginTop: 20, - marginBottom: 12, -}); - -export const body = style({ - display: 'flex', - justifyContent: 'center', - alignItems: 'center', - width: '100%', - flexWrap: 'wrap', - gap: '48px', - padding: '0 20px', -}); - -export const leftContainer = style({ - display: 'flex', - flexDirection: 'column', - width: '548px', - gap: '28px', -}); -export const leftContentTitle = style({ - fontSize: 'var(--affine-font-title)', - fontWeight: 700, - minHeight: '44px', -}); export const leftContentText = style({ fontSize: 'var(--affine-font-base)', fontWeight: 400, lineHeight: '1.6', + maxWidth: '548px', }); export const mail = style({ diff --git a/packages/frontend/core/src/pages/upgrade-success.tsx b/packages/frontend/core/src/pages/upgrade-success.tsx index ab0cdd168f..ce67a89711 100644 --- a/packages/frontend/core/src/pages/upgrade-success.tsx +++ b/packages/frontend/core/src/pages/upgrade-success.tsx @@ -1,8 +1,7 @@ -import { Empty } from '@affine/component'; +import { AuthPageContainer } from '@affine/component/auth-components'; import { Button } from '@affine/component/ui/button'; import { Trans } from '@affine/i18n'; import { useAFFiNEI18N } from '@affine/i18n/hooks'; -import { Logo1Icon } from '@blocksuite/icons'; import { useCallback } from 'react'; import { useNavigateHelper } from '../hooks/use-navigate-helper'; @@ -11,93 +10,40 @@ import * as styles from './upgrade-success.css'; export const UpgradeSuccess = () => { const t = useAFFiNEI18N(); - const openDownloadLink = useCallback(() => { - const url = `https://affine.pro/download`; - open(url, '_blank'); - }, []); - const { jumpToIndex } = useNavigateHelper(); const openAffine = useCallback(() => { jumpToIndex(); }, [jumpToIndex]); - return ( -
    - -
    -
    -
    - {t['com.affine.payment.upgrade-success-page.title']()} -
    -
    - {t['com.affine.payment.upgrade-success-page.text']()} -
    - - ), - }} + const subtitle = ( +
    + {t['com.affine.payment.upgrade-success-page.text']()} +
    + -
    -
    -
    - -
    -
    - + ), + }} + />
    ); + + return ( + + + + ); }; export const Component = () => { From 467d3137307b95c8aa68d31a924e58246850782c Mon Sep 17 00:00:00 2001 From: LongYinan Date: Thu, 7 Dec 2023 07:28:24 +0000 Subject: [PATCH 40/68] test(server): remove flaky assertion (#5224) --- tests/affine-cloud/e2e/migration.spec.ts | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/tests/affine-cloud/e2e/migration.spec.ts b/tests/affine-cloud/e2e/migration.spec.ts index f5db86fb57..c65f8dcdc1 100644 --- a/tests/affine-cloud/e2e/migration.spec.ts +++ b/tests/affine-cloud/e2e/migration.spec.ts @@ -10,7 +10,6 @@ import { loginUser, runPrisma, } from '@affine-test/kit/utils/cloud'; -import { clickEdgelessModeButton } from '@affine-test/kit/utils/editor'; import { coreUrl } from '@affine-test/kit/utils/load-page'; import { clickNewPageButton, @@ -104,8 +103,10 @@ test('migration', async ({ page, browser }) => { await page.waitForTimeout(5000); await page.reload(); await waitForEditorLoad(page); - await clickEdgelessModeButton(page); - await expect(page.locator('affine-edgeless-page')).toBeVisible({ - timeout: 1000, - }); + + // click edgeless switch button is flaky in e2e + // await clickEdgelessModeButton(page); + // await expect(page.locator('affine-edgeless-page')).toBeVisible({ + // timeout: 1000, + // }); }); From febe5cc2ae6134222520764cab19d9281ef1f4f8 Mon Sep 17 00:00:00 2001 From: LongYinan Date: Thu, 7 Dec 2023 09:13:00 +0000 Subject: [PATCH 41/68] ci: fix ts-node scripts (#5225) - Ref: https://github.com/TypeStrong/ts-node/issues/2094 --- .github/workflows/build-test.yml | 6 +++--- packages/frontend/electron/package.json | 16 ++++++++-------- packages/frontend/i18n/package.json | 4 ++-- tsconfig.json | 8 -------- 4 files changed, 13 insertions(+), 21 deletions(-) diff --git a/.github/workflows/build-test.yml b/.github/workflows/build-test.yml index 7b76cb92cb..cb26bc18c1 100644 --- a/.github/workflows/build-test.yml +++ b/.github/workflows/build-test.yml @@ -374,7 +374,7 @@ jobs: DATABASE_URL: postgresql://affine:affine@localhost:5432/affine - name: Run init-db script - run: yarn workspace @affine/server exec ts-node ./scripts/init-db.ts + run: yarn workspace @affine/server exec node --loader ts-node/esm/transpile-only ./scripts/init-db.ts env: DATABASE_URL: postgresql://affine:affine@localhost:5432/affine @@ -464,7 +464,7 @@ jobs: DATABASE_URL: postgresql://affine:affine@localhost:5432/affine - name: Run init-db script - run: yarn workspace @affine/server exec ts-node ./scripts/init-db.ts + run: yarn workspace @affine/server exec node --loader ts-node/esm/transpile-only ./scripts/init-db.ts - name: Download storage.node uses: actions/download-artifact@v3 with: @@ -588,7 +588,7 @@ jobs: - name: Output check if: ${{ matrix.spec.os == 'macos-latest' && matrix.spec.arch == 'arm64' }} run: | - yarn workspace @affine/electron ts-node ./scripts/macos-arm64-output-check.ts + yarn workspace @affine/electron exec node --loader ts-node/esm/transpile-only ./scripts/macos-arm64-output-check.ts - name: Upload test results if: ${{ failure() }} diff --git a/packages/frontend/electron/package.json b/packages/frontend/electron/package.json index cfa5bce56c..92d2573313 100644 --- a/packages/frontend/electron/package.json +++ b/packages/frontend/electron/package.json @@ -11,14 +11,14 @@ "homepage": "https://github.com/toeverything/AFFiNE", "scripts": { "start": "electron .", - "dev": "DEV_SERVER_URL=http://localhost:8080 yarn ts-node ./scripts/dev.ts", - "dev:prod": "yarn ts-node scripts/dev.ts", - "build": "NODE_ENV=production ts-node scripts/build-layers.ts", - "build:dev": "NODE_ENV=development ts-node scripts/build-layers.ts", - "generate-assets": "ts-node scripts/generate-assets.ts", - "package": "cross-env NODE_OPTIONS=\"--loader ts-node/esm\" electron-forge package", - "make": "cross-env NODE_OPTIONS=\"--loader ts-node/esm\" electron-forge make", - "make-squirrel": "yarn ts-node scripts/make-squirrel.ts" + "dev": "DEV_SERVER_URL=http://localhost:8080 node --loader ts-node/esm/transpile-only ./scripts/dev.ts", + "dev:prod": "yarn node --loader ts-node/esm/transpile-only scripts/dev.ts", + "build": "NODE_ENV=production node --loader ts-node/esm/transpile-only scripts/build-layers.ts", + "build:dev": "NODE_ENV=development node --loader ts-node/esm/transpile-only scripts/build-layers.ts", + "generate-assets": "node --loader ts-node/esm/transpile-only scripts/generate-assets.ts", + "package": "cross-env NODE_OPTIONS=\"--loader ts-node/esm/transpile-only\" electron-forge package", + "make": "cross-env NODE_OPTIONS=\"--loader ts-node/esm/transpile-only\" electron-forge make", + "make-squirrel": "node --loader ts-node/esm/transpile-only scripts/make-squirrel.ts" }, "main": "./dist/main.js", "devDependencies": { diff --git a/packages/frontend/i18n/package.json b/packages/frontend/i18n/package.json index 4d1c8a165c..c049ed4be9 100644 --- a/packages/frontend/i18n/package.json +++ b/packages/frontend/i18n/package.json @@ -17,9 +17,9 @@ "scripts": { "build": "node build.mjs", "dev": "node dev.mjs", - "sync-languages": "ts-node -P ./tsconfig.node.json src/scripts/sync.ts", + "sync-languages": "node --loader ts-node/esm/transpile-only src/scripts/sync.ts", "sync-languages:check": "yarn run sync-languages --check", - "download-resources": "ts-node -P ./tsconfig.node.json src/scripts/download.ts" + "download-resources": "node --loader ts-node/esm/transpile-only src/scripts/download.ts" }, "keywords": [], "repository": { diff --git a/tsconfig.json b/tsconfig.json index 0439ba2331..b03ccd2b6c 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -2,7 +2,6 @@ "compilerOptions": { "verbatimModuleSyntax": true, // Classification follows https://www.typescriptlang.org/tsconfig - // Type Checking "strict": true, "exactOptionalPropertyTypes": false, @@ -16,7 +15,6 @@ "noPropertyAccessFromIndexSignature": false, "noUncheckedIndexedAccess": false, "useUnknownInCatchVariables": true, - // Modules "module": "ESNext", "moduleResolution": "bundler", @@ -28,16 +26,13 @@ "sourceMap": true, // skip type emit for @internal types // "stripInternal": true, - // JavaScript Support "allowJs": false, "checkJs": false, - // Interop Constraints "forceConsistentCasingInFileNames": true, "allowSyntheticDefaultImports": true, "isolatedModules": true, - // Language and Environment "jsx": "preserve", "jsxImportSource": "@emotion/react", @@ -46,11 +41,9 @@ "useDefineForClassFields": false, "experimentalDecorators": true, "emitDecoratorMetadata": true, - // Projects "composite": true, "incremental": true, - // Completeness "skipLibCheck": true, // skip all type checks for .d.ts files "paths": { @@ -81,7 +74,6 @@ "@affine/native": ["./packages/frontend/native/index.d.ts"], "@affine/native/*": ["./packages/frontend/native/*"], "@affine/storage": ["./packages/backend/storage/index.d.ts"], - // Development only "@affine/electron/*": ["./packages/frontend/electron/src/*"] } From 819f0243d57c89f05f9fea27189465a2e7e316b8 Mon Sep 17 00:00:00 2001 From: Yifeng Wang Date: Thu, 7 Dec 2023 18:24:23 +0800 Subject: [PATCH 42/68] feat: bump blocksuite (#5218) Co-authored-by: LongYinan --- packages/common/env/package.json | 4 +- packages/common/infra/package.json | 10 +- packages/common/sdk/package.json | 10 +- packages/common/y-indexeddb/package.json | 4 +- packages/common/y-provider/package.json | 2 +- packages/frontend/component/package.json | 10 +- packages/frontend/core/package.json | 14 +- packages/frontend/electron/package.json | 8 +- packages/frontend/hooks/package.json | 12 +- scripts/bump-blocksuite.sh | 1 + tests/affine-legacy/0.6.1-beta.1/package.json | 8 +- .../0.7.0-canary.18/package.json | 8 +- .../affine-legacy/0.8.0-canary.7/package.json | 8 +- tests/affine-legacy/0.8.4/package.json | 8 +- tests/affine-migration/package.json | 8 +- tests/storybook/package.json | 14 +- yarn.lock | 263 +++++++++--------- 17 files changed, 201 insertions(+), 191 deletions(-) diff --git a/packages/common/env/package.json b/packages/common/env/package.json index e44b5b78f8..1ffa0ab71f 100644 --- a/packages/common/env/package.json +++ b/packages/common/env/package.json @@ -3,8 +3,8 @@ "private": true, "type": "module", "devDependencies": { - "@blocksuite/global": "0.0.0-20231205045113-03964196-nightly", - "@blocksuite/store": "0.0.0-20231205045113-03964196-nightly", + "@blocksuite/global": "0.11.0-nightly-202312061456-a5bf73a", + "@blocksuite/store": "0.11.0-nightly-202312061456-a5bf73a", "react": "18.2.0", "react-dom": "18.2.0", "vitest": "0.34.6", diff --git a/packages/common/infra/package.json b/packages/common/infra/package.json index 99e7e3c16a..bf84e90992 100644 --- a/packages/common/infra/package.json +++ b/packages/common/infra/package.json @@ -55,9 +55,9 @@ }, "dependencies": { "@affine/sdk": "workspace:*", - "@blocksuite/blocks": "0.0.0-20231205045113-03964196-nightly", - "@blocksuite/global": "0.0.0-20231205045113-03964196-nightly", - "@blocksuite/store": "0.0.0-20231205045113-03964196-nightly", + "@blocksuite/blocks": "0.11.0-nightly-202312061456-a5bf73a", + "@blocksuite/global": "0.11.0-nightly-202312061456-a5bf73a", + "@blocksuite/store": "0.11.0-nightly-202312061456-a5bf73a", "jotai": "^2.5.1", "jotai-effect": "^0.2.3", "tinykeys": "^2.1.0", @@ -66,8 +66,8 @@ "devDependencies": { "@affine-test/fixtures": "workspace:*", "@affine/templates": "workspace:*", - "@blocksuite/lit": "0.0.0-20231205045113-03964196-nightly", - "@blocksuite/presets": "0.0.0-20231205045113-03964196-nightly", + "@blocksuite/lit": "0.11.0-nightly-202312061456-a5bf73a", + "@blocksuite/presets": "0.11.0-nightly-202312061456-a5bf73a", "@testing-library/react": "^14.0.0", "async-call-rpc": "^6.3.1", "electron": "link:../../frontend/electron/node_modules/electron", diff --git a/packages/common/sdk/package.json b/packages/common/sdk/package.json index bc68907830..3c1fed85ef 100644 --- a/packages/common/sdk/package.json +++ b/packages/common/sdk/package.json @@ -22,11 +22,11 @@ "dist" ], "dependencies": { - "@blocksuite/block-std": "0.0.0-20231205045113-03964196-nightly", - "@blocksuite/blocks": "0.0.0-20231205045113-03964196-nightly", - "@blocksuite/global": "0.0.0-20231205045113-03964196-nightly", - "@blocksuite/presets": "0.0.0-20231205045113-03964196-nightly", - "@blocksuite/store": "0.0.0-20231205045113-03964196-nightly", + "@blocksuite/block-std": "0.11.0-nightly-202312061456-a5bf73a", + "@blocksuite/blocks": "0.11.0-nightly-202312061456-a5bf73a", + "@blocksuite/global": "0.11.0-nightly-202312061456-a5bf73a", + "@blocksuite/presets": "0.11.0-nightly-202312061456-a5bf73a", + "@blocksuite/store": "0.11.0-nightly-202312061456-a5bf73a", "jotai": "^2.5.1", "zod": "^3.22.4" }, diff --git a/packages/common/y-indexeddb/package.json b/packages/common/y-indexeddb/package.json index aeea5cf03d..dafedf78b8 100644 --- a/packages/common/y-indexeddb/package.json +++ b/packages/common/y-indexeddb/package.json @@ -37,8 +37,8 @@ "y-provider": "workspace:*" }, "devDependencies": { - "@blocksuite/blocks": "0.0.0-20231205045113-03964196-nightly", - "@blocksuite/store": "0.0.0-20231205045113-03964196-nightly", + "@blocksuite/blocks": "0.11.0-nightly-202312061456-a5bf73a", + "@blocksuite/store": "0.11.0-nightly-202312061456-a5bf73a", "fake-indexeddb": "^5.0.0", "vite": "^4.4.11", "vite-plugin-dts": "3.6.0", diff --git a/packages/common/y-provider/package.json b/packages/common/y-provider/package.json index 413140db6a..acfb9f1ba7 100644 --- a/packages/common/y-provider/package.json +++ b/packages/common/y-provider/package.json @@ -24,7 +24,7 @@ "build": "vite build" }, "devDependencies": { - "@blocksuite/store": "0.0.0-20231205045113-03964196-nightly", + "@blocksuite/store": "0.11.0-nightly-202312061456-a5bf73a", "vite": "^4.4.11", "vite-plugin-dts": "3.6.0", "vitest": "0.34.6", diff --git a/packages/frontend/component/package.json b/packages/frontend/component/package.json index 428e2e7ad0..692459d091 100644 --- a/packages/frontend/component/package.json +++ b/packages/frontend/component/package.json @@ -71,12 +71,12 @@ "uuid": "^9.0.1" }, "devDependencies": { - "@blocksuite/blocks": "0.0.0-20231205045113-03964196-nightly", - "@blocksuite/global": "0.0.0-20231205045113-03964196-nightly", + "@blocksuite/blocks": "0.11.0-nightly-202312061456-a5bf73a", + "@blocksuite/global": "0.11.0-nightly-202312061456-a5bf73a", "@blocksuite/icons": "2.1.36", - "@blocksuite/lit": "0.0.0-20231205045113-03964196-nightly", - "@blocksuite/presets": "0.0.0-20231205045113-03964196-nightly", - "@blocksuite/store": "0.0.0-20231205045113-03964196-nightly", + "@blocksuite/lit": "0.11.0-nightly-202312061456-a5bf73a", + "@blocksuite/presets": "0.11.0-nightly-202312061456-a5bf73a", + "@blocksuite/store": "0.11.0-nightly-202312061456-a5bf73a", "@storybook/addon-actions": "^7.5.3", "@storybook/addon-essentials": "^7.5.3", "@storybook/addon-interactions": "^7.5.3", diff --git a/packages/frontend/core/package.json b/packages/frontend/core/package.json index c71e4d9e0c..3c1f3f93d8 100644 --- a/packages/frontend/core/package.json +++ b/packages/frontend/core/package.json @@ -25,14 +25,14 @@ "@affine/i18n": "workspace:*", "@affine/templates": "workspace:*", "@affine/workspace": "workspace:*", - "@blocksuite/block-std": "0.0.0-20231205045113-03964196-nightly", - "@blocksuite/blocks": "0.0.0-20231205045113-03964196-nightly", - "@blocksuite/global": "0.0.0-20231205045113-03964196-nightly", + "@blocksuite/block-std": "0.11.0-nightly-202312061456-a5bf73a", + "@blocksuite/blocks": "0.11.0-nightly-202312061456-a5bf73a", + "@blocksuite/global": "0.11.0-nightly-202312061456-a5bf73a", "@blocksuite/icons": "2.1.36", - "@blocksuite/lit": "0.0.0-20231205045113-03964196-nightly", - "@blocksuite/presets": "0.0.0-20231205045113-03964196-nightly", - "@blocksuite/store": "0.0.0-20231205045113-03964196-nightly", - "@blocksuite/virgo": "0.0.0-20231205045113-03964196-nightly", + "@blocksuite/lit": "0.11.0-nightly-202312061456-a5bf73a", + "@blocksuite/presets": "0.11.0-nightly-202312061456-a5bf73a", + "@blocksuite/store": "0.11.0-nightly-202312061456-a5bf73a", + "@blocksuite/virgo": "0.11.0-nightly-202312061456-a5bf73a", "@dnd-kit/core": "^6.0.8", "@dnd-kit/sortable": "^8.0.0", "@emotion/cache": "^11.11.0", diff --git a/packages/frontend/electron/package.json b/packages/frontend/electron/package.json index 92d2573313..3d3089936b 100644 --- a/packages/frontend/electron/package.json +++ b/packages/frontend/electron/package.json @@ -32,10 +32,10 @@ "@affine/sdk": "workspace:*", "@affine/templates": "workspace:*", "@affine/vue-hello-world-plugin": "workspace:*", - "@blocksuite/blocks": "0.0.0-20231205045113-03964196-nightly", - "@blocksuite/lit": "0.0.0-20231205045113-03964196-nightly", - "@blocksuite/presets": "0.0.0-20231205045113-03964196-nightly", - "@blocksuite/store": "0.0.0-20231205045113-03964196-nightly", + "@blocksuite/blocks": "0.11.0-nightly-202312061456-a5bf73a", + "@blocksuite/lit": "0.11.0-nightly-202312061456-a5bf73a", + "@blocksuite/presets": "0.11.0-nightly-202312061456-a5bf73a", + "@blocksuite/store": "0.11.0-nightly-202312061456-a5bf73a", "@electron-forge/cli": "^7.1.0", "@electron-forge/core": "^7.1.0", "@electron-forge/core-utils": "^7.1.0", diff --git a/packages/frontend/hooks/package.json b/packages/frontend/hooks/package.json index ac38ca7240..98932e3945 100644 --- a/packages/frontend/hooks/package.json +++ b/packages/frontend/hooks/package.json @@ -19,12 +19,12 @@ "devDependencies": { "@affine/debug": "workspace:*", "@affine/env": "workspace:*", - "@blocksuite/block-std": "0.0.0-20231205045113-03964196-nightly", - "@blocksuite/blocks": "0.0.0-20231205045113-03964196-nightly", - "@blocksuite/global": "0.0.0-20231205045113-03964196-nightly", - "@blocksuite/lit": "0.0.0-20231205045113-03964196-nightly", - "@blocksuite/presets": "0.0.0-20231205045113-03964196-nightly", - "@blocksuite/store": "0.0.0-20231205045113-03964196-nightly", + "@blocksuite/block-std": "0.11.0-nightly-202312061456-a5bf73a", + "@blocksuite/blocks": "0.11.0-nightly-202312061456-a5bf73a", + "@blocksuite/global": "0.11.0-nightly-202312061456-a5bf73a", + "@blocksuite/lit": "0.11.0-nightly-202312061456-a5bf73a", + "@blocksuite/presets": "0.11.0-nightly-202312061456-a5bf73a", + "@blocksuite/store": "0.11.0-nightly-202312061456-a5bf73a", "@testing-library/react": "^14.0.0", "@types/image-blob-reduce": "^4.1.3", "@types/lodash.debounce": "^4.0.7", diff --git a/scripts/bump-blocksuite.sh b/scripts/bump-blocksuite.sh index 8d63044bc6..c76ee4feae 100755 --- a/scripts/bump-blocksuite.sh +++ b/scripts/bump-blocksuite.sh @@ -8,4 +8,5 @@ yarn up "@blocksuite/blocks@${LATEST_NIGHTLY}" yarn up "@blocksuite/presets@${LATEST_NIGHTLY}" yarn up "@blocksuite/global@${LATEST_NIGHTLY}" yarn up "@blocksuite/block-std@${LATEST_NIGHTLY}" +yarn up "@blocksuite/lit@${LATEST_NIGHTLY}" yarn up "@blocksuite/virgo@${LATEST_NIGHTLY}" diff --git a/tests/affine-legacy/0.6.1-beta.1/package.json b/tests/affine-legacy/0.6.1-beta.1/package.json index 5b285ceab3..4907ae92a4 100644 --- a/tests/affine-legacy/0.6.1-beta.1/package.json +++ b/tests/affine-legacy/0.6.1-beta.1/package.json @@ -9,10 +9,10 @@ "devDependencies": { "@affine-test/fixtures": "workspace:*", "@affine-test/kit": "workspace:*", - "@blocksuite/block-std": "0.0.0-20231205045113-03964196-nightly", - "@blocksuite/blocks": "0.0.0-20231205045113-03964196-nightly", - "@blocksuite/global": "0.0.0-20231205045113-03964196-nightly", - "@blocksuite/store": "0.0.0-20231205045113-03964196-nightly", + "@blocksuite/block-std": "0.11.0-nightly-202312061456-a5bf73a", + "@blocksuite/blocks": "0.11.0-nightly-202312061456-a5bf73a", + "@blocksuite/global": "0.11.0-nightly-202312061456-a5bf73a", + "@blocksuite/store": "0.11.0-nightly-202312061456-a5bf73a", "@playwright/test": "^1.39.0", "express": "^4.18.2", "http-proxy-middleware": "^3.0.0-beta.1", diff --git a/tests/affine-legacy/0.7.0-canary.18/package.json b/tests/affine-legacy/0.7.0-canary.18/package.json index ca84a213eb..5fab121844 100644 --- a/tests/affine-legacy/0.7.0-canary.18/package.json +++ b/tests/affine-legacy/0.7.0-canary.18/package.json @@ -9,10 +9,10 @@ "devDependencies": { "@affine-test/fixtures": "workspace:*", "@affine-test/kit": "workspace:*", - "@blocksuite/block-std": "0.0.0-20231205045113-03964196-nightly", - "@blocksuite/blocks": "0.0.0-20231205045113-03964196-nightly", - "@blocksuite/global": "0.0.0-20231205045113-03964196-nightly", - "@blocksuite/store": "0.0.0-20231205045113-03964196-nightly", + "@blocksuite/block-std": "0.11.0-nightly-202312061456-a5bf73a", + "@blocksuite/blocks": "0.11.0-nightly-202312061456-a5bf73a", + "@blocksuite/global": "0.11.0-nightly-202312061456-a5bf73a", + "@blocksuite/store": "0.11.0-nightly-202312061456-a5bf73a", "@playwright/test": "^1.39.0", "express": "^4.18.2", "http-proxy-middleware": "^3.0.0-beta.1", diff --git a/tests/affine-legacy/0.8.0-canary.7/package.json b/tests/affine-legacy/0.8.0-canary.7/package.json index 3df0a628bb..f53c3df475 100644 --- a/tests/affine-legacy/0.8.0-canary.7/package.json +++ b/tests/affine-legacy/0.8.0-canary.7/package.json @@ -9,10 +9,10 @@ "devDependencies": { "@affine-test/fixtures": "workspace:*", "@affine-test/kit": "workspace:*", - "@blocksuite/block-std": "0.0.0-20231205045113-03964196-nightly", - "@blocksuite/blocks": "0.0.0-20231205045113-03964196-nightly", - "@blocksuite/global": "0.0.0-20231205045113-03964196-nightly", - "@blocksuite/store": "0.0.0-20231205045113-03964196-nightly", + "@blocksuite/block-std": "0.11.0-nightly-202312061456-a5bf73a", + "@blocksuite/blocks": "0.11.0-nightly-202312061456-a5bf73a", + "@blocksuite/global": "0.11.0-nightly-202312061456-a5bf73a", + "@blocksuite/store": "0.11.0-nightly-202312061456-a5bf73a", "@playwright/test": "^1.39.0", "express": "^4.18.2", "http-proxy-middleware": "^3.0.0-beta.1", diff --git a/tests/affine-legacy/0.8.4/package.json b/tests/affine-legacy/0.8.4/package.json index 780449708a..38a5b757c4 100644 --- a/tests/affine-legacy/0.8.4/package.json +++ b/tests/affine-legacy/0.8.4/package.json @@ -9,10 +9,10 @@ "devDependencies": { "@affine-test/fixtures": "workspace:*", "@affine-test/kit": "workspace:*", - "@blocksuite/block-std": "0.0.0-20231205045113-03964196-nightly", - "@blocksuite/blocks": "0.0.0-20231205045113-03964196-nightly", - "@blocksuite/global": "0.0.0-20231205045113-03964196-nightly", - "@blocksuite/store": "0.0.0-20231205045113-03964196-nightly", + "@blocksuite/block-std": "0.11.0-nightly-202312061456-a5bf73a", + "@blocksuite/blocks": "0.11.0-nightly-202312061456-a5bf73a", + "@blocksuite/global": "0.11.0-nightly-202312061456-a5bf73a", + "@blocksuite/store": "0.11.0-nightly-202312061456-a5bf73a", "@playwright/test": "^1.39.0", "express": "^4.18.2", "http-proxy-middleware": "^3.0.0-beta.1", diff --git a/tests/affine-migration/package.json b/tests/affine-migration/package.json index be1082584f..95abde84b0 100644 --- a/tests/affine-migration/package.json +++ b/tests/affine-migration/package.json @@ -7,10 +7,10 @@ "devDependencies": { "@affine-test/fixtures": "workspace:*", "@affine-test/kit": "workspace:*", - "@blocksuite/block-std": "0.0.0-20231205045113-03964196-nightly", - "@blocksuite/blocks": "0.0.0-20231205045113-03964196-nightly", - "@blocksuite/global": "0.0.0-20231205045113-03964196-nightly", - "@blocksuite/store": "0.0.0-20231205045113-03964196-nightly", + "@blocksuite/block-std": "0.11.0-nightly-202312061456-a5bf73a", + "@blocksuite/blocks": "0.11.0-nightly-202312061456-a5bf73a", + "@blocksuite/global": "0.11.0-nightly-202312061456-a5bf73a", + "@blocksuite/store": "0.11.0-nightly-202312061456-a5bf73a", "@playwright/test": "^1.39.0" }, "version": "0.10.3-canary.2" diff --git a/tests/storybook/package.json b/tests/storybook/package.json index 741ef28f3b..08e5e43096 100644 --- a/tests/storybook/package.json +++ b/tests/storybook/package.json @@ -31,14 +31,14 @@ "wait-on": "^7.2.0" }, "devDependencies": { - "@blocksuite/block-std": "0.0.0-20231205045113-03964196-nightly", - "@blocksuite/blocks": "0.0.0-20231205045113-03964196-nightly", - "@blocksuite/global": "0.0.0-20231205045113-03964196-nightly", + "@blocksuite/block-std": "0.11.0-nightly-202312061456-a5bf73a", + "@blocksuite/blocks": "0.11.0-nightly-202312061456-a5bf73a", + "@blocksuite/global": "0.11.0-nightly-202312061456-a5bf73a", "@blocksuite/icons": "2.1.36", - "@blocksuite/lit": "0.0.0-20231205045113-03964196-nightly", - "@blocksuite/presets": "0.0.0-20231205045113-03964196-nightly", - "@blocksuite/store": "0.0.0-20231205045113-03964196-nightly", - "@blocksuite/virgo": "0.0.0-20231205045113-03964196-nightly", + "@blocksuite/lit": "0.11.0-nightly-202312061456-a5bf73a", + "@blocksuite/presets": "0.11.0-nightly-202312061456-a5bf73a", + "@blocksuite/store": "0.11.0-nightly-202312061456-a5bf73a", + "@blocksuite/virgo": "0.11.0-nightly-202312061456-a5bf73a", "@dnd-kit/sortable": "^8.0.0", "@tomfreudenberg/next-auth-mock": "^0.5.6", "chromatic": "^9.1.0", diff --git a/yarn.lock b/yarn.lock index 6034dbd693..e4c5391079 100644 --- a/yarn.lock +++ b/yarn.lock @@ -25,10 +25,10 @@ __metadata: dependencies: "@affine-test/fixtures": "workspace:*" "@affine-test/kit": "workspace:*" - "@blocksuite/block-std": "npm:0.0.0-20231205045113-03964196-nightly" - "@blocksuite/blocks": "npm:0.0.0-20231205045113-03964196-nightly" - "@blocksuite/global": "npm:0.0.0-20231205045113-03964196-nightly" - "@blocksuite/store": "npm:0.0.0-20231205045113-03964196-nightly" + "@blocksuite/block-std": "npm:0.11.0-nightly-202312061456-a5bf73a" + "@blocksuite/blocks": "npm:0.11.0-nightly-202312061456-a5bf73a" + "@blocksuite/global": "npm:0.11.0-nightly-202312061456-a5bf73a" + "@blocksuite/store": "npm:0.11.0-nightly-202312061456-a5bf73a" "@playwright/test": "npm:^1.39.0" express: "npm:^4.18.2" http-proxy-middleware: "npm:^3.0.0-beta.1" @@ -42,10 +42,10 @@ __metadata: dependencies: "@affine-test/fixtures": "workspace:*" "@affine-test/kit": "workspace:*" - "@blocksuite/block-std": "npm:0.0.0-20231205045113-03964196-nightly" - "@blocksuite/blocks": "npm:0.0.0-20231205045113-03964196-nightly" - "@blocksuite/global": "npm:0.0.0-20231205045113-03964196-nightly" - "@blocksuite/store": "npm:0.0.0-20231205045113-03964196-nightly" + "@blocksuite/block-std": "npm:0.11.0-nightly-202312061456-a5bf73a" + "@blocksuite/blocks": "npm:0.11.0-nightly-202312061456-a5bf73a" + "@blocksuite/global": "npm:0.11.0-nightly-202312061456-a5bf73a" + "@blocksuite/store": "npm:0.11.0-nightly-202312061456-a5bf73a" "@playwright/test": "npm:^1.39.0" express: "npm:^4.18.2" http-proxy-middleware: "npm:^3.0.0-beta.1" @@ -59,10 +59,10 @@ __metadata: dependencies: "@affine-test/fixtures": "workspace:*" "@affine-test/kit": "workspace:*" - "@blocksuite/block-std": "npm:0.0.0-20231205045113-03964196-nightly" - "@blocksuite/blocks": "npm:0.0.0-20231205045113-03964196-nightly" - "@blocksuite/global": "npm:0.0.0-20231205045113-03964196-nightly" - "@blocksuite/store": "npm:0.0.0-20231205045113-03964196-nightly" + "@blocksuite/block-std": "npm:0.11.0-nightly-202312061456-a5bf73a" + "@blocksuite/blocks": "npm:0.11.0-nightly-202312061456-a5bf73a" + "@blocksuite/global": "npm:0.11.0-nightly-202312061456-a5bf73a" + "@blocksuite/store": "npm:0.11.0-nightly-202312061456-a5bf73a" "@playwright/test": "npm:^1.39.0" express: "npm:^4.18.2" http-proxy-middleware: "npm:^3.0.0-beta.1" @@ -76,10 +76,10 @@ __metadata: dependencies: "@affine-test/fixtures": "workspace:*" "@affine-test/kit": "workspace:*" - "@blocksuite/block-std": "npm:0.0.0-20231205045113-03964196-nightly" - "@blocksuite/blocks": "npm:0.0.0-20231205045113-03964196-nightly" - "@blocksuite/global": "npm:0.0.0-20231205045113-03964196-nightly" - "@blocksuite/store": "npm:0.0.0-20231205045113-03964196-nightly" + "@blocksuite/block-std": "npm:0.11.0-nightly-202312061456-a5bf73a" + "@blocksuite/blocks": "npm:0.11.0-nightly-202312061456-a5bf73a" + "@blocksuite/global": "npm:0.11.0-nightly-202312061456-a5bf73a" + "@blocksuite/store": "npm:0.11.0-nightly-202312061456-a5bf73a" "@playwright/test": "npm:^1.39.0" express: "npm:^4.18.2" http-proxy-middleware: "npm:^3.0.0-beta.1" @@ -138,10 +138,10 @@ __metadata: dependencies: "@affine-test/fixtures": "workspace:*" "@affine-test/kit": "workspace:*" - "@blocksuite/block-std": "npm:0.0.0-20231205045113-03964196-nightly" - "@blocksuite/blocks": "npm:0.0.0-20231205045113-03964196-nightly" - "@blocksuite/global": "npm:0.0.0-20231205045113-03964196-nightly" - "@blocksuite/store": "npm:0.0.0-20231205045113-03964196-nightly" + "@blocksuite/block-std": "npm:0.11.0-nightly-202312061456-a5bf73a" + "@blocksuite/blocks": "npm:0.11.0-nightly-202312061456-a5bf73a" + "@blocksuite/global": "npm:0.11.0-nightly-202312061456-a5bf73a" + "@blocksuite/store": "npm:0.11.0-nightly-202312061456-a5bf73a" "@playwright/test": "npm:^1.39.0" languageName: unknown linkType: soft @@ -222,12 +222,12 @@ __metadata: "@affine/graphql": "workspace:*" "@affine/i18n": "workspace:*" "@affine/workspace": "workspace:*" - "@blocksuite/blocks": "npm:0.0.0-20231205045113-03964196-nightly" - "@blocksuite/global": "npm:0.0.0-20231205045113-03964196-nightly" + "@blocksuite/blocks": "npm:0.11.0-nightly-202312061456-a5bf73a" + "@blocksuite/global": "npm:0.11.0-nightly-202312061456-a5bf73a" "@blocksuite/icons": "npm:2.1.36" - "@blocksuite/lit": "npm:0.0.0-20231205045113-03964196-nightly" - "@blocksuite/presets": "npm:0.0.0-20231205045113-03964196-nightly" - "@blocksuite/store": "npm:0.0.0-20231205045113-03964196-nightly" + "@blocksuite/lit": "npm:0.11.0-nightly-202312061456-a5bf73a" + "@blocksuite/presets": "npm:0.11.0-nightly-202312061456-a5bf73a" + "@blocksuite/store": "npm:0.11.0-nightly-202312061456-a5bf73a" "@dnd-kit/core": "npm:^6.0.8" "@dnd-kit/modifiers": "npm:^7.0.0" "@dnd-kit/sortable": "npm:^8.0.0" @@ -350,14 +350,14 @@ __metadata: "@affine/templates": "workspace:*" "@affine/workspace": "workspace:*" "@aws-sdk/client-s3": "npm:3.433.0" - "@blocksuite/block-std": "npm:0.0.0-20231205045113-03964196-nightly" - "@blocksuite/blocks": "npm:0.0.0-20231205045113-03964196-nightly" - "@blocksuite/global": "npm:0.0.0-20231205045113-03964196-nightly" + "@blocksuite/block-std": "npm:0.11.0-nightly-202312061456-a5bf73a" + "@blocksuite/blocks": "npm:0.11.0-nightly-202312061456-a5bf73a" + "@blocksuite/global": "npm:0.11.0-nightly-202312061456-a5bf73a" "@blocksuite/icons": "npm:2.1.36" - "@blocksuite/lit": "npm:0.0.0-20231205045113-03964196-nightly" - "@blocksuite/presets": "npm:0.0.0-20231205045113-03964196-nightly" - "@blocksuite/store": "npm:0.0.0-20231205045113-03964196-nightly" - "@blocksuite/virgo": "npm:0.0.0-20231205045113-03964196-nightly" + "@blocksuite/lit": "npm:0.11.0-nightly-202312061456-a5bf73a" + "@blocksuite/presets": "npm:0.11.0-nightly-202312061456-a5bf73a" + "@blocksuite/store": "npm:0.11.0-nightly-202312061456-a5bf73a" + "@blocksuite/virgo": "npm:0.11.0-nightly-202312061456-a5bf73a" "@dnd-kit/core": "npm:^6.0.8" "@dnd-kit/sortable": "npm:^8.0.0" "@emotion/cache": "npm:^11.11.0" @@ -463,10 +463,10 @@ __metadata: "@affine/sdk": "workspace:*" "@affine/templates": "workspace:*" "@affine/vue-hello-world-plugin": "workspace:*" - "@blocksuite/blocks": "npm:0.0.0-20231205045113-03964196-nightly" - "@blocksuite/lit": "npm:0.0.0-20231205045113-03964196-nightly" - "@blocksuite/presets": "npm:0.0.0-20231205045113-03964196-nightly" - "@blocksuite/store": "npm:0.0.0-20231205045113-03964196-nightly" + "@blocksuite/blocks": "npm:0.11.0-nightly-202312061456-a5bf73a" + "@blocksuite/lit": "npm:0.11.0-nightly-202312061456-a5bf73a" + "@blocksuite/presets": "npm:0.11.0-nightly-202312061456-a5bf73a" + "@blocksuite/store": "npm:0.11.0-nightly-202312061456-a5bf73a" "@electron-forge/cli": "npm:^7.1.0" "@electron-forge/core": "npm:^7.1.0" "@electron-forge/core-utils": "npm:^7.1.0" @@ -514,8 +514,8 @@ __metadata: version: 0.0.0-use.local resolution: "@affine/env@workspace:packages/common/env" dependencies: - "@blocksuite/global": "npm:0.0.0-20231205045113-03964196-nightly" - "@blocksuite/store": "npm:0.0.0-20231205045113-03964196-nightly" + "@blocksuite/global": "npm:0.11.0-nightly-202312061456-a5bf73a" + "@blocksuite/store": "npm:0.11.0-nightly-202312061456-a5bf73a" lit: "npm:^3.0.2" react: "npm:18.2.0" react-dom: "npm:18.2.0" @@ -707,11 +707,11 @@ __metadata: version: 0.0.0-use.local resolution: "@affine/sdk@workspace:packages/common/sdk" dependencies: - "@blocksuite/block-std": "npm:0.0.0-20231205045113-03964196-nightly" - "@blocksuite/blocks": "npm:0.0.0-20231205045113-03964196-nightly" - "@blocksuite/global": "npm:0.0.0-20231205045113-03964196-nightly" - "@blocksuite/presets": "npm:0.0.0-20231205045113-03964196-nightly" - "@blocksuite/store": "npm:0.0.0-20231205045113-03964196-nightly" + "@blocksuite/block-std": "npm:0.11.0-nightly-202312061456-a5bf73a" + "@blocksuite/blocks": "npm:0.11.0-nightly-202312061456-a5bf73a" + "@blocksuite/global": "npm:0.11.0-nightly-202312061456-a5bf73a" + "@blocksuite/presets": "npm:0.11.0-nightly-202312061456-a5bf73a" + "@blocksuite/store": "npm:0.11.0-nightly-202312061456-a5bf73a" jotai: "npm:^2.5.1" vite: "npm:^4.4.11" vite-plugin-dts: "npm:3.6.0" @@ -835,14 +835,14 @@ __metadata: dependencies: "@affine/component": "workspace:*" "@affine/i18n": "workspace:*" - "@blocksuite/block-std": "npm:0.0.0-20231205045113-03964196-nightly" - "@blocksuite/blocks": "npm:0.0.0-20231205045113-03964196-nightly" - "@blocksuite/global": "npm:0.0.0-20231205045113-03964196-nightly" + "@blocksuite/block-std": "npm:0.11.0-nightly-202312061456-a5bf73a" + "@blocksuite/blocks": "npm:0.11.0-nightly-202312061456-a5bf73a" + "@blocksuite/global": "npm:0.11.0-nightly-202312061456-a5bf73a" "@blocksuite/icons": "npm:2.1.36" - "@blocksuite/lit": "npm:0.0.0-20231205045113-03964196-nightly" - "@blocksuite/presets": "npm:0.0.0-20231205045113-03964196-nightly" - "@blocksuite/store": "npm:0.0.0-20231205045113-03964196-nightly" - "@blocksuite/virgo": "npm:0.0.0-20231205045113-03964196-nightly" + "@blocksuite/lit": "npm:0.11.0-nightly-202312061456-a5bf73a" + "@blocksuite/presets": "npm:0.11.0-nightly-202312061456-a5bf73a" + "@blocksuite/store": "npm:0.11.0-nightly-202312061456-a5bf73a" + "@blocksuite/virgo": "npm:0.11.0-nightly-202312061456-a5bf73a" "@dnd-kit/sortable": "npm:^8.0.0" "@storybook/addon-actions": "npm:^7.5.3" "@storybook/addon-essentials": "npm:^7.5.3" @@ -4083,41 +4083,41 @@ __metadata: languageName: node linkType: hard -"@blocksuite/block-std@npm:0.0.0-20231205045113-03964196-nightly": - version: 0.0.0-20231205045113-03964196-nightly - resolution: "@blocksuite/block-std@npm:0.0.0-20231205045113-03964196-nightly" +"@blocksuite/block-std@npm:0.11.0-nightly-202312061456-a5bf73a": + version: 0.11.0-nightly-202312061456-a5bf73a + resolution: "@blocksuite/block-std@npm:0.11.0-nightly-202312061456-a5bf73a" dependencies: - "@blocksuite/global": "npm:0.0.0-20231205045113-03964196-nightly" + "@blocksuite/global": "npm:0.11.0-nightly-202312061456-a5bf73a" lz-string: "npm:^1.5.0" w3c-keyname: "npm:^2.2.8" zod: "npm:^3.22.4" peerDependencies: - "@blocksuite/store": 0.0.0-20231205045113-03964196-nightly - checksum: bfe59fa67bc37f5fafdb57b0a59bd4e94858cfe6939cb7ca556c92944e3c59486fd832103510c490583354138d5d82f00823ad74803d8c223ebe3f4c035b30f7 + "@blocksuite/store": 0.11.0-nightly-202312061456-a5bf73a + checksum: c03a4f84ce6c4d90af35ebe73222e0a8014642bf6e0b86d9ba5d1566dfa986ffe87b6a0ca4568217a50def081d8cb44699501bb280e4dd6169a073b70b826737 languageName: node linkType: hard -"@blocksuite/blocks@npm:0.0.0-20231205045113-03964196-nightly": - version: 0.0.0-20231205045113-03964196-nightly - resolution: "@blocksuite/blocks@npm:0.0.0-20231205045113-03964196-nightly" +"@blocksuite/blocks@npm:0.11.0-nightly-202312061456-a5bf73a": + version: 0.11.0-nightly-202312061456-a5bf73a + resolution: "@blocksuite/blocks@npm:0.11.0-nightly-202312061456-a5bf73a" dependencies: - "@blocksuite/block-std": "npm:0.0.0-20231205045113-03964196-nightly" - "@blocksuite/global": "npm:0.0.0-20231205045113-03964196-nightly" - "@blocksuite/lit": "npm:0.0.0-20231205045113-03964196-nightly" - "@blocksuite/store": "npm:0.0.0-20231205045113-03964196-nightly" - "@blocksuite/virgo": "npm:0.0.0-20231205045113-03964196-nightly" + "@blocksuite/block-std": "npm:0.11.0-nightly-202312061456-a5bf73a" + "@blocksuite/global": "npm:0.11.0-nightly-202312061456-a5bf73a" + "@blocksuite/lit": "npm:0.11.0-nightly-202312061456-a5bf73a" + "@blocksuite/store": "npm:0.11.0-nightly-202312061456-a5bf73a" + "@blocksuite/virgo": "npm:0.11.0-nightly-202312061456-a5bf73a" "@floating-ui/dom": "npm:^1.5.3" "@toeverything/theme": "npm:^0.7.27" "@types/hast": "npm:^3.0.3" - "@types/mdast": "npm:^4.0.2" - "@types/webfontloader": "npm:^1.6.36" + "@types/mdast": "npm:^4.0.3" + "@types/webfontloader": "npm:^1.6.38" buffer: "npm:^6.0.3" date-fns: "npm:^2.30.0" file-type: "npm:^16.5.4" fractional-indexing: "npm:^3.2.0" html2canvas: "npm:^1.4.1" jszip: "npm:^3.10.1" - lit: "npm:^3.0.2" + lit: "npm:^3.1.0" marked: "npm:^4.3.0" mdast-util-gfm-autolink-literal: "npm:^2.0.0" mdast-util-gfm-strikethrough: "npm:^2.0.0" @@ -4128,27 +4128,27 @@ __metadata: micromark-extension-gfm-table: "npm:^2.0.0" micromark-extension-gfm-task-list-item: "npm:^2.0.1" micromark-util-combine-extensions: "npm:^2.0.0" - nanoid: "npm:^5.0.3" + nanoid: "npm:^5.0.4" pdf-lib: "npm:^1.17.1" rehype-parse: "npm:^9.0.0" rehype-stringify: "npm:^10.0.0" remark-parse: "npm:^11.0.0" remark-stringify: "npm:^11.0.0" shiki: "npm:^0.14.5" - sortablejs: "npm:^1.15.0" + sortablejs: "npm:^1.15.1" unified: "npm:^11.0.4" webfontloader: "npm:^1.6.28" zod: "npm:^3.22.4" - checksum: 3b3fc3cd3ddc7cc0bf9b064ce804788e8fae66f9034008a73bfa8565fe1e9123c16af2582de3a28a343e1915ee11c0dccca8eb4bbde5732df1a4dafda0b3ed6d + checksum: 6e9c53557db308e504479dbabadabf8240edcbc4d8bd71936b352d276de199e4b3528ed047fffe25874a814c5d814f5b054e30cde2e717377c4ea1e52430ac47 languageName: node linkType: hard -"@blocksuite/global@npm:0.0.0-20231205045113-03964196-nightly": - version: 0.0.0-20231205045113-03964196-nightly - resolution: "@blocksuite/global@npm:0.0.0-20231205045113-03964196-nightly" +"@blocksuite/global@npm:0.11.0-nightly-202312061456-a5bf73a": + version: 0.11.0-nightly-202312061456-a5bf73a + resolution: "@blocksuite/global@npm:0.11.0-nightly-202312061456-a5bf73a" dependencies: zod: "npm:^3.22.4" - checksum: e676b8ab6d7207cc5781bd7d3b1b31809d70bd7a0662f876479206cc45f6ecb54beff7839e9d30981e9af475aa9f5b33e8721927cae0ab1bd6af22d8f398f698 + checksum: ef45d0a8a2bff4b1ccb62dbd211de2e72cba26bc4a7e01c1f47de9b74970955cad8abf0a9ebe88ba3e6fde36fe198d72b9a3ed557e929b178aa22dd9861f94be languageName: node linkType: hard @@ -4162,66 +4162,66 @@ __metadata: languageName: node linkType: hard -"@blocksuite/lit@npm:0.0.0-20231205045113-03964196-nightly": - version: 0.0.0-20231205045113-03964196-nightly - resolution: "@blocksuite/lit@npm:0.0.0-20231205045113-03964196-nightly" +"@blocksuite/lit@npm:0.11.0-nightly-202312061456-a5bf73a": + version: 0.11.0-nightly-202312061456-a5bf73a + resolution: "@blocksuite/lit@npm:0.11.0-nightly-202312061456-a5bf73a" dependencies: - "@blocksuite/global": "npm:0.0.0-20231205045113-03964196-nightly" - "@blocksuite/virgo": "npm:0.0.0-20231205045113-03964196-nightly" - lit: "npm:^3.0.2" + "@blocksuite/global": "npm:0.11.0-nightly-202312061456-a5bf73a" + "@blocksuite/virgo": "npm:0.11.0-nightly-202312061456-a5bf73a" + lit: "npm:^3.1.0" peerDependencies: - "@blocksuite/block-std": 0.0.0-20231205045113-03964196-nightly - "@blocksuite/store": 0.0.0-20231205045113-03964196-nightly - checksum: a055dfb8ec205af791f6589a8f44b642975b7637d6fe26d8c79b5abfe748dd5ee1381a4519b966fc2b1d9a97003f25e0a00fd47da60cf827f40b045be4ed03c2 + "@blocksuite/block-std": 0.11.0-nightly-202312061456-a5bf73a + "@blocksuite/store": 0.11.0-nightly-202312061456-a5bf73a + checksum: 7741c4046aceeb37a2aa4367972efbe977149ffcb58f635e398ee9cd9c580d48db730f46d39ab6d12844f690fc5c6b159e05fd1595024ed3367f3b15992c6860 languageName: node linkType: hard -"@blocksuite/presets@npm:0.0.0-20231205045113-03964196-nightly": - version: 0.0.0-20231205045113-03964196-nightly - resolution: "@blocksuite/presets@npm:0.0.0-20231205045113-03964196-nightly" +"@blocksuite/presets@npm:0.11.0-nightly-202312061456-a5bf73a": + version: 0.11.0-nightly-202312061456-a5bf73a + resolution: "@blocksuite/presets@npm:0.11.0-nightly-202312061456-a5bf73a" dependencies: - "@blocksuite/blocks": "npm:0.0.0-20231205045113-03964196-nightly" - "@blocksuite/global": "npm:0.0.0-20231205045113-03964196-nightly" - "@blocksuite/lit": "npm:0.0.0-20231205045113-03964196-nightly" - "@blocksuite/store": "npm:0.0.0-20231205045113-03964196-nightly" + "@blocksuite/blocks": "npm:0.11.0-nightly-202312061456-a5bf73a" + "@blocksuite/global": "npm:0.11.0-nightly-202312061456-a5bf73a" + "@blocksuite/lit": "npm:0.11.0-nightly-202312061456-a5bf73a" + "@blocksuite/store": "npm:0.11.0-nightly-202312061456-a5bf73a" "@toeverything/theme": "npm:^0.7.27" - lit: "npm:^3.0.2" - checksum: 87369243342c96070c99eb11e9e0ca880e851ad67a8bedc6cf26c58f3bd9a554fcf471c7edca3f54b44eb60baa3bfc1b4fcaf475b4d94f836f0cb75b4bec0e96 + lit: "npm:^3.1.0" + checksum: dd7cc666b49f0fff76e8537d13f175c122a3c0a0210b6411b88252ea595112f582fae887c7c1c9088f86ebba94aa590cda38f933f079bfc6c5baa9d3763eb320 languageName: node linkType: hard -"@blocksuite/store@npm:0.0.0-20231205045113-03964196-nightly": - version: 0.0.0-20231205045113-03964196-nightly - resolution: "@blocksuite/store@npm:0.0.0-20231205045113-03964196-nightly" +"@blocksuite/store@npm:0.11.0-nightly-202312061456-a5bf73a": + version: 0.11.0-nightly-202312061456-a5bf73a + resolution: "@blocksuite/store@npm:0.11.0-nightly-202312061456-a5bf73a" dependencies: - "@blocksuite/global": "npm:0.0.0-20231205045113-03964196-nightly" - "@blocksuite/virgo": "npm:0.0.0-20231205045113-03964196-nightly" + "@blocksuite/global": "npm:0.11.0-nightly-202312061456-a5bf73a" + "@blocksuite/virgo": "npm:0.11.0-nightly-202312061456-a5bf73a" "@types/flexsearch": "npm:^0.7.3" flexsearch: "npm:0.7.21" idb-keyval: "npm:^6.2.1" - lib0: "npm:^0.2.87" + lib0: "npm:^0.2.88" merge: "npm:^2.1.1" minimatch: "npm:^9.0.3" - nanoid: "npm:^5.0.3" + nanoid: "npm:^5.0.4" y-protocols: "npm:^1.0.6" zod: "npm:^3.22.4" peerDependencies: async-call-rpc: ^6 yjs: ^13 - checksum: 5763df05b5516c1c02d65621fede517602ac50145adb4ceed3e573f6b8c72f5010861fdc916028c75b1b9b5367dc0345f489d954c25ccc2f792574a6e15eaeee + checksum: 04e8a643d20afbdeea9deaabf1242f10264ce95c20b73833710f45239b6082a9aca2b418c29bbb6f33d2c1374db706c6dd63ea90d8aa56b59780b8cba3a00d13 languageName: node linkType: hard -"@blocksuite/virgo@npm:0.0.0-20231205045113-03964196-nightly": - version: 0.0.0-20231205045113-03964196-nightly - resolution: "@blocksuite/virgo@npm:0.0.0-20231205045113-03964196-nightly" +"@blocksuite/virgo@npm:0.11.0-nightly-202312061456-a5bf73a": + version: 0.11.0-nightly-202312061456-a5bf73a + resolution: "@blocksuite/virgo@npm:0.11.0-nightly-202312061456-a5bf73a" dependencies: - "@blocksuite/global": "npm:0.0.0-20231205045113-03964196-nightly" + "@blocksuite/global": "npm:0.11.0-nightly-202312061456-a5bf73a" zod: "npm:^3.22.4" peerDependencies: lit: ^3.0.2 yjs: ^13 - checksum: befba6e7784e87fc37548a8b6f1203af5959fa0c8477e6dae8222c46726942bbdf5d931c0fc66f87794f20b9354d1e40fe0df5710090d03e5c02d9392050a34a + checksum: bfcf654f243ecc6846c2f291cd89752c23391bb8d336ba49f825acb7927d50510093185b87fa47b4df3b8b343e53e0f473dfa2147e2a62a3a8abacfbb963217a languageName: node linkType: hard @@ -13658,12 +13658,12 @@ __metadata: dependencies: "@affine/debug": "workspace:*" "@affine/env": "workspace:*" - "@blocksuite/block-std": "npm:0.0.0-20231205045113-03964196-nightly" - "@blocksuite/blocks": "npm:0.0.0-20231205045113-03964196-nightly" - "@blocksuite/global": "npm:0.0.0-20231205045113-03964196-nightly" - "@blocksuite/lit": "npm:0.0.0-20231205045113-03964196-nightly" - "@blocksuite/presets": "npm:0.0.0-20231205045113-03964196-nightly" - "@blocksuite/store": "npm:0.0.0-20231205045113-03964196-nightly" + "@blocksuite/block-std": "npm:0.11.0-nightly-202312061456-a5bf73a" + "@blocksuite/blocks": "npm:0.11.0-nightly-202312061456-a5bf73a" + "@blocksuite/global": "npm:0.11.0-nightly-202312061456-a5bf73a" + "@blocksuite/lit": "npm:0.11.0-nightly-202312061456-a5bf73a" + "@blocksuite/presets": "npm:0.11.0-nightly-202312061456-a5bf73a" + "@blocksuite/store": "npm:0.11.0-nightly-202312061456-a5bf73a" "@testing-library/react": "npm:^14.0.0" "@types/image-blob-reduce": "npm:^4.1.3" "@types/lodash.debounce": "npm:^4.0.7" @@ -13711,11 +13711,11 @@ __metadata: "@affine-test/fixtures": "workspace:*" "@affine/sdk": "workspace:*" "@affine/templates": "workspace:*" - "@blocksuite/blocks": "npm:0.0.0-20231205045113-03964196-nightly" - "@blocksuite/global": "npm:0.0.0-20231205045113-03964196-nightly" - "@blocksuite/lit": "npm:0.0.0-20231205045113-03964196-nightly" - "@blocksuite/presets": "npm:0.0.0-20231205045113-03964196-nightly" - "@blocksuite/store": "npm:0.0.0-20231205045113-03964196-nightly" + "@blocksuite/blocks": "npm:0.11.0-nightly-202312061456-a5bf73a" + "@blocksuite/global": "npm:0.11.0-nightly-202312061456-a5bf73a" + "@blocksuite/lit": "npm:0.11.0-nightly-202312061456-a5bf73a" + "@blocksuite/presets": "npm:0.11.0-nightly-202312061456-a5bf73a" + "@blocksuite/store": "npm:0.11.0-nightly-202312061456-a5bf73a" "@testing-library/react": "npm:^14.0.0" async-call-rpc: "npm:^6.3.1" electron: "link:../../frontend/electron/node_modules/electron" @@ -13764,8 +13764,8 @@ __metadata: version: 0.0.0-use.local resolution: "@toeverything/y-indexeddb@workspace:packages/common/y-indexeddb" dependencies: - "@blocksuite/blocks": "npm:0.0.0-20231205045113-03964196-nightly" - "@blocksuite/store": "npm:0.0.0-20231205045113-03964196-nightly" + "@blocksuite/blocks": "npm:0.11.0-nightly-202312061456-a5bf73a" + "@blocksuite/store": "npm:0.11.0-nightly-202312061456-a5bf73a" fake-indexeddb: "npm:^5.0.0" idb: "npm:^8.0.0" nanoid: "npm:^5.0.3" @@ -14505,7 +14505,7 @@ __metadata: languageName: node linkType: hard -"@types/mdast@npm:^4.0.0, @types/mdast@npm:^4.0.2": +"@types/mdast@npm:^4.0.0, @types/mdast@npm:^4.0.3": version: 4.0.3 resolution: "@types/mdast@npm:4.0.3" dependencies: @@ -14907,7 +14907,7 @@ __metadata: languageName: node linkType: hard -"@types/webfontloader@npm:^1.6.36": +"@types/webfontloader@npm:^1.6.38": version: 1.6.38 resolution: "@types/webfontloader@npm:1.6.38" checksum: 2be3d1e43837ddeea8ea0390d0952fc735abc6d713b2b87843ad0a6d4acd6628b2ce8f0280ec81d48144a23e358d1bd22c16e4717cc8d67f75c1cd1ddc2d0f27 @@ -26067,7 +26067,7 @@ __metadata: languageName: node linkType: hard -"lib0@npm:^0.2.74, lib0@npm:^0.2.85, lib0@npm:^0.2.86, lib0@npm:^0.2.87": +"lib0@npm:^0.2.74, lib0@npm:^0.2.85, lib0@npm:^0.2.86, lib0@npm:^0.2.87, lib0@npm:^0.2.88": version: 0.2.88 resolution: "lib0@npm:0.2.88" dependencies: @@ -26233,7 +26233,7 @@ __metadata: languageName: node linkType: hard -"lit@npm:^3.0.2": +"lit@npm:^3.0.2, lit@npm:^3.1.0": version: 3.1.0 resolution: "lit@npm:3.1.0" dependencies: @@ -28639,6 +28639,15 @@ __metadata: languageName: node linkType: hard +"nanoid@npm:^5.0.4": + version: 5.0.4 + resolution: "nanoid@npm:5.0.4" + bin: + nanoid: bin/nanoid.js + checksum: cf09cca3774f3147100948f7478f75f4c9ee97a4af65c328dd9abbd83b12f8bb35cf9f89a21c330f3b759d667a4cd0140ed84aa5fdd522c61e0d341aeaa7fb6f + languageName: node + linkType: hard + "natural-compare@npm:^1.4.0": version: 1.4.0 resolution: "natural-compare@npm:1.4.0" @@ -33274,10 +33283,10 @@ __metadata: languageName: node linkType: hard -"sortablejs@npm:^1.15.0": - version: 1.15.0 - resolution: "sortablejs@npm:1.15.0" - checksum: f93a8e2f34b9fced858d09056fe9da55b022d51401cddee652b19449be99ce7b4e42f3bfad926d7e2a34ac4ca681296c5ba129f33ddbd4fc1f69c04af741049d +"sortablejs@npm:^1.15.1": + version: 1.15.1 + resolution: "sortablejs@npm:1.15.1" + checksum: c4ccbc60e7936321eee0e07448e04b1f4481fed727ed1ace86866f49f9929e3acda2b7b825894e7ece5b8bc41f3c135eb4d00d09a287de1ee896d8256a0a84df languageName: node linkType: hard @@ -36820,7 +36829,7 @@ __metadata: version: 0.0.0-use.local resolution: "y-provider@workspace:packages/common/y-provider" dependencies: - "@blocksuite/store": "npm:0.0.0-20231205045113-03964196-nightly" + "@blocksuite/store": "npm:0.11.0-nightly-202312061456-a5bf73a" vite: "npm:^4.4.11" vite-plugin-dts: "npm:3.6.0" vitest: "npm:0.34.6" From d507c245708f0eeb6ca1fa322d1cb51504eb3cbf Mon Sep 17 00:00:00 2001 From: Yifeng Wang Date: Thu, 7 Dec 2023 19:28:49 +0800 Subject: [PATCH 43/68] feat: bump blocksuite (#5228) --- packages/common/env/package.json | 4 +- packages/common/infra/package.json | 10 +- packages/common/sdk/package.json | 10 +- packages/common/y-indexeddb/package.json | 4 +- packages/common/y-provider/package.json | 2 +- packages/frontend/component/package.json | 10 +- packages/frontend/core/package.json | 14 +- packages/frontend/electron/package.json | 8 +- packages/frontend/hooks/package.json | 12 +- tests/affine-legacy/0.6.1-beta.1/package.json | 8 +- .../0.7.0-canary.18/package.json | 8 +- .../affine-legacy/0.8.0-canary.7/package.json | 8 +- tests/affine-legacy/0.8.4/package.json | 8 +- tests/affine-migration/package.json | 8 +- tests/storybook/package.json | 14 +- yarn.lock | 220 +++++++++--------- 16 files changed, 174 insertions(+), 174 deletions(-) diff --git a/packages/common/env/package.json b/packages/common/env/package.json index 1ffa0ab71f..439d80bf89 100644 --- a/packages/common/env/package.json +++ b/packages/common/env/package.json @@ -3,8 +3,8 @@ "private": true, "type": "module", "devDependencies": { - "@blocksuite/global": "0.11.0-nightly-202312061456-a5bf73a", - "@blocksuite/store": "0.11.0-nightly-202312061456-a5bf73a", + "@blocksuite/global": "0.11.0-nightly-202312070955-2b5bb47", + "@blocksuite/store": "0.11.0-nightly-202312070955-2b5bb47", "react": "18.2.0", "react-dom": "18.2.0", "vitest": "0.34.6", diff --git a/packages/common/infra/package.json b/packages/common/infra/package.json index bf84e90992..e783cc5504 100644 --- a/packages/common/infra/package.json +++ b/packages/common/infra/package.json @@ -55,9 +55,9 @@ }, "dependencies": { "@affine/sdk": "workspace:*", - "@blocksuite/blocks": "0.11.0-nightly-202312061456-a5bf73a", - "@blocksuite/global": "0.11.0-nightly-202312061456-a5bf73a", - "@blocksuite/store": "0.11.0-nightly-202312061456-a5bf73a", + "@blocksuite/blocks": "0.11.0-nightly-202312070955-2b5bb47", + "@blocksuite/global": "0.11.0-nightly-202312070955-2b5bb47", + "@blocksuite/store": "0.11.0-nightly-202312070955-2b5bb47", "jotai": "^2.5.1", "jotai-effect": "^0.2.3", "tinykeys": "^2.1.0", @@ -66,8 +66,8 @@ "devDependencies": { "@affine-test/fixtures": "workspace:*", "@affine/templates": "workspace:*", - "@blocksuite/lit": "0.11.0-nightly-202312061456-a5bf73a", - "@blocksuite/presets": "0.11.0-nightly-202312061456-a5bf73a", + "@blocksuite/lit": "0.11.0-nightly-202312070955-2b5bb47", + "@blocksuite/presets": "0.11.0-nightly-202312070955-2b5bb47", "@testing-library/react": "^14.0.0", "async-call-rpc": "^6.3.1", "electron": "link:../../frontend/electron/node_modules/electron", diff --git a/packages/common/sdk/package.json b/packages/common/sdk/package.json index 3c1fed85ef..9221f906be 100644 --- a/packages/common/sdk/package.json +++ b/packages/common/sdk/package.json @@ -22,11 +22,11 @@ "dist" ], "dependencies": { - "@blocksuite/block-std": "0.11.0-nightly-202312061456-a5bf73a", - "@blocksuite/blocks": "0.11.0-nightly-202312061456-a5bf73a", - "@blocksuite/global": "0.11.0-nightly-202312061456-a5bf73a", - "@blocksuite/presets": "0.11.0-nightly-202312061456-a5bf73a", - "@blocksuite/store": "0.11.0-nightly-202312061456-a5bf73a", + "@blocksuite/block-std": "0.11.0-nightly-202312070955-2b5bb47", + "@blocksuite/blocks": "0.11.0-nightly-202312070955-2b5bb47", + "@blocksuite/global": "0.11.0-nightly-202312070955-2b5bb47", + "@blocksuite/presets": "0.11.0-nightly-202312070955-2b5bb47", + "@blocksuite/store": "0.11.0-nightly-202312070955-2b5bb47", "jotai": "^2.5.1", "zod": "^3.22.4" }, diff --git a/packages/common/y-indexeddb/package.json b/packages/common/y-indexeddb/package.json index dafedf78b8..57359f9f33 100644 --- a/packages/common/y-indexeddb/package.json +++ b/packages/common/y-indexeddb/package.json @@ -37,8 +37,8 @@ "y-provider": "workspace:*" }, "devDependencies": { - "@blocksuite/blocks": "0.11.0-nightly-202312061456-a5bf73a", - "@blocksuite/store": "0.11.0-nightly-202312061456-a5bf73a", + "@blocksuite/blocks": "0.11.0-nightly-202312070955-2b5bb47", + "@blocksuite/store": "0.11.0-nightly-202312070955-2b5bb47", "fake-indexeddb": "^5.0.0", "vite": "^4.4.11", "vite-plugin-dts": "3.6.0", diff --git a/packages/common/y-provider/package.json b/packages/common/y-provider/package.json index acfb9f1ba7..fcdd780ccd 100644 --- a/packages/common/y-provider/package.json +++ b/packages/common/y-provider/package.json @@ -24,7 +24,7 @@ "build": "vite build" }, "devDependencies": { - "@blocksuite/store": "0.11.0-nightly-202312061456-a5bf73a", + "@blocksuite/store": "0.11.0-nightly-202312070955-2b5bb47", "vite": "^4.4.11", "vite-plugin-dts": "3.6.0", "vitest": "0.34.6", diff --git a/packages/frontend/component/package.json b/packages/frontend/component/package.json index 692459d091..62289f3a16 100644 --- a/packages/frontend/component/package.json +++ b/packages/frontend/component/package.json @@ -71,12 +71,12 @@ "uuid": "^9.0.1" }, "devDependencies": { - "@blocksuite/blocks": "0.11.0-nightly-202312061456-a5bf73a", - "@blocksuite/global": "0.11.0-nightly-202312061456-a5bf73a", + "@blocksuite/blocks": "0.11.0-nightly-202312070955-2b5bb47", + "@blocksuite/global": "0.11.0-nightly-202312070955-2b5bb47", "@blocksuite/icons": "2.1.36", - "@blocksuite/lit": "0.11.0-nightly-202312061456-a5bf73a", - "@blocksuite/presets": "0.11.0-nightly-202312061456-a5bf73a", - "@blocksuite/store": "0.11.0-nightly-202312061456-a5bf73a", + "@blocksuite/lit": "0.11.0-nightly-202312070955-2b5bb47", + "@blocksuite/presets": "0.11.0-nightly-202312070955-2b5bb47", + "@blocksuite/store": "0.11.0-nightly-202312070955-2b5bb47", "@storybook/addon-actions": "^7.5.3", "@storybook/addon-essentials": "^7.5.3", "@storybook/addon-interactions": "^7.5.3", diff --git a/packages/frontend/core/package.json b/packages/frontend/core/package.json index 3c1f3f93d8..feda06b5fb 100644 --- a/packages/frontend/core/package.json +++ b/packages/frontend/core/package.json @@ -25,14 +25,14 @@ "@affine/i18n": "workspace:*", "@affine/templates": "workspace:*", "@affine/workspace": "workspace:*", - "@blocksuite/block-std": "0.11.0-nightly-202312061456-a5bf73a", - "@blocksuite/blocks": "0.11.0-nightly-202312061456-a5bf73a", - "@blocksuite/global": "0.11.0-nightly-202312061456-a5bf73a", + "@blocksuite/block-std": "0.11.0-nightly-202312070955-2b5bb47", + "@blocksuite/blocks": "0.11.0-nightly-202312070955-2b5bb47", + "@blocksuite/global": "0.11.0-nightly-202312070955-2b5bb47", "@blocksuite/icons": "2.1.36", - "@blocksuite/lit": "0.11.0-nightly-202312061456-a5bf73a", - "@blocksuite/presets": "0.11.0-nightly-202312061456-a5bf73a", - "@blocksuite/store": "0.11.0-nightly-202312061456-a5bf73a", - "@blocksuite/virgo": "0.11.0-nightly-202312061456-a5bf73a", + "@blocksuite/lit": "0.11.0-nightly-202312070955-2b5bb47", + "@blocksuite/presets": "0.11.0-nightly-202312070955-2b5bb47", + "@blocksuite/store": "0.11.0-nightly-202312070955-2b5bb47", + "@blocksuite/virgo": "0.11.0-nightly-202312070955-2b5bb47", "@dnd-kit/core": "^6.0.8", "@dnd-kit/sortable": "^8.0.0", "@emotion/cache": "^11.11.0", diff --git a/packages/frontend/electron/package.json b/packages/frontend/electron/package.json index 3d3089936b..d41b310016 100644 --- a/packages/frontend/electron/package.json +++ b/packages/frontend/electron/package.json @@ -32,10 +32,10 @@ "@affine/sdk": "workspace:*", "@affine/templates": "workspace:*", "@affine/vue-hello-world-plugin": "workspace:*", - "@blocksuite/blocks": "0.11.0-nightly-202312061456-a5bf73a", - "@blocksuite/lit": "0.11.0-nightly-202312061456-a5bf73a", - "@blocksuite/presets": "0.11.0-nightly-202312061456-a5bf73a", - "@blocksuite/store": "0.11.0-nightly-202312061456-a5bf73a", + "@blocksuite/blocks": "0.11.0-nightly-202312070955-2b5bb47", + "@blocksuite/lit": "0.11.0-nightly-202312070955-2b5bb47", + "@blocksuite/presets": "0.11.0-nightly-202312070955-2b5bb47", + "@blocksuite/store": "0.11.0-nightly-202312070955-2b5bb47", "@electron-forge/cli": "^7.1.0", "@electron-forge/core": "^7.1.0", "@electron-forge/core-utils": "^7.1.0", diff --git a/packages/frontend/hooks/package.json b/packages/frontend/hooks/package.json index 98932e3945..1a8d4f128d 100644 --- a/packages/frontend/hooks/package.json +++ b/packages/frontend/hooks/package.json @@ -19,12 +19,12 @@ "devDependencies": { "@affine/debug": "workspace:*", "@affine/env": "workspace:*", - "@blocksuite/block-std": "0.11.0-nightly-202312061456-a5bf73a", - "@blocksuite/blocks": "0.11.0-nightly-202312061456-a5bf73a", - "@blocksuite/global": "0.11.0-nightly-202312061456-a5bf73a", - "@blocksuite/lit": "0.11.0-nightly-202312061456-a5bf73a", - "@blocksuite/presets": "0.11.0-nightly-202312061456-a5bf73a", - "@blocksuite/store": "0.11.0-nightly-202312061456-a5bf73a", + "@blocksuite/block-std": "0.11.0-nightly-202312070955-2b5bb47", + "@blocksuite/blocks": "0.11.0-nightly-202312070955-2b5bb47", + "@blocksuite/global": "0.11.0-nightly-202312070955-2b5bb47", + "@blocksuite/lit": "0.11.0-nightly-202312070955-2b5bb47", + "@blocksuite/presets": "0.11.0-nightly-202312070955-2b5bb47", + "@blocksuite/store": "0.11.0-nightly-202312070955-2b5bb47", "@testing-library/react": "^14.0.0", "@types/image-blob-reduce": "^4.1.3", "@types/lodash.debounce": "^4.0.7", diff --git a/tests/affine-legacy/0.6.1-beta.1/package.json b/tests/affine-legacy/0.6.1-beta.1/package.json index 4907ae92a4..f9a47be432 100644 --- a/tests/affine-legacy/0.6.1-beta.1/package.json +++ b/tests/affine-legacy/0.6.1-beta.1/package.json @@ -9,10 +9,10 @@ "devDependencies": { "@affine-test/fixtures": "workspace:*", "@affine-test/kit": "workspace:*", - "@blocksuite/block-std": "0.11.0-nightly-202312061456-a5bf73a", - "@blocksuite/blocks": "0.11.0-nightly-202312061456-a5bf73a", - "@blocksuite/global": "0.11.0-nightly-202312061456-a5bf73a", - "@blocksuite/store": "0.11.0-nightly-202312061456-a5bf73a", + "@blocksuite/block-std": "0.11.0-nightly-202312070955-2b5bb47", + "@blocksuite/blocks": "0.11.0-nightly-202312070955-2b5bb47", + "@blocksuite/global": "0.11.0-nightly-202312070955-2b5bb47", + "@blocksuite/store": "0.11.0-nightly-202312070955-2b5bb47", "@playwright/test": "^1.39.0", "express": "^4.18.2", "http-proxy-middleware": "^3.0.0-beta.1", diff --git a/tests/affine-legacy/0.7.0-canary.18/package.json b/tests/affine-legacy/0.7.0-canary.18/package.json index 5fab121844..ee71475789 100644 --- a/tests/affine-legacy/0.7.0-canary.18/package.json +++ b/tests/affine-legacy/0.7.0-canary.18/package.json @@ -9,10 +9,10 @@ "devDependencies": { "@affine-test/fixtures": "workspace:*", "@affine-test/kit": "workspace:*", - "@blocksuite/block-std": "0.11.0-nightly-202312061456-a5bf73a", - "@blocksuite/blocks": "0.11.0-nightly-202312061456-a5bf73a", - "@blocksuite/global": "0.11.0-nightly-202312061456-a5bf73a", - "@blocksuite/store": "0.11.0-nightly-202312061456-a5bf73a", + "@blocksuite/block-std": "0.11.0-nightly-202312070955-2b5bb47", + "@blocksuite/blocks": "0.11.0-nightly-202312070955-2b5bb47", + "@blocksuite/global": "0.11.0-nightly-202312070955-2b5bb47", + "@blocksuite/store": "0.11.0-nightly-202312070955-2b5bb47", "@playwright/test": "^1.39.0", "express": "^4.18.2", "http-proxy-middleware": "^3.0.0-beta.1", diff --git a/tests/affine-legacy/0.8.0-canary.7/package.json b/tests/affine-legacy/0.8.0-canary.7/package.json index f53c3df475..fa0e303127 100644 --- a/tests/affine-legacy/0.8.0-canary.7/package.json +++ b/tests/affine-legacy/0.8.0-canary.7/package.json @@ -9,10 +9,10 @@ "devDependencies": { "@affine-test/fixtures": "workspace:*", "@affine-test/kit": "workspace:*", - "@blocksuite/block-std": "0.11.0-nightly-202312061456-a5bf73a", - "@blocksuite/blocks": "0.11.0-nightly-202312061456-a5bf73a", - "@blocksuite/global": "0.11.0-nightly-202312061456-a5bf73a", - "@blocksuite/store": "0.11.0-nightly-202312061456-a5bf73a", + "@blocksuite/block-std": "0.11.0-nightly-202312070955-2b5bb47", + "@blocksuite/blocks": "0.11.0-nightly-202312070955-2b5bb47", + "@blocksuite/global": "0.11.0-nightly-202312070955-2b5bb47", + "@blocksuite/store": "0.11.0-nightly-202312070955-2b5bb47", "@playwright/test": "^1.39.0", "express": "^4.18.2", "http-proxy-middleware": "^3.0.0-beta.1", diff --git a/tests/affine-legacy/0.8.4/package.json b/tests/affine-legacy/0.8.4/package.json index 38a5b757c4..f47bd78e45 100644 --- a/tests/affine-legacy/0.8.4/package.json +++ b/tests/affine-legacy/0.8.4/package.json @@ -9,10 +9,10 @@ "devDependencies": { "@affine-test/fixtures": "workspace:*", "@affine-test/kit": "workspace:*", - "@blocksuite/block-std": "0.11.0-nightly-202312061456-a5bf73a", - "@blocksuite/blocks": "0.11.0-nightly-202312061456-a5bf73a", - "@blocksuite/global": "0.11.0-nightly-202312061456-a5bf73a", - "@blocksuite/store": "0.11.0-nightly-202312061456-a5bf73a", + "@blocksuite/block-std": "0.11.0-nightly-202312070955-2b5bb47", + "@blocksuite/blocks": "0.11.0-nightly-202312070955-2b5bb47", + "@blocksuite/global": "0.11.0-nightly-202312070955-2b5bb47", + "@blocksuite/store": "0.11.0-nightly-202312070955-2b5bb47", "@playwright/test": "^1.39.0", "express": "^4.18.2", "http-proxy-middleware": "^3.0.0-beta.1", diff --git a/tests/affine-migration/package.json b/tests/affine-migration/package.json index 95abde84b0..f810c820cf 100644 --- a/tests/affine-migration/package.json +++ b/tests/affine-migration/package.json @@ -7,10 +7,10 @@ "devDependencies": { "@affine-test/fixtures": "workspace:*", "@affine-test/kit": "workspace:*", - "@blocksuite/block-std": "0.11.0-nightly-202312061456-a5bf73a", - "@blocksuite/blocks": "0.11.0-nightly-202312061456-a5bf73a", - "@blocksuite/global": "0.11.0-nightly-202312061456-a5bf73a", - "@blocksuite/store": "0.11.0-nightly-202312061456-a5bf73a", + "@blocksuite/block-std": "0.11.0-nightly-202312070955-2b5bb47", + "@blocksuite/blocks": "0.11.0-nightly-202312070955-2b5bb47", + "@blocksuite/global": "0.11.0-nightly-202312070955-2b5bb47", + "@blocksuite/store": "0.11.0-nightly-202312070955-2b5bb47", "@playwright/test": "^1.39.0" }, "version": "0.10.3-canary.2" diff --git a/tests/storybook/package.json b/tests/storybook/package.json index 08e5e43096..59a3302326 100644 --- a/tests/storybook/package.json +++ b/tests/storybook/package.json @@ -31,14 +31,14 @@ "wait-on": "^7.2.0" }, "devDependencies": { - "@blocksuite/block-std": "0.11.0-nightly-202312061456-a5bf73a", - "@blocksuite/blocks": "0.11.0-nightly-202312061456-a5bf73a", - "@blocksuite/global": "0.11.0-nightly-202312061456-a5bf73a", + "@blocksuite/block-std": "0.11.0-nightly-202312070955-2b5bb47", + "@blocksuite/blocks": "0.11.0-nightly-202312070955-2b5bb47", + "@blocksuite/global": "0.11.0-nightly-202312070955-2b5bb47", "@blocksuite/icons": "2.1.36", - "@blocksuite/lit": "0.11.0-nightly-202312061456-a5bf73a", - "@blocksuite/presets": "0.11.0-nightly-202312061456-a5bf73a", - "@blocksuite/store": "0.11.0-nightly-202312061456-a5bf73a", - "@blocksuite/virgo": "0.11.0-nightly-202312061456-a5bf73a", + "@blocksuite/lit": "0.11.0-nightly-202312070955-2b5bb47", + "@blocksuite/presets": "0.11.0-nightly-202312070955-2b5bb47", + "@blocksuite/store": "0.11.0-nightly-202312070955-2b5bb47", + "@blocksuite/virgo": "0.11.0-nightly-202312070955-2b5bb47", "@dnd-kit/sortable": "^8.0.0", "@tomfreudenberg/next-auth-mock": "^0.5.6", "chromatic": "^9.1.0", diff --git a/yarn.lock b/yarn.lock index e4c5391079..5f4dc4e6a6 100644 --- a/yarn.lock +++ b/yarn.lock @@ -25,10 +25,10 @@ __metadata: dependencies: "@affine-test/fixtures": "workspace:*" "@affine-test/kit": "workspace:*" - "@blocksuite/block-std": "npm:0.11.0-nightly-202312061456-a5bf73a" - "@blocksuite/blocks": "npm:0.11.0-nightly-202312061456-a5bf73a" - "@blocksuite/global": "npm:0.11.0-nightly-202312061456-a5bf73a" - "@blocksuite/store": "npm:0.11.0-nightly-202312061456-a5bf73a" + "@blocksuite/block-std": "npm:0.11.0-nightly-202312070955-2b5bb47" + "@blocksuite/blocks": "npm:0.11.0-nightly-202312070955-2b5bb47" + "@blocksuite/global": "npm:0.11.0-nightly-202312070955-2b5bb47" + "@blocksuite/store": "npm:0.11.0-nightly-202312070955-2b5bb47" "@playwright/test": "npm:^1.39.0" express: "npm:^4.18.2" http-proxy-middleware: "npm:^3.0.0-beta.1" @@ -42,10 +42,10 @@ __metadata: dependencies: "@affine-test/fixtures": "workspace:*" "@affine-test/kit": "workspace:*" - "@blocksuite/block-std": "npm:0.11.0-nightly-202312061456-a5bf73a" - "@blocksuite/blocks": "npm:0.11.0-nightly-202312061456-a5bf73a" - "@blocksuite/global": "npm:0.11.0-nightly-202312061456-a5bf73a" - "@blocksuite/store": "npm:0.11.0-nightly-202312061456-a5bf73a" + "@blocksuite/block-std": "npm:0.11.0-nightly-202312070955-2b5bb47" + "@blocksuite/blocks": "npm:0.11.0-nightly-202312070955-2b5bb47" + "@blocksuite/global": "npm:0.11.0-nightly-202312070955-2b5bb47" + "@blocksuite/store": "npm:0.11.0-nightly-202312070955-2b5bb47" "@playwright/test": "npm:^1.39.0" express: "npm:^4.18.2" http-proxy-middleware: "npm:^3.0.0-beta.1" @@ -59,10 +59,10 @@ __metadata: dependencies: "@affine-test/fixtures": "workspace:*" "@affine-test/kit": "workspace:*" - "@blocksuite/block-std": "npm:0.11.0-nightly-202312061456-a5bf73a" - "@blocksuite/blocks": "npm:0.11.0-nightly-202312061456-a5bf73a" - "@blocksuite/global": "npm:0.11.0-nightly-202312061456-a5bf73a" - "@blocksuite/store": "npm:0.11.0-nightly-202312061456-a5bf73a" + "@blocksuite/block-std": "npm:0.11.0-nightly-202312070955-2b5bb47" + "@blocksuite/blocks": "npm:0.11.0-nightly-202312070955-2b5bb47" + "@blocksuite/global": "npm:0.11.0-nightly-202312070955-2b5bb47" + "@blocksuite/store": "npm:0.11.0-nightly-202312070955-2b5bb47" "@playwright/test": "npm:^1.39.0" express: "npm:^4.18.2" http-proxy-middleware: "npm:^3.0.0-beta.1" @@ -76,10 +76,10 @@ __metadata: dependencies: "@affine-test/fixtures": "workspace:*" "@affine-test/kit": "workspace:*" - "@blocksuite/block-std": "npm:0.11.0-nightly-202312061456-a5bf73a" - "@blocksuite/blocks": "npm:0.11.0-nightly-202312061456-a5bf73a" - "@blocksuite/global": "npm:0.11.0-nightly-202312061456-a5bf73a" - "@blocksuite/store": "npm:0.11.0-nightly-202312061456-a5bf73a" + "@blocksuite/block-std": "npm:0.11.0-nightly-202312070955-2b5bb47" + "@blocksuite/blocks": "npm:0.11.0-nightly-202312070955-2b5bb47" + "@blocksuite/global": "npm:0.11.0-nightly-202312070955-2b5bb47" + "@blocksuite/store": "npm:0.11.0-nightly-202312070955-2b5bb47" "@playwright/test": "npm:^1.39.0" express: "npm:^4.18.2" http-proxy-middleware: "npm:^3.0.0-beta.1" @@ -138,10 +138,10 @@ __metadata: dependencies: "@affine-test/fixtures": "workspace:*" "@affine-test/kit": "workspace:*" - "@blocksuite/block-std": "npm:0.11.0-nightly-202312061456-a5bf73a" - "@blocksuite/blocks": "npm:0.11.0-nightly-202312061456-a5bf73a" - "@blocksuite/global": "npm:0.11.0-nightly-202312061456-a5bf73a" - "@blocksuite/store": "npm:0.11.0-nightly-202312061456-a5bf73a" + "@blocksuite/block-std": "npm:0.11.0-nightly-202312070955-2b5bb47" + "@blocksuite/blocks": "npm:0.11.0-nightly-202312070955-2b5bb47" + "@blocksuite/global": "npm:0.11.0-nightly-202312070955-2b5bb47" + "@blocksuite/store": "npm:0.11.0-nightly-202312070955-2b5bb47" "@playwright/test": "npm:^1.39.0" languageName: unknown linkType: soft @@ -222,12 +222,12 @@ __metadata: "@affine/graphql": "workspace:*" "@affine/i18n": "workspace:*" "@affine/workspace": "workspace:*" - "@blocksuite/blocks": "npm:0.11.0-nightly-202312061456-a5bf73a" - "@blocksuite/global": "npm:0.11.0-nightly-202312061456-a5bf73a" + "@blocksuite/blocks": "npm:0.11.0-nightly-202312070955-2b5bb47" + "@blocksuite/global": "npm:0.11.0-nightly-202312070955-2b5bb47" "@blocksuite/icons": "npm:2.1.36" - "@blocksuite/lit": "npm:0.11.0-nightly-202312061456-a5bf73a" - "@blocksuite/presets": "npm:0.11.0-nightly-202312061456-a5bf73a" - "@blocksuite/store": "npm:0.11.0-nightly-202312061456-a5bf73a" + "@blocksuite/lit": "npm:0.11.0-nightly-202312070955-2b5bb47" + "@blocksuite/presets": "npm:0.11.0-nightly-202312070955-2b5bb47" + "@blocksuite/store": "npm:0.11.0-nightly-202312070955-2b5bb47" "@dnd-kit/core": "npm:^6.0.8" "@dnd-kit/modifiers": "npm:^7.0.0" "@dnd-kit/sortable": "npm:^8.0.0" @@ -350,14 +350,14 @@ __metadata: "@affine/templates": "workspace:*" "@affine/workspace": "workspace:*" "@aws-sdk/client-s3": "npm:3.433.0" - "@blocksuite/block-std": "npm:0.11.0-nightly-202312061456-a5bf73a" - "@blocksuite/blocks": "npm:0.11.0-nightly-202312061456-a5bf73a" - "@blocksuite/global": "npm:0.11.0-nightly-202312061456-a5bf73a" + "@blocksuite/block-std": "npm:0.11.0-nightly-202312070955-2b5bb47" + "@blocksuite/blocks": "npm:0.11.0-nightly-202312070955-2b5bb47" + "@blocksuite/global": "npm:0.11.0-nightly-202312070955-2b5bb47" "@blocksuite/icons": "npm:2.1.36" - "@blocksuite/lit": "npm:0.11.0-nightly-202312061456-a5bf73a" - "@blocksuite/presets": "npm:0.11.0-nightly-202312061456-a5bf73a" - "@blocksuite/store": "npm:0.11.0-nightly-202312061456-a5bf73a" - "@blocksuite/virgo": "npm:0.11.0-nightly-202312061456-a5bf73a" + "@blocksuite/lit": "npm:0.11.0-nightly-202312070955-2b5bb47" + "@blocksuite/presets": "npm:0.11.0-nightly-202312070955-2b5bb47" + "@blocksuite/store": "npm:0.11.0-nightly-202312070955-2b5bb47" + "@blocksuite/virgo": "npm:0.11.0-nightly-202312070955-2b5bb47" "@dnd-kit/core": "npm:^6.0.8" "@dnd-kit/sortable": "npm:^8.0.0" "@emotion/cache": "npm:^11.11.0" @@ -463,10 +463,10 @@ __metadata: "@affine/sdk": "workspace:*" "@affine/templates": "workspace:*" "@affine/vue-hello-world-plugin": "workspace:*" - "@blocksuite/blocks": "npm:0.11.0-nightly-202312061456-a5bf73a" - "@blocksuite/lit": "npm:0.11.0-nightly-202312061456-a5bf73a" - "@blocksuite/presets": "npm:0.11.0-nightly-202312061456-a5bf73a" - "@blocksuite/store": "npm:0.11.0-nightly-202312061456-a5bf73a" + "@blocksuite/blocks": "npm:0.11.0-nightly-202312070955-2b5bb47" + "@blocksuite/lit": "npm:0.11.0-nightly-202312070955-2b5bb47" + "@blocksuite/presets": "npm:0.11.0-nightly-202312070955-2b5bb47" + "@blocksuite/store": "npm:0.11.0-nightly-202312070955-2b5bb47" "@electron-forge/cli": "npm:^7.1.0" "@electron-forge/core": "npm:^7.1.0" "@electron-forge/core-utils": "npm:^7.1.0" @@ -514,8 +514,8 @@ __metadata: version: 0.0.0-use.local resolution: "@affine/env@workspace:packages/common/env" dependencies: - "@blocksuite/global": "npm:0.11.0-nightly-202312061456-a5bf73a" - "@blocksuite/store": "npm:0.11.0-nightly-202312061456-a5bf73a" + "@blocksuite/global": "npm:0.11.0-nightly-202312070955-2b5bb47" + "@blocksuite/store": "npm:0.11.0-nightly-202312070955-2b5bb47" lit: "npm:^3.0.2" react: "npm:18.2.0" react-dom: "npm:18.2.0" @@ -707,11 +707,11 @@ __metadata: version: 0.0.0-use.local resolution: "@affine/sdk@workspace:packages/common/sdk" dependencies: - "@blocksuite/block-std": "npm:0.11.0-nightly-202312061456-a5bf73a" - "@blocksuite/blocks": "npm:0.11.0-nightly-202312061456-a5bf73a" - "@blocksuite/global": "npm:0.11.0-nightly-202312061456-a5bf73a" - "@blocksuite/presets": "npm:0.11.0-nightly-202312061456-a5bf73a" - "@blocksuite/store": "npm:0.11.0-nightly-202312061456-a5bf73a" + "@blocksuite/block-std": "npm:0.11.0-nightly-202312070955-2b5bb47" + "@blocksuite/blocks": "npm:0.11.0-nightly-202312070955-2b5bb47" + "@blocksuite/global": "npm:0.11.0-nightly-202312070955-2b5bb47" + "@blocksuite/presets": "npm:0.11.0-nightly-202312070955-2b5bb47" + "@blocksuite/store": "npm:0.11.0-nightly-202312070955-2b5bb47" jotai: "npm:^2.5.1" vite: "npm:^4.4.11" vite-plugin-dts: "npm:3.6.0" @@ -835,14 +835,14 @@ __metadata: dependencies: "@affine/component": "workspace:*" "@affine/i18n": "workspace:*" - "@blocksuite/block-std": "npm:0.11.0-nightly-202312061456-a5bf73a" - "@blocksuite/blocks": "npm:0.11.0-nightly-202312061456-a5bf73a" - "@blocksuite/global": "npm:0.11.0-nightly-202312061456-a5bf73a" + "@blocksuite/block-std": "npm:0.11.0-nightly-202312070955-2b5bb47" + "@blocksuite/blocks": "npm:0.11.0-nightly-202312070955-2b5bb47" + "@blocksuite/global": "npm:0.11.0-nightly-202312070955-2b5bb47" "@blocksuite/icons": "npm:2.1.36" - "@blocksuite/lit": "npm:0.11.0-nightly-202312061456-a5bf73a" - "@blocksuite/presets": "npm:0.11.0-nightly-202312061456-a5bf73a" - "@blocksuite/store": "npm:0.11.0-nightly-202312061456-a5bf73a" - "@blocksuite/virgo": "npm:0.11.0-nightly-202312061456-a5bf73a" + "@blocksuite/lit": "npm:0.11.0-nightly-202312070955-2b5bb47" + "@blocksuite/presets": "npm:0.11.0-nightly-202312070955-2b5bb47" + "@blocksuite/store": "npm:0.11.0-nightly-202312070955-2b5bb47" + "@blocksuite/virgo": "npm:0.11.0-nightly-202312070955-2b5bb47" "@dnd-kit/sortable": "npm:^8.0.0" "@storybook/addon-actions": "npm:^7.5.3" "@storybook/addon-essentials": "npm:^7.5.3" @@ -4083,29 +4083,29 @@ __metadata: languageName: node linkType: hard -"@blocksuite/block-std@npm:0.11.0-nightly-202312061456-a5bf73a": - version: 0.11.0-nightly-202312061456-a5bf73a - resolution: "@blocksuite/block-std@npm:0.11.0-nightly-202312061456-a5bf73a" +"@blocksuite/block-std@npm:0.11.0-nightly-202312070955-2b5bb47": + version: 0.11.0-nightly-202312070955-2b5bb47 + resolution: "@blocksuite/block-std@npm:0.11.0-nightly-202312070955-2b5bb47" dependencies: - "@blocksuite/global": "npm:0.11.0-nightly-202312061456-a5bf73a" + "@blocksuite/global": "npm:0.11.0-nightly-202312070955-2b5bb47" lz-string: "npm:^1.5.0" w3c-keyname: "npm:^2.2.8" zod: "npm:^3.22.4" peerDependencies: - "@blocksuite/store": 0.11.0-nightly-202312061456-a5bf73a - checksum: c03a4f84ce6c4d90af35ebe73222e0a8014642bf6e0b86d9ba5d1566dfa986ffe87b6a0ca4568217a50def081d8cb44699501bb280e4dd6169a073b70b826737 + "@blocksuite/store": 0.11.0-nightly-202312070955-2b5bb47 + checksum: 386721e0232cc1b2c566ca931b5d36b24d99ca9dc365df2b15115033b4bf1647490b87adfcd1ae8cffbf6c2fe65ae17e193ab349e80a040a536424bca515d58d languageName: node linkType: hard -"@blocksuite/blocks@npm:0.11.0-nightly-202312061456-a5bf73a": - version: 0.11.0-nightly-202312061456-a5bf73a - resolution: "@blocksuite/blocks@npm:0.11.0-nightly-202312061456-a5bf73a" +"@blocksuite/blocks@npm:0.11.0-nightly-202312070955-2b5bb47": + version: 0.11.0-nightly-202312070955-2b5bb47 + resolution: "@blocksuite/blocks@npm:0.11.0-nightly-202312070955-2b5bb47" dependencies: - "@blocksuite/block-std": "npm:0.11.0-nightly-202312061456-a5bf73a" - "@blocksuite/global": "npm:0.11.0-nightly-202312061456-a5bf73a" - "@blocksuite/lit": "npm:0.11.0-nightly-202312061456-a5bf73a" - "@blocksuite/store": "npm:0.11.0-nightly-202312061456-a5bf73a" - "@blocksuite/virgo": "npm:0.11.0-nightly-202312061456-a5bf73a" + "@blocksuite/block-std": "npm:0.11.0-nightly-202312070955-2b5bb47" + "@blocksuite/global": "npm:0.11.0-nightly-202312070955-2b5bb47" + "@blocksuite/lit": "npm:0.11.0-nightly-202312070955-2b5bb47" + "@blocksuite/store": "npm:0.11.0-nightly-202312070955-2b5bb47" + "@blocksuite/virgo": "npm:0.11.0-nightly-202312070955-2b5bb47" "@floating-ui/dom": "npm:^1.5.3" "@toeverything/theme": "npm:^0.7.27" "@types/hast": "npm:^3.0.3" @@ -4139,16 +4139,16 @@ __metadata: unified: "npm:^11.0.4" webfontloader: "npm:^1.6.28" zod: "npm:^3.22.4" - checksum: 6e9c53557db308e504479dbabadabf8240edcbc4d8bd71936b352d276de199e4b3528ed047fffe25874a814c5d814f5b054e30cde2e717377c4ea1e52430ac47 + checksum: 5a5e4d186c79436b0169d6b2de8e19e8d2da2246e873e87b49ce53d82e6168fb684a7b3d36533ce2ca2914aa87b6eb1795842e5b3e686396c3760f08c50ddd2a languageName: node linkType: hard -"@blocksuite/global@npm:0.11.0-nightly-202312061456-a5bf73a": - version: 0.11.0-nightly-202312061456-a5bf73a - resolution: "@blocksuite/global@npm:0.11.0-nightly-202312061456-a5bf73a" +"@blocksuite/global@npm:0.11.0-nightly-202312070955-2b5bb47": + version: 0.11.0-nightly-202312070955-2b5bb47 + resolution: "@blocksuite/global@npm:0.11.0-nightly-202312070955-2b5bb47" dependencies: zod: "npm:^3.22.4" - checksum: ef45d0a8a2bff4b1ccb62dbd211de2e72cba26bc4a7e01c1f47de9b74970955cad8abf0a9ebe88ba3e6fde36fe198d72b9a3ed557e929b178aa22dd9861f94be + checksum: de06d91f72a9387a882003f189493c5d532a72d321744d6a478d243c9f464e1d71b652cfe7628bf87ff2c200e0595695bc20883993bb78b41edacb617aff8734 languageName: node linkType: hard @@ -4162,40 +4162,40 @@ __metadata: languageName: node linkType: hard -"@blocksuite/lit@npm:0.11.0-nightly-202312061456-a5bf73a": - version: 0.11.0-nightly-202312061456-a5bf73a - resolution: "@blocksuite/lit@npm:0.11.0-nightly-202312061456-a5bf73a" +"@blocksuite/lit@npm:0.11.0-nightly-202312070955-2b5bb47": + version: 0.11.0-nightly-202312070955-2b5bb47 + resolution: "@blocksuite/lit@npm:0.11.0-nightly-202312070955-2b5bb47" dependencies: - "@blocksuite/global": "npm:0.11.0-nightly-202312061456-a5bf73a" - "@blocksuite/virgo": "npm:0.11.0-nightly-202312061456-a5bf73a" + "@blocksuite/global": "npm:0.11.0-nightly-202312070955-2b5bb47" + "@blocksuite/virgo": "npm:0.11.0-nightly-202312070955-2b5bb47" lit: "npm:^3.1.0" peerDependencies: - "@blocksuite/block-std": 0.11.0-nightly-202312061456-a5bf73a - "@blocksuite/store": 0.11.0-nightly-202312061456-a5bf73a - checksum: 7741c4046aceeb37a2aa4367972efbe977149ffcb58f635e398ee9cd9c580d48db730f46d39ab6d12844f690fc5c6b159e05fd1595024ed3367f3b15992c6860 + "@blocksuite/block-std": 0.11.0-nightly-202312070955-2b5bb47 + "@blocksuite/store": 0.11.0-nightly-202312070955-2b5bb47 + checksum: 9e2f12a824a3121953c1b31d68005a34a5ab9b2069f7e4b296aaf8fcc0acf10a1165298eb2baa8527f3493f2aba23e862fd8398fa4d659fb8ace68de13ba3cf2 languageName: node linkType: hard -"@blocksuite/presets@npm:0.11.0-nightly-202312061456-a5bf73a": - version: 0.11.0-nightly-202312061456-a5bf73a - resolution: "@blocksuite/presets@npm:0.11.0-nightly-202312061456-a5bf73a" +"@blocksuite/presets@npm:0.11.0-nightly-202312070955-2b5bb47": + version: 0.11.0-nightly-202312070955-2b5bb47 + resolution: "@blocksuite/presets@npm:0.11.0-nightly-202312070955-2b5bb47" dependencies: - "@blocksuite/blocks": "npm:0.11.0-nightly-202312061456-a5bf73a" - "@blocksuite/global": "npm:0.11.0-nightly-202312061456-a5bf73a" - "@blocksuite/lit": "npm:0.11.0-nightly-202312061456-a5bf73a" - "@blocksuite/store": "npm:0.11.0-nightly-202312061456-a5bf73a" + "@blocksuite/blocks": "npm:0.11.0-nightly-202312070955-2b5bb47" + "@blocksuite/global": "npm:0.11.0-nightly-202312070955-2b5bb47" + "@blocksuite/lit": "npm:0.11.0-nightly-202312070955-2b5bb47" + "@blocksuite/store": "npm:0.11.0-nightly-202312070955-2b5bb47" "@toeverything/theme": "npm:^0.7.27" lit: "npm:^3.1.0" - checksum: dd7cc666b49f0fff76e8537d13f175c122a3c0a0210b6411b88252ea595112f582fae887c7c1c9088f86ebba94aa590cda38f933f079bfc6c5baa9d3763eb320 + checksum: 3e607f11dd709cc8d1f824bb087449c0f32350d306dff3b0948ef97b84da9c223da353ddd538ee148c0449d424f46c8f0b13cacf6804ae3ea77e4197474e0fbd languageName: node linkType: hard -"@blocksuite/store@npm:0.11.0-nightly-202312061456-a5bf73a": - version: 0.11.0-nightly-202312061456-a5bf73a - resolution: "@blocksuite/store@npm:0.11.0-nightly-202312061456-a5bf73a" +"@blocksuite/store@npm:0.11.0-nightly-202312070955-2b5bb47": + version: 0.11.0-nightly-202312070955-2b5bb47 + resolution: "@blocksuite/store@npm:0.11.0-nightly-202312070955-2b5bb47" dependencies: - "@blocksuite/global": "npm:0.11.0-nightly-202312061456-a5bf73a" - "@blocksuite/virgo": "npm:0.11.0-nightly-202312061456-a5bf73a" + "@blocksuite/global": "npm:0.11.0-nightly-202312070955-2b5bb47" + "@blocksuite/virgo": "npm:0.11.0-nightly-202312070955-2b5bb47" "@types/flexsearch": "npm:^0.7.3" flexsearch: "npm:0.7.21" idb-keyval: "npm:^6.2.1" @@ -4208,20 +4208,20 @@ __metadata: peerDependencies: async-call-rpc: ^6 yjs: ^13 - checksum: 04e8a643d20afbdeea9deaabf1242f10264ce95c20b73833710f45239b6082a9aca2b418c29bbb6f33d2c1374db706c6dd63ea90d8aa56b59780b8cba3a00d13 + checksum: e4ce26662ac86dafcf03f9ed542a355567c785ca1f6cebf3ca63a51e9a9c5db00153a26a133990202b297a36be393ac56d15033c7c578048413257e07807d1bf languageName: node linkType: hard -"@blocksuite/virgo@npm:0.11.0-nightly-202312061456-a5bf73a": - version: 0.11.0-nightly-202312061456-a5bf73a - resolution: "@blocksuite/virgo@npm:0.11.0-nightly-202312061456-a5bf73a" +"@blocksuite/virgo@npm:0.11.0-nightly-202312070955-2b5bb47": + version: 0.11.0-nightly-202312070955-2b5bb47 + resolution: "@blocksuite/virgo@npm:0.11.0-nightly-202312070955-2b5bb47" dependencies: - "@blocksuite/global": "npm:0.11.0-nightly-202312061456-a5bf73a" + "@blocksuite/global": "npm:0.11.0-nightly-202312070955-2b5bb47" zod: "npm:^3.22.4" peerDependencies: lit: ^3.0.2 yjs: ^13 - checksum: bfcf654f243ecc6846c2f291cd89752c23391bb8d336ba49f825acb7927d50510093185b87fa47b4df3b8b343e53e0f473dfa2147e2a62a3a8abacfbb963217a + checksum: a279e498b96c1b44e90bcd8216fe680e895d1aea5e22eb06cf2d4ed23227eaf42db699ce8bd34777dc821e2f727f04db2505f9b92642768268d4b2cd9abcffb5 languageName: node linkType: hard @@ -13658,12 +13658,12 @@ __metadata: dependencies: "@affine/debug": "workspace:*" "@affine/env": "workspace:*" - "@blocksuite/block-std": "npm:0.11.0-nightly-202312061456-a5bf73a" - "@blocksuite/blocks": "npm:0.11.0-nightly-202312061456-a5bf73a" - "@blocksuite/global": "npm:0.11.0-nightly-202312061456-a5bf73a" - "@blocksuite/lit": "npm:0.11.0-nightly-202312061456-a5bf73a" - "@blocksuite/presets": "npm:0.11.0-nightly-202312061456-a5bf73a" - "@blocksuite/store": "npm:0.11.0-nightly-202312061456-a5bf73a" + "@blocksuite/block-std": "npm:0.11.0-nightly-202312070955-2b5bb47" + "@blocksuite/blocks": "npm:0.11.0-nightly-202312070955-2b5bb47" + "@blocksuite/global": "npm:0.11.0-nightly-202312070955-2b5bb47" + "@blocksuite/lit": "npm:0.11.0-nightly-202312070955-2b5bb47" + "@blocksuite/presets": "npm:0.11.0-nightly-202312070955-2b5bb47" + "@blocksuite/store": "npm:0.11.0-nightly-202312070955-2b5bb47" "@testing-library/react": "npm:^14.0.0" "@types/image-blob-reduce": "npm:^4.1.3" "@types/lodash.debounce": "npm:^4.0.7" @@ -13711,11 +13711,11 @@ __metadata: "@affine-test/fixtures": "workspace:*" "@affine/sdk": "workspace:*" "@affine/templates": "workspace:*" - "@blocksuite/blocks": "npm:0.11.0-nightly-202312061456-a5bf73a" - "@blocksuite/global": "npm:0.11.0-nightly-202312061456-a5bf73a" - "@blocksuite/lit": "npm:0.11.0-nightly-202312061456-a5bf73a" - "@blocksuite/presets": "npm:0.11.0-nightly-202312061456-a5bf73a" - "@blocksuite/store": "npm:0.11.0-nightly-202312061456-a5bf73a" + "@blocksuite/blocks": "npm:0.11.0-nightly-202312070955-2b5bb47" + "@blocksuite/global": "npm:0.11.0-nightly-202312070955-2b5bb47" + "@blocksuite/lit": "npm:0.11.0-nightly-202312070955-2b5bb47" + "@blocksuite/presets": "npm:0.11.0-nightly-202312070955-2b5bb47" + "@blocksuite/store": "npm:0.11.0-nightly-202312070955-2b5bb47" "@testing-library/react": "npm:^14.0.0" async-call-rpc: "npm:^6.3.1" electron: "link:../../frontend/electron/node_modules/electron" @@ -13764,8 +13764,8 @@ __metadata: version: 0.0.0-use.local resolution: "@toeverything/y-indexeddb@workspace:packages/common/y-indexeddb" dependencies: - "@blocksuite/blocks": "npm:0.11.0-nightly-202312061456-a5bf73a" - "@blocksuite/store": "npm:0.11.0-nightly-202312061456-a5bf73a" + "@blocksuite/blocks": "npm:0.11.0-nightly-202312070955-2b5bb47" + "@blocksuite/store": "npm:0.11.0-nightly-202312070955-2b5bb47" fake-indexeddb: "npm:^5.0.0" idb: "npm:^8.0.0" nanoid: "npm:^5.0.3" @@ -36829,7 +36829,7 @@ __metadata: version: 0.0.0-use.local resolution: "y-provider@workspace:packages/common/y-provider" dependencies: - "@blocksuite/store": "npm:0.11.0-nightly-202312061456-a5bf73a" + "@blocksuite/store": "npm:0.11.0-nightly-202312070955-2b5bb47" vite: "npm:^4.4.11" vite-plugin-dts: "npm:3.6.0" vitest: "npm:0.34.6" From 70c376fac8adb996bc75db3da44c764799f81829 Mon Sep 17 00:00:00 2001 From: Joooye_34 Date: Thu, 7 Dec 2023 11:50:24 +0000 Subject: [PATCH 44/68] chore(core): skip cloud migration testing until page level upgrade implemented (#5227) --- tests/affine-cloud/e2e/migration.spec.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/affine-cloud/e2e/migration.spec.ts b/tests/affine-cloud/e2e/migration.spec.ts index c65f8dcdc1..b0a42db203 100644 --- a/tests/affine-cloud/e2e/migration.spec.ts +++ b/tests/affine-cloud/e2e/migration.spec.ts @@ -49,7 +49,8 @@ test.afterEach(async () => { await deleteUser(user.email); }); -test('migration', async ({ page, browser }) => { +// TODO: @joooye34 mock migration from server data after page level upgrade implemented. +test.skip('migration', async ({ page, browser }) => { let workspaceId: string; { // create the old cloud workspace in another browser From 761c3c2551d6b99c8bf7be4fc5e872e4e8c7e941 Mon Sep 17 00:00:00 2001 From: Joooye_34 Date: Thu, 7 Dec 2023 12:27:53 +0000 Subject: [PATCH 45/68] fix(electron): only update db after data changed (#5226) --- .../electron/src/helper/db/migration.ts | 31 ++++++++++--------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/packages/frontend/electron/src/helper/db/migration.ts b/packages/frontend/electron/src/helper/db/migration.ts index d6cb90f199..393b0f76b4 100644 --- a/packages/frontend/electron/src/helper/db/migration.ts +++ b/packages/frontend/electron/src/helper/db/migration.ts @@ -1,4 +1,3 @@ -import { equal } from 'node:assert'; import { resolve } from 'node:path'; import { SqliteConnection } from '@affine/native'; @@ -78,19 +77,23 @@ export const migrateToLatest = async ( }; await downloadBinary(rootDoc, true); const result = await forceUpgradePages(rootDoc, schema); - equal(result, true, 'migrateWorkspace should return boolean value'); - const uploadBinary = async (doc: YDoc, isRoot: boolean) => { - await connection.replaceUpdates(doc.guid, [ - { docId: isRoot ? undefined : doc.guid, data: encodeStateAsUpdate(doc) }, - ]); - // connection..applyUpdate(encodeStateAsUpdate(doc), 'self', doc.guid) - await Promise.all( - [...doc.subdocs].map(subdoc => { - return uploadBinary(subdoc, false); - }) - ); - }; - await uploadBinary(rootDoc, true); + if (result) { + const uploadBinary = async (doc: YDoc, isRoot: boolean) => { + await connection.replaceUpdates(doc.guid, [ + { + docId: isRoot ? undefined : doc.guid, + data: encodeStateAsUpdate(doc), + }, + ]); + // connection..applyUpdate(encodeStateAsUpdate(doc), 'self', doc.guid) + await Promise.all( + [...doc.subdocs].map(subdoc => { + return uploadBinary(subdoc, false); + }) + ); + }; + await uploadBinary(rootDoc, true); + } await connection.close(); }; From 352bb548f0a33f50c5e3a6a7489591e83a352a6d Mon Sep 17 00:00:00 2001 From: Peng Xiao Date: Thu, 7 Dec 2023 15:11:00 +0000 Subject: [PATCH 46/68] fix(core): update noise image (#5219) seems https://github.com/toeverything/AFFiNE/pull/4946 not in latest canary. --- .../src/components/workspace/index.css.ts | 6 +++--- .../frontend/component/src/theme/global.css | 2 +- .../frontend/component/src/theme/noise.avif | Bin 0 -> 4146 bytes packages/frontend/component/src/theme/noise.png | Bin 45775 -> 0 bytes 4 files changed, 4 insertions(+), 4 deletions(-) create mode 100644 packages/frontend/component/src/theme/noise.avif delete mode 100644 packages/frontend/component/src/theme/noise.png diff --git a/packages/frontend/component/src/components/workspace/index.css.ts b/packages/frontend/component/src/components/workspace/index.css.ts index 02a86963a5..ce31f3cd35 100644 --- a/packages/frontend/component/src/components/workspace/index.css.ts +++ b/packages/frontend/component/src/components/workspace/index.css.ts @@ -23,7 +23,7 @@ export const appStyle = style({ inset: 0, opacity: 'var(--affine-noise-opacity, 0)', backgroundRepeat: 'repeat', - backgroundSize: '2.5%', + backgroundSize: '3%', // todo: figure out how to use vanilla-extract webpack plugin to inject img url backgroundImage: `var(--noise-background)`, }, @@ -32,13 +32,13 @@ export const appStyle = style({ globalStyle(`html[data-theme="light"] ${appStyle}`, { vars: { - '--affine-noise-opacity': '0.25', + '--affine-noise-opacity': '0.35', }, }); globalStyle(`html[data-theme="dark"] ${appStyle}`, { vars: { - '--affine-noise-opacity': '0.1', + '--affine-noise-opacity': '1', }, '@media': { diff --git a/packages/frontend/component/src/theme/global.css b/packages/frontend/component/src/theme/global.css index 31754752bd..3e9119f8aa 100644 --- a/packages/frontend/component/src/theme/global.css +++ b/packages/frontend/component/src/theme/global.css @@ -9,7 +9,7 @@ } :root { - --noise-background: url(./noise.png); + --noise-background: url(./noise.avif); } html, diff --git a/packages/frontend/component/src/theme/noise.avif b/packages/frontend/component/src/theme/noise.avif new file mode 100644 index 0000000000000000000000000000000000000000..c08002c5bd46e3b81c36fd5b5d57b97276eb89cc GIT binary patch literal 4146 zcmYLMbyyQz7aujckvSSicL_)+3{WWv86lvIbTD8bF}g!S5RfSi(jg4#mJ%cdUO=Qn zq)WQK;rqPLckXlV@5Jw(bMF1`0000ETQ@Hh+yh|?z{w3dB5cJS5pY{=WpQNy058_j z#tnWG!wKI@YozPHDgb~&Sh@YD-yjlU`Cl3;6vEB%ZwwE23L%irRyUR^0Dup;@!&QM z7>8h-{nx^)1^}q6aXJ)%aQfTH-v|@Vu(_e!+<<$CiK{pxo&PrQ{|GL86H!K@Uczsf zObAz-e>31x!rjrxzcp{Fb|6r$C>*9EP*%=3WI((^+2HU-Zff6b8WaMJxN#7WkdWYj z0`4KM62yVi004R`XQZo>6%vihh+Ba;7w)0|(((RJ2C&?aWpSldZWMP{Cpkxyjose^ zDrbeTLdm`IdgW&0_(~4PK_C%uS1&pEf9z4!fxC+PEJ8f|5JCVxAs$gUF|J&g zqcz-(4nPLH4aP3n=t@km(8lBbbtX|a_Un3}a0}MgQ?09PO3!?!#K$jiuBIV*t0&F%l%JLdmURoK_7HGkOv#`A29BcO8+odQoHMow0TrZxBf$Q>UM*|G1Vv zL;d^pxvYaeIo&S!?l-y%GJ6*>*J>W6vEDi7j9~LLiT7@M31&>^~-Sulb&@kJ@s{5dzH-w{1>czg44C>k3om9|d zbQSA&hW#DNeh7()e{k1C;--)T3xw4ZKTCk#t>5H}ux0pUlHL8ZEB~sXcD#}(*H6tJ z0serbDIW1%k&V2OmOJ}K;wo3{-?o)WRUi@f01_EZ-*X#bn>qaQEQ^|&l73a{ihNF| ztX;Y@Q1^uS*LQj3FHOw9SM5%db<2{ZoY}4C9@v*s+$-_sTG0r_q%)bF&0k*AMM*ri zG+(|x7tq|8f90E86l}gXZuG?1J&WNY?|^8=Rf(X_Xu77pp_w>wDOm1)RW^pts9IZG zf`wJA(WVNz;jzZjn5KBw-L3e(-q=SLU?|14h_F$fZvggu)Aj962>Js#iv=h2YD)9(lk*Q_hc4gQoX9AU z)wkNlFcmv<`IrHutWH#N7A-TaOchRxljientTQgeSBgOxn&ZmCXF2{q3dIev#_k^~ zPLQn}czF6yHZeTHJt4(%37R{K4zik>7My2(GlVdzKE7OrPZRJ6Jm;q{fhb2i<$n~> z@%RTJ>2HVP{b>lrV9VJ|3E{q-lsD0OG?$2GNDJ0be_+C+(f>_fc=qe zX(5MDiqCw=FyxN4TT5tM?-udxmVCJUkhGMv7 z7_nnf9m~zzM)wS#xcyW@oj8SEWi2Kd3kmE({BCRNj45y0x{dT_;KB75Cn~_Z5~u6{ zxx%xIh9vQ`-ptDDy)m5#9Y3#{PBRah{pH^1juS1S2yXZ6T;gl$;&xymwH9eX9uWkq zIrByWSl2)Q&~Mmp=YVS+BgN0C@wTDNQQXcpw5^M6%z-wIw>+!Q+uMV#3ZDJ4WTqX+ zQBnA$g5)VV3FLsL+8-t~JY=JfpRW)*$~6|o7wg57I=B9ZCviqQ+Kby%#uWQG2ulNvH}WC&%>P2IN62^B zXQi=kJl>F0 zS!T=qWDz4u+6$!>Ip$g9VZ!!k!`(t6U3YaA_3T*!s$&ea-L-;(`^^XVvp)b-IM3`m~>A~nWR?3%fWk)f}aDJ zjk1*aZR^r#Q;)`9_9)8D3t1ylhn7vK0KeqnDep)(N}fn5@nnSdiX*#Wtt*`yLl3a7 zLuN!rEGQDGS95>QGw*>@p-MzjM2y<@ni=EDG*08EI`a7A0IWM_#|J*ig>@1p{>C%a zyp2WBP{t9DF0yZZsga?RHW0RCn{y!Yn}!LkieJZsDu_>kML{Gv`@*@5Pca>hOr z+l7?t`v{>7!cPf!wPCw$>Z357cfG=KR5mdm<;#i2tPNe>2DEC~y|zdh&!jSegE5(?=mx#s`ZyD5%W9UeO&QFF77XBrq8*koXmt2y_&K}#(5<{|D&gkiFUc`k8a4qEVVw&J z=ujyNiAdkE?ONY!hbJK~zlvjA&W|eQVXZE%%d&avIgwS^w@K#mlnapUgM4zSmB#M5 zgeFQBh2`g6Kh=H|yb^6%cwtu%U+l*NRR}vF6YAN;rlPy$$GKm}f>;+oQd&GQ0|RD? zZ0~0`pwD8Lbe{dzt}1<0EGux%=?E{;bq8ZIwVVLk^PGj$h_w7OywbYJ{TDe zsL|#ac@=+4a#Rw0B%y6vQt+r$Puw)`&hC5iiG7xPVPix`4!=}$d1I=yl`d!`@-8l( zODvPcOg0}5TU?9s(o_c_A8yIi*OHYDy!#SFYU0&qjHj2F^@X8NEO^;mfXxQK`_^Md z!NFVG9=z9$RBbdZ1k4sC{}8w=`;>r{q>|j$B6K>LQ4Q{5>+_x~`d37j-j0uVDoK=x z^A(B8v+1{oEEJ^%Q?-(Schax0vI`WRM_C_8GFV;NfXHEJu*nZD0DZ;@eNI-O{6CuE z)G^S80!Ws|o%P9j{z)??wY(}v^|aXEcFc8alg$))1vOGnVu_<7?&$K>g5|wp7FB2| zyFtIv?D2qGe-??Vo$rCb5+&8^5%7Xwb&N zgRUTBT=nqp!Q!oqKNnAxI#metJMOPJQz`G1ehLsh*kaC;`8N41N$jgh_}%Q6fbEZw zgZv&pLq z$tH=9g%uND87GYFqjCnwqT^nR!iX)3n4^`_QKwDS&)wghn$xSheL_3Gq!b1S2DUc| z3+k=XOK;jgWj^L_aTTz<^{fStV0bWv%hD4cO&~`}|Bp~fy*3B$N8R_K?y|w8tDSo-{mu76j|r-*^#wRv7i8=2u)tlP9giA36xF)iqRg**%1} zGy8czj1*j*H5sCB(u)6zR`O{z zpM$Q(R6rgo$Nr(lwoz?quQZCfYx9#AY8wo*M%MebrT19tw|3CeY=FwR0)qJ@&dgj$ z4~;mhp|OjLNbF<@NsTSRSo|+t8BIKj_Go;3TIgF6 z@pFGANGoe;>GQ`Zduol z37Q@*4eviW3iN9nuM60RSSI?X`U1I}WgwQ_@4f<8m7j^mT6cadaDa{r?VZSWU?y`! zoZVz0dKr%A^DHxJp+n}Lloh~3nJ-0DMYJ<2j2HM?q@Et}&=*a%Nqz1eq%Tz?u$2#7 zv5iMhs9_Hu*nKmnE-&!j14#{pl!3Ek>k(-p z=7BkJK_|ax;NGUz|Wb*n9r8#%aBrVO(8rY=3J8Lttd&I%cvCAQRFX?8+ Yl*P@M*6|XQHzOtu4WLX$r%TfFeDLhQg{twu*Gw8@3(!FBz?Hak^BD3M=sr~@Wx_rHN-pzYKT0m^sO3Y6 zf+;7AksQzsDZE5(Fm69)!@P4Fl_YL5Lf>!Ue8EV@J6K+3mW&%j@jDQf0g2EXQD5;n z4=3d>bQUT6lzyqC`vom>uxpaUNM_FQ@9E{+9x@gY?!10fCFLqkLR_t+j>7j-ncxFj z*=z#lNsz6QZ_;vU(4S>lG)998ED8H4q}w@60-o6^VE(pVxwh^HtoLNyNb|J%$n?`` zwB}6ZStR+RG;#^a>ng9dULP9^BbioHNTSmP=2G6GGqDIV_82n#hmZGRUt26*p9dDx zslFciz&hO=JZ#K@{_azN zq4I_>-Sbse9~~bEAaZZ_GwH5Qfz_BqZvUb5um^}@OeXux20B@wLaA`wf^imhZ(yJ? z9U#l^5E`^&*;Vp2C_^A5N?__4VSkj^K&*OUY8MduKQNV?h@pX!h!E(&^pap%g0Shq zX@+RV2)V25PCcGo45JEyE5kZ%L zor;hrl9?hf5h9FWK!^7gaZ(~l2Zbi0YD3utLKhiV;8ulN7a0_)%z&LxFTn8yz7-Ok z&^=&@_mXBppZAs3!%YNcIU?dhF@&n@&~jo-g|z-Lb42sSv=3(Zv%K3`59<$=PzWRq zTpG_Ts8xhXiBA0kEkRm5N~u~2tU_58tqOQC`b=}JH6?*+5VtRPK(}vW5Y~|2 zutC#}7VkV3?$40Xd_7HlPJ>T<+{*omy{&-zkBEM&U0SEBHbh*AjJWaP%RaoJy#CET zxE=mIw3|0ipDqG^e1?I#;f%fW8;jf4n~)c#VCLS?9cf6S8_01eu~5)Z^**^iAfwm{ z;S!Y1sH6ebJ#J&Hh9J+V6&c_1!a~D}ou7zhgo>Kgie-+fyV1f0eH6*mqrn5jWQipu zbS2hvUUQ&xJj_|P(oe+0DNUm~BP|Cp2NVYh(WqiJV!w$MoZ^hbj8pdL2A8FOkfD&3 z%@LRCmMWL-OLL^@Q=z2FrD=`f9xjfdjg_ZfQzcX=s$QrHt1_#xS1(lRs(Jm2R$)_n zR6DFZs=U$wRIDioDaBIKLT5AvIR`pNF$)eVpQ^I6#c50O3161LS65a|D#fVll&KfF zi_4Y8D|4t>R9jSFR1&CMD}C1#RrfCJ*x1fl&a{;>RdLD8%cRt46|PozY1}uV%Z+Q$ z=-K3`H!YdiHUAEC&wNt81gvE=8%+M3a?TmdQ)4_|sfpmOj}Mb?n}W{!N)ApOcxVndPbGC{dVwp20ZDI4PJ95K<{-vchU+*57kZO-@ z(lOh-`oN`^GF5gwcYX>mH)T<1qHUsX;yKcE3HR!F#lNSAS?QZ4Ui{g&S4L)gYD!hV zVY14H!?JGn+tGdT!bhEyrc5nf4WL%g(&1MB=zVT}zRW(ve#^dY%Wd1e%Dra3f?w}v zT5gSD*}C;>@v0UO#<$$v_Z1Ji+B@(v-4N z*=sejy23T<)q2kdo`y8GGSRjd>~!m{weP%km{Of$^ZT4>xo4whV{Y?oBY(Pd`f!?$ zv2}ZMCU0N=l>WZZi`4t$g6N+0=D<_ki~o`NZqEzv4%;-FWj-?^s}5iX7~G-&NND}4 zQLDM5cHXA&5BI0?fAsJFivObdn1(O}2?qHMwqbJK*nXk?DN@scP(YM{hhBC{#SuD-<8hDNF`kSBIpJ($G(qm^5@3bOMC|(jn3%GXLFB z$0|+|sf&_LseWB_4~l29=@^YZoW0KbnAecetI@&HX_XC?-{r8S-eu`!-N^Mn4ud(Y zfUVx=#OFoks^^DUjG3`nZnL7Y%0sLAT#eq50c7Lpt}(P?uf$sEHcRm}Mox(@i9eEQ zQ=3gyl6FtR7i8Z;ni+;k%88Hn=T1t8Gb(9O=sO!Wj9<$RL)!h@Av6j#95tG2SvA}3 z&9T*)&Po>TY+{!VYOyrWdw!eaIqAK1Y%i_rB1Y ziPovs)?$%!{5#t?ZEs`m>+=3LN7{@uwDi`sX4k&;Y3`gKPZUonkC|Do8C_?rhu!95 zDR0Y%eVB*XzJ1rjO*i;%-shVxP5^oTr>mt&5#qp1htCpDsf!0e7xr+j-=4QaX5b_?Y=_ReRF?&-*(165SIAosFjx9f~!fxw98&5_Yme}jaL4-)_^A&nq|f7VO+vGeshj+tUL zi@%^7M}Z`t|Lpjw=R@RfI3uXb;=rOb)kph# z%j!8wfY+y+38%Z~PTb4n%lhPX^Ojmq!F{(Ksq4XL!~}v#F&IG$|B|n<@7W9Py_ciy zDaJ-dW8IN~P7j#hIo>ob0fy5+?x+$_7-eoQ?4NaOpb;k^#SS1s`poP~3b5=q0!FDF zf!l=*J}P;j1y5kasFQ(6cSqwAJ(xh`J6vwF2t3>aZoY5%sWX(HzL|l{@%rL{+m_?ru?@K2oO+&70{1=>uCRN|0#)o>tFQ0ThQciAc((L$bV~S zA;^Dg2Nr_<5B*mLB%~rDCH1#eF>y9Cvv;v{aCMHwhWg8Za+K6^0RloN`=`Bd z6aHh@$k@Tnm5-SCA4mUP{wq#1Ppkj&Wbg9tZvE{b!#@%RCVEDO{~OHJ%KZNU`$zI$ zuz&UIzufWuV~ktT%G1nNQ`E}t?@<2@jh~H)nfG6A{(qAH3G}~^YA$BZA`W(cfv)`j zGgtox|EKVO1OMex>;LKUKP3Nw{HF`t%4RMOwr>9np_;vwEC1g}|8MO7jneub7(Wv$ z>%T$&$^G95&HpRnKe_)Kq2O%wcN~oV35}oW-yZ&x_iue(hJU91KT_ep^6X#Szlp{V z&CBrLNy`r{h9Nxw1SAL~B`T!q3Cy~AnrtfJOlH~Hd5y0_F9}q0X5O^@Eq8Q0p-4Gr z+E4{_fSgn3QJ{dwOe+O40_o9eQ|A3}qNH|zLGbMqO3FsVBCt0L$w@%u_u7fY9SU^s1;sjLfc)>F4?$W&fGI@PwD+ceKnemOEX##fF+G*4%zW_Vej zamiW9?=O^?@Ra-%DDTEo;fJf_nmB#Ye~D$L^Kg5+u9T&y(=$-0Jkg)~^q0+l0l@nNF&84S8bEvGC=6~j=JJRcD_TzqEJaQ>Ocgt!Vq=rj*)R(X1*01f~ z`nqS+8n=;>zUC>l)+(!fPo;Os!{=9}a>#Xi&mOb? zOpT6{Ysa7SADe6NlvTfUOF_`(ik&0(lUcRTxod9DGNX?7qnb z%qw+1QQ3O_%_CzIo~k8GO>3xE_GxzNvP5OUsO4WTo%5wWC}2;Zh2~ckL3J2GYvy)g zoTtC8*(H|2?)ph&H}7}m4PiKG_GFv#rpndKWC28zuI8ziUuym^+9V<$^2{*Ln5*)> zRmvh#hdF4^Q$9FTa{EY@XScQk=zjsoP}3Lp^OQx5ZLwFY(vLlCvaqzUdR?+Q26oG6 z3~|6SP|=(N>RAD% z>P&SHucv4|;+Im)PPr8-bA1BTtsZ>IiYKNs4$xH2Y|@9Z?=DRCFi%IUs~Tjm5NNv` zTeQo5QC%K$p_R(ftfgYetzGyZa>W`o3#YH@Gn}%vSmoU}UuzKf${#j9^P^u0Ha!!m zX%!4{dqnEHKwTTodU$c0xoCUa?H0y#ax)dXx+j`A$+>mQf8GxjvB$PZ55h2b)e#OP z!k_co(Q9eTiDjR~Oa=-cQ^~E4i~|r_Gdb9M1$1)U_2}lvnu3N^))?+t>DO6(rWQYm z)jIv|zEzH~=Ia%_zCtnpKHH0MX#O~ti=}eUuenbI2v$bZ^zbxw%T^gYHM2!`PD?v{ zXA86%R5lhqEG6#ll&@rF^ZbwFbj6`=iB!DZrZX``(sJ7+SA9^?8{1qrCZlD1v*^jN zuzQ@P6Z!}yS$8yo*jNp2$0#Nz$F8>?zyd5J0NsQyH_4nY7j5>OhqET^2mzrwkMOSB zwW|S2X&gqb8xi%=%4cEthcTE8yaeFRf{3uea#rsbIZfp8=ku-}X|r9ncs`8&It;j@Y(S;{T)BeYS^&spkT3^NIQ|z`@Lkb9w2U~UH^$P7nRdy1VtK!(q{kpr zEs>UA1HzXE+xUV&8hn@-XY-`-xgYx}chDUfCw{?v7*f2yz|5sFU&d6g#_|HJNmY|u zw$~HmL@b*O0mHfKBYdlQpicZex1I&@4mT&HYu@}Acg9k>2McN7694nfyTel;u)RPz zJdmvhLEz8hkg=4<9w?vVWl#$$V;EGfX8ms&YTgO=$9(iEZ;Fm2PDZJ8~%LEbr zweD1yh|@q`KmE`HEg?ddV!DPRM8_^F-*rSrE9ORCq2OuO-^J2_?s1C6i3-Bn_+!@o z4*bm7LwY&gRP#o6c?@IHCLfg5l<}e4j0ws)KfopVd0|fqB_vD8hhVEk0O{?QQc{o9JDQR_s6h7D4uU-hq>D>Spx(T{hc6+@H?Xre%-m{){t$R zIsG;*Xa+!trPgQoaZtSL)L&a44mb`2CO#1hgtjn6WIo`fJm8&xJ&LYQ32KhxhfE^d zSMt24T`15HAzZq;VU&Ru*7b;}V^^$vmgu_uW7hhPU=Otxi=9d^`+3#aWMG1#qZxy_ z7F#bjsN|dlNRj;(>1CTd@o)b7r5C*#!p*!exDPs5kD-LE(CNT@ByLpyYpwt{Ukuy` zmOVj?bNDN^-?>hDgjszc{V?AnCIJ4PN(8It!L=#54h&<7bKbk)y_20Dg1Nbl>__&v zb-IHSu5+q12Z;2PprU;aquj}tKRq>czHviQi;Ex=!Hv4HUZ4ROGv0nfn%mcN3gZb> z!^u8Ffh>2{2T5qlg-F$RyYQr+^$lKc==FzuWAkj6m=eHNXKH!*^e$^b>wD`Ci73W` zX&?6z7Z@P6oJ;PG?pY{#bnCX04gky?k!m8(F{SCwWq_LOoUwQXl zlTt5vp2yHy6BkGdCN25}{DMRR2rmNHg`!UTkgHSrYs>J&-Q6o3rtSN>mq}~x?>4x5@4ir}Ei4}c6A)LO})=+Q0 zsP(eD7p>f$c6WFrq(iBgc#Y|bg)lMLoy1SP@pT_+bjWASAg)7hOeHZk>{)t9axyia zV%tso{(KB`(G4su+UGR}0PDcykPJN!FE@iXJ<=XP5&`;0LjqJ;D39_EK`D(szcNPk zxoO+8FcrvD>Ef-Z$ZBy+DQI1I z1Ip~@vHO#<>4a|3&kY3QbTM%-&q~wPxla7uXN)iY0IiSs4qSpbFY*4)!J=F+%wGaO zGf8O3*7RZ^)2-Pi0$#vEl-SZ@N^pNn0t~ozmFw=WrG0HhHxdKlcqW8Y{qWX<)Cc3bGmMM);#t60|||8o@a|mTg7A_rUqYp3=+4Vk&)1iF9F}+^L;;@j>mSU z8x=kDE>$dgSw@bas}6JmQ&cGda?QtEB>R<7=hE{F$C*wfI32?_V2e0ae_21o(xY#d zjgI%cF84IT@wPGG78^WRFuxp|D*gBRac;5dq`~~&kC?Di_BL@dJu#e2uOBu;)L9l<0J z@ZMUxOjAcJ5OL~@0f9_1n*Z5b=Dk8JnFJp8sdX3A-geMhA^rrqeuW=xBx0z;q^yAN zHA&9M@0~ae!~~eE!${>Kz^vpJkf24!G0dgR+!3Sa-^P}T^nhoyK^!g&%EoU-Rtg;* z?IKOAF?MS_3!@cPm{DfT5ZY?D`XvGDMvBwEKXZT5E;G3E{V=nINI~ zK*|yw^3F;0QNJdaz;MU1|9;BSpOo7ZWH_w zficn%of!23*u#7B)fSY(k_&34uc1So49N^@ET=ft+Xb)?85Z`!e)&Hb_CL&?an7n; zM4;*s;WQK^5%y2RL+BA0UI@eTKq|>kh{0A2tgqp+o z3r^-rD%VRhvxi5@hdDe+{}j?dXCo-*4G^BB%k+j8tV|pOb7n*{$&+F?E;;Y3?&H^Q zTMNcLAtMZTXyf!r`b5VEL>&6KG@=(3^B_^Lmz0*FTxz&8kPFLP6IP##aj*^tvLq8##*$gD(w~Hj^BX#wgss0TG&>hrEBBOq z8`s?wL%=Jof3&1hkU|c^G+s`V3kvh??g%z_D&N9UG1yj{q`2A0icS!?cK;j-X`|$6 z3Tuhy9rQ7D7Y<)t3$!Jw*Ossaz|jAI$2$Q!#V!<^Wjlu1;1DogHTM~#3bkQYU^SDZ z{v)fN3x{+P<@VRjs@j?A^Cp923S>k3Kqax^fqqpBLh1vLs<)NZ597S^5 zcF33TwG1N^QnpI0=Ex^2N)tVwp06g7K_GpBRbQ|10SuILUDiD93NXBh?t};5Rr2%) zvuUNf-2@1!07~3rpPCP`@ThhC%KHje~0Qoms*uPKnG zfFbt^YWO5HWb!kGHIDG$RhYHv375is$tNA7OKd2;AdL3)OX%|No~wK$cMKPw- zFiPr_bD0|M=y+a}USLrgYB#sCvj*Y?R4@9{oLJn^jDK2o=*8%`_L(YSVm%{?3kiJv z1xF!7tSUQt^YaEuAfjBPfKXe^PaL13N=n+zCqh@+}20UeeJ3qfF#)q9fKqHg+puH1KI9|LFYt3=#Zj!IIz$; zKqA2tU3nTLhTzXsP9K4xncCeIJodf|u9MOm6D-X6h9+`NP)tndKzwbKoZQz51TA;5wuTA5xIkO;sJy z;y0vv304kx4s2%Sp5mYx{{E{FmI&hX^jy3Hg?@~#9c@LD2RhB2MIugwiW&P&NG823 z>ik>!v^?QS;GgE{F5p&4gc99b#ov>Z!shyf#jupol#+3|px=q$d-%YWGHI=ALGceE zh+4tw7>d=t_gu#AQAQE?h`L7?pVJ4kTHyEcGMd6U;*pt9Qb-UIVwq?rU1|cjf)ufN zSgPbKmAogRn-oO*(v0n6?C2@SL}W2c{5qaZQhW?LhF?V?5k#+!5f#|dl{O0s;7)IF z+Pf9J@XWzC;pX+U#Pl#|!b2C&!48)?cR zw|{<-0m4$i1LtM6r*p@>&8>c3uu3B?fo6sUAK7Hc8z@Bk;Zir_MlNfJcEz9feg%_J1ExXhb0PZ*t|amFD;$$$7eK)#uXi((1m#SS{n@w*$i$^8>LCl{ zWlpx?PL{k^kug|lu>JuT>^IoA49n_bNnA6T?Cw=ZLj2HL=h?TO`lUTW`jb_94`8Bd zR=iPz@7VY~zvs}^)D&*uMUB_C)d-|H^I78K@X4v6u$kERIfDdu}%>;f!+eHng{Z0U{Dt?%- zF>P}Kqrj$&Ek+*HTQFk#yHCAPIcC=c{7DHskP>`O%!^+n*2eqKz*ODbC5c)_yt!N? zEr|XRybI7d=X)(`M-((@@=g3J{lE^it(^0%|KNFI<7-Ek*5ybFw*CzzA@8e}NbafD zzLNhNEi5WK$6R4zB(ucY-*WOIzRiTQ$G6pqvStS=yrE& zLy)SPl2`_r=zH8=kYVzJY=c>;D0KmB18E08;=r7`e*wee|4Z`^I<6X`8?`v-r zd|G)<%7LyQy^D#*8BLYjrzg3LuXJtW3%Fc?P>HHQQ3Dtk-5iQ^-cu*slLZV7QGuyMHc`MkHG_6cMrP(Ti1jm|y1#ecsIp)}R`d*p@F zA!7q$=+K?OhV>opjRa~RAob_xqY8n{hh_>j3pDw;q0E?X_q zAw9^0OVVG?4$Dt^rZLVF?7xQF0IMWModH|Y6&*x}i6tcSN*4;5%i%0{KuS80JTi-j z&5e9PD-UOJo0Qy)jv{9Iv9fJ6sqywgS^gMnH41kf&}gWbl43OK;2LB&Jx3hcK-w)@ zS~p-?uApw($pUK+9tS!Q`6~;IMEB+?91}$mBYN}Xu^l{4sHU!Hc+6;FZg9k5T2f2A zTGRNP0)nl(Up?mo{~#?=E%=yN+s5_XKK4J`rO7p8pMN5y(q%DS_&1pDRT{nFfhPP@FJk%iM@?4-s9BK zPyKSEG0gX-1rcW=-V)v-a=2kZBgQWV*3V*KC+`|lKrdisN6AdbbnnLjk>pvEKg#TzkGqy2cqmG=}gOUWkXb*?r5gVh5dXIU=h zxZAMSFP6#bf&sd%+Zw3SE*Xtl%~kz)oHE4K&NRd#Bh)9AI9+x~`Wwb~ zG?sP@uKLK4*3(Jxt1Lz4dsc9sh}rTSBvT}C(5GXetwKw!>j(H)wCvGk&P@q7N~k-}F&34_tiB zqDK$+pC-c3Wsye<;uDgtTp(DDAPMbB!7;1(lUZ*Rc|2|-NrDFl9$ABBv2B^%Jrl^eug*r5CQabdxwsg<(J5 zE;Zp2lUVX0Oc9cpMM`gUt)y6oH&n8BBbsQqMx1-6>0@b%{U#R^BFeW`ad-=ETMyp- zWcP*`uoqV%*05>dA9gd0pI+vWJjCT7@GN#`4aY`)P+q)O4-~nJ7hVz=S&7+Ecu3-U zW?377-+NMeN5pp~vW1|UYRsi{+;l-zoo?#cV^-pMt2hQZ1-kRsv;MqTjJU={AIl#KD7}M{W{YBn7PJUg z1)F$(C3NFtT0%bfJ)eN%G@+?8-8rRXld-RkVP_0$47WDT_$){f`BXUtd|~@l_7!76 zD8n)!EA~rI%8cnV*1q2SAq%k?I@!XdZmT%0Jr+`DypSBbH<*~xEl81Hd#Z8)Th>NKQP-FV%_@h~d6d z--NI34LabdOUWmbOAFkqN06UbeCz}*t?AXE8Uhz=Y!2+_@tv$!p70ojh(e!d=UZd} zBuDJ8TUoDr8ou79_2tK6-G`7SRi_%nCn-+`k1l?g$H)j|gkD@Jwh45E%o5ZLmUFKm z-rmKHQ!^7Ii^O5Ax%Fy@wQ&Z|6ZMaFPzfw&&d@^)qEy3i()s*jSgzd0;2KH4K@m0-`Bb!p4 z<8Fl>)NfFY8`%be{99QrJ}RgTc$c^nJ2Me9lFYF@Rn4_gE8A`X$o3m_JzcW%vuqJ> zw08wwpTSZ3oacwU8}hlb7*zfz8(4|mW+ZZTNOSq1Jn7`_3(B#HQen)B`Gr8+=Gh4( zWrpzX`bb1_`3{$#18vZH{Hldb!Qun9W9se4bO#y<&N170oT_1u5&<}7PU^N?qR(Po z@tH{>J$wwY%C+cW&9~c0#x3YLyd>O?65-ARA0qKjZR`oc<)1!|kzmsXZ?6!3KhWx+ zo_t9{nZe)XM+i;0%s$GVEMOYBTD3_X~bl7K`M;t*=&n#it(c2F6TQeBNkJdit>bEBgk#;CGLbd=?Eu;{RC_#Q<7rMRbsQ$!V37CD~NOS zEQ$gK)|JPWldld-E*>g&)A~MK{AG(0R*cDAuvrE^24Zft_AQ7fgQwn$E6kxe+|cC8 z31o6!14~K~I?|rl-3|7&%R6Vt2qks4j+Vvve@@z>V?99JNMktHMpuHdN?hOlJlFiB4E1@X?XC#QkSD5Pb7So>EQ=P=(=19vYC_0LK z-;uei;o=U#0KDFPv<4Xb)<9#Jx`gza!iva<88^d`*jv&t+JiOi0qjXkyH7f}-lN0w z{dGdW0fdkCgt;a+F-gw#oe+@~pL^dPx#;Z7B2ZYvZ` z!cSPR2U($gCkmLDR)j|Y`$9Ig`uYsC5csC+KB!YF7^Z-PlV6U1UjUdt)$=K0(Um{C zWRIe&YQa^U4hSw18H?m>Jv8puIU6LGdTuLSvwJ{BX-sAM(F3d=Zw}|mCE3n&)ieFWkV$gGtytyHefo519 z=EHBRzZN3x$OiS+Hk3bjNpv&@ewmlx72_rfOT{=II15u!ah}JG8kz&y~5_iQ625UHs zLiK0coClQle8-RYRVgCy;bN?J({~_H|0s7!Xq!I*!^fhrNas5_-3$v9_C4|-R{#;k zb@sOv!znI6H$sVNR=e8m3t8MOBAQY{P#u$n;M$nC&*t-u{Sd!s6Zr03DF!r4)~zxD z>ZVpWZlxYCq%9m4$)~2*I_%^N2Lml9;r)nMRubi#PGD~pi|##QkNP;dO&!oZ>iT;i zS=b?y58!>=lQkM|TRtS;4J%-OEzz_g!fT5M5OOa*gp_4;L|1#9^Q?a+ZsA$lHz~n0 z%Fq~{;Kb@CE{}?^&YQH(60|-{$O2)n!MMQ*$x~BVwBF9n@k>2^(Z}`g&&d~6!k}JY za(T52d?UhFrg)CLl5rOZedwvGsWCfjgnXP^giKYq47g<5d-5g%MxP$V-g8+x*&Au@ zkwww2W&HeLOghS*cUy6QFPHkj7Z^a&L=fN&7zPfT#hl^KHfsDS90G{U{SENv%Fl{} z5uz;@zb^_NODs+yN{tg({gM>Kt(ssOAaBP!{m}N1K%f*g>zbuEL^fT~F9*rl-&_h= zru#lD8Yr;JMXfJ;RyLALFBs z1wXIUmfX_RP-BY^7AFH_bh4grHFAZ?kv~(o$k?87do_aPG2pwW zmP9Fa^s$P-)`(@b3p{6-x#QX5rbf_r)LxkpDDovv+nY{&g7Q_ULZG<@QY_HA6_WaN zw`y~ePh4b%R2hiR6T?#TF<}w9I-;_Kd)XISa-70jU$=uP(qClpK%!Y6q7MUdpco*_ zwaNEFW48iCX{o}Kn(iBELcS-e3$~J|J_zr#N?V z6Ahi{>@Mza0t&+sRs7MD+4j>>wSUTWe7SeP1zeb-&jzN`O4m1L?2BJjxKh$bQ6GWk%s{6Rvp}GG9b0OaGEfm5GBjDwbRJ zImgwBtzj;XQYnj7DpJ5_)a5*ECZ4^GzTqhwnHRZ_Ok()`;LgB+oF34bg7=Yv&%^S1 z=wq8P30Ks3dxa;!B$DW#4+<){7t9lyg>3v&#xu6}Ge8cZZ#3Us$-iJu%o7{2?SyHh zT7eluk~~$ko3GpWfXL8_XB<;zdP31x!iY``TO*0~sJyZUo&;3xaiJ?$2RW*gMWhH(` z0EMq-F($L_SijY_Wea6O&1lh2KHj&h;=}jmvVgV1Akz=|8^o7Es=RKGRQduO}o+x=Mji$`%dN~(I zx9TZ=)8F~_XMnUXho%#zi6$2&_ZLUNNU@n_`3%HqsyqnPz_F?vb1ybarWfD194xj= z<#IMm49Lbh4g*OL9f_gc;cO`~>5m4ZMCyx;h{;4UFO}F6__;JqW*K;phhV{ZZiQR$ zEKiBk%PrUzZbOGAIC(0XS;6}3D$tZ+D7Qc&)j6;g$6bXqk?7?>E ztoA=XlqHg0w)EJ5)vR^L`J?Mvs;*xAQMm6UUNQ0XKEWwP;xbjk?ACQ+fMj`(J?G(X z`Y8NHDvF-x{d5&>S82Z21h~Ezs9{rv)SXQ+kj_yoQ--MsTwFLtoIsZV8cowa@bO$g<3f zXs^H&Eq1z3!A>z`gYYmZ-`dUI>!NRATn+PdU?3M*fUwH#fs*?P>2_>ji70WjNtBEp zbPzD-W(ICJs!SX}V9IC#zG97}1K{?pw7tB6use3hEsDwqe`iC=0skOo-$|O~Bc22k zp-wy!^LId~Aw%u*sI_gCrVtf!7wPI)*4m_6ihUV~k}#;*zX45ZG3aN2m$LGuIygX` zn>7@JsGWj!l`GoFLDB@f?uFo<_7)A?Hp4Kg`J19`v*}JXKldRXhWQ{v`gCJ@Mk$G+ z`^(WkfJ?_eN%}~h{fIcirPXCQpqM>Vq&zAjM=bKAgVkCsGii6No) zEPbo%3{d*(J`aEw8}ZzddnhiSZ!@ZAU{%o7SFDp`P<*-+KA1Yu-Btt=3YnXf@M24+ z0pSrlh)w*|<_K;i_6+{J8$MBpW!8T}j-Wka`qLh1E6Jco8&oPf=t%b`oF|#u^V}3- zr*JAQVl_9kHWOixQ`B3QICl60|s3{j}m8* zatYRVu*TE(3Ta4j73HD@L0=KU&e`(>;8u@>t^i-Z^gZWZ1?__eWm>lN=!esZb&*Co zejeI}HIj7$Xp#M+B9+Ai4Ly%!4P0SrT@m);28V>2 zB0YK%k2XW-IpD8=r!OOXy{3{6CTCX9lafxwa4^M6L5yHY(Jfl1D!Ig1dHFUQ;-&Ei z?BLHjXoT!D`P?Mp{}G8ly8$bzWO#z+Nt93-L6a4yZf@jKNu-~|ng!FbP?j}{o=N-- zG1O-wQF1ED(q?!c(%p+0FUpJAx?FK6Qz}(UaRbXIY!pL}WO~(SX(8$%M34nI;`0oO zGmwHi|4QtJ5fdOhRMz6SqKR~VOm3Jivt#D-Q~G&zsmB^}Ail(tC11-_9JM9td-5|7 zO?nIYHIGl`s}L(aD4jq!EcVLE;*WUM4i~N<4iIW6{PhT_vzHC9iZOz{ds&F9z!&Qo z`y1Moyp@Ge${9@+x+C z8*mdm6oW_+G}5RDKN7IkV%4k7pJ^$@mps|L6q#&eKr`Vv4>-@ztR->;znn%0l9vyz z=`9`|Cy|{FC-4g>BUOY>tg-)S#8u3y-dgFE3)H-C57(W>^mzTqNYaTg8i4eCeB&WD z+kEe2O^G-^K7LS>Sn&999k7p`mRQ!p_zC{{t2rJR`BLZuUiO&1tyJTn9eWbT> z*P8lZJyY$$6mG&L>4U-UnhultEJ7CHr`E>J!AhA6S+w^cximz%IwJpW6Osm-CEh}_ zv4}HP>|&H$!E&2v{{4oUjx&aYyq~y!Xc3~LpFAJTwugBs){}Wf#XNq*N?FbS$#kTJ zCyjHZdYP}no`1xXxyVv+00y$1#@-)(8R4Q=Y4z`uZe6`a8H zCGo1DyO8D$x$#@NvzVR=OP1@z_fl(4!c#MLuOcclT5~Hjv-cVzUE8RWCJrC3F1yQ% z4lG*LVaT$WfS%qylkRst63p!j9c0|Q1%G`vCSHQR@PdfS0nbmf*{(}tarij%**alp zg&&~XxO0%%%h$%`BAQYb*w!mQuuz$V&O1GAo8n9o90=o`?Cnl=5YO81Lf6HL&WP2j z+*V1SVJhOi(do|Mci%pzF<-)9aYe9R$Ul8cffwM&m@}xlmJz|%<@Tq4P+#9-xdxC@ z+NBw1utu)2*eBM|Hj+=D;bJu-?)8wdNoIVa+OvleCAe2#$+?EfgQJ-p(;-n50z$%> zq|ma5VLMD}=&#_S_pBbS*pyJB_9lh7HuGytMO)lNQ@Mq$g_Msl`kAwN!$$i|m&1A= zr}nK4iu|+TZs_kU@}3D&m(9>-II%s@`wp{{;*~wZ{nWzEh_>nlcc?|l-^>1F`k8zR zb#)ct)DttrlTW8aA_s-1#mTV4fM>{4g>mR8-sc?AqWAAP%txj0st*a`=e4mx&LhabQt! z?uy;}OQf^c@8b63*aUgTRoEfb@pwRavO*95LeAh~FO0P<*7-<^0!ol`rvC&u?I;@i z#um$=PR7|-{gm|&V+B3HyD3Db(4^#-!?vA%dZS(RaseJDY3J%Y;B%_j4MZWK3;PX> z&>kCr!JUWIhyTN$V>5E^E zV`OIM_$VM=k`l;)^*oc29~$X!4~asM*H|$)!hrF$&9CQfnLgl7PDN4aj=EAG9i;=ZW3! zk9{+d8&8}s8wogJbM2Fsn}Oi|xT17!?Q10tm)Bi8*F&lGngd0unObKnmsY?`_Hsz= zho|i!qas0fh%6#)$;d8=uGPCV{;4vbepR|Yb0;}Urx#K_S+GS>+eHfiF%7we7B2}_ z^P>*UDn(|=Uottt{|7ig$G;XZ5O97}72^p?>X^Ckk-p#3vd#37YWQb0ZQvm#c^kMyX@)YIiis@;zCKbosr)w9(0UB zmhyM1>CU0i;_YAP7ri)Nd%rD%tIbr#RQ4WPExbNj)}CczukK}7(IH|8Cpx8{Ia*IA ziFEk{9Sdu!g~(V??`Ivv)2x`9=>LnbfLnEtCy;c0f~XL^Y!!cEYIFfEuaW??=Q=LMvU7QuD5XpCkDEUBGNV^D5G%u_aG-8q_?)V91u@W~= zDrZOUSGYaw>;NJb-b*((Jg&Km=8vfT^Co?AC;xsF8VZa_#%ZlI2gG(jmMZOR{*jhi zt!C165ZIN2sMR&1A0cKT1|B*7MtTlL?YTBKxnTg35}QdyGm@_P9tW})(zQlNS;ve* z7?6ipInZ8qa`O5UG-$-{;-cgnN++MaG=lt;^!q9G=eo{Hm86ly{X2_qx*%xXdv53dPwsee#&kcvjV0rQGk zg@G6r09m$@#kfg|E9gpv0N`gu9$VSuSub2Xz!rS2Z6fJ|Wt+;vIA!6pH7<~|7diBs^5_mM?m%wL5tKG9GKvzjUV~I13!bHO9x#)FPS6T)^BiG; zR)31?XRUc9#1(dHBZTFyYpH~^KJ;-LS{S9y{xBsRQ@7E%q-=gw?3u;zlDxctbkcRN zhX^!)J?^k@fHPreNkWb!eyx`w$fHF_nW2Y$9T{-rV#x*aIU%_DU&MaAr!xMYJ-^(l zo`ED`99LJxj*Kr-=3rH!Y20p0fdWCE3&PI$AS@E_GW;ZZ|8mva#-HavA}F;-l5dDA z{49KK?mQz^&Y51{!IJ6ehHgOo;^iG&b?cytV6#D+CU-6$o> zcSxcK35D=BmPB&QV;4HRn{7+;XMe3D})=fb#!{`V`haeMK+`eu--^#r~nVyB}BQ?(&+Hc>| z<;DEKPf|_{m}v(FKRrM?$?9y1fsP8WPGuBJV> zr{Nm|`~`V!jGYfs@pCk6XeE!^(q4s|Q-rmx*eHxSpwH>SrHexhN17dvTPTW8-S95iA~_g&y$^&Q4_370Jx~Pb}FDrK*ga121Drf!Zaoxb7~*mYdcoQw0b!`^C?p$#E&xQRoHTE^9W^v@uh zA@$hz2|~Ou+|yV4h+c#$7}van)SW4kb*|1?Dy>htry|R`a*iGpsF(dY85QD`S;?6e z(8pkB{m&@r38#305EJ(T-zKbsSbOgrDxTFLI%m{6jOd60LJXYeQ!Iazy{*g=l=mi4 zOEJCFWFU(Z1C1a#w3vY_!F~4(e!WRfvv0LtW#VvUg0~N0!2#N#w8Zpxa_x#IR~i}$ zrPH|cw(vojshR@wkK3$mg4_PQ)RTN z!wmc&jH5_@xOI#ynDXxq(T3;h35~RG()oKpNdJHoJ0ar}qv)X1QfdTmJ($l2i7l^~ zD47Ge@4z~046fDlDQOXMH232fR7$Yj)1Qy!Zw5o6<3>p20DTl@?&A=k5&1e&v`t)q z&BF{%YbGTMxhgkM?oMcX6H?Cl6elS8gO=ZE-QGtVojHQ22Z&0N6V{G%#a%-agovBk zM!G;$@qCE&)alV&UnV4v&^2FuMXh2^;wRb8?uOPQE*0HRJwprbvcSzg$YL^|-;$vV z;kk0?2Tt7y-wOozY^_rAhg(|K+kg^8MhkPVSyN8uVC);O3y)fo8{?+%n4URd?e(2p zTO$(d6$Xh4UNSdk$-%?8_*-#GbOBpi%7qk46dd(!a2RB=mJ7$cpPzIFO0cP_kMDB!$<`-y;5YSi32T!I4j zZeM?M@SlV*HWwX2@%}M#-aOlf4I$1RMEB6^;U7X?0FHxY7=7Hv0!a%+C>|)dn4mU^2%OCPG#Wy=9_M42?&uQ8z8ruXE@XujxN@^}rolZ+Z= z;K8lr-3xJpas7eUTN#v!3h5N-WGI@RX%M>u?V_tIZUBor5U#7gAicIv7Noii z@nmDJNrw zw;{hq7wt+m(N%Zp#lf9u0z$b9rd+yUetjbdQg)?k!I0f(84@R0t!(HE4l-yu31jRD z0hLYdbihPeb4zB9k*ytQ-!ekf*`|O@C>7#QTzGZm#bxy!Y(8P!jL1QsgrgvI6@4LQ z0}CF!`@DoekvcN^s4fZ#v$giP&UDsGhvddJx%GD$kIlSj2adaoK4}SyOEn7++K{ii zg({?8#u7<8*_U33+cL1xbnk!&N7KedpF~tCH8~?}vWzc0mZQ!w%A002M$NklU7q|h!*#S0D6S zQN~o}A^>?W@hWQd4OqQ5kUHto4e@7=Y=ig2)%7v<9hXLzE|ZKJ{s4gr*Sy+)n=5-z zOzDkGn}|kQ#bTLA===rCkBVF7@Z!GV|9|8yE_7b0sh7OAW6WLf2RDFbzA$6PWoA0T zt(vHKv%z7wri-Fn>Yz68m#+?)fn2RU%D}n%31_GfLRl2CPEylz z47QK-hu~>jd(OBbli0XbB;%|*>nRvS;YRmJiU~KM!y1FH@cfEGbkvjBtG7gb!B?ex z_8*;1-LbH}#zaJv8EGCuF5=4v!pemvh!D4WA!|Hr`d32?jAF!|D+Q1!b;h@1 z%#b54cm{OXxe+J%{I3k9!3**@WfE_cOgr(vR)LJBj;jjfJswg;+c`^m3Cj)MAyb))iLX~f$bmvugu~Op>dsxR`pr&s$)z?lekk$?{?^MFHfPWIM3=4 z(#_ssO*UeOW?!|Gz4$VTO6Ul&WY$Gn>Wv@qa2@R%h?5iU+fEm}lu7lgqH^NJ`MLR|pNHM1V_?=L;H93r{?DYJ( z=V(cr*y=Zk$?4IBl;@c2ajC-_^h(;z_KbIu87=nSPbOE$#4;!yBX#9ZK`f&e10p-C zxX4rGo--n(!bGSsv((JRzdEo%BqR1UokbP1!1o5S1=HrlN5{Wbkl zHL&5O+t2r`n1Mv88N&~8={xdRd4LT>nv`m_^YC_6GnKC)8Y{5mH;3E0*y-tuM#<%a zcpQzI2h}wY?FO_Pfn_X#5NA~VBIT+~+$>EgOWeiYxBwy!^j(pKq4+(&0hXbU7<;wZ zCw2Kr)ou}$MOZx(fZ|VTl$L257a?e*1?&hvABB`9#Oy<|N$_g-nBIuC=MfSLnom=cp2RX9A}Tp-VMz8FAVue9Ob*ORgk8$dx%i zB2j}lMj1WkEh<_;qq#Hg_qznkLkd?iuFxBD#ym>R9->OBs#tQA2FV>|T%%OEP-n=a z;1mkp-@(X}t{@kI@f!mM(r0 zUqmLCC4|Zm*Rye3`o6(TGHl%W8}sP#l_rbmx^=(JTPaj9ijDFVT_1NRY8i zVI!`H+vs1zbeJ8!A)pjUPpezG;~h1AFq4p%4^l54_NJb(M!IS$UEHR%k}@5oaUDf5 zE@V23qnUMnQ2Y^Q$pdtY=n8UJy>xC=Xc{MX^tl2ruB<)sl=ti(Qpp!JbSa^XA-sNv zAkMX0#fHzfEASSob7$o8YHguQM7L1m&mzJAJ~PU0qHCg5)QX$C2OO%TS&a5$=@1J= zo*_^NCx~lyv^Pol^z1=4fxz>dhY;e>QgCnoq@1~Hc(V`w`JhGJ78QCRh}*VF#Zdta zGq_y>)!2uaj9ROw#P<#~kSzDzIiv7+JpMal^B=40e}O4PO0T}p(N1j2HBt^9UOfLD z>jb|%t6Cb!kRl9VY~{gn#iHibqIgu?fc<8AO!|TzPT* z+YG*9w$H^t#<>w3f=3CWZsS!*Rv<;AzQ2?KT&P@O0C6{e5WB_C55}8#M#!q5@XUyo zY6NTV^(y`8qG5x8)8Z==hTpdzWjNLeIa)2*OZ{_|YhXJ@9ye_XnlcMqK@qF<*>Tle z=mf)eA_)lE8lTF%|C^%EhQY}?DQ}Ps{IrTXF^?FvklQUMV0#_;I_K!{sF8S9;u=e+ z7hiL8aRd5w{>+qPlsgav;NOFGDc@Df+v=Z~gt(C5Pg2i@mJkzNXG(s{311ZBUQG4i4Gx) z_VWzZlrc$(JcXbY*P}QCO${E{H;Pqe)1#Rr?&*sjfRVPF1#zKEUny)OJwA{6yod0p zteEviN{Un&BErT`=?7SB7jNqKVnsBa3Jvda_g9A#wi)Gy z`fgop%}|l1J9~&Zb7^z1`k3yT;=bcZld=5);fry+_$~rW zj1C5II8`2;2jX6SS*Dloo~<#eb+GuOO3@MnFU^t_M3~+Ko}+!5`mpgKaSSarYx7f- zT)mlCS_KOQXRA-HdW|`Ms$K{<&N!W32|B@ZxlDB4Gz6V!ql)jdIUBIJT@8a=M#s0-X?6LWW1Vc#KV# z!GNJ@bmY!1Tnym}LW7e=yG^#Je4+O_jj~a~-YA35 zE7MV2vkLM@JsMrtpMTVUfw0$xS{I+B@1~XqU-dH+zH;wb_GbMD!cF!Ush5q-s8s@u zBuk!8b&C7^;$GyX5$-v9JiPHMP^pg-p^>J&q!nL7~_!6rae2od_mTs|Nz)PWH!9Wyk#cC;%4KKiZ zrK4yqhQE9EmE1lukU?mBG0y$F;?D*&OA>Bn>X>!7eZ31w`nSth96_Z{|JfZx3_^Nz zV|n2&qOAjerGI=oNm;FB=c0_9Xp?@9Y$$XC)lsVJ#R&czVP`9p-0M?_Da*op!foDf zeGy9C=^T9xFS?qe|KLD`8{M&Vq9ERG88MqtQ-2!rdI9B5SC?#FKBnd0a1aQS;}(^H zorNYx+jUD{R~mQ9@vAFWRMO&30DHnCqtjHR|@H z1RD*qdG|nTi0?$2831inUW~uk^h|h)1FZ0ay$mIUptu0?!Vs@9R;HX>x$1t6yv`v0 zS(fx&YM4Gf+cKH}Qn?M?-I-k&eJ^}g^)Eh)!Nl_mAG;V9!PGPN0P7)2=>ufiLKj!O zZDle|?W>N}9U@k}$0F?z4j?H@gj zATpmJnkM`#m`{g^-)ZiM5%!U8&|vF;oTETGUs!psGP+0X*6vn_EA9rr8y8)5dhX*I zx_fQwGs(HqX}!X2YN=^lKzWvNT%g$yzvlw!&YcQ#w8%MB44Bal(qo9MeJ+7e2p)YIcKC2UT&akhKwREpZ~WyAH~@_Qma9H<1R^uT(K}kXzhz2;X|D z)93Ga6B$eW0Fm=tqwZ|<+ZoVaBExx>c`&X}ENg}zvyt)5ss58rBVASsj(Z2<#`AY= zb~W|$65okvBrL|o;~PWbMzgXueto+G5CcAf>I?5!v(P=3TG$yB%fYzgAG~(@+^$j; z$yR!_=!JBv3e`?Zaqt?56*OPthJ#mY?o(J_;ULdNMse2R|Q zxKAL6XGuq7F3=uVzgEBE8)31mI@-D~Jnal#A-J?v{EkCqP+rCxqZbZD z@}OYR=R)ceDUTFwBDBY)7V&)m(eHoK&(M>eH*q}-bWlr%2-Z(CSjzctmp-`oqEXja zBCC1yLEt$BzOj~i{ioFOMWgIr5#<%0qEbc}ism_5MO?{38V^Az8bi8YIFY#9ySs3T z)RV(R58*78jw|I0G5?@a_`6o_A_iP#N`-bbzma|q3EcWuG=sQZq%g8Zb|SPg4n>{@ zzli~r$S8VblG=3BNgB0{sHSp>G`V&4RSW#HkQ5heZdB;XbyzU7iB8ekrVSRcfCTaN z?HO;3uHX}Cm{Yl~C1&uzhm%-XP~p%bH;)ewwjEzz8fji!3K`!Qkn=*~s1&J7zq^DrION*Ar6$*B1gk>Xp-j+p&Y0cO@DF`6~&5wocC6B>yzG6Now@v_;o#`QG^YNS)Z zMHmbzH}mrfay5Rro6JQ(hgsOFbODVFB-F&&d!m!B(b3f`TxIcKNLWub&G**BKA53oh)cL<8AL06ekMq50^R5uSLhX~=}5$iTUodG%}S~sQ%FJL*HO+!98Qd^wpZ{w zI$K~MPie4N&(>HxO+cDhf&5*hk-O0|x z9e)d?6yAnYlYXOmO8SOsWrldi4J0=X5U9qhp;~7&4zJ`uz6F8;T9N3Z9#VIY4ALMk zqyHZ?8m^Se|0Gtl^2kTohybh26^$D%GRW6w?vGhRmogB z`1N^e4!t?V*5QscgY=K^4hOIf_KZL&hfan(uYML+v_EwQI6U+Q@rg?xGa<)O-v%Y^ zPpV%vpwKzSzlO5rpcz~=d(0iLR%7@sE}jw4C#X}pE+_g08nD}vLgRY`L(88^lQrti zS7;OH+R5MhQw(8T(ic5>oAFC}2xCX0`zW482^_@l?B5C_KhyGi#4;c{_uT`w9ePBH zchucPPItqHzD*&B1Ilz7U(^xzEJw+>;N|Cc+(xlWpl9&*(?8eSXYUnRiDH!X#{5Br zbRrhQsPBOEj9-QHn05R`SfA|YV)GGqL<_rdA;ZjUM+EE4_VLB#4g` zrW5;mUOR|iS5>R%<6nhW`C;58P&)iU_=xY|X*6bJaRWGbyt`vR!Z9kcPjpd;If)Yrz2cu=X~W8rYux~10CK6rwIbZO(_=52hDlrnGk z3c1jNxGVV-Ay#Ixi%TOye{g+HNBdZB)-IspnRwNVs5K#(dp?=Cu;tkqbQUe{aX%4H zj4SQes*%xdULdUnqCV`rr`L5fi&ql#7GH@B>PkzAZthS+8~JA&c?ihqZPMsg#18zw3dpUKh=Ii?1We&p`7S zfs5O%Zsd^67^O=}3nU3D0S$PtIJW>_E5FlH-s};nlbC)mln}ReF6&2z z=OK~CqtsK8P3$H_DbFsXkEGvCG$r9PhG>8uIdP5(rg2x=}pEJeR%SO+Gc$q#+JL7s; zae%mFFX<+?Z(Ap24%)nf54I|$F|r=jhTfe4F&hzr>kSn(i}l&xeTEzi0*|t)TB>-U z%*OW>OpN)!*+S(6?!rP$S3wh>Cz9O^RYH}%63CW}afJtsZaXP=Yu6u|O6gt*D)m=? z;o5cnno03uey`CmvLsr>4V*=^XvdjEu7!zSqN3!W2Ap8T8-jpE-hQANtXOfRYB4+! z-_|kq-;tAR`sR-RS0&5OdqWV|Y90saeIwom&nUjmE^a;_X&rI*Vchjw`u(`YD~zY~Y&k;@P;T&s;6|-d@g1Z0_w~%pxY7 zau-z0s+E^WQxVt6_Y`Bow-$H!V6$G*2jRR9Vu*ue{^Y{KAbjV6paG$-uqhaS>WrEN zA}ka>q9JjnUlYW^q&wMLC=YRZ@^$ZZfeeMFhD+4N9mc*@ zANb=RW(^qRPB$#8eiMGCXh{<`*p#?vGlZ^F^er-?T$p+H(5qn3!Ge8bNaWek8&Jj1 z-d^b%G=vxp!^men_-dfu$oqJ<(RFTNBynX;j~7Mn;+4V2Ma?lld*ab6#SPU1@^O57~Iv^&zd_y+XCp=MHFagITHpZ~9=JKd2a zORfVPzJ$k`dsbHUHl#>O5cE%g-v2cO5CSw*_jGq?}A+_UbsvZ)QQiG=6p|SSV!h2)z4giWl;(ui>W*`r+=W~n{qV;zPUG^-BL(% zTqDD}dyB9kw>o334*cZQOCCX3g)gmOB!DB|zj>Wu6A!HedK z*HBgszB{t5BNtp*=nzn`GAx0&to4BmW+kQTxw0SiMlE|Gc1@wf zqx>-^#hKwsS+7%@k*1k?wa_Ga0EiAz%3g#eL*XjXb{1nn=`xd6Y&18X{~#ytKGCL; zjZ0IuJWHt8l?T0$kJ5Kq!ptT_7^RL+(Hb-5gn14NPKg@%7iR*faJBO6sqUf70qhy; z*(H)S_dA22=YKL#dinDgNZDy`{oVkK&f{vK+@AXj;ENJA1FfUZJ*r%;bra9%6+j!j zz?Bov^Mok`Cvk+$I8{Qc2lF4FYLCV2C(nL1An!Ojg z9UAW$kxYF}^%JVl!5INcnnXULco7G8_<{W`*Xz`W=g*+UT=+bc|L|ZI$Vtm>ndxgE zLLlM%mt4qyEfQ{NE-#RksgWo9y>gKDH=cIL+hl_rmezBm0 z7~%Ah>tbbqrZ}y<8+p|MtC%@GN4!8LjxU_*JbG?1trbQV#1{*!UzZIBEJa3!CeDs& z5TmfTVZt)9B?_PyzrT?FExuqR6Ln+>VdP5reC|q$94kX28t6K#BD!PpNr+3)=*+9M zyw(c}duuZW4M40)xBZ-o3N3d zah>vfSX+iP*MAsKCPLGDWEw0tu(OFf-x8@)2l)?T>v-|7l;z4`wav$7CEhD~2#+3EEgv<{<5PliG$h@%Mp(Ds8ni>R`5R?{MVO>ndQ% zsa|rcS5(bC7roWfxQ!GmE|*u6p~}?hC3t~@uu&tGav}EA=gzE69gM-)mVT#UIOClO zLdE&j0pe+18Pbur`mj6iz~`rcPG~W&Fx784y!bu{zT+O>{M`n7JC`YSO2nP!nVA|x zC5;_4#7YdTDbL98KOVi4aGs2+m5Gi2E*?j!yWacK2n2-$u8;eR*ntIwsj5NNjA?5q zLNd+cq;h8mfJ33c?_~lcVFNBK;t#lvXysplvmO2Y3^{ZbgNFz> zBelxC#SnD)Tdhhbua?R=Cm7M3R0te?se!c_gjU#)j)5K-XGZH*G!!$UkWk6#85lg{ zQYx95ikWZNU?2yZgFnW68o%ejobO?a@E_R3vp-uU{Z^(iqmlZ+F~!ShyjCh6d3O zIeM~$10VW9ZIc_UGNJTR-5Tn{12B#^3T1JriRR7o?At$F(hOXE^?=vl|G}uiea&;kM{t+Q3r*M$+`1_N0$;jD0G%Q?mm5^oA?|8Z_L`LGx%szS} zn8;~EEc|D+(t3FAq@lU1V4R=8QxrD-fD-R>s?g9G7juyeB$_)6;8M8Qi#3B#m+57l z6f&JiTXPl~n`DwJ z|HjqiMEL@JWt|#+B^JdWR2Farv>koO%!Dvd1ISPqv2Zbf+{HIr@f7me9>u3K3DA#< z2$1pdm7-CGMMrm+F|$pIDha6KVSHzA;UarJ=)t#Zs8&U!{&sTxo1c^OUVj#=lc8V* z)1rN_Nqn8ErP&13wRr zU_CS8Zc=~czI8##NHVx0gP1~Dr)l&ZXe)5@xt^_Jgi9n-nljHHx1%@wxOd=GMpwZP z>2L7w9ia&sBYX0!LR38BF|OPJDZO7WEY){TF1MW9%5KQzR#Lpo^@nC`xb%}mJ-4?# zIzSS$g!#oa%dfDU_zkXN1Vg|hbK{K#%^1?s)gzVM z^GLX0T(}36YIw<#Q3!OC!{;Dpi%(t_fHdWXrqY`(9kGDVyNztZi|5qQxJ6JB8P+a; zzBOFx{e^nPF_1oK3x<41 zu}kKWE9|F_MH)t&SUM0C2_Yg~N~DjxxAVFDR&~ zr!tC+Z<##0oh#{=5HntPr??aK4)mzh%n*c-@DEdJrUSq?MHr#nAOJuOu&F^i#Jx7>RVqZHqSL>1a56!)Em8X-Yp z5nthZIm>bk?cPRVT~*bFw8x8 z`~DA;U|(4K-=xC$eF|4DL0_R*gAL4ev$ItAA`_oc`T$Z58P!oep>fhO3T^?Brr+&A z@cEd*1~%7|;lvRvjO`U!@lHso?M~H&F-A`TDCFHB<5b@cBeRV->3>Gq2d~+a6*PZOaa7FDY)_dQ*?C;W4th8 z;dn&Yt7snra2du6k5JjfC7iLm7YdYv&zfEv1kVxp+Q&#Pc^lqfVcoo-6x+}8e(4oR z)*Hc0D8MA zF&=a{Pk@mUAS*?l%t(wjAknQ+w~?EoBd#c*^0)^C@|xy*tII%~5$6Rw)T+bJ=49)h~FN z%s!Cla%Av|uXvZD`U-ZzaCn|^xFqEK?AA1PEVYvX@tn1gxA5;Y%NEMKk&R8^f%B`4 z22kTw3!&{gUCr#U7e=&zT6-J=@~w)X*CFp|3uX+;O1Vhd%;Q@g#`n2mR@aO8+oN?c zLOh<6L{Gk=)`_Sh!i#)zniJE_n&yUPk0pbWJ8u5yRHpjX>a3kYv*!=Q3f2pRCU&_o z6F@wZk~FQBE7LMF93s=f3W9{Pj^8X7!rU}SX`=7f1Z+ZGj z{045Eh5{+F;9(>iRIhT`h&32q1;m!QIEjTVs z!Sr2W=*D4MGrpNTex*jxg<$IqeMUYl(1-z!9gvy(m=2_S>7-&Nz8C$?YbC6t*>{jJ zM3+&15|Xd2-S zq7{HgCQ!Cmw3D}OwOtR6M`L1j>j4hr+Rw)q?)78xPfo$i=GIcMlKaX;G2%pgyw7(U za~acFV?=>c&Jd+ z#LL&jh?kldE)gYX_wzmJ_2UYp9Wn)gFqCeE<4?MEL-=q7#cCWz3)__4fAZ^E(f7FX z!?Vrz5V>|P_vdm87Fn?e5tADIjHV=ll1S6%a6+n)ecHQWvpvaoq0*L#7X|M%JJ2OQ zhYAN0aCq+$siOZs83u`p|G$TUn#SVjacuxm1{RFP1%n%41z>C%G;E5^EQKgpB zP;}!3o?NU|Gh%!e{UE*OJ*9k)&m_zS=&jHCu1i8z`#^MhL()d7s* zFDveLfhbvupF95!nyLYq_ENzED_49IgCJM}cSevDlRv@bkGGQ&2mTm>Xe2Up>Wcm8 z{4HI!ct9GQ0I!*omstx-=scG!z2g?b5QP74f6@?o@i(B#2~z4lai>S6+cN21Kr)<$kE{?Ex2obIS;&fI#)vIV!XQ%L$Cce^Hx zT{*pql%xCo$ste#^-St3H^>`UY31ani~7VMb2nl1l{r`^-$l_vM~NVVV@jFD;`~Y4 z2Q%=JxhVS?)x1$Bxb*j#A-EzDi)v~o)J^01c>!_Oo=K5YfKzfmr8e?|+K11p;H`}8 zt(4eLIT@10d|!obOgr=(&RX5>vNbJ7Wv)Md{o+7w%o zAtZ-orI{QCdcXoyxX6x6DNMRkbGNQwz=hf{Cotm3j7M#_!`2nCiMnqo`$lr5CcX(J4{C+mN()55R5jj>GS>zZ>qX6Q}-+Q}}uE!vII% z;}25P(g^m(74b91FrR%EgMmz0MY5$80N4w287G*_D5D@62Wgv(b{zh6Khq}wPa3C6 z*$c6I9yHbO(rBAKk|<=>f@d4lDM|yYDx>9+snq==f{Sr;(S0-)3_Z7j=T5{U!29(Z zzz2g2JmQn@-IDX)-Dec7h^>Q%2pj>i7i%$ZWyWpK2|tmxIjX zGW4(YP8u0?Peml+MR+T}qt7t&2hJ|J=y|g7S{f;(k__}O^pMj>zLr8v@8?qF(gO$& zu<#9cl5uCXy8G$*aq{)}CT8hyAN8-E67&V2ReBr)Q|%Gj_$zPFW=M+#T-nwRUZo}JpynxAO-8sVvz3ho_{ zv-!d2QL)1#0I%cJ5}xyl5&ujOW9RSyybvsKaL`IXyD)!Y<#4Qd=&2MoZ0+A}gkEC!4ordBs{~5CA#@V1o=|?K66@ zeeLsmq{ugVgMHAgv9h^?@JimENnnNSA``AoULt*bnW>kKoeYjDj6biQA=*#;t$TFG zizrFBbI7mVm;3vpzQyz{TtWOH7Zhl2r9`Q4o?Vok7VDkOKM4$;F4l4d5{85>W}}b*k$eR93qSTcU;E% z`&U2zgEM>Ko+YDf9jFFDliS5#xU%$9EO@_omeW__mv4wSmCf9ElE%{zX}KjVg{7&q z@aX5QsJ1xdmckM{8u7={fk?w^k1Ofq`c3v&7|rmla3<;V=z!m2JoDLaB`Ij}g;>MM z+owo|ShS7HfWmtxe#zyG(=`4J-6?L}>gL6-SIylB7EioDhBz&`^W1)g)e6B&Z_0L%K1ijtCWu^36L6Szbhr!o^}B!2u8ouV<64o3T-?TG-fxOhZ@|s-o&cqU zWNq*#0k#uI58nt`WG<~m9AJme_l~-Mo}jd-H(~N@%6RbF!-CHLz<@K- zE-CEZrZ+;7AvjJmHw6n!4XGM3)5oo9nFKOp04FmDBZi&PQhe}qe^<&bVT((p@`d4) z8`gJF_rH;|gP631m_Gdsts6>v&()H5f$C$qHj~!UB$ByB$;u2>hj?-A+M6&r?Sw`(W z&cw5!yjS*?o_}(BaIkTGm2i}_eIPa|aWi!b0By;;mOgkeYvvMrcXR&H3wuadfkFB$ zC>7gwl!oLQd92MykM6j>^vY#|Rt7zXkB9A8wCa-$?UT2=Y+@$$JJ{3#z)RZI7-V>$ z*oji7c&0*j-Rt~)&J6u6El+rMmGN^Bs~f}1t{ z*XczH5fyB?Yru9CZ%maVqpax?v&E4}i>GShar*~gD^opkdbcQ!fDLhp-``x zvY9C;ox#v90yN5whw`)I^>{&_4+W29W0zqQ~YC8_hC&k3IEnTQ!JBsqcC9GP(SW zh~~}CI*C50g*P&_0Y%+=$5JVNWxW18Sxt?SOqcCQTmX20JugeytKFsC*#ZZ!by!XJ~&OM{U0%HCzDr*-~@VYq-txM7S^q$ zf#)N|ukR>Ikx&d=qbL`-GCnn6CqvRp01_RcQ%(2Q8jbe!AgnRS4N>DPLX11lZv)jK z(XBsgI|sZN@FwogN3b=EA%}0DodVmEAx(&U=wZ+s9sX}4I}#y@_v*;cU@imx2Wzig){FLtlqsp!UYWY z`WLU2VGq2G&ph*Vr$6y2<}XfdcmotRiaQZ`?kIaR_P&BeE&5t7c75b+av5`G1?M8_pf0Z?CVN*!lvkTL zmMZ1cV2xV63FAH*6D|}0dxmIdl!_6>sZ!H5$QDS<8nOAFDE5}5{D$o7B)4Xo5IT|x zKX5c|_YT2RD_g54nH8W52N-Kdn%!a(dR{V=S}J^WS8}}0ieh*sWJIDiFw9I;eV0DB zGMsC=%(b;W`E1aCEMU!fxGQs!bFs%EH<3L(N(YV9fk)yEOxG5QJv5`d@LjoLFY2Kg zuI4_*W`JkiAc8L65ilf0E86-Y+Bt=vL%L3+7BU*~@-Ig0%)%~o%B1L#`};amzzT8l zboq_Zd{g_Oi}R4n8A1l)E`r{TB{L#&vN47G!18Xv>)eoa7IagY+DfsAhDpEfCaY&@ zOnT%UG~je3I!Z@3QmN?K>&RMoqbnQ%r36kvm`HLwBTx;}j&5FB89n1P6SP*|1vj6x zbq|H7-XB?c>2oTJ(r1^G3me|>VPh_@$Y`{4MNK=NGU?AwsjQE-kGroJWAUs0MTAR{ z)+>dtg{o)c6 zqY-BF4^z~n+8;c`51t2XUoigGJjBl0uN24%p0yB0-h>eP5*u!_w>+j&`d(NjcOG%n z^s|B!RM$~k?O1g}t}WsX;gyu!GnP(Bs^>%;Q&v;GvIZw*cBAkT^vkuaMph4+b&6&b z!POYc7z#IRXGc-T!Ha%~dlydhOpNTr)|p0*a3t^!$v2PirxfNlWlxLRA!6_nljEn8 zE7&b;K-Ph@D@-6#XNKt;?$zUYi<0|IYg!E~z1pPowtEzwDfb0Hu%>M3Aeg)e6Akfb z8%|%RQ4OtEyjVJ4BFdw!^{m2{pUs`bxeFnu(7oWJF`qP3*2?eZGN&`ZITunp zptR)ydtX*LBr;;B3?AVPo-&+|2RJj(x7WqwO5eaNpiMZKY5QIZ2j}OAL8*-s3S?HT zwOU!z)72O0yfm0LbI$W+7;c(GxgQyk5Sp+k8_N8rDTX$6no~ge8FH`MKRu`y(UUh< z{K?%lDbYGuayq9B0W!a^C~$7X$tit$gx{a>-v25|@Qf*2&OU*%MC)zkE;ON~0MQhPtsY5J&nhbID$Z<)vAZDaK}{@oFa z6oBS|7kP(AKG4Bus@%*o1arIth{+XpZvL3YGsqvGq?r{=vyi6;d!21ql{^?%@gZiW zS04BvRN; zVe9`%UH;|o#QiovV=NOlbyUB^7-G{7aib-S_5VVtsphy*Mr$X4PTen=+R9!Wx zWtv2{T=-A?a`NXXq2NY?#A6CEo;BCpjW?F6iRb#4^a-5e%Krd*WFQ}^ito_%89{Py zW3TZZ9Wm%pEVALwivR#5EJ;K`R4*!XhZ)G)?4fHQAlk&K8c28gM5`czKFafjnHMLl z);?xgkta^1X9RHoJs`_z-Z(tH)3+kbTu6_PK-hsG!_gHEoigj4J_`PC^2sxYlipO~3_Lr(F|Z8Qzi=no+9>>cY;c`;Y0bUIacEV)XIkXOQ!tXsMR z%|-)}dw~xAE;nw!AqYGZB1JsHzo(XPl_Cj(V(!0preXF9D!iu$z|KLc>`N>ZmV zTOZ1tGnK=o{=yp2Ix(z4b!*Om`lO@o1i15p%Y+^CbT3iD^UoI3Nt{2EiJ7()QOY;2 z-{BfPNFiODGm;_`LJWCsPk(TK23t@o=eCkHuQ0bkf8Dd=mw>tlMxBv3x!@|-yX6~} zHhCQBg1=8sL}r$=H4qrh8()igmox#D(hBS8^g~{|HG&dLk zdo}pp3TfrH86b(cAs1`(b0)J^Dx@du7i@1ogkrKb4x3!xyP}ETV5m7`uhVy)`*ofU ze>j;$5n8PZ;H1Uj+X@I@Fn{v!v;q(uFqIR<3c07;{4E4oR4?KMXNh}WZbxd~;l_DK zFMxy)qqkY)$(4A>^>ER-4=A(oGv;KNRd+nX7HfIRsg{N%1Paol)wo}zZLYZ&9aQz|E#ohzv>b=%ruRXdBiGV&J4 zT%xGe|r1oR=sqLJBSe;FpvrV#?fFwg*alAa|suAWlU^ z6t&Aa8@~P`M*1)yX!yUV-jPuHD-ItWr8RH0of>pS0zRAiSugnRD!4Ohd%+!geJLD& zh5(tWys3pwW{98;I6Cc~c^Oqc=RWVYOd$Z17foZO6rOp~>e<#Pn9ilt5pYDo6LIQ{H;srV12j4pW+vs! zgtEa+D!nZ1iu7(S^LRmBA5)le7%O2V9nVGt@Y3NJ2xS=dMs|}K1LO42XMfJ}y(&xk+^1kY3vC?jOhgucsu;uRv$ zfNz`#dAcxAsK;m2N7A;Gi=j1(!-^T)QE4(aZJyMy&wx{d&}r}tIhE(cw2BAQ7t;`f z@ZXzKiW%eVN0%m!XN*|#=wddtHF2!~kG`9ri|(=l_baP!^VAJe&`PD=4- z#pAWW!I6O-PMAMRT{TtD1n7ok1aeDsaoqKX>@0=3xx>2myeFcMdm($lNaMvSIN_er z?tS0!4v&j59Td&N?-T*Pyz0{7%;nOV13B;ijo-~ykpq8qqRD1-%UHvkDRVhHy#kw{e6aL61xdyoOV`JP;L zU$`i0aA=hF)iHAVc`hsa?xqo{7V(~!ba>jZoxER>FlWSE2)fA+rjV*y_J(5{v5(qB zzzjd5N&&w zkEc0vy%DFRlzoEc_fF~-rbuzANnuS!QgO?v>0dgjDW)alNNG4HKgZL=Gp9T^L>wcN z$ZGC*y@Km*g^?ZbSsJL3PN#*N-c!q06SnrzV2-!-y{(CSN@ z>;%b>fNEF2L;=*=uf4-KWJo84^e3M77H-JBh?$|7>8|782ZuA0K;GOQzSK6}^IG+t zy+Uwpt^Llv;DM~~T6|_bksT%8oXz;@9>b%vUK@ESeW=mDrHh2qSlLsk9z(C9Qab~j z5dOZ@q%37(qAjOaY=YoxmAW_Tjxd!oocUJ#ub}19X{~@l45*Xkfr4@!nA{CCkYJsN zFD|&*fpt$a^EXWlPS+VOkZ_MDv`LLVwFjqtL#TKn+q#6}W{9lBI%xryugq&xyAV}C z*i1?kZ#Lr%n#5V}Y7hwo{?6-ocE)?*pVG#qEz7doXkN#nr$_%>+)iEr+E>rdhvhar zrJE2?b-cBt+B$D1?8C#`VVfE-#rW~A`$?cERp2}XTsM_(o zORmf*kNAAGk4$5oQT4Valcr(z>|zNP!_ZY_aUpMimkbyObNR1;37$pqb_|EXGjI^Y!NPG0hz;lwWctVRczny#&mC?N_c|0D{k|oV6%0a zZy@LtTGE3!kZHZ)5|()Em4?zL-;rt=&v8saN0Vw?c9X#nJivkaDEOqu7fdmlGodK5 zrxU|UV^rt!(}KOQ$hX2w$>TKXeMI;i2ra}uzyD&o=F8+pC-O9+mqebVc#1BmFU~4= zAjl}5QeDfb_nh-|@Bz%}3ba|a>AYEUGE#5C#!VM3SD{nj6 zyFykYJ~(vTI$*n2=;>)Q&PKpE(r9OU5yUO8&J}}4CGMr~%W1}A!bSef(2b2S`C;b| zjPpd=R^vI+gAiHXrA@A^VLFFkYN8~O}@ z#yu=p&?4hnePj!qz9@3!mXNb%m1p|D2Q~JFU^D!6KBEn5X8n7_)DAH1sfuz*WcnW8 zg_kA9GV_meDRs!6g9Gp+91cG8iWYGY?s}6Ob&d3MQlUBq>ZSsu|Da561Mqfzo4YSkiap#1366Ne|NZrkL1-tkf%JNJ@*U1$sw zxSk|!Q0pj#eL1hr?a4>w)Klr8?G$U(=Z%o5yjaIot??>pE3c(UndrT-F{Nk9eK~9C zU1sv0;gpexDh}wSH@=w$he8brZ3;V z$%;%^18haJ(a4tTWC~OUpKf(+yH8kqnYaZd@zkC_^BFQA>-e2vOKBTk1x&FQ(sc&X z8S~czFApB%n*^+n3*tdv0&a#?H zIyl~@5zGSvymIqLUSSv=PCXp^6Ldqk~&vlCJNU{a-^C)r2g=g(OO;b6+6I*&ew zA)04+t?;$v;nqT7!$5Mcap$lk44<`xw|M#`%rlc}bG+6>CdXh8QoPd>=^igsei4H0 zXKsTzaDAEgRKs+a@Pj!}0Fa8;QWfffiQQ25hE_fMkQZ_3B*nP!B2sd0*Fy`EM~awR zF=~`oLzC&yJz4w>Nms^{X58u_=*LN$F^W{7&YDQyY-$gf^tyzXT=`C%f9E2X5lg1r zOHI_tlLu2ZL&0+N;|v_jJxrJtfl8a34xDMOgX2+3aaqa8?`jgkvqz^8f+ho~3LdY8o`+1`WWF;0S zYbkl7QjF~waqW7$OibO${}a0A>KkcfZKQLh#cqJWDMIWyo|HM0P zQ(qBMg1>HPEPF+!>Q?%8_>ajali7OR(InHt12T zm-O>9MAqDC!awn5T(oz{2>TfgV@VHJ0IKN{>SQ(hDW+yx znp11|=lY8jS||$m^PmSQ9lgio_$s}IOHVQAwJGC5!l1jfamPV(r?O8!na$7K-wzvE zDExflNhc`$Dj8NdhpS(ZdP?d*Y8p@rsV^O!zoS_k{zkW8{qV@+%tw8Q?dzXBfbQ2z z9Xu^1@MeU-+=Sor8Wz(7p(MAPU!6g)^IG>S*Oki|GVOaOWt)1@%+_DXLDLY59haLh z5~uS?tUlVfRv5XWin&nk90xfA11*8+3~xS8)btGFl#YBCDmNE2&bZRtR34`A8E^3H z-oG0NdJ3>k-dVMR({M7W^ZFB;4o7Yxs0tgF9_n{dO$Z$^`na_KPR#l4vpiU=^jv9r z)!s09a-!ZDW9Id=@J4azbAYc|tsz!GKk{mgn^Gco$1eC}#v-Yo32Pn04NZ=YWRRQ5 z_s8#JK7VVCy5JzPurP!@cYjt=j;Lg10QGpe71dPfotPE&Rr=zkojm29yTPTrxFC-!fVyu0M;M@wgdx*UA!5 z@;+P0;?>rnkl~k>IQ0fNTyWDfTKm=}r5&K4(CyQtL6rnuNOcX#;B791=DqVZ=93Q2fT)f8q|Vxg`0d1;`|jR(sYv zD{88T(N*qJzRk4IRIq}CrBN+-*>X9#BEI*#8F~~t^Fs0G5-ohswT_oa;Rkl&T)~Bf zBiMR?!1vOrPN_F8G57UF2+_JDD3h?yer90=`ii&7&0sOg%p}O7sbd?Xu0J2xs(~y{ zh(|X^kJrlORlkvS$>D&(7ySx0K$?))Ua8m9Sx)YN#{Kuw$x_+;;?K#a6Z)p!<4r2~ z#+?su!VuS5D28Q>%^vX71O}8*>Nwp6@+&oy)C$7A&ygo5;Uq4!!X1RRHFsBb!od0m zH4g(d81j`?vvpKMDV+J-Ogq2iB^s<~fHi3eOoX>^PzdlH5FygK4h;Tm(;}3aqvZ#e zRCQ9kS0QRcReiSEQ@}W5d~1Bc;CXi0s1x~bLM<=TDcbG)c@K}AU=aaXDxqs-KgX>* z`5Tsh!6VGMN{s@O>R*5$mooMG_V?WK!Uja@lz4PPn6zTs(ih}JpPZI0vSG?KuF?=; zLF0aN`)7tECq2xR&h47)$;LHYVP@jwCtEb|G~$$>2uQfH@Cge*E;^h(ov?scPUJoy z(FtF1V~6BptU6b#GF#k(1<&MfW#Arl+Kny}=Z+xRaq}H~kS?P+@kHbKK7A%hdqI4$ z#Z&=3wQR~7`2Lr7{NVR|jxz!vHb7qPG+4m`m!V>%%>`{9%rl<}rnM$)yh?$ALv%I@!6`uXAuBDCyAD zX%D*=sx!a9jaB1`pWk1buV5RKLi3K9F?<>Mx3%6goQ*ZkY{fUVku~64l)vIgcvj#x zqyG%vR)Xw)9AB=ItEZDDdGc6}B?})J#N%%k4GOrz0{Xi*7X25pCURm;6?YXDE;Z(v zxSvs|2jgUi6eygiw3Yt@-#rkAkkoP2xO~NtHENjcN;MyO6dO4Fz#^q#P80)|P4F-Z zRjn82nRyU31`_jdxO;#w9Xo>}(s#qbbQ$;ADYvio#y`KyHW*#8#9#t`*p0D}mv+2uD192kQ$;R=iOfMs zD|?z{(>i}5*_%lz*A7bk=ogMQu3~9KF>21SYSzhJ%%xN_C;bSNoluMyPQuj5MW~Kn zINoiq?I;%>`UX2h62(=0I8D)mEm&OG%r(otL^ZcaoEr-ip1;hkTvEtfKvl{fqA_eK zf|kiwQON}qeDM8N2gsyk;aXd#_b~lU1rhj!rl+3m-J%~oapHVo0#;2Au=Mw}GHg7;tN68pewX7omT>lf)ac5p$$w>Jg+=tbx?MQzbX$11 zT#j5R(XL%QJ#~5;V64R*JX76j<3ofHq*4JHB8t2rcG$uKKv{C-)CMl~_s?OGhS988 zb!*VlMqJDU@S6v$W>PZml=%dKzAsNQ0~0!~q6+4%GMatnlxDEykhm#Uu6dp)fjeVy zA}vpsapv}9z(N{7OQ*F&TJ1^0HgHF}q%+HRT70GtawxpGcZoOWMpbM5E%( zGBzdyuD{#7Lb?_d-}yV|(gbzi>t_Q_mq1|)Z@lnSXNT`7Ca5@(bRrt7nL>l*AAG`nUj6CAajb(+DYbqJ{ zC~;ZPY!ok4C{t>cY3;;;NZ)y!28Djcha4H_izb)<=l5nZlyp7Y ze^pKgkh=N|ICoN3EC%hlvmfJf10eGQ+Ti?UuBb5*&Hfis)c_SO;gofnC0kj^x_7YRpe!;48je7{i(A1GX zA8mMj`o=|KA)C*_h|dL72eGm8{5$i0I{9*GC_?DvWNfkg@y6}QW5eh_fR#9l!saJm zpF0I9G;Km^;r|y57=^{_$ygMaW>T_-_lsiqe2qCvK}lRwC>QRei@eH_ygU`blyEl| zb*`)Tk~*lVeqwNu!e@;OBdUC*%D*PUbW2 zCqD$RdA=8=+_R!tM=`u(O?%(fN_EGEQy_gVe3)Y;)XLn%s+yF)^-MjFnBrXwW5t7| zDJ4A}lPBxFTKzYmf@R>&2Vaz%rRRzfy}^&7@(998NdL&CE}h~yo>ZE0BlwwH9bHYB zL?|6&yq)>~-Tf}bWEA>-(uC5*8Fa$Xrq#kg`sUG5MrQM0*`YzTvAGFGmh zPpG)ZJschLli$fTGCK>zC(sQDM^JWe99~2(r7&=o%lk^yHrE|>4O<;pp2QPx@1R7% zt8f3(=QIjS2~B~CQWI&JIl&CYU9z$$VS{njK5U+M*Qh$>#>zF~I#~m3#RLFbC)J^n z>QBD&xUJ{?>_9{jy%1(HHa~YAoDoUAI~yzEJF2cV0c#Y{Dkdm)=`?S+66$*1aA%C| z_JeGl;`jt;c05d}f;c5eshiV(F`$q;$^3Ythml+vrNkffe@?7|!@?D>p2LP&D84u` zruyJwd|~M{92$AMoIT~$8Fp%!X23fLI{L(hQhMOdPr83g zYNo77|H@GR;FjNcJ(ftnG`UeVY!E)3aI?2QN8Y41kC$Jt!SDmHnsAvR5gBLOx+SEq z{~^o>pS)BmWlMU>h*=YcG8ggXt64{+Wv2(AH<`($;gLSS5X;W>14PEacxpb`nh0?K za2H<1$lihGFg1XZ7u%DdZFL$go&18=EgXzNKV}S^$Cri}bU5A#=mX~5N5F8aMQp`& zfpw%zSUc8S(rBeDo2zDPx!u$U^!oKZ-q`gL_azx(0NfZ?(L2qz7IP4|axHy26yTeY zESaj+9}r0ULJO4N0flXl@4|Vfv{{;yldRx~)VO%a$>ya@(3~Tos924WmBqMt(dXalG@6@&<~9H7_66XUa{S7o$hUYJlK9N? z`4_PrE-5^JC-kjlEg6vUZie3sP(8~~PD06*l17EMk){<4tylT1>vu5wN89W4VhU629&|s~!81NH zliddCb?HE5PF$@6-c{=~hmERw|3>xGEaL-}MUx)h8op66*6AUa&Mnrr{EM zty8TNe$?ZZyKOqIuu*K7lY>{)FC#cPIXS&AK0~@amsZ)Nh1BFI=AQwptv@d_q#&n+ z6zj|i590~uN_7#>l`_*QoB_!_FVUFo6IJX~Pu|hA%mFtLQDsZ^b$TT_`RW;@m6woO zXy*oc5BYOqVdK~~u`GFaOYtg9Pg)mM&oyW)gGCgGvcwsL;CNaz$(lk^l+Ipovbg_o za*^f;1WGjWC#lg_Id{^k)rH65U-e)Gqjl!1cKQSrLfi&6rqwaB=ln#m^=Rn>EjQ{mDH6 zKBxr+wiR4!-|GYM1eHnYNKzKXQfI$u#mq{r^k=5oU6?D?&b(TjowZ zYcV3@Sv-OA?LJt-7-SY;?gc!C-=dqyMMPo8h3BN)49BiDdGXMYp From ed8e526f71ff853be05b919d267fba52cc044d0d Mon Sep 17 00:00:00 2001 From: Peng Xiao Date: Thu, 7 Dec 2023 15:34:09 +0000 Subject: [PATCH 47/68] fix(core): remove duplicate loading component (#5168) --- packages/frontend/component/src/index.ts | 1 + .../src/ui/loading/loading.stories.tsx | 2 +- .../component/src/ui/loading/loading.tsx | 21 ++++++----- .../about/update-check-section.tsx | 2 +- .../workspace-card/index.css.ts | 17 --------- .../workspace-card/index.tsx | 2 +- .../workspace-card/loading-icon.tsx | 35 ------------------- 7 files changed, 17 insertions(+), 63 deletions(-) delete mode 100644 packages/frontend/core/src/components/pure/workspace-slider-bar/workspace-card/index.css.ts delete mode 100644 packages/frontend/core/src/components/pure/workspace-slider-bar/workspace-card/loading-icon.tsx diff --git a/packages/frontend/component/src/index.ts b/packages/frontend/component/src/index.ts index bd9d76dc72..aed6a07316 100644 --- a/packages/frontend/component/src/index.ts +++ b/packages/frontend/component/src/index.ts @@ -7,6 +7,7 @@ export * from './ui/divider'; export * from './ui/empty'; export * from './ui/input'; export * from './ui/layout'; +export * from './ui/loading'; export * from './ui/lottie/collections-icon'; export * from './ui/lottie/delete-icon'; export * from './ui/menu'; diff --git a/packages/frontend/component/src/ui/loading/loading.stories.tsx b/packages/frontend/component/src/ui/loading/loading.stories.tsx index 59a08780a8..ec1d8ca25a 100644 --- a/packages/frontend/component/src/ui/loading/loading.stories.tsx +++ b/packages/frontend/component/src/ui/loading/loading.stories.tsx @@ -1,6 +1,6 @@ import type { Meta, StoryFn } from '@storybook/react'; -import { Loading, type LoadingProps } from '.'; +import { Loading, type LoadingProps } from './loading'; export default { title: 'UI/Loading', diff --git a/packages/frontend/component/src/ui/loading/loading.tsx b/packages/frontend/component/src/ui/loading/loading.tsx index 78f7f39513..49e72705c2 100644 --- a/packages/frontend/component/src/ui/loading/loading.tsx +++ b/packages/frontend/component/src/ui/loading/loading.tsx @@ -11,20 +11,25 @@ export const Loading = ({ size, speed = 1.2 }: LoadingProps) => { return ( ); }; diff --git a/packages/frontend/core/src/components/affine/setting-modal/general-setting/about/update-check-section.tsx b/packages/frontend/core/src/components/affine/setting-modal/general-setting/about/update-check-section.tsx index 4aaef0b709..b28d545861 100644 --- a/packages/frontend/core/src/components/affine/setting-modal/general-setting/about/update-check-section.tsx +++ b/packages/frontend/core/src/components/affine/setting-modal/general-setting/about/update-check-section.tsx @@ -1,3 +1,4 @@ +import { Loading } from '@affine/component'; import { SettingRow } from '@affine/component/setting-components'; import { Button } from '@affine/component/ui/button'; import { useAFFiNEI18N } from '@affine/i18n/hooks'; @@ -13,7 +14,6 @@ import clsx from 'clsx'; import { useAtomValue } from 'jotai'; import { useCallback, useMemo, useState } from 'react'; -import { Loading } from '../../../../pure/workspace-slider-bar/workspace-card/loading-icon'; import * as styles from './style.css'; enum CheckUpdateStatus { diff --git a/packages/frontend/core/src/components/pure/workspace-slider-bar/workspace-card/index.css.ts b/packages/frontend/core/src/components/pure/workspace-slider-bar/workspace-card/index.css.ts deleted file mode 100644 index 465f98986e..0000000000 --- a/packages/frontend/core/src/components/pure/workspace-slider-bar/workspace-card/index.css.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { createVar, keyframes, style } from '@vanilla-extract/css'; - -export const speedVar = createVar('speedVar'); - -const rotate = keyframes({ - '0%': { transform: 'rotate(0deg)' }, - '50%': { transform: 'rotate(180deg)' }, - '100%': { transform: 'rotate(360deg)' }, -}); -export const loading = style({ - vars: { - [speedVar]: '1.5s', - }, - textRendering: 'optimizeLegibility', - WebkitFontSmoothing: 'antialiased', - animation: `${rotate} ${speedVar} infinite linear`, -}); diff --git a/packages/frontend/core/src/components/pure/workspace-slider-bar/workspace-card/index.tsx b/packages/frontend/core/src/components/pure/workspace-slider-bar/workspace-card/index.tsx index ce005f65b9..ed06618827 100644 --- a/packages/frontend/core/src/components/pure/workspace-slider-bar/workspace-card/index.tsx +++ b/packages/frontend/core/src/components/pure/workspace-slider-bar/workspace-card/index.tsx @@ -1,4 +1,5 @@ import { Avatar } from '@affine/component/ui/avatar'; +import { Loading } from '@affine/component/ui/loading'; import { Tooltip } from '@affine/component/ui/tooltip'; import { useCurrentSyncEngine } from '@affine/core/hooks/current/use-current-sync-engine'; import { WorkspaceFlavour } from '@affine/env/workspace'; @@ -27,7 +28,6 @@ import { import { useSystemOnline } from '../../../../hooks/use-system-online'; import type { AllWorkspace } from '../../../../shared'; -import { Loading } from './loading-icon'; import { StyledSelectorContainer, StyledSelectorWrapper, diff --git a/packages/frontend/core/src/components/pure/workspace-slider-bar/workspace-card/loading-icon.tsx b/packages/frontend/core/src/components/pure/workspace-slider-bar/workspace-card/loading-icon.tsx deleted file mode 100644 index 9921cf517d..0000000000 --- a/packages/frontend/core/src/components/pure/workspace-slider-bar/workspace-card/loading-icon.tsx +++ /dev/null @@ -1,35 +0,0 @@ -import { assignInlineVars } from '@vanilla-extract/dynamic'; - -import { loading, speedVar } from './index.css'; - -export type LoadingProps = { - size?: number; - speed?: number; -}; - -export const Loading = ({ size, speed = 1.2 }: LoadingProps) => { - return ( - - - - - ); -}; From 980831f9f1e526aa44f577fd109d7d9b34f69a34 Mon Sep 17 00:00:00 2001 From: Peng Xiao Date: Thu, 7 Dec 2023 15:56:09 +0000 Subject: [PATCH 48/68] fix(electron): add debug flag for helper process (#5223) --- packages/frontend/electron/src/main/helper-process.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/frontend/electron/src/main/helper-process.ts b/packages/frontend/electron/src/main/helper-process.ts index 23b6da1653..d2d3d05fce 100644 --- a/packages/frontend/electron/src/main/helper-process.ts +++ b/packages/frontend/electron/src/main/helper-process.ts @@ -20,6 +20,8 @@ import { logger } from './logger'; const HELPER_PROCESS_PATH = path.join(__dirname, './helper.js'); +const isDev = process.env.NODE_ENV === 'development'; + function pickAndBind( obj: T, keys: U[] @@ -48,12 +50,16 @@ class HelperProcessManager { } private constructor() { - const helperProcess = utilityProcess.fork(HELPER_PROCESS_PATH); + const helperProcess = utilityProcess.fork(HELPER_PROCESS_PATH, [], { + // todo: port number should not being used + execArgv: isDev ? ['--inspect=40894'] : [], + }); this.#process = helperProcess; this.ready = new Promise((resolve, reject) => { helperProcess.once('spawn', () => { try { this.#connectMain(); + logger.info('[helper] forked', helperProcess.pid); resolve(); } catch (err) { logger.error('[helper] connectMain error', err); From 5352736eba19711b8b3def21b34a05c0739ccfee Mon Sep 17 00:00:00 2001 From: Peng Xiao Date: Fri, 8 Dec 2023 01:03:47 +0000 Subject: [PATCH 49/68] feat(component): new right sidebar (#5169) Refactor AFFiNE layout to support new right sidebar. The new layout: ![image](https://github.com/toeverything/AFFiNE/assets/584378/678a05f5-bd48-4dbe-ad78-7a0bcc979918) **Highlights:** - new sidebar UI/UX - favoring top-down UI components that are composed by basic building blocks in each route, instead of creating universal component like `WorkspaceHeader` that renders every possible cases (which I think is really hard to maintain) - remove plugin based solution **Pros/cons for current plugin-based solution:** The current solution is somewhat a Dependency Injection (DI) approach, where the layout is defined at the top and UI items can be injected using Jotai atom slots. This approach works well if we want a fully configurable system with everything being handled by plugins. It provides flexibility for custom extensions. However, this solution is more suitable for single-page applications where the UI is completely controlled by configuration. It becomes challenging to achieve an optimized and visually appealing UI that remains under our control. An example of such a scenario would be a customizable dashboard like Grafana. Another drawback of the existing solution is that we need to use Jotai and hooks to access context values, resulting in an unclear data flow within the component hierarchy. **Alternatively, our approach in this PR** provides layout building blocks such as headers and sidebars, which can then be composed in individual route components. The good is that we have cleaner biz component instead of vague all-in-one layout component (like ``). **Issues of the implementation in this PR:** Some UI layouts that that seems to be defined at the root layout are now defined in individual route component instead. New 3-col layout component like the right sidebar still needs some abstraction and they are right now just for the detail editor only. --- packages/common/env/src/workspace.ts | 21 - .../src/components/workspace/index.css.ts | 26 +- .../src/components/workspace/index.tsx | 14 +- .../component/src/ui/button/button.css.ts | 1 + .../frontend/core/src/adapters/cloud/ui.tsx | 42 +- .../core/src/adapters/local/index.tsx | 28 +- .../core/src/adapters/public-cloud/ui.tsx | 18 +- packages/frontend/core/src/adapters/shared.ts | 6 - packages/frontend/core/src/atoms/element.ts | 5 - .../register-blocksuite-components.ts | 12 + packages/frontend/core/src/bootstrap/setup.ts | 2 + .../src/components/affine/awareness/index.tsx | 45 +++ .../components/affine/hub-island/index.tsx | 11 + .../affine/share-page-modal/index.tsx | 2 +- .../share-menu/share-menu.tsx | 4 +- .../block-suite-header-title/styles.css.ts | 2 +- .../src/components/page-detail-editor.css.ts | 17 +- .../src/components/page-detail-editor.tsx | 198 ++-------- .../core/src/components/pure/header/index.tsx | 41 +- .../src/components/pure/header/style.css.tsx | 13 +- .../src/components/pure/help-island/index.tsx | 16 +- .../src/components/pure/help-island/style.ts | 1 - .../pure/trash-button-group/index.tsx | 154 -------- .../pure/trash-page-footer/index.tsx | 99 +++++ .../styles.css.ts | 4 +- .../core/src/components/workspace-header.tsx | 189 --------- .../core/src/hooks/affine/use-current-user.ts | 3 +- .../src/hooks/current/use-current-page.ts | 12 + .../core/src/layouts/workspace-layout.tsx | 32 +- ...{detail-page.tsx => share-detail-page.tsx} | 4 +- .../share}/share-header.tsx | 18 +- .../workspace/all-page/all-page-filter.tsx | 60 +++ .../workspace/{ => all-page}/all-page.css.ts | 7 + .../workspace/{ => all-page}/all-page.tsx | 93 +++-- .../core/src/pages/workspace/collection.tsx | 2 +- .../core/src/pages/workspace/detail-page.tsx | 215 ----------- .../detail-page/detail-page-header.css.ts | 59 +++ .../detail-page/detail-page-header.tsx | 159 ++++++++ .../workspace/detail-page/detail-page.css.ts | 95 +++++ .../workspace/detail-page/detail-page.tsx | 363 ++++++++++++++++++ .../detail-page/editor-sidebar/atoms.ts | 79 ++++ .../editor-sidebar/editor-sidebar.css.ts | 10 + .../editor-sidebar/editor-sidebar.tsx | 16 + .../extensions/extensions.css.ts | 45 +++ .../editor-sidebar/extensions/extensions.tsx | 37 ++ .../editor-sidebar/extensions/frame.css.ts | 7 + .../editor-sidebar/extensions/frame.tsx | 41 ++ .../editor-sidebar/extensions/index.tsx | 1 + .../editor-sidebar/extensions/outline.css.ts | 7 + .../editor-sidebar/extensions/outline.tsx | 41 ++ .../detail-page/editor-sidebar/index.ts | 4 + .../detail-page/editor-sidebar/types.ts | 7 + .../src/pages/workspace/detail-page/index.ts | 1 + .../workspace/trash-page.css.ts} | 2 + .../core/src/pages/workspace/trash-page.tsx | 36 +- packages/frontend/core/src/router.ts | 6 +- packages/frontend/core/src/utils/toast.ts | 9 +- .../frontend/hooks/src/use-is-tiny-screen.ts | 29 +- packages/frontend/i18n/src/resources/en.json | 1 + tests/affine-desktop/e2e/basic.spec.ts | 4 +- 60 files changed, 1424 insertions(+), 1052 deletions(-) delete mode 100644 packages/frontend/core/src/atoms/element.ts create mode 100644 packages/frontend/core/src/bootstrap/register-blocksuite-components.ts create mode 100644 packages/frontend/core/src/components/affine/awareness/index.tsx create mode 100644 packages/frontend/core/src/components/affine/hub-island/index.tsx delete mode 100644 packages/frontend/core/src/components/pure/trash-button-group/index.tsx create mode 100644 packages/frontend/core/src/components/pure/trash-page-footer/index.tsx rename packages/frontend/core/src/components/pure/{trash-button-group => trash-page-footer}/styles.css.ts (96%) delete mode 100644 packages/frontend/core/src/components/workspace-header.tsx create mode 100644 packages/frontend/core/src/hooks/current/use-current-page.ts rename packages/frontend/core/src/pages/share/{detail-page.tsx => share-detail-page.tsx} (96%) rename packages/frontend/core/src/{components => pages/share}/share-header.tsx (52%) create mode 100644 packages/frontend/core/src/pages/workspace/all-page/all-page-filter.tsx rename packages/frontend/core/src/pages/workspace/{ => all-page}/all-page.css.ts (91%) rename packages/frontend/core/src/pages/workspace/{ => all-page}/all-page.tsx (78%) delete mode 100644 packages/frontend/core/src/pages/workspace/detail-page.tsx create mode 100644 packages/frontend/core/src/pages/workspace/detail-page/detail-page-header.css.ts create mode 100644 packages/frontend/core/src/pages/workspace/detail-page/detail-page-header.tsx create mode 100644 packages/frontend/core/src/pages/workspace/detail-page/detail-page.css.ts create mode 100644 packages/frontend/core/src/pages/workspace/detail-page/detail-page.tsx create mode 100644 packages/frontend/core/src/pages/workspace/detail-page/editor-sidebar/atoms.ts create mode 100644 packages/frontend/core/src/pages/workspace/detail-page/editor-sidebar/editor-sidebar.css.ts create mode 100644 packages/frontend/core/src/pages/workspace/detail-page/editor-sidebar/editor-sidebar.tsx create mode 100644 packages/frontend/core/src/pages/workspace/detail-page/editor-sidebar/extensions/extensions.css.ts create mode 100644 packages/frontend/core/src/pages/workspace/detail-page/editor-sidebar/extensions/extensions.tsx create mode 100644 packages/frontend/core/src/pages/workspace/detail-page/editor-sidebar/extensions/frame.css.ts create mode 100644 packages/frontend/core/src/pages/workspace/detail-page/editor-sidebar/extensions/frame.tsx create mode 100644 packages/frontend/core/src/pages/workspace/detail-page/editor-sidebar/extensions/index.tsx create mode 100644 packages/frontend/core/src/pages/workspace/detail-page/editor-sidebar/extensions/outline.css.ts create mode 100644 packages/frontend/core/src/pages/workspace/detail-page/editor-sidebar/extensions/outline.tsx create mode 100644 packages/frontend/core/src/pages/workspace/detail-page/editor-sidebar/index.ts create mode 100644 packages/frontend/core/src/pages/workspace/detail-page/editor-sidebar/types.ts create mode 100644 packages/frontend/core/src/pages/workspace/detail-page/index.ts rename packages/frontend/core/src/{components/workspace-header.css.ts => pages/workspace/trash-page.css.ts} (85%) diff --git a/packages/common/env/src/workspace.ts b/packages/common/env/src/workspace.ts index 91ed56f6a0..b92b8e3521 100644 --- a/packages/common/env/src/workspace.ts +++ b/packages/common/env/src/workspace.ts @@ -1,5 +1,3 @@ -import type { EditorContainer } from '@blocksuite/presets'; -import type { Page } from '@blocksuite/store'; import type { ActiveDocProvider, PassiveDocProvider, @@ -134,18 +132,6 @@ type UIBaseProps<_Flavour extends keyof WorkspaceRegistry> = { currentWorkspaceId: string; }; -export type WorkspaceHeaderProps = - UIBaseProps & { - rightSlot?: ReactNode; - currentEntry: - | { - subPath: WorkspaceSubPath; - } - | { - pageId: string; - }; - }; - type NewSettingProps = UIBaseProps & { onDeleteLocalWorkspace: () => void; @@ -161,18 +147,11 @@ type NewSettingProps = ) => void; }; -type PageDetailProps = - UIBaseProps & { - currentPageId: string; - onLoadEditor: (page: Page, editor: EditorContainer) => () => void; - }; - interface FC

    { (props: P): ReactNode; } export interface WorkspaceUISchema { - PageDetail: FC>; NewSettingsDetail: FC>; Provider: FC; LoginCard?: FC; diff --git a/packages/frontend/component/src/components/workspace/index.css.ts b/packages/frontend/component/src/components/workspace/index.css.ts index ce31f3cd35..a5a91dee95 100644 --- a/packages/frontend/component/src/components/workspace/index.css.ts +++ b/packages/frontend/component/src/components/workspace/index.css.ts @@ -54,13 +54,11 @@ export const mainContainerStyle = style({ width: 0, flex: 1, maxWidth: '100%', - backgroundColor: 'var(--affine-background-primary-color)', selectors: { '&[data-show-padding="true"]': { margin: '8px', borderRadius: '5px', overflow: 'hidden', - boxShadow: 'var(--affine-shadow-1)', '@media': { print: { overflow: 'visible', @@ -72,12 +70,6 @@ export const mainContainerStyle = style({ '&[data-show-padding="true"][data-is-macos="true"]': { borderRadius: '6px', }, - '&[data-in-trash-page="true"]': { - marginBottom: '66px', - }, - '&[data-in-trash-page="true"][data-show-padding="true"]': { - marginBottom: '66px', - }, '&[data-show-padding="true"]:before': { content: '""', position: 'absolute', @@ -124,7 +116,7 @@ globalStyle( ); export const toolStyle = style({ - position: 'fixed', + position: 'absolute', right: '30px', bottom: '30px', zIndex: 'var(--affine-z-index-popover)', @@ -143,20 +135,4 @@ export const toolStyle = style({ display: 'none', }, }, - selectors: { - '&[data-in-trash-page="true"]': { - bottom: '70px', - '@media': { - 'screen and (max-width: 960px)': { - bottom: '80px', - }, - 'screen and (max-width: 640px)': { - bottom: '85px', - }, - print: { - display: 'none', - }, - }, - }, - }, }); diff --git a/packages/frontend/component/src/components/workspace/index.tsx b/packages/frontend/component/src/components/workspace/index.tsx index 3472660124..157df78619 100644 --- a/packages/frontend/component/src/components/workspace/index.tsx +++ b/packages/frontend/component/src/components/workspace/index.tsx @@ -35,14 +35,13 @@ export const AppContainer = ({ export interface MainContainerProps extends HTMLAttributes { className?: string; padding?: boolean; - inTrashPage?: boolean; } export const MainContainer = forwardRef< HTMLDivElement, PropsWithChildren >(function MainContainer( - { className, padding, inTrashPage, children, ...props }, + { className, padding, children, ...props }, ref ): ReactElement { return ( @@ -51,7 +50,6 @@ export const MainContainer = forwardRef< className={clsx(mainContainerStyle, className)} data-is-macos={environment.isDesktop && environment.isMacOs} data-show-padding={!!padding} - data-in-trash-page={!!inTrashPage} ref={ref} > {children} @@ -61,14 +59,8 @@ export const MainContainer = forwardRef< MainContainer.displayName = 'MainContainer'; -export const ToolContainer = ( - props: PropsWithChildren & { inTrashPage: boolean } -): ReactElement => { - return ( -
    - {props.children} -
    - ); +export const ToolContainer = (props: PropsWithChildren): ReactElement => { + return
    {props.children}
    ; }; export const WorkspaceFallback = (): ReactElement => { diff --git a/packages/frontend/component/src/ui/button/button.css.ts b/packages/frontend/component/src/ui/button/button.css.ts index f74f0a2661..bb48c4c0e4 100644 --- a/packages/frontend/component/src/ui/button/button.css.ts +++ b/packages/frontend/component/src/ui/button/button.css.ts @@ -6,6 +6,7 @@ export const button = style({ alignItems: 'center', userSelect: 'none', touchAction: 'manipulation', + flexShrink: 0, outline: '0', border: '1px solid', padding: '0 18px', diff --git a/packages/frontend/core/src/adapters/cloud/ui.tsx b/packages/frontend/core/src/adapters/cloud/ui.tsx index 08e113719a..af1cca88c2 100644 --- a/packages/frontend/core/src/adapters/cloud/ui.tsx +++ b/packages/frontend/core/src/adapters/cloud/ui.tsx @@ -1,19 +1,11 @@ -import { PageNotFoundError } from '@affine/env/constant'; import type { WorkspaceFlavour, WorkspaceUISchema, } from '@affine/env/workspace'; -import { lazy, useCallback } from 'react'; +import { lazy } from 'react'; -import type { OnLoadEditor } from '../../components/page-detail-editor'; -import { useCurrentUser } from '../../hooks/affine/use-current-user'; import { useIsWorkspaceOwner } from '../../hooks/affine/use-is-workspace-owner'; -import { useWorkspace } from '../../hooks/use-workspace'; -import { - NewWorkspaceSettingDetail, - PageDetailEditor, - Provider, -} from '../shared'; +import { NewWorkspaceSettingDetail, Provider } from '../shared'; const LoginCard = lazy(() => import('../../components/cloud/login-card').then(({ LoginCard }) => ({ @@ -24,36 +16,6 @@ const LoginCard = lazy(() => export const UI = { Provider, LoginCard, - PageDetail: ({ currentWorkspaceId, currentPageId, onLoadEditor }) => { - const workspace = useWorkspace(currentWorkspaceId); - const page = workspace.blockSuiteWorkspace.getPage(currentPageId); - if (!page) { - throw new PageNotFoundError(workspace.blockSuiteWorkspace, currentPageId); - } - // this should be safe because we are under cloud workspace adapter - const currentUser = useCurrentUser(); - const onLoad = useCallback( - (...args) => { - const dispose = onLoadEditor(...args); - workspace.blockSuiteWorkspace.awarenessStore.awareness.setLocalStateField( - 'user', - { - name: currentUser.name, - } - ); - return dispose; - }, - [currentUser, workspace, onLoadEditor] - ); - - return ( - - ); - }, NewSettingsDetail: ({ currentWorkspaceId, onTransformWorkspace, diff --git a/packages/frontend/core/src/adapters/local/index.tsx b/packages/frontend/core/src/adapters/local/index.tsx index 1b99823f23..fbb0bee268 100644 --- a/packages/frontend/core/src/adapters/local/index.tsx +++ b/packages/frontend/core/src/adapters/local/index.tsx @@ -1,8 +1,5 @@ import { DebugLogger } from '@affine/debug'; -import { - DEFAULT_WORKSPACE_NAME, - PageNotFoundError, -} from '@affine/env/constant'; +import { DEFAULT_WORKSPACE_NAME } from '@affine/env/constant'; import type { WorkspaceAdapter } from '@affine/env/workspace'; import { LoadPriority, @@ -14,19 +11,13 @@ import { saveWorkspaceToLocalStorage, } from '@affine/workspace/local/crud'; import { getOrCreateWorkspace } from '@affine/workspace/manager'; -import { getBlockSuiteWorkspaceAtom } from '@toeverything/infra/__internal__/workspace'; import { getCurrentStore } from '@toeverything/infra/atom'; import { initEmptyPage } from '@toeverything/infra/blocksuite'; import { buildShowcaseWorkspace } from '@toeverything/infra/blocksuite'; -import { useAtomValue } from 'jotai'; import { nanoid } from 'nanoid'; import { setPageModeAtom } from '../../atoms'; -import { - NewWorkspaceSettingDetail, - PageDetailEditor, - Provider, -} from '../shared'; +import { NewWorkspaceSettingDetail, Provider } from '../shared'; const logger = new DebugLogger('use-create-first-workspace'); @@ -68,21 +59,6 @@ export const LocalAdapter: WorkspaceAdapter = { CRUD, UI: { Provider, - PageDetail: ({ currentWorkspaceId, currentPageId, onLoadEditor }) => { - const [workspaceAtom] = getBlockSuiteWorkspaceAtom(currentWorkspaceId); - const workspace = useAtomValue(workspaceAtom); - const page = workspace.getPage(currentPageId); - if (!page) { - throw new PageNotFoundError(workspace, currentPageId); - } - return ( - - ); - }, NewSettingsDetail: ({ currentWorkspaceId, onTransformWorkspace, diff --git a/packages/frontend/core/src/adapters/public-cloud/ui.tsx b/packages/frontend/core/src/adapters/public-cloud/ui.tsx index 120be63620..0e033dd58a 100644 --- a/packages/frontend/core/src/adapters/public-cloud/ui.tsx +++ b/packages/frontend/core/src/adapters/public-cloud/ui.tsx @@ -1,26 +1,10 @@ -import { PageNotFoundError } from '@affine/env/constant'; import type { WorkspaceFlavour } from '@affine/env/workspace'; import { type WorkspaceUISchema } from '@affine/env/workspace'; -import { useWorkspace } from '../../hooks/use-workspace'; -import { PageDetailEditor, Provider } from '../shared'; +import { Provider } from '../shared'; export const UI = { Provider, - PageDetail: ({ currentWorkspaceId, currentPageId, onLoadEditor }) => { - const workspace = useWorkspace(currentWorkspaceId); - const page = workspace.blockSuiteWorkspace.getPage(currentPageId); - if (!page) { - throw new PageNotFoundError(workspace.blockSuiteWorkspace, currentPageId); - } - return ( - - ); - }, NewSettingsDetail: () => { throw new Error('Not implemented'); }, diff --git a/packages/frontend/core/src/adapters/shared.ts b/packages/frontend/core/src/adapters/shared.ts index 79f369bf34..6a075b042f 100644 --- a/packages/frontend/core/src/adapters/shared.ts +++ b/packages/frontend/core/src/adapters/shared.ts @@ -13,9 +13,3 @@ export const NewWorkspaceSettingDetail = lazy(() => }) ) ); - -export const PageDetailEditor = lazy(() => - import('../components/page-detail-editor').then(({ PageDetailEditor }) => ({ - default: PageDetailEditor, - })) -); diff --git a/packages/frontend/core/src/atoms/element.ts b/packages/frontend/core/src/atoms/element.ts deleted file mode 100644 index 2f33acdc67..0000000000 --- a/packages/frontend/core/src/atoms/element.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { atom } from 'jotai/vanilla'; - -export const appHeaderAtom = atom(null); - -export const mainContainerAtom = atom(null); diff --git a/packages/frontend/core/src/bootstrap/register-blocksuite-components.ts b/packages/frontend/core/src/bootstrap/register-blocksuite-components.ts new file mode 100644 index 0000000000..d5f5b07f84 --- /dev/null +++ b/packages/frontend/core/src/bootstrap/register-blocksuite-components.ts @@ -0,0 +1,12 @@ +import { registerTOCComponents } from '@blocksuite/blocks'; + +registerTOCComponents(components => { + for (const compName in components) { + if (window.customElements.get(compName)) continue; + + window.customElements.define( + compName, + components[compName as keyof typeof components] + ); + } +}); diff --git a/packages/frontend/core/src/bootstrap/setup.ts b/packages/frontend/core/src/bootstrap/setup.ts index 36af514255..caa79875a3 100644 --- a/packages/frontend/core/src/bootstrap/setup.ts +++ b/packages/frontend/core/src/bootstrap/setup.ts @@ -1,3 +1,5 @@ +import './register-blocksuite-components'; + import { setupGlobal } from '@affine/env/global'; import type { WorkspaceAdapter } from '@affine/env/workspace'; import type { WorkspaceFlavour } from '@affine/env/workspace'; diff --git a/packages/frontend/core/src/components/affine/awareness/index.tsx b/packages/frontend/core/src/components/affine/awareness/index.tsx new file mode 100644 index 0000000000..db308bd264 --- /dev/null +++ b/packages/frontend/core/src/components/affine/awareness/index.tsx @@ -0,0 +1,45 @@ +import { Suspense, useEffect } from 'react'; + +import { useCurrentLoginStatus } from '../../../hooks/affine/use-current-login-status'; +import { useCurrentUser } from '../../../hooks/affine/use-current-user'; +import { useCurrentWorkspace } from '../../../hooks/current/use-current-workspace'; + +const SyncAwarenessInnerLoggedIn = () => { + const currentUser = useCurrentUser(); + const [{ blockSuiteWorkspace: workspace }] = useCurrentWorkspace(); + + useEffect(() => { + if (currentUser && workspace) { + workspace.awarenessStore.awareness.setLocalStateField('user', { + name: currentUser.name, + // todo: add avatar? + }); + + return () => { + workspace.awarenessStore.awareness.setLocalStateField('user', null); + }; + } + return; + }, [currentUser, workspace]); + + return null; +}; + +const SyncAwarenessInner = () => { + const loginStatus = useCurrentLoginStatus(); + + if (loginStatus === 'authenticated') { + return ; + } + + return null; +}; + +// todo: we could do something more interesting here, e.g., show where the current user is +export const SyncAwareness = () => { + return ( + + + + ); +}; diff --git a/packages/frontend/core/src/components/affine/hub-island/index.tsx b/packages/frontend/core/src/components/affine/hub-island/index.tsx new file mode 100644 index 0000000000..732c220b82 --- /dev/null +++ b/packages/frontend/core/src/components/affine/hub-island/index.tsx @@ -0,0 +1,11 @@ +import { ToolContainer } from '@affine/component/workspace'; + +import { HelpIsland } from '../../pure/help-island'; + +export const HubIsland = () => { + return ( + + + + ); +}; diff --git a/packages/frontend/core/src/components/affine/share-page-modal/index.tsx b/packages/frontend/core/src/components/affine/share-page-modal/index.tsx index 1e4395ce46..353f9cd7ca 100644 --- a/packages/frontend/core/src/components/affine/share-page-modal/index.tsx +++ b/packages/frontend/core/src/components/affine/share-page-modal/index.tsx @@ -14,7 +14,7 @@ type SharePageModalProps = { page: Page; }; -export const SharePageModal = ({ workspace, page }: SharePageModalProps) => { +export const SharePageButton = ({ workspace, page }: SharePageModalProps) => { const onTransformWorkspace = useOnTransformWorkspace(); const [open, setOpen] = useState(false); diff --git a/packages/frontend/core/src/components/affine/share-page-modal/share-menu/share-menu.tsx b/packages/frontend/core/src/components/affine/share-page-modal/share-menu/share-menu.tsx index b77f8c1905..b4492cfec6 100644 --- a/packages/frontend/core/src/components/affine/share-page-modal/share-menu/share-menu.tsx +++ b/packages/frontend/core/src/components/affine/share-page-modal/share-menu/share-menu.tsx @@ -60,7 +60,7 @@ const LocalShareMenu = (props: ShareMenuProps) => { modal: false, }} > - @@ -86,7 +86,7 @@ const CloudShareMenu = (props: ShareMenuProps) => { modal: false, }} > - - - - - - - { - jumpToSubPath(workspace.id, WorkspaceSubPath.ALL); - blockSuiteWorkspace.removePage(pageId); - toast(t['com.affine.toastMessage.permanentlyDeleted']()); - }, [blockSuiteWorkspace, jumpToSubPath, pageId, workspace.id, t])} - onOpenChange={setOpen} - /> - - - ); -}; - -export default TrashButtonGroup; diff --git a/packages/frontend/core/src/components/pure/trash-page-footer/index.tsx b/packages/frontend/core/src/components/pure/trash-page-footer/index.tsx new file mode 100644 index 0000000000..57ac8fcc0a --- /dev/null +++ b/packages/frontend/core/src/components/pure/trash-page-footer/index.tsx @@ -0,0 +1,99 @@ +import { Button } from '@affine/component/ui/button'; +import { ConfirmModal } from '@affine/component/ui/modal'; +import { Tooltip } from '@affine/component/ui/tooltip'; +import { WorkspaceSubPath } from '@affine/env/workspace'; +import { useAFFiNEI18N } from '@affine/i18n/hooks'; +import { assertExists } from '@blocksuite/global/utils'; +import { DeleteIcon, ResetIcon } from '@blocksuite/icons'; +import { useBlockSuitePageMeta } from '@toeverything/hooks/use-block-suite-page-meta'; +import { useCallback, useState } from 'react'; + +import { useAppSettingHelper } from '../../../hooks/affine/use-app-setting-helper'; +import { useBlockSuiteMetaHelper } from '../../../hooks/affine/use-block-suite-meta-helper'; +import { useCurrentWorkspace } from '../../../hooks/current/use-current-workspace'; +import { useNavigateHelper } from '../../../hooks/use-navigate-helper'; +import { toast } from '../../../utils'; +import * as styles from './styles.css'; + +export const TrashPageFooter = ({ pageId }: { pageId: string }) => { + // fixme(himself65): remove these hooks ASAP + const [workspace] = useCurrentWorkspace(); + assertExists(workspace); + const blockSuiteWorkspace = workspace.blockSuiteWorkspace; + const pageMeta = useBlockSuitePageMeta(blockSuiteWorkspace).find( + meta => meta.id === pageId + ); + assertExists(pageMeta); + const t = useAFFiNEI18N(); + const { appSettings } = useAppSettingHelper(); + const { jumpToSubPath } = useNavigateHelper(); + const { restoreFromTrash } = useBlockSuiteMetaHelper(blockSuiteWorkspace); + const [open, setOpen] = useState(false); + const hintText = t['com.affine.cmdk.affine.editor.trash-footer-hint'](); + + const onRestore = useCallback(() => { + restoreFromTrash(pageId); + toast( + t['com.affine.toastMessage.restored']({ + title: pageMeta.title || 'Untitled', + }) + ); + }, [pageId, pageMeta.title, restoreFromTrash, t]); + + const onConfirmDelete = useCallback(() => { + jumpToSubPath(workspace.id, WorkspaceSubPath.ALL); + blockSuiteWorkspace.removePage(pageId); + toast(t['com.affine.toastMessage.permanentlyDeleted']()); + }, [blockSuiteWorkspace, jumpToSubPath, pageId, workspace.id, t]); + + const onDelete = useCallback(() => { + setOpen(true); + }, []); + + return ( +
    +
    {hintText}
    +
    + + + + + + +
    + +
    + ); +}; diff --git a/packages/frontend/core/src/components/pure/trash-button-group/styles.css.ts b/packages/frontend/core/src/components/pure/trash-page-footer/styles.css.ts similarity index 96% rename from packages/frontend/core/src/components/pure/trash-button-group/styles.css.ts rename to packages/frontend/core/src/components/pure/trash-page-footer/styles.css.ts index 71b07c64f0..8895b4118d 100644 --- a/packages/frontend/core/src/components/pure/trash-button-group/styles.css.ts +++ b/packages/frontend/core/src/components/pure/trash-page-footer/styles.css.ts @@ -6,12 +6,13 @@ export const group = style({ justifyContent: 'center', }); export const deleteHintContainer = style({ - position: 'fixed', + position: 'relative', zIndex: 2, padding: '14px 20px', display: 'flex', justifyContent: 'space-between', alignItems: 'center', + flexShrink: 0, bottom: '0', gap: '16px', backgroundColor: 'var(--affine-background-primary-color)', @@ -32,7 +33,6 @@ export const deleteHintText = style({ whiteSpace: 'nowrap', textOverflow: 'ellipsis', overflow: 'hidden', - cursor: 'pointer', }); export const buttonContainer = style({ color: 'var(--affine-pure-white)', diff --git a/packages/frontend/core/src/components/workspace-header.tsx b/packages/frontend/core/src/components/workspace-header.tsx deleted file mode 100644 index 18d15026e1..0000000000 --- a/packages/frontend/core/src/components/workspace-header.tsx +++ /dev/null @@ -1,189 +0,0 @@ -import { - CollectionList, - FilterList, - SaveAsCollectionButton, - useCollectionManager, -} from '@affine/component/page-list'; -import { Unreachable } from '@affine/env/constant'; -import type { Collection, Filter } from '@affine/env/filter'; -import type { - WorkspaceFlavour, - WorkspaceHeaderProps, -} from '@affine/env/workspace'; -import { WorkspaceSubPath } from '@affine/env/workspace'; -import { useAFFiNEI18N } from '@affine/i18n/hooks'; -import { DeleteIcon } from '@blocksuite/icons'; -import { useAsyncCallback } from '@toeverything/hooks/affine-async-hooks'; -import { useSetAtom } from 'jotai/react'; -import { useCallback } from 'react'; - -import { collectionsCRUDAtom } from '../atoms/collections'; -import { appHeaderAtom, mainContainerAtom } from '../atoms/element'; -import { useAllPageListConfig } from '../hooks/affine/use-all-page-list-config'; -import { useDeleteCollectionInfo } from '../hooks/affine/use-delete-collection-info'; -import { useNavigateHelper } from '../hooks/use-navigate-helper'; -import { useWorkspace } from '../hooks/use-workspace'; -import { SharePageModal } from './affine/share-page-modal'; -import { BlockSuiteHeaderTitle } from './blocksuite/block-suite-header-title'; -import { filterContainerStyle } from './filter-container.css'; -import { Header } from './pure/header'; -import { PluginHeader } from './pure/plugin-header'; -import { WorkspaceModeFilterTab } from './pure/workspace-mode-filter-tab'; -import { TopTip } from './top-tip'; -import * as styles from './workspace-header.css'; - -const FilterContainer = ({ workspaceId }: { workspaceId: string }) => { - const currentWorkspace = useWorkspace(workspaceId); - const navigateHelper = useNavigateHelper(); - const setting = useCollectionManager(collectionsCRUDAtom); - const saveToCollection = useCallback( - async (collection: Collection) => { - await setting.createCollection({ - ...collection, - filterList: setting.currentCollection.filterList, - }); - navigateHelper.jumpToCollection(workspaceId, collection.id); - }, - [setting, navigateHelper, workspaceId] - ); - - const onFilterChange = useAsyncCallback( - async (filterList: Filter[]) => { - await setting.updateCollection({ - ...setting.currentCollection, - filterList, - }); - }, - [setting] - ); - - if (!setting.isDefault || !setting.currentCollection.filterList.length) { - return null; - } - - return ( -
    -
    - -
    -
    - {setting.currentCollection.filterList.length > 0 ? ( - - ) : null} -
    -
    - ); -}; - -export function WorkspaceHeader({ - currentWorkspaceId, - currentEntry, - rightSlot, -}: WorkspaceHeaderProps) { - const setAppHeader = useSetAtom(appHeaderAtom); - - const currentWorkspace = useWorkspace(currentWorkspaceId); - const workspace = currentWorkspace.blockSuiteWorkspace; - const setting = useCollectionManager(collectionsCRUDAtom); - const config = useAllPageListConfig(); - const userInfo = useDeleteCollectionInfo(); - - const t = useAFFiNEI18N(); - - // route in all page - if ( - 'subPath' in currentEntry && - currentEntry.subPath === WorkspaceSubPath.ALL - ) { - return ( - <> -
    - } - right={rightSlot} - center={} - /> - - - ); - } - - // route in shared - if ( - 'subPath' in currentEntry && - currentEntry.subPath === WorkspaceSubPath.SHARED - ) { - return ( -
    } - /> - ); - } - - // route in trash - if ( - 'subPath' in currentEntry && - currentEntry.subPath === WorkspaceSubPath.TRASH - ) { - return ( -
    - - {t['com.affine.workspaceSubPath.trash']()} - - } - /> - ); - } - - // route in edit page - if ('pageId' in currentEntry) { - const currentPage = workspace.getPage(currentEntry.pageId); - const sharePageModal = currentPage ? ( - - ) : null; - return ( - <> -
    - } - right={ -
    - {sharePageModal} - -
    - } - bottomBorder - /> - - - ); - } - - throw new Unreachable(); -} diff --git a/packages/frontend/core/src/hooks/affine/use-current-user.ts b/packages/frontend/core/src/hooks/affine/use-current-user.ts index 94b4b967a2..35cbe9bbc3 100644 --- a/packages/frontend/core/src/hooks/affine/use-current-user.ts +++ b/packages/frontend/core/src/hooks/affine/use-current-user.ts @@ -106,5 +106,6 @@ export function useCurrentUser(): CheckedUser { hasPassword: user?.hasPassword ?? false, update, }; - }, [user, update]); + // spread the user object to make sure the hook will not be re-rendered when user ref changed but the properties not. + }, [user.id, user.name, user.email, user.image, user.hasPassword, update]); } diff --git a/packages/frontend/core/src/hooks/current/use-current-page.ts b/packages/frontend/core/src/hooks/current/use-current-page.ts new file mode 100644 index 0000000000..0e5a35ada8 --- /dev/null +++ b/packages/frontend/core/src/hooks/current/use-current-page.ts @@ -0,0 +1,12 @@ +import { + currentPageIdAtom, + currentWorkspaceAtom, +} from '@toeverything/infra/atom'; +import { useAtomValue } from 'jotai'; + +export const useCurrentPage = () => { + const currentPageId = useAtomValue(currentPageIdAtom); + const currentWorkspace = useAtomValue(currentWorkspaceAtom); + + return currentPageId ? currentWorkspace.getPage(currentPageId) : null; +}; diff --git a/packages/frontend/core/src/layouts/workspace-layout.tsx b/packages/frontend/core/src/layouts/workspace-layout.tsx index d9603b7e91..ab848eeb00 100644 --- a/packages/frontend/core/src/layouts/workspace-layout.tsx +++ b/packages/frontend/core/src/layouts/workspace-layout.tsx @@ -6,11 +6,7 @@ import { type DraggableTitleCellData, PageListDragOverlay, } from '@affine/component/page-list'; -import { - MainContainer, - ToolContainer, - WorkspaceFallback, -} from '@affine/component/workspace'; +import { MainContainer, WorkspaceFallback } from '@affine/component/workspace'; import { useAFFiNEI18N } from '@affine/i18n/hooks'; import { rootWorkspacesMetadataAtom } from '@affine/workspace/atom'; import { getBlobEngine } from '@affine/workspace/manager'; @@ -35,12 +31,10 @@ import { useLocation, useParams } from 'react-router-dom'; import { Map as YMap } from 'yjs'; import { openQuickSearchModalAtom, openSettingModalAtom } from '../atoms'; -import { mainContainerAtom } from '../atoms/element'; import { AdapterProviderWrapper } from '../components/adapter-worksapce-wrapper'; import { AppContainer } from '../components/affine/app-container'; +import { SyncAwareness } from '../components/affine/awareness'; import { usePageHelper } from '../components/blocksuite/block-suite-page-list/utils'; -import type { IslandItemNames } from '../components/pure/help-island'; -import { HelpIsland } from '../components/pure/help-island'; import { processCollectionsDrag } from '../components/pure/workspace-slider-bar/collections'; import { DROPPABLE_SIDEBAR_TRASH, @@ -90,10 +84,6 @@ export const QuickSearch = () => { ); }; -const showList: IslandItemNames[] = environment.isDesktop - ? ['whatNew', 'contact', 'guide'] - : ['whatNew', 'contact']; - export const CurrentWorkspaceContext = ({ children, }: PropsWithChildren): ReactNode => { @@ -258,12 +248,6 @@ export const WorkspaceLayoutInner = ({ const { appSettings } = useAppSettingHelper(); const location = useLocation(); - const { pageId } = useParams(); - const pageMeta = useBlockSuitePageMeta( - currentWorkspace.blockSuiteWorkspace - ).find(meta => meta.id === pageId); - const inTrashPage = pageMeta?.trash ?? false; - const setMainContainer = useSetAtom(mainContainerAtom); return ( <> @@ -292,26 +276,20 @@ export const WorkspaceLayoutInner = ({ paths={pathGenerator} /> - }> - + }> + {migration ? ( ) : ( children )} - - - + ); }; diff --git a/packages/frontend/core/src/pages/share/detail-page.tsx b/packages/frontend/core/src/pages/share/share-detail-page.tsx similarity index 96% rename from packages/frontend/core/src/pages/share/detail-page.tsx rename to packages/frontend/core/src/pages/share/share-detail-page.tsx index 0776f83237..e255212a63 100644 --- a/packages/frontend/core/src/pages/share/detail-page.tsx +++ b/packages/frontend/core/src/pages/share/share-detail-page.tsx @@ -18,11 +18,11 @@ import { } from 'react-router-dom'; import { applyUpdate } from 'yjs'; -import { PageDetailEditor } from '../../adapters/shared'; import type { PageMode } from '../../atoms'; import { AppContainer } from '../../components/affine/app-container'; -import { ShareHeader } from '../../components/share-header'; +import { PageDetailEditor } from '../../components/page-detail-editor'; import { SharePageNotFoundError } from '../../components/share-page-not-found-error'; +import { ShareHeader } from './share-header'; type LoaderData = { page: Page; diff --git a/packages/frontend/core/src/components/share-header.tsx b/packages/frontend/core/src/pages/share/share-header.tsx similarity index 52% rename from packages/frontend/core/src/components/share-header.tsx rename to packages/frontend/core/src/pages/share/share-header.tsx index 20f6c6ab64..675902637a 100644 --- a/packages/frontend/core/src/components/share-header.tsx +++ b/packages/frontend/core/src/pages/share/share-header.tsx @@ -1,13 +1,11 @@ import type { Workspace } from '@blocksuite/store'; -import { useSetAtom } from 'jotai/react'; -import type { PageMode } from '../atoms'; -import { appHeaderAtom, mainContainerAtom } from '../atoms/element'; -import { useWorkspace } from '../hooks/use-workspace'; -import { BlockSuiteHeaderTitle } from './blocksuite/block-suite-header-title'; -import ShareHeaderLeftItem from './cloud/share-header-left-item'; -import ShareHeaderRightItem from './cloud/share-header-right-item'; -import { Header } from './pure/header'; +import type { PageMode } from '../../atoms'; +import { BlockSuiteHeaderTitle } from '../../components/blocksuite/block-suite-header-title'; +import ShareHeaderLeftItem from '../../components/cloud/share-header-left-item'; +import ShareHeaderRightItem from '../../components/cloud/share-header-right-item'; +import { Header } from '../../components/pure/header'; +import { useWorkspace } from '../../hooks/use-workspace'; export function ShareHeader({ workspace, @@ -18,14 +16,10 @@ export function ShareHeader({ pageId: string; publishMode: PageMode; }) { - const setAppHeader = useSetAtom(appHeaderAtom); - const currentWorkspace = useWorkspace(workspace.id); return (
    } center={ { + const currentWorkspace = useWorkspace(workspaceId); + const navigateHelper = useNavigateHelper(); + const setting = useCollectionManager(collectionsCRUDAtom); + const saveToCollection = useCallback( + async (collection: Collection) => { + await setting.createCollection({ + ...collection, + filterList: setting.currentCollection.filterList, + }); + navigateHelper.jumpToCollection(workspaceId, collection.id); + }, + [setting, navigateHelper, workspaceId] + ); + + const onFilterChange = useAsyncCallback( + async (filterList: Filter[]) => { + await setting.updateCollection({ + ...setting.currentCollection, + filterList, + }); + }, + [setting] + ); + + if (!setting.isDefault || !setting.currentCollection.filterList.length) { + return null; + } + + return ( +
    +
    + +
    +
    + {setting.currentCollection.filterList.length > 0 ? ( + + ) : null} +
    +
    + ); +}; diff --git a/packages/frontend/core/src/pages/workspace/all-page.css.ts b/packages/frontend/core/src/pages/workspace/all-page/all-page.css.ts similarity index 91% rename from packages/frontend/core/src/pages/workspace/all-page.css.ts rename to packages/frontend/core/src/pages/workspace/all-page/all-page.css.ts index 32ecc9f4c4..70db74ebc4 100644 --- a/packages/frontend/core/src/pages/workspace/all-page.css.ts +++ b/packages/frontend/core/src/pages/workspace/all-page/all-page.css.ts @@ -67,3 +67,10 @@ export const headerCreateNewButtonHidden = style({ opacity: 0, pointerEvents: 'none', }); + +export const headerRightWindows = style({ + display: 'flex', + alignItems: 'center', + gap: 8, + transform: 'translateX(16px)', +}); diff --git a/packages/frontend/core/src/pages/workspace/all-page.tsx b/packages/frontend/core/src/pages/workspace/all-page/all-page.tsx similarity index 78% rename from packages/frontend/core/src/pages/workspace/all-page.tsx rename to packages/frontend/core/src/pages/workspace/all-page/all-page.tsx index d62bf16b29..d07a8fb2d3 100644 --- a/packages/frontend/core/src/pages/workspace/all-page.tsx +++ b/packages/frontend/core/src/pages/workspace/all-page/all-page.tsx @@ -1,5 +1,6 @@ import { toast } from '@affine/component'; import { + CollectionList, currentCollectionAtom, FloatingToolbar, NewPageButton as PureNewPageButton, @@ -8,7 +9,7 @@ import { useCollectionManager, VirtualizedPageList, } from '@affine/component/page-list'; -import { WorkspaceFlavour, WorkspaceSubPath } from '@affine/env/workspace'; +import { WorkspaceFlavour } from '@affine/env/workspace'; import { Trans } from '@affine/i18n'; import { useAFFiNEI18N } from '@affine/i18n/hooks'; import { assertExists } from '@blocksuite/global/utils'; @@ -18,7 +19,7 @@ import { PlusIcon, ViewLayersIcon, } from '@blocksuite/icons'; -import type { PageMeta } from '@blocksuite/store'; +import type { PageMeta, Workspace } from '@blocksuite/store'; import { useBlockSuitePageMeta } from '@toeverything/hooks/use-block-suite-page-meta'; import { getBlockSuiteWorkspaceAtom } from '@toeverything/infra/__internal__/workspace'; import { getCurrentStore } from '@toeverything/infra/atom'; @@ -34,16 +35,22 @@ import type { LoaderFunction } from 'react-router-dom'; import { redirect } from 'react-router-dom'; import { NIL } from 'uuid'; -import { collectionsCRUDAtom } from '../../atoms/collections'; -import { usePageHelper } from '../../components/blocksuite/block-suite-page-list/utils'; -import { WorkspaceHeader } from '../../components/workspace-header'; -import { useBlockSuiteMetaHelper } from '../../hooks/affine/use-block-suite-meta-helper'; -import { useTrashModalHelper } from '../../hooks/affine/use-trash-modal-helper'; -import { useCurrentWorkspace } from '../../hooks/current/use-current-workspace'; -import { performanceRenderLogger } from '../../shared'; +import { collectionsCRUDAtom } from '../../../atoms/collections'; +import { HubIsland } from '../../../components/affine/hub-island'; +import { usePageHelper } from '../../../components/blocksuite/block-suite-page-list/utils'; +import { Header } from '../../../components/pure/header'; +import { WindowsAppControls } from '../../../components/pure/header/windows-app-controls'; +import { WorkspaceModeFilterTab } from '../../../components/pure/workspace-mode-filter-tab'; +import { useAllPageListConfig } from '../../../hooks/affine/use-all-page-list-config'; +import { useBlockSuiteMetaHelper } from '../../../hooks/affine/use-block-suite-meta-helper'; +import { useDeleteCollectionInfo } from '../../../hooks/affine/use-delete-collection-info'; +import { useTrashModalHelper } from '../../../hooks/affine/use-trash-modal-helper'; +import { useCurrentWorkspace } from '../../../hooks/current/use-current-workspace'; +import { performanceRenderLogger } from '../../../shared'; +import { EmptyPageList } from '../page-list-empty'; +import { useFilteredPageMetas } from '../pages'; import * as styles from './all-page.css'; -import { EmptyPageList } from './page-list-empty'; -import { useFilteredPageMetas } from './pages'; +import { FilterContainer } from './all-page-filter'; export const loader: LoaderFunction = async args => { const rootStore = getCurrentStore(); @@ -217,6 +224,50 @@ const NewPageButton = ({ ); }; +const AllPageHeader = ({ + workspace, + showCreateNew, +}: { + workspace: Workspace; + showCreateNew: boolean; +}) => { + const setting = useCollectionManager(collectionsCRUDAtom); + const config = useAllPageListConfig(); + const userInfo = useDeleteCollectionInfo(); + const isWindowsDesktop = environment.isDesktop && environment.isWindows; + + return ( + <> +
    + } + right={ +
    + + + + {isWindowsDesktop ? : null} +
    + } + center={} + /> + + + ); +}; + // even though it is called all page, it is also being used for collection route as well export const AllPage = () => { const [currentWorkspace] = useCurrentWorkspace(); @@ -250,22 +301,9 @@ export const AllPage = () => { return (
    {currentWorkspace.flavour !== WorkspaceFlavour.AFFINE_PUBLIC ? ( - - - - } + ) : null} {filteredPageMetas.length > 0 ? ( @@ -299,6 +337,7 @@ export const AllPage = () => { blockSuiteWorkspace={currentWorkspace.blockSuiteWorkspace} /> )} +
    ); }; diff --git a/packages/frontend/core/src/pages/workspace/collection.tsx b/packages/frontend/core/src/pages/workspace/collection.tsx index f66bb5fe75..3db8be5986 100644 --- a/packages/frontend/core/src/pages/workspace/collection.tsx +++ b/packages/frontend/core/src/pages/workspace/collection.tsx @@ -30,7 +30,7 @@ import { useCurrentWorkspace } from '../../hooks/current/use-current-workspace'; import { useNavigateHelper } from '../../hooks/use-navigate-helper'; import { WorkspaceSubPath } from '../../shared'; import { getWorkspaceSetting } from '../../utils/workspace-setting'; -import { AllPage } from './all-page'; +import { AllPage } from './all-page/all-page'; import * as styles from './collection.css'; export const loader: LoaderFunction = async args => { diff --git a/packages/frontend/core/src/pages/workspace/detail-page.tsx b/packages/frontend/core/src/pages/workspace/detail-page.tsx deleted file mode 100644 index e270ad26f8..0000000000 --- a/packages/frontend/core/src/pages/workspace/detail-page.tsx +++ /dev/null @@ -1,215 +0,0 @@ -import { PageDetailSkeleton } from '@affine/component/page-detail-skeleton'; -import { - createTagFilter, - useCollectionManager, -} from '@affine/component/page-list'; -import { WorkspaceSubPath } from '@affine/env/workspace'; -import { globalBlockSuiteSchema } from '@affine/workspace/manager'; -import { SyncEngineStep } from '@affine/workspace/providers'; -import { assertExists } from '@blocksuite/global/utils'; -import type { EditorContainer } from '@blocksuite/presets'; -import type { Page } from '@blocksuite/store'; -import { - contentLayoutAtom, - currentPageIdAtom, - currentWorkspaceIdAtom, -} from '@toeverything/infra/atom'; -import { useAtomValue, useSetAtom } from 'jotai'; -import { type ReactElement, useCallback, useEffect, useState } from 'react'; -import { type LoaderFunction, useParams } from 'react-router-dom'; -import type { Map as YMap } from 'yjs'; - -import { getUIAdapter } from '../../adapters/workspace'; -import { setPageModeAtom } from '../../atoms'; -import { collectionsCRUDAtom } from '../../atoms/collections'; -import { currentModeAtom } from '../../atoms/mode'; -import { AffineErrorBoundary } from '../../components/affine/affine-error-boundary'; -import { GlobalPageHistoryModal } from '../../components/affine/page-history-modal'; -import { WorkspaceHeader } from '../../components/workspace-header'; -import { useRegisterBlocksuiteEditorCommands } from '../../hooks/affine/use-register-blocksuite-editor-commands'; -import { - useCurrentSyncEngine, - useCurrentSyncEngineStatus, -} from '../../hooks/current/use-current-sync-engine'; -import { useCurrentWorkspace } from '../../hooks/current/use-current-workspace'; -import { useNavigateHelper } from '../../hooks/use-navigate-helper'; -import { performanceRenderLogger } from '../../shared'; - -const DetailPageImpl = (): ReactElement => { - const { openPage, jumpToSubPath } = useNavigateHelper(); - const currentPageId = useAtomValue(currentPageIdAtom); - const [currentWorkspace] = useCurrentWorkspace(); - assertExists(currentWorkspace); - assertExists(currentPageId); - const blockSuiteWorkspace = currentWorkspace.blockSuiteWorkspace; - const { setTemporaryFilter } = useCollectionManager(collectionsCRUDAtom); - const mode = useAtomValue(currentModeAtom); - const setPageMode = useSetAtom(setPageModeAtom); - useRegisterBlocksuiteEditorCommands(currentPageId, mode); - const onLoad = useCallback( - (page: Page, editor: EditorContainer) => { - try { - const surfaceBlock = page.getBlockByFlavour('affine:surface')[0]; - // hotfix for old page - if ( - surfaceBlock && - (surfaceBlock.yBlock.get('prop:elements') as YMap).get( - 'type' - ) !== '$blocksuite:internal:native$' - ) { - globalBlockSuiteSchema.upgradePage( - 0, - { - 'affine:surface': 3, - }, - page.spaceDoc - ); - } - } catch {} - setPageMode(currentPageId, mode); - const dispose = editor.slots.pageLinkClicked.on(({ pageId }) => { - return openPage(blockSuiteWorkspace.id, pageId); - }); - const disposeTagClick = editor.slots.tagClicked.on(async ({ tagId }) => { - jumpToSubPath(currentWorkspace.id, WorkspaceSubPath.ALL); - setTemporaryFilter([createTagFilter(tagId)]); - }); - return () => { - dispose.dispose(); - disposeTagClick.dispose(); - }; - }, - [ - blockSuiteWorkspace.id, - currentPageId, - currentWorkspace.id, - jumpToSubPath, - mode, - openPage, - setPageMode, - setTemporaryFilter, - ] - ); - - const { PageDetail } = getUIAdapter(currentWorkspace.flavour); - return ( - <> - - - - - - ); -}; - -export const DetailPage = (): ReactElement => { - const [currentWorkspace] = useCurrentWorkspace(); - const currentSyncEngineStatus = useCurrentSyncEngineStatus(); - const currentSyncEngine = useCurrentSyncEngine(); - const currentPageId = useAtomValue(currentPageIdAtom); - const [page, setPage] = useState(null); - - // set sync engine priority target - useEffect(() => { - if (!currentPageId) { - return; - } - currentSyncEngine?.setPriorityRule(id => id.endsWith(currentPageId)); - }, [currentPageId, currentSyncEngine, currentWorkspace]); - - // load page by current page id - useEffect(() => { - if (!currentPageId) { - setPage(null); - return; - } - - const exists = currentWorkspace.blockSuiteWorkspace.getPage(currentPageId); - - if (exists) { - setPage(exists); - return; - } - - const dispose = currentWorkspace.blockSuiteWorkspace.slots.pagesUpdated.on( - () => { - const exists = - currentWorkspace.blockSuiteWorkspace.getPage(currentPageId); - - if (exists) { - setPage(exists); - } - } - ); - - return dispose.dispose; - }, [currentPageId, currentWorkspace]); - - const navigate = useNavigateHelper(); - - // if sync engine has been synced and the page is null, wait 1s and jump to 404 page. - useEffect(() => { - if (currentSyncEngineStatus?.step === SyncEngineStep.Synced && !page) { - const timeout = setTimeout(() => { - navigate.jumpTo404(); - }, 1000); - return () => { - clearTimeout(timeout); - }; - } - return; - }, [currentSyncEngineStatus, navigate, page]); - - if (!currentPageId || !page) { - return ; - } - - if (page.meta.jumpOnce) { - currentWorkspace.blockSuiteWorkspace.setPageMeta(page.id, { - jumpOnce: false, - }); - } - - return ; -}; - -export const loader: LoaderFunction = async () => { - return null; -}; - -export const Component = () => { - performanceRenderLogger.info('DetailPage'); - - const setContentLayout = useSetAtom(contentLayoutAtom); - const setCurrentWorkspaceId = useSetAtom(currentWorkspaceIdAtom); - const setCurrentPageId = useSetAtom(currentPageIdAtom); - const params = useParams(); - - useEffect(() => { - setContentLayout('editor'); - if (params.workspaceId) { - localStorage.setItem('last_workspace_id', params.workspaceId); - setCurrentWorkspaceId(params.workspaceId); - } - if (params.pageId) { - localStorage.setItem('last_page_id', params.pageId); - setCurrentPageId(params.pageId); - } - }, [params, setContentLayout, setCurrentPageId, setCurrentWorkspaceId]); - - // Add a key to force rerender when page changed, to avoid error boundary persisting. - return ( - - - - ); -}; diff --git a/packages/frontend/core/src/pages/workspace/detail-page/detail-page-header.css.ts b/packages/frontend/core/src/pages/workspace/detail-page/detail-page-header.css.ts new file mode 100644 index 0000000000..73b4f6052c --- /dev/null +++ b/packages/frontend/core/src/pages/workspace/detail-page/detail-page-header.css.ts @@ -0,0 +1,59 @@ +import type { ComplexStyleRule } from '@vanilla-extract/css'; +import { style } from '@vanilla-extract/css'; + +export const header = style({ + display: 'flex', + height: '52px', + width: '100%', + alignItems: 'center', + flexShrink: 0, + background: 'var(--affine-background-primary-color)', + borderBottom: '1px solid var(--affine-border-color)', + selectors: { + '&[data-sidebar-floating="false"]': { + WebkitAppRegion: 'drag', + }, + }, + '@media': { + print: { + display: 'none', + }, + }, + ':has([data-popper-placement])': { + WebkitAppRegion: 'no-drag', + }, +} as ComplexStyleRule); + +export const mainHeader = style([ + header, + { + padding: '0 16px', + }, +]); + +export const sidebarHeader = style([ + header, + { + padding: '0 14px', + gap: '12px', + }, +]); + +export const mainHeaderRight = style({ + display: 'flex', + alignItems: 'center', + gap: '8px', +}); + +export const spacer = style({ + flexGrow: 1, +}); + +export const standaloneExtensionSwitcherWrapper = style({ + display: 'flex', + alignItems: 'center', + justifyContent: 'center', + flexShrink: 0, + height: '52px', + position: 'relative', +}); diff --git a/packages/frontend/core/src/pages/workspace/detail-page/detail-page-header.tsx b/packages/frontend/core/src/pages/workspace/detail-page/detail-page-header.tsx new file mode 100644 index 0000000000..6628da77e8 --- /dev/null +++ b/packages/frontend/core/src/pages/workspace/detail-page/detail-page-header.tsx @@ -0,0 +1,159 @@ +import { IconButton } from '@affine/component'; +import { + appSidebarFloatingAtom, + appSidebarOpenAtom, + SidebarSwitch, +} from '@affine/component/app-sidebar'; +import type { AllWorkspace } from '@affine/core/shared'; +import { RightSidebarIcon } from '@blocksuite/icons'; +import type { Page } from '@blocksuite/store'; +import { useAtomValue, useSetAtom } from 'jotai'; + +import { SharePageButton } from '../../../components/affine/share-page-modal'; +import { BlockSuiteHeaderTitle } from '../../../components/blocksuite/block-suite-header-title'; +import { HeaderDivider } from '../../../components/pure/header'; +import { WindowsAppControls } from '../../../components/pure/header/windows-app-controls'; +import * as styles from './detail-page-header.css'; +import { ExtensionTabs } from './editor-sidebar'; +import { + editorSidebarOpenAtom, + editorSidebarToggleAtom, +} from './editor-sidebar/atoms'; + +interface PageHeaderRightProps { + showSidebarSwitch?: boolean; +} + +const ToggleSidebarButton = () => { + const toggle = useSetAtom(editorSidebarToggleAtom); + return ( + + + + ); +}; +const isWindowsDesktop = environment.isDesktop && environment.isWindows; + +const WindowsMainPageHeaderRight = ({ + showSidebarSwitch, +}: PageHeaderRightProps) => { + const editorSidebarOpen = useAtomValue(editorSidebarOpenAtom); + + if (editorSidebarOpen) { + return null; + } + + return ( + <> + +
    + {showSidebarSwitch ? : null} + +
    + + ); +}; + +const NonWindowsMainPageHeaderRight = ({ + showSidebarSwitch, +}: PageHeaderRightProps) => { + const editorSidebarOpen = useAtomValue(editorSidebarOpenAtom); + + if (editorSidebarOpen || !showSidebarSwitch) { + return null; + } + + return ( + <> + +
    + +
    + + ); +}; + +function Header({ + children, + style, + className, +}: { + children: React.ReactNode; + className?: string; + style?: React.CSSProperties; +}) { + const appSidebarFloating = useAtomValue(appSidebarFloatingAtom); + return ( +
    + {children} +
    + ); +} + +export function DetailPageHeader({ + page, + workspace, + showSidebarSwitch = true, +}: { + page: Page; + workspace: AllWorkspace; + showSidebarSwitch?: boolean; +}) { + const leftSidebarOpen = useAtomValue(appSidebarOpenAtom); + const RightHeader = isWindowsDesktop + ? WindowsMainPageHeaderRight + : NonWindowsMainPageHeaderRight; + return ( +
    + + {!leftSidebarOpen ? : null} + +
    + {page ? : null} + +
    + ); +} + +function WindowsSidebarHeader() { + return ( + <> +
    +
    + + +
    +
    + +
    + + ); +} + +function NonWindowsSidebarHeader() { + return ( +
    + +
    + +
    + ); +} + +export function RightSidebarHeader() { + return isWindowsDesktop ? ( + + ) : ( + + ); +} diff --git a/packages/frontend/core/src/pages/workspace/detail-page/detail-page.css.ts b/packages/frontend/core/src/pages/workspace/detail-page/detail-page.css.ts new file mode 100644 index 0000000000..4c01eab62b --- /dev/null +++ b/packages/frontend/core/src/pages/workspace/detail-page/detail-page.css.ts @@ -0,0 +1,95 @@ +import { style } from '@vanilla-extract/css'; + +export const root = style({ + display: 'flex', + height: '100%', + overflow: 'hidden', + width: '100%', +}); + +export const mainContainer = style({ + display: 'flex', + flex: 1, + height: '100%', + position: 'relative', + flexDirection: 'column', + width: '100%', + selectors: { + [`${root}[data-client-border] &`]: { + borderRadius: '4px', + }, + }, +}); + +export const editorContainer = style({ + position: 'relative', + display: 'flex', + flexDirection: 'column', + flex: 1, + overflow: 'hidden', + zIndex: 0, // it will create stacking context to limit layer of child elements and be lower than after auto zIndex +}); + +export const resizeHandle = style({ + width: '1px', + position: 'relative', + backgroundColor: 'var(--affine-border-color)', + selectors: { + '&[data-collapsed=true]': { + display: 'none', + }, + [`${root}[data-client-border] &`]: { + width: '8px', + backgroundColor: 'transparent', + }, + }, +}); + +export const resizeHandleInner = style({ + height: '100%', + width: '10px', // this is the real hit box + position: 'absolute', + transform: 'translateX(-50%)', + zIndex: 10, + transition: 'all 0.2s ease-in-out', + display: 'flex', + justifyContent: 'center', + '::before': { + content: '""', + width: '0px', + height: '100%', + borderRadius: '2px', + transition: 'all 0.2s ease-in-out', + }, + selectors: { + [`${root}[data-client-border] &`]: { + transform: 'translateX(-1px)', + }, + [`:is(${resizeHandle}:hover, ${resizeHandle}[data-resize-handle-active]) &::before`]: + { + width: '2px', + backgroundColor: 'var(--affine-primary-color)', + }, + [`${resizeHandle}[data-resize-handle-active] &::before`]: { + width: '4px', + borderRadius: '4px', + }, + }, +}); + +export const sidebarContainer = style({ + transition: 'flex 0.2s ease-in-out', + display: 'flex', + flexDirection: 'column', + selectors: { + [`${resizeHandle}[data-resize-handle-active] + &`]: { + transition: 'none', + }, + [`${root}[data-disable-animation] &`]: { + transition: 'none', + }, + [`${root}[data-client-border] &`]: { + borderRadius: '4px', + }, + }, +}); diff --git a/packages/frontend/core/src/pages/workspace/detail-page/detail-page.tsx b/packages/frontend/core/src/pages/workspace/detail-page/detail-page.tsx new file mode 100644 index 0000000000..a4aa1c82dd --- /dev/null +++ b/packages/frontend/core/src/pages/workspace/detail-page/detail-page.tsx @@ -0,0 +1,363 @@ +import { PageDetailSkeleton } from '@affine/component/page-detail-skeleton'; +import { + createTagFilter, + useCollectionManager, +} from '@affine/component/page-list'; +import { WorkspaceSubPath } from '@affine/env/workspace'; +import { globalBlockSuiteSchema } from '@affine/workspace/manager'; +import { SyncEngineStep } from '@affine/workspace/providers'; +import { assertExists } from '@blocksuite/global/utils'; +import type { EditorContainer } from '@blocksuite/presets'; +import type { Page, Workspace } from '@blocksuite/store'; +import { useBlockSuitePageMeta } from '@toeverything/hooks/use-block-suite-page-meta'; +import { + currentPageIdAtom, + currentWorkspaceIdAtom, +} from '@toeverything/infra/atom'; +import { useAtomValue, useSetAtom } from 'jotai'; +import { + type ReactElement, + type ReactNode, + useCallback, + useEffect, + useRef, + useState, +} from 'react'; +import type { PanelOnResize } from 'react-resizable-panels'; +import { + type ImperativePanelHandle, + Panel, + PanelGroup, + PanelResizeHandle, +} from 'react-resizable-panels'; +import { type LoaderFunction, useParams } from 'react-router-dom'; +import type { Map as YMap } from 'yjs'; + +import { setPageModeAtom } from '../../../atoms'; +import { collectionsCRUDAtom } from '../../../atoms/collections'; +import { currentModeAtom } from '../../../atoms/mode'; +import { appSettingAtom } from '../../../atoms/settings'; +import { AffineErrorBoundary } from '../../../components/affine/affine-error-boundary'; +import { HubIsland } from '../../../components/affine/hub-island'; +import { GlobalPageHistoryModal } from '../../../components/affine/page-history-modal'; +import { PageDetailEditor } from '../../../components/page-detail-editor'; +import { TrashPageFooter } from '../../../components/pure/trash-page-footer'; +import { TopTip } from '../../../components/top-tip'; +import { useRegisterBlocksuiteEditorCommands } from '../../../hooks/affine/use-register-blocksuite-editor-commands'; +import { + useCurrentSyncEngine, + useCurrentSyncEngineStatus, +} from '../../../hooks/current/use-current-sync-engine'; +import { useCurrentWorkspace } from '../../../hooks/current/use-current-workspace'; +import { useNavigateHelper } from '../../../hooks/use-navigate-helper'; +import { performanceRenderLogger } from '../../../shared'; +import * as styles from './detail-page.css'; +import { DetailPageHeader, RightSidebarHeader } from './detail-page-header'; +import { + EditorSidebar, + editorSidebarOpenAtom, + editorSidebarStateAtom, + editorSidebarWidthAtom, +} from './editor-sidebar'; + +interface DetailPageLayoutProps { + main: ReactNode; + header: ReactNode; + footer: ReactNode; + sidebar: ReactNode; +} + +// disable animation to avoid UI flash +function useEnableAnimation() { + const [enable, setEnable] = useState(false); + useEffect(() => { + window.setTimeout(() => { + setEnable(true); + }, 500); + }, []); + return enable; +} + +// todo: consider move to a shared place if we also want to reuse the layout for other routes +const DetailPageLayout = ({ + main, + header, + footer, + sidebar, +}: DetailPageLayoutProps): ReactElement => { + const sidebarState = useAtomValue(editorSidebarStateAtom); + const setSidebarWidth = useSetAtom(editorSidebarWidthAtom); + const setSidebarOpen = useSetAtom(editorSidebarOpenAtom); + const { clientBorder } = useAtomValue(appSettingAtom); + + const sidebarRef = useRef(null); + + const onExpandSidebar = useCallback(() => { + setSidebarOpen(true); + }, [setSidebarOpen]); + + const onCollapseSidebar = useCallback(() => { + setSidebarOpen(false); + }, [setSidebarOpen]); + + const onResize: PanelOnResize = useCallback( + e => { + if (e.sizePixels > 0) { + setSidebarWidth(e.sizePixels); + } + }, + [setSidebarWidth] + ); + + useEffect(() => { + const panelHandle = sidebarRef.current; + if (!panelHandle) { + return; + } + + if (sidebarState.isOpen) { + panelHandle.expand(); + } else { + panelHandle.collapse(); + } + }, [sidebarState.isOpen]); + + const enableAnimation = useEnableAnimation(); + + return ( + + + {header} + {main} + {footer} + + {sidebar ? ( + <> + +
    + + + {sidebar} + + + ) : null} + + ); +}; + +const DetailPageImpl = ({ page }: { page: Page }) => { + const currentPageId = page.id; + const { openPage, jumpToSubPath } = useNavigateHelper(); + const [currentWorkspace] = useCurrentWorkspace(); + assertExists( + currentWorkspace, + 'current workspace is null when rendering detail' + ); + const blockSuiteWorkspace = currentWorkspace.blockSuiteWorkspace; + + const pageMeta = useBlockSuitePageMeta(blockSuiteWorkspace).find( + meta => meta.id === page.id + ); + + const isInTrash = pageMeta?.trash; + + const { setTemporaryFilter } = useCollectionManager(collectionsCRUDAtom); + const mode = useAtomValue(currentModeAtom); + const setPageMode = useSetAtom(setPageModeAtom); + useRegisterBlocksuiteEditorCommands(currentPageId, mode); + + const onLoad = useCallback( + (page: Page, editor: EditorContainer) => { + try { + // todo(joooye34): improve the following migration code + const surfaceBlock = page.getBlockByFlavour('affine:surface')[0]; + // hotfix for old page + if ( + surfaceBlock && + (surfaceBlock.yBlock.get('prop:elements') as YMap).get( + 'type' + ) !== '$blocksuite:internal:native$' + ) { + globalBlockSuiteSchema.upgradePage( + 0, + { + 'affine:surface': 3, + }, + page.spaceDoc + ); + } + } catch {} + setPageMode(currentPageId, mode); + const dispose = editor.slots.pageLinkClicked.on(({ pageId }) => { + return openPage(blockSuiteWorkspace.id, pageId); + }); + const disposeTagClick = editor.slots.tagClicked.on(async ({ tagId }) => { + jumpToSubPath(currentWorkspace.id, WorkspaceSubPath.ALL); + setTemporaryFilter([createTagFilter(tagId)]); + }); + return () => { + dispose.dispose(); + disposeTagClick.dispose(); + }; + }, + [ + blockSuiteWorkspace.id, + currentPageId, + currentWorkspace.id, + jumpToSubPath, + mode, + openPage, + setPageMode, + setTemporaryFilter, + ] + ); + + return ( + <> + + + + + } + main={ +
    + + +
    + } + footer={isInTrash ? : null} + sidebar={ + !isInTrash ? ( + <> + + + + ) : null + } + /> + + + ); +}; + +const useForceUpdate = () => { + const [, setCount] = useState(0); + return useCallback(() => setCount(count => count + 1), []); +}; +const useSafePage = (workspace: Workspace, pageId: string) => { + const forceUpdate = useForceUpdate(); + useEffect(() => { + const disposable = workspace.slots.pagesUpdated.on(() => { + forceUpdate(); + }); + return disposable.dispose; + }, [pageId, workspace.slots.pagesUpdated, forceUpdate]); + + return workspace.getPage(pageId); +}; + +export const DetailPage = ({ pageId }: { pageId: string }): ReactElement => { + const [currentWorkspace] = useCurrentWorkspace(); + const currentSyncEngineStatus = useCurrentSyncEngineStatus(); + const currentSyncEngine = useCurrentSyncEngine(); + + // set sync engine priority target + useEffect(() => { + currentSyncEngine?.setPriorityRule(id => id.endsWith(pageId)); + }, [pageId, currentSyncEngine, currentWorkspace]); + + const page = useSafePage(currentWorkspace?.blockSuiteWorkspace, pageId); + + const navigate = useNavigateHelper(); + + // if sync engine has been synced and the page is null, wait 1s and jump to 404 page. + useEffect(() => { + if (currentSyncEngineStatus?.step === SyncEngineStep.Synced && !page) { + const timeout = setTimeout(() => { + navigate.jumpTo404(); + }, 1000); + return () => { + clearTimeout(timeout); + }; + } + return; + }, [currentSyncEngineStatus, navigate, page]); + + if (!page) { + return ; + } + + if (page.meta.jumpOnce) { + currentWorkspace.blockSuiteWorkspace.setPageMeta(page.id, { + jumpOnce: false, + }); + } + + return ; +}; + +export const loader: LoaderFunction = async () => { + return null; +}; + +export const Component = () => { + performanceRenderLogger.info('DetailPage'); + + const setCurrentWorkspaceId = useSetAtom(currentWorkspaceIdAtom); + const setCurrentPageId = useSetAtom(currentPageIdAtom); + const params = useParams(); + + useEffect(() => { + if (params.workspaceId) { + localStorage.setItem('last_workspace_id', params.workspaceId); + setCurrentWorkspaceId(params.workspaceId); + } + if (params.pageId) { + localStorage.setItem('last_page_id', params.pageId); + setCurrentPageId(params.pageId); + } + }, [params, setCurrentPageId, setCurrentWorkspaceId]); + + const pageId = params.pageId; + + // Add a key to force rerender when page changed, to avoid error boundary persisting. + return ( + + {pageId ? : null} + + ); +}; diff --git a/packages/frontend/core/src/pages/workspace/detail-page/editor-sidebar/atoms.ts b/packages/frontend/core/src/pages/workspace/detail-page/editor-sidebar/atoms.ts new file mode 100644 index 0000000000..0d0fcfb8d9 --- /dev/null +++ b/packages/frontend/core/src/pages/workspace/detail-page/editor-sidebar/atoms.ts @@ -0,0 +1,79 @@ +// main editor sidebar states +import { assertExists } from '@blocksuite/global/utils'; +import { atom } from 'jotai'; +import { selectAtom } from 'jotai/utils'; + +import { outlineExtension } from './extensions/outline'; +import type { EditorExtension, EditorExtensionName } from './types'; + +// the list of all possible extensions in affine. +// order matters (determines the order of the tabs) +export const extensions: EditorExtension[] = [outlineExtension]; + +export interface EditorSidebarState { + isOpen: boolean; + width: number; + activeExtension?: EditorExtension; + extensions: EditorExtension[]; +} + +const baseStateAtom = atom({ + isOpen: false, + width: 300, // todo: should be resizable + activeExtension: extensions[0], + extensions: extensions, // todo: maybe should be dynamic (by feature flag?) +}); + +export const editorSidebarStateAtom = atom(get => get(baseStateAtom)); + +const isOpenAtom = selectAtom(baseStateAtom, state => state.isOpen); +const activeExtensionAtom = selectAtom( + baseStateAtom, + state => state.activeExtension +); +const widthAtom = selectAtom(baseStateAtom, state => state.width); + +export const editorExtensionsAtom = selectAtom( + baseStateAtom, + state => state.extensions +); + +// get/set sidebar open state +export const editorSidebarOpenAtom = atom( + get => get(isOpenAtom), + (_, set, isOpen: boolean) => { + set(baseStateAtom, prev => { + return { ...prev, isOpen }; + }); + } +); + +// get/set active extension +export const editorSidebarActiveExtensionAtom = atom( + get => get(activeExtensionAtom), + (_, set, extension: EditorExtensionName) => { + set(baseStateAtom, prev => { + const extensions = prev.extensions; + const newExtension = extensions.find(e => e.name === extension); + assertExists(newExtension, `extension ${extension} not found`); + return { ...prev, activeExtension: newExtension }; + }); + } +); + +// toggle sidebar (write only) +export const editorSidebarToggleAtom = atom(null, (_, set) => { + set(baseStateAtom, prev => { + return { ...prev, isOpen: !prev.isOpen }; + }); +}); + +// get/set sidebar width +export const editorSidebarWidthAtom = atom( + get => get(widthAtom), + (_, set, width: number) => { + set(baseStateAtom, prev => { + return { ...prev, width }; + }); + } +); diff --git a/packages/frontend/core/src/pages/workspace/detail-page/editor-sidebar/editor-sidebar.css.ts b/packages/frontend/core/src/pages/workspace/detail-page/editor-sidebar/editor-sidebar.css.ts new file mode 100644 index 0000000000..5c9fd6fa13 --- /dev/null +++ b/packages/frontend/core/src/pages/workspace/detail-page/editor-sidebar/editor-sidebar.css.ts @@ -0,0 +1,10 @@ +import { style } from '@vanilla-extract/css'; + +export const root = style({ + display: 'flex', + flexDirection: 'column', + flex: 1, + overflow: 'auto', + width: '100%', + minWidth: '300px', +}); diff --git a/packages/frontend/core/src/pages/workspace/detail-page/editor-sidebar/editor-sidebar.tsx b/packages/frontend/core/src/pages/workspace/detail-page/editor-sidebar/editor-sidebar.tsx new file mode 100644 index 0000000000..9d0427f2cf --- /dev/null +++ b/packages/frontend/core/src/pages/workspace/detail-page/editor-sidebar/editor-sidebar.tsx @@ -0,0 +1,16 @@ +import { useAtomValue } from 'jotai'; + +import { editorSidebarStateAtom } from './atoms'; +import * as styles from './editor-sidebar.css'; + +export const EditorSidebar = () => { + const sidebarState = useAtomValue(editorSidebarStateAtom); + const Component = sidebarState.activeExtension?.Component; + + // do we need this? + if (!sidebarState.isOpen) { + return null; + } + + return
    {Component ? : null}
    ; +}; diff --git a/packages/frontend/core/src/pages/workspace/detail-page/editor-sidebar/extensions/extensions.css.ts b/packages/frontend/core/src/pages/workspace/detail-page/editor-sidebar/extensions/extensions.css.ts new file mode 100644 index 0000000000..f5231a4e1a --- /dev/null +++ b/packages/frontend/core/src/pages/workspace/detail-page/editor-sidebar/extensions/extensions.css.ts @@ -0,0 +1,45 @@ +import { createVar, style } from '@vanilla-extract/css'; + +export const activeIdx = createVar(); + +export const switchRoot = style({ + vars: { + [activeIdx]: '0', + }, + display: 'flex', + alignItems: 'center', + gap: '8px', + height: '32px', + borderRadius: '12px', + padding: '4px', + position: 'relative', + background: 'var(--affine-background-secondary-color)', + + '::after': { + content: '""', + display: 'block', + width: '24px', + height: '24px', + background: 'var(--affine-background-primary-color)', + boxShadow: 'var(--affine-shadow-1)', + borderRadius: '8px', + position: 'absolute', + transform: `translateX(calc(${activeIdx} * 32px))`, + transition: 'all .15s', + }, +}); + +export const button = style({ + width: '24px', + height: '24px', + borderRadius: '8px', + color: 'var(--affine-icon-color)', + position: 'relative', + zIndex: 1, + + selectors: { + '&[data-active=true]': { + color: 'var(--affine-primary-color)', + }, + }, +}); diff --git a/packages/frontend/core/src/pages/workspace/detail-page/editor-sidebar/extensions/extensions.tsx b/packages/frontend/core/src/pages/workspace/detail-page/editor-sidebar/extensions/extensions.tsx new file mode 100644 index 0000000000..01c0a07221 --- /dev/null +++ b/packages/frontend/core/src/pages/workspace/detail-page/editor-sidebar/extensions/extensions.tsx @@ -0,0 +1,37 @@ +import { IconButton } from '@affine/component'; +import { assignInlineVars } from '@vanilla-extract/dynamic'; +import { useAtom, useAtomValue } from 'jotai'; + +import { + editorExtensionsAtom, + editorSidebarActiveExtensionAtom, +} from '../atoms'; +import * as styles from './extensions.css'; + +// provide a switcher for active extensions +// will be used in global top header (MacOS) or sidebar (Windows) +export const ExtensionTabs = () => { + const exts = useAtomValue(editorExtensionsAtom); + const [selected, setSelected] = useAtom(editorSidebarActiveExtensionAtom); + const vars = assignInlineVars({ + [styles.activeIdx]: String( + exts.findIndex(ext => ext.name === selected?.name) ?? 0 + ), + }); + return ( +
    + {exts.map(extension => { + return ( + setSelected(extension.name)} + key={extension.name} + data-active={selected?.name === extension.name} + className={styles.button} + > + {extension.icon} + + ); + })} +
    + ); +}; diff --git a/packages/frontend/core/src/pages/workspace/detail-page/editor-sidebar/extensions/frame.css.ts b/packages/frontend/core/src/pages/workspace/detail-page/editor-sidebar/extensions/frame.css.ts new file mode 100644 index 0000000000..0a2dbb4421 --- /dev/null +++ b/packages/frontend/core/src/pages/workspace/detail-page/editor-sidebar/extensions/frame.css.ts @@ -0,0 +1,7 @@ +import { style } from '@vanilla-extract/css'; + +export const root = style({ + display: 'flex', + height: '100%', + width: '100%', +}); diff --git a/packages/frontend/core/src/pages/workspace/detail-page/editor-sidebar/extensions/frame.tsx b/packages/frontend/core/src/pages/workspace/detail-page/editor-sidebar/extensions/frame.tsx new file mode 100644 index 0000000000..9ac1705446 --- /dev/null +++ b/packages/frontend/core/src/pages/workspace/detail-page/editor-sidebar/extensions/frame.tsx @@ -0,0 +1,41 @@ +import { TOCNotesPanel } from '@blocksuite/blocks'; +import { assertExists } from '@blocksuite/global/utils'; +import { FrameIcon } from '@blocksuite/icons'; +import { useCallback, useRef } from 'react'; + +import { useCurrentPage } from '../../../../../hooks/current/use-current-page'; +import type { EditorExtension } from '../types'; +import * as styles from './frame.css'; + +// A wrapper for TOCNotesPanel +const EditorOutline = () => { + const tocPanelRef = useRef(null); + const currentPage = useCurrentPage(); + + const onRefChange = useCallback((container: HTMLDivElement | null) => { + if (container) { + assertExists(tocPanelRef.current, 'toc panel should be initialized'); + container.append(tocPanelRef.current); + } + }, []); + + if (!currentPage) { + return; + } + + if (!tocPanelRef.current) { + tocPanelRef.current = new TOCNotesPanel(); + } + + if (currentPage !== tocPanelRef.current?.page) { + (tocPanelRef.current as TOCNotesPanel).page = currentPage; + } + + return
    ; +}; + +export const frameExtension: EditorExtension = { + name: 'frame', + icon: , + Component: EditorOutline, +}; diff --git a/packages/frontend/core/src/pages/workspace/detail-page/editor-sidebar/extensions/index.tsx b/packages/frontend/core/src/pages/workspace/detail-page/editor-sidebar/extensions/index.tsx new file mode 100644 index 0000000000..4509f5ccb0 --- /dev/null +++ b/packages/frontend/core/src/pages/workspace/detail-page/editor-sidebar/extensions/index.tsx @@ -0,0 +1 @@ +export * from './extensions'; diff --git a/packages/frontend/core/src/pages/workspace/detail-page/editor-sidebar/extensions/outline.css.ts b/packages/frontend/core/src/pages/workspace/detail-page/editor-sidebar/extensions/outline.css.ts new file mode 100644 index 0000000000..0a2dbb4421 --- /dev/null +++ b/packages/frontend/core/src/pages/workspace/detail-page/editor-sidebar/extensions/outline.css.ts @@ -0,0 +1,7 @@ +import { style } from '@vanilla-extract/css'; + +export const root = style({ + display: 'flex', + height: '100%', + width: '100%', +}); diff --git a/packages/frontend/core/src/pages/workspace/detail-page/editor-sidebar/extensions/outline.tsx b/packages/frontend/core/src/pages/workspace/detail-page/editor-sidebar/extensions/outline.tsx new file mode 100644 index 0000000000..eaa2f3cac1 --- /dev/null +++ b/packages/frontend/core/src/pages/workspace/detail-page/editor-sidebar/extensions/outline.tsx @@ -0,0 +1,41 @@ +import { TOCNotesPanel } from '@blocksuite/blocks'; +import { assertExists } from '@blocksuite/global/utils'; +import { TocIcon } from '@blocksuite/icons'; +import { useCallback, useRef } from 'react'; + +import { useCurrentPage } from '../../../../../hooks/current/use-current-page'; +import type { EditorExtension } from '../types'; +import * as styles from './outline.css'; + +// A wrapper for TOCNotesPanel +const EditorOutline = () => { + const tocPanelRef = useRef(null); + const currentPage = useCurrentPage(); + + const onRefChange = useCallback((container: HTMLDivElement | null) => { + if (container) { + assertExists(tocPanelRef.current, 'toc panel should be initialized'); + container.append(tocPanelRef.current); + } + }, []); + + if (!currentPage) { + return; + } + + if (!tocPanelRef.current) { + tocPanelRef.current = new TOCNotesPanel(); + } + + if (currentPage !== tocPanelRef.current?.page) { + (tocPanelRef.current as TOCNotesPanel).page = currentPage; + } + + return
    ; +}; + +export const outlineExtension: EditorExtension = { + name: 'outline', + icon: , + Component: EditorOutline, +}; diff --git a/packages/frontend/core/src/pages/workspace/detail-page/editor-sidebar/index.ts b/packages/frontend/core/src/pages/workspace/detail-page/editor-sidebar/index.ts new file mode 100644 index 0000000000..3ee1e3b1b2 --- /dev/null +++ b/packages/frontend/core/src/pages/workspace/detail-page/editor-sidebar/index.ts @@ -0,0 +1,4 @@ +export * from './atoms'; +export * from './editor-sidebar'; +export * from './extensions'; +export * from './types'; diff --git a/packages/frontend/core/src/pages/workspace/detail-page/editor-sidebar/types.ts b/packages/frontend/core/src/pages/workspace/detail-page/editor-sidebar/types.ts new file mode 100644 index 0000000000..ab7ab4d043 --- /dev/null +++ b/packages/frontend/core/src/pages/workspace/detail-page/editor-sidebar/types.ts @@ -0,0 +1,7 @@ +export type EditorExtensionName = 'outline' | 'frame'; + +export interface EditorExtension { + name: EditorExtensionName; + icon: React.ReactNode; + Component: React.ComponentType; +} diff --git a/packages/frontend/core/src/pages/workspace/detail-page/index.ts b/packages/frontend/core/src/pages/workspace/detail-page/index.ts new file mode 100644 index 0000000000..dbf539bf24 --- /dev/null +++ b/packages/frontend/core/src/pages/workspace/detail-page/index.ts @@ -0,0 +1 @@ +export * from './detail-page'; diff --git a/packages/frontend/core/src/components/workspace-header.css.ts b/packages/frontend/core/src/pages/workspace/trash-page.css.ts similarity index 85% rename from packages/frontend/core/src/components/workspace-header.css.ts rename to packages/frontend/core/src/pages/workspace/trash-page.css.ts index 6b483a6096..ec4d58ba79 100644 --- a/packages/frontend/core/src/components/workspace-header.css.ts +++ b/packages/frontend/core/src/pages/workspace/trash-page.css.ts @@ -1,5 +1,7 @@ import { style } from '@vanilla-extract/css'; +export { root } from './all-page/all-page.css'; + export const trashTitle = style({ display: 'flex', alignItems: 'center', diff --git a/packages/frontend/core/src/pages/workspace/trash-page.tsx b/packages/frontend/core/src/pages/workspace/trash-page.tsx index 26345cc5aa..82f2a87f29 100644 --- a/packages/frontend/core/src/pages/workspace/trash-page.tsx +++ b/packages/frontend/core/src/pages/workspace/trash-page.tsx @@ -3,20 +3,43 @@ import { TrashOperationCell, VirtualizedPageList, } from '@affine/component/page-list'; -import { WorkspaceSubPath } from '@affine/env/workspace'; import { useAFFiNEI18N } from '@affine/i18n/hooks'; import { assertExists } from '@blocksuite/global/utils'; +import { DeleteIcon } from '@blocksuite/icons'; import type { PageMeta } from '@blocksuite/store'; import { useBlockSuitePageMeta } from '@toeverything/hooks/use-block-suite-page-meta'; import { useCallback } from 'react'; import { usePageHelper } from '../../components/blocksuite/block-suite-page-list/utils'; -import { WorkspaceHeader } from '../../components/workspace-header'; +import { Header } from '../../components/pure/header'; +import { WindowsAppControls } from '../../components/pure/header/windows-app-controls'; import { useBlockSuiteMetaHelper } from '../../hooks/affine/use-block-suite-meta-helper'; import { useCurrentWorkspace } from '../../hooks/current/use-current-workspace'; -import * as styles from './all-page.css'; import { EmptyPageList } from './page-list-empty'; import { useFilteredPageMetas } from './pages'; +import * as styles from './trash-page.css'; + +const isWindowsDesktop = environment.isDesktop && environment.isWindows; +const TrashHeader = () => { + const t = useAFFiNEI18N(); + return ( +
    + + {t['com.affine.workspaceSubPath.trash']()} +
    + } + right={ + isWindowsDesktop ? ( +
    + +
    + ) : null + } + /> + ); +}; export const TrashPage = () => { const [currentWorkspace] = useCurrentWorkspace(); @@ -60,12 +83,7 @@ export const TrashPage = () => { ); return (
    - + {filteredPageMetas.length > 0 ? ( import('./pages/workspace/all-page'), + lazy: () => import('./pages/workspace/all-page/all-page'), }, { path: 'collection/:collectionId', @@ -25,13 +25,13 @@ export const routes = [ }, { path: ':pageId', - lazy: () => import('./pages/workspace/detail-page'), + lazy: () => import('./pages/workspace/detail-page/detail-page'), }, ], }, { path: '/share/:workspaceId/:pageId', - lazy: () => import('./pages/share/detail-page'), + lazy: () => import('./pages/share/share-detail-page'), }, { path: '/404', diff --git a/packages/frontend/core/src/utils/toast.ts b/packages/frontend/core/src/utils/toast.ts index 4e951259c1..b65e99d96f 100644 --- a/packages/frontend/core/src/utils/toast.ts +++ b/packages/frontend/core/src/utils/toast.ts @@ -1,21 +1,16 @@ import type { ToastOptions } from '@affine/component'; import { toast as basicToast } from '@affine/component'; -import { assertEquals, assertExists } from '@blocksuite/global/utils'; -import { getCurrentStore } from '@toeverything/infra/atom'; - -import { mainContainerAtom } from '../atoms/element'; +import { assertEquals } from '@blocksuite/global/utils'; export const toast = (message: string, options?: ToastOptions) => { - const mainContainer = getCurrentStore().get(mainContainerAtom); const modal = document.querySelector( '[role=presentation]' ) as HTMLDivElement | null; - assertExists(mainContainer, 'main container should exist'); if (modal) { assertEquals(modal.constructor, HTMLDivElement, 'modal should be div'); } return basicToast(message, { - portal: modal || mainContainer || document.body, + portal: modal || document.body, ...options, }); }; diff --git a/packages/frontend/hooks/src/use-is-tiny-screen.ts b/packages/frontend/hooks/src/use-is-tiny-screen.ts index 506416a983..e87971da79 100644 --- a/packages/frontend/hooks/src/use-is-tiny-screen.ts +++ b/packages/frontend/hooks/src/use-is-tiny-screen.ts @@ -4,24 +4,22 @@ import debounce from 'lodash.debounce'; import { type RefObject, useEffect, useState } from 'react'; export function useIsTinyScreen({ - mainContainer, + container, leftStatic, leftSlot, centerDom, - rightStatic, rightSlot, }: { - mainContainer: HTMLElement | null; + container: HTMLElement | null; leftStatic: RefObject; leftSlot: RefObject[]; centerDom: RefObject; - rightStatic: RefObject; rightSlot: RefObject[]; }) { const [isTinyScreen, setIsTinyScreen] = useState(false); useEffect(() => { - if (!mainContainer) { + if (!container) { return; } const handleResize = debounce(() => { @@ -33,8 +31,6 @@ export function useIsTinyScreen({ return accWidth + (dom.current?.clientWidth || 0); }, 0); - const rightStaticWidth = rightStatic.current?.clientWidth || 0; - const rightSlotWidth = rightSlot.reduce((accWidth, dom) => { return accWidth + (dom.current?.clientWidth || 0); }, 0); @@ -46,14 +42,13 @@ export function useIsTinyScreen({ return; } - const containerRect = mainContainer.getBoundingClientRect(); + const containerRect = container.getBoundingClientRect(); const centerRect = centerDom.current.getBoundingClientRect(); if ( leftStaticWidth + leftSlotWidth + containerRect.left >= centerRect.left || - containerRect.right - centerRect.right <= - rightSlotWidth + rightStaticWidth + containerRect.right - centerRect.right <= rightSlotWidth ) { setIsTinyScreen(true); } else { @@ -67,20 +62,12 @@ export function useIsTinyScreen({ handleResize(); }); - resizeObserver.observe(mainContainer); + resizeObserver.observe(container); return () => { - resizeObserver.unobserve(mainContainer); + resizeObserver.unobserve(container); }; - }, [ - centerDom, - isTinyScreen, - leftSlot, - leftStatic, - mainContainer, - rightSlot, - rightStatic, - ]); + }, [centerDom, isTinyScreen, leftSlot, leftStatic, container, rightSlot]); return isTinyScreen; } diff --git a/packages/frontend/i18n/src/resources/en.json b/packages/frontend/i18n/src/resources/en.json index 70ede531fa..32aa077c25 100644 --- a/packages/frontend/i18n/src/resources/en.json +++ b/packages/frontend/i18n/src/resources/en.json @@ -510,6 +510,7 @@ "com.affine.cmdk.affine.editor.edgeless.presentation-start": "Start Presentation", "com.affine.cmdk.affine.editor.remove-from-favourites": "Remove from Favourites", "com.affine.cmdk.affine.editor.restore-from-trash": "Restore from Trash", + "com.affine.cmdk.affine.editor.trash-footer-hint": "This page has been moved to the trash, you can either restore or permanently delete it.", "com.affine.cmdk.affine.font-style.to": "Change Font Style to", "com.affine.cmdk.affine.full-width-layout.to": "Change Full Width Layout to", "com.affine.cmdk.affine.getting-started": "Getting Started", diff --git a/tests/affine-desktop/e2e/basic.spec.ts b/tests/affine-desktop/e2e/basic.spec.ts index 5ff31caf87..1089934aca 100644 --- a/tests/affine-desktop/e2e/basic.spec.ts +++ b/tests/affine-desktop/e2e/basic.spec.ts @@ -160,9 +160,9 @@ test('affine onboarding button', async ({ page }) => { test('windows only check', async ({ page }) => { const windowOnlyUI = page.locator('[data-platform-target=win32]'); if (process.platform === 'win32') { - await expect(windowOnlyUI).toBeVisible(); + await expect(windowOnlyUI.first()).toBeVisible(); } else { - await expect(windowOnlyUI).not.toBeVisible(); + await expect(windowOnlyUI.first()).not.toBeVisible(); } }); From 780ffd94dc4ec4482993e157a74e1715163311a9 Mon Sep 17 00:00:00 2001 From: Rakhee Singh Date: Fri, 8 Dec 2023 08:38:15 +0530 Subject: [PATCH 50/68] feat(core): added new filter for last n days (#5167) Co-authored-by: rakhee28 Co-authored-by: EYHN --- .../filter/filter-tag-translation.tsx | 2 + .../page-list/filter/literal-matcher.tsx | 37 ++++++++++++++++++- .../page-list/filter/logical/custom-type.ts | 4 ++ .../src/components/page-list/filter/vars.tsx | 20 +++++++++- packages/frontend/i18n/src/resources/en.json | 1 + .../frontend/i18n/src/resources/zh-Hans.json | 1 + 6 files changed, 62 insertions(+), 3 deletions(-) diff --git a/packages/frontend/component/src/components/page-list/filter/filter-tag-translation.tsx b/packages/frontend/component/src/components/page-list/filter/filter-tag-translation.tsx index 587ca00d75..1c3d8c27b6 100644 --- a/packages/frontend/component/src/components/page-list/filter/filter-tag-translation.tsx +++ b/packages/frontend/component/src/components/page-list/filter/filter-tag-translation.tsx @@ -19,6 +19,8 @@ const useFilterTag = ({ name }: FilterTagProps) => { return t['com.affine.filter.after'](); case 'before': return t['com.affine.filter.before'](); + case 'last': + return t['com.affine.filter.last'](); case 'is': return t['com.affine.filter.is'](); case 'is not empty': diff --git a/packages/frontend/component/src/components/page-list/filter/literal-matcher.tsx b/packages/frontend/component/src/components/page-list/filter/literal-matcher.tsx index 132fed81d5..6a4a77e1dc 100644 --- a/packages/frontend/component/src/components/page-list/filter/literal-matcher.tsx +++ b/packages/frontend/component/src/components/page-list/filter/literal-matcher.tsx @@ -1,11 +1,13 @@ import type { LiteralValue, Tag } from '@affine/env/filter'; import dayjs from 'dayjs'; -import type { ReactNode } from 'react'; +import { type ReactNode } from 'react'; +import Input from '../../../ui/input'; +import { Menu, MenuItem } from '../../../ui/menu'; import { AFFiNEDatePicker } from '../../date-picker'; import { FilterTag } from './filter-tag-translation'; import { inputStyle } from './index.css'; -import { tBoolean, tDate, tTag } from './logical/custom-type'; +import { tBoolean, tDate, tDateRange, tTag } from './logical/custom-type'; import { Matcher } from './logical/matcher'; import type { TType } from './logical/typesystem'; import { tArray, typesystem } from './logical/typesystem'; @@ -21,6 +23,37 @@ export const literalMatcher = new Matcher<{ return typesystem.isSubtype(type, target); }); +literalMatcher.register(tDateRange.create(), { + render: ({ value, onChange }) => ( + + (i ? onChange(parseInt(i)) : onChange(0))} + /> + {[1, 2, 3, 7, 14, 30].map(i => ( + { + // Handle the menu item click and update the value accordingly + onChange(i); + }} + > + {i} {i > 1 ? 'days' : 'day'} + + ))} +
    + } + > +
    + {value.toString()} {(value as number) > 1 ? 'days' : 'day'} +
    + + ), +}); + literalMatcher.register(tBoolean.create(), { render: ({ value, onChange }) => (
    ({ name: 'Tag', supers: [], }); + +export const tDateRange = typesystem.defineData( + DataHelper.create<{ value: number }>('DateRange') +); diff --git a/packages/frontend/component/src/components/page-list/filter/vars.tsx b/packages/frontend/component/src/components/page-list/filter/vars.tsx index 8bb53ab57d..a1b36cf8b0 100644 --- a/packages/frontend/component/src/components/page-list/filter/vars.tsx +++ b/packages/frontend/component/src/components/page-list/filter/vars.tsx @@ -11,7 +11,7 @@ import type { ReactNode } from 'react'; import { MenuIcon, MenuItem, MenuSeparator } from '../../../ui/menu'; import { FilterTag } from './filter-tag-translation'; import * as styles from './index.css'; -import { tBoolean, tDate, tTag } from './logical/custom-type'; +import { tBoolean, tDate, tDateRange, tTag } from './logical/custom-type'; import { Matcher } from './logical/matcher'; import type { TFunction } from './logical/typesystem'; import { @@ -161,6 +161,24 @@ filterMatcher.register( } ); +filterMatcher.register( + tFunction({ + args: [tDate.create(), tDateRange.create()], + rt: tBoolean.create(), + }), + { + name: 'last', + defaultArgs: () => [30], // Default to the last 30 days + impl: (date, n) => { + if (typeof date !== 'number' || typeof n !== 'number') { + throw new Error('Argument type error: date and n must be numbers'); + } + const startDate = dayjs().subtract(n, 'day').startOf('day').valueOf(); + return date > startDate; + }, + } +); + filterMatcher.register( tFunction({ args: [tDate.create(), tDate.create()], diff --git a/packages/frontend/i18n/src/resources/en.json b/packages/frontend/i18n/src/resources/en.json index 32aa077c25..4aa27db82a 100644 --- a/packages/frontend/i18n/src/resources/en.json +++ b/packages/frontend/i18n/src/resources/en.json @@ -608,6 +608,7 @@ "com.affine.filter": "Filter", "com.affine.filter.after": "after", "com.affine.filter.before": "before", + "com.affine.filter.last": "last", "com.affine.filter.contains all": "contains all", "com.affine.filter.contains one of": "contains one of", "com.affine.filter.does not contains all": "does not contains all", diff --git a/packages/frontend/i18n/src/resources/zh-Hans.json b/packages/frontend/i18n/src/resources/zh-Hans.json index 47833ee09c..54a6b9c7a7 100644 --- a/packages/frontend/i18n/src/resources/zh-Hans.json +++ b/packages/frontend/i18n/src/resources/zh-Hans.json @@ -593,6 +593,7 @@ "com.affine.filter": "筛选", "com.affine.filter.after": "晚于", "com.affine.filter.before": "早于", + "com.affine.filter.last": "最近", "com.affine.filter.contains all": "包含以下所有", "com.affine.filter.contains one of": "包含以下之一", "com.affine.filter.does not contains all": "不包含以下所有", From 453d4db71310ea71f469e7c935d15cf1e7b05faa Mon Sep 17 00:00:00 2001 From: Umar Faiz <83939820+umar23faiz@users.noreply.github.com> Date: Fri, 8 Dec 2023 08:38:59 +0530 Subject: [PATCH 51/68] fix: close font calt to avoid render twinkle (#4969) --- packages/frontend/component/src/theme/global.css | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/frontend/component/src/theme/global.css b/packages/frontend/component/src/theme/global.css index 3e9119f8aa..015a003d28 100644 --- a/packages/frontend/component/src/theme/global.css +++ b/packages/frontend/component/src/theme/global.css @@ -174,6 +174,7 @@ legend { border: 0; font-size: var(--affine-font-base); font-family: var(--affine-font-family); + font-feature-settings: 'calt' 0; } body { From fcd43033feabf7f599a3632dd4ca67239bf6240d Mon Sep 17 00:00:00 2001 From: Peng Xiao Date: Fri, 8 Dec 2023 03:20:02 +0000 Subject: [PATCH 52/68] fix(electron): sync settings from localStorage -> atom -> electron (#5020) - moved `appSettingAtom` to infra since we now have different packages that depends on it. There is no better place to fit in for now - use atomEffect to sync setting changes to updater related configs to Electron side - refactored how Electron reacts to updater config changes. --- packages/common/env/package.json | 3 +- packages/common/env/tsconfig.json | 3 - packages/common/infra/package.json | 1 + packages/common/infra/src/atom/index.ts | 8 + .../infra/src/{atom.ts => atom/layout.ts} | 31 +- packages/common/infra/src/atom/root-store.ts | 15 + .../infra/src/atom}/settings.ts | 34 +- packages/common/infra/src/atom/workspace.ts | 14 + packages/common/infra/src/type.ts | 2 +- packages/common/infra/tsconfig.json | 3 + packages/common/infra/vite.config.ts | 2 +- .../app-updater-button/index.css.ts | 3 +- .../app-sidebar/app-updater-button/index.tsx | 341 +++++++++++------- packages/frontend/core/package.json | 1 + .../core/src/commands/affine-settings.tsx | 2 +- .../about/update-check-section.tsx | 47 ++- .../appearance/date-format-setting.tsx | 5 +- .../general-setting/appearance/index.tsx | 8 +- .../src/components/page-detail-editor.tsx | 2 +- .../src/components/root-app-sidebar/index.tsx | 29 -- .../hooks/affine/use-app-setting-helper.ts | 3 +- .../workspace/detail-page/detail-page.tsx | 2 +- .../src/main/application-menu/create.ts | 2 +- .../src/main/updater/electron-updater.ts | 62 ++-- .../electron/src/main/updater/index.ts | 4 +- packages/frontend/hooks/package.json | 2 + .../frontend/hooks/src/use-app-updater.ts | 146 ++++---- packages/frontend/hooks/tsconfig.json | 3 +- packages/frontend/i18n/src/resources/en.json | 1 + yarn.lock | 5 +- 30 files changed, 441 insertions(+), 343 deletions(-) create mode 100644 packages/common/infra/src/atom/index.ts rename packages/common/infra/src/{atom.ts => atom/layout.ts} (50%) create mode 100644 packages/common/infra/src/atom/root-store.ts rename packages/{frontend/core/src/atoms => common/infra/src/atom}/settings.ts (68%) create mode 100644 packages/common/infra/src/atom/workspace.ts diff --git a/packages/common/env/package.json b/packages/common/env/package.json index 439d80bf89..8c44d85e05 100644 --- a/packages/common/env/package.json +++ b/packages/common/env/package.json @@ -21,8 +21,7 @@ }, "peerDependencies": { "@affine/templates": "workspace:*", - "@blocksuite/global": "0.0.0-20230409084303-221991d4-nightly", - "@toeverything/infra": "workspace:*" + "@blocksuite/global": "0.0.0-20230409084303-221991d4-nightly" }, "dependencies": { "lit": "^3.0.2" diff --git a/packages/common/env/tsconfig.json b/packages/common/env/tsconfig.json index d3368cce03..60bef5cacc 100644 --- a/packages/common/env/tsconfig.json +++ b/packages/common/env/tsconfig.json @@ -7,9 +7,6 @@ "outDir": "lib" }, "references": [ - { - "path": "../infra" - }, { "path": "../../../tests/fixtures" } diff --git a/packages/common/infra/package.json b/packages/common/infra/package.json index e783cc5504..7da35fcbf9 100644 --- a/packages/common/infra/package.json +++ b/packages/common/infra/package.json @@ -54,6 +54,7 @@ "dev": "vite build --watch" }, "dependencies": { + "@affine/env": "workspace:*", "@affine/sdk": "workspace:*", "@blocksuite/blocks": "0.11.0-nightly-202312070955-2b5bb47", "@blocksuite/global": "0.11.0-nightly-202312070955-2b5bb47", diff --git a/packages/common/infra/src/atom/index.ts b/packages/common/infra/src/atom/index.ts new file mode 100644 index 0000000000..8b5f2a3104 --- /dev/null +++ b/packages/common/infra/src/atom/index.ts @@ -0,0 +1,8 @@ +import { atom } from 'jotai'; + +export const loadedPluginNameAtom = atom([]); + +export * from './layout'; +export * from './root-store'; +export * from './settings'; +export * from './workspace'; diff --git a/packages/common/infra/src/atom.ts b/packages/common/infra/src/atom/layout.ts similarity index 50% rename from packages/common/infra/src/atom.ts rename to packages/common/infra/src/atom/layout.ts index 4957094507..ed6ec20fe7 100644 --- a/packages/common/infra/src/atom.ts +++ b/packages/common/infra/src/atom/layout.ts @@ -1,34 +1,5 @@ import type { ExpectedLayout } from '@affine/sdk/entry'; -import { assertExists } from '@blocksuite/global/utils'; -import type { Workspace } from '@blocksuite/store'; -import { atom, createStore } from 'jotai/vanilla'; - -import { getBlockSuiteWorkspaceAtom } from './__internal__/workspace'; - -// global store -let rootStore = createStore(); - -export function getCurrentStore() { - return rootStore; -} - -/** - * @internal do not use this function unless you know what you are doing - */ -export function _setCurrentStore(store: ReturnType) { - rootStore = store; -} - -export const loadedPluginNameAtom = atom([]); - -export const currentWorkspaceIdAtom = atom(null); -export const currentPageIdAtom = atom(null); -export const currentWorkspaceAtom = atom>(async get => { - const workspaceId = get(currentWorkspaceIdAtom); - assertExists(workspaceId); - const [currentWorkspaceAtom] = getBlockSuiteWorkspaceAtom(workspaceId); - return get(currentWorkspaceAtom); -}); +import { atom } from 'jotai'; const contentLayoutBaseAtom = atom('editor'); diff --git a/packages/common/infra/src/atom/root-store.ts b/packages/common/infra/src/atom/root-store.ts new file mode 100644 index 0000000000..7bbb1ae73e --- /dev/null +++ b/packages/common/infra/src/atom/root-store.ts @@ -0,0 +1,15 @@ +import { createStore } from 'jotai'; + +// global store +let rootStore = createStore(); + +export function getCurrentStore() { + return rootStore; +} + +/** + * @internal do not use this function unless you know what you are doing + */ +export function _setCurrentStore(store: ReturnType) { + rootStore = store; +} diff --git a/packages/frontend/core/src/atoms/settings.ts b/packages/common/infra/src/atom/settings.ts similarity index 68% rename from packages/frontend/core/src/atoms/settings.ts rename to packages/common/infra/src/atom/settings.ts index 835dd16ce1..229335ce48 100644 --- a/packages/frontend/core/src/atoms/settings.ts +++ b/packages/common/infra/src/atom/settings.ts @@ -1,5 +1,9 @@ +import { setupGlobal } from '@affine/env/global'; import { atom } from 'jotai'; import { atomWithStorage } from 'jotai/utils'; +import { atomEffect } from 'jotai-effect'; + +setupGlobal(); export type DateFormats = | 'MM/dd/YYYY' @@ -63,15 +67,35 @@ const appSettingBaseAtom = atomWithStorage('affine-settings', { type SetStateAction = Value | ((prev: Value) => Value); +const appSettingEffect = atomEffect(get => { + const settings = get(appSettingBaseAtom); + // some values in settings should be synced into electron side + if (environment.isDesktop) { + console.log('set config', settings); + window.apis?.updater + .setConfig({ + autoCheckUpdate: settings.autoCheckUpdate, + autoDownloadUpdate: settings.autoDownloadUpdate, + }) + .catch(err => { + console.error(err); + }); + } +}); + export const appSettingAtom = atom< AppSetting, [SetStateAction>], void >( - get => get(appSettingBaseAtom), - (get, set, apply) => { - const prev = get(appSettingBaseAtom); - const next = typeof apply === 'function' ? apply(prev) : apply; - set(appSettingBaseAtom, { ...prev, ...next }); + get => { + get(appSettingEffect); + return get(appSettingBaseAtom); + }, + (_get, set, apply) => { + set(appSettingBaseAtom, prev => { + const next = typeof apply === 'function' ? apply(prev) : apply; + return { ...prev, ...next }; + }); } ); diff --git a/packages/common/infra/src/atom/workspace.ts b/packages/common/infra/src/atom/workspace.ts new file mode 100644 index 0000000000..c73ab5a5e7 --- /dev/null +++ b/packages/common/infra/src/atom/workspace.ts @@ -0,0 +1,14 @@ +import { assertExists } from '@blocksuite/global/utils'; +import type { Workspace } from '@blocksuite/store'; +import { atom } from 'jotai'; + +import { getBlockSuiteWorkspaceAtom } from '../__internal__/workspace'; + +export const currentWorkspaceIdAtom = atom(null); +export const currentPageIdAtom = atom(null); +export const currentWorkspaceAtom = atom>(async get => { + const workspaceId = get(currentWorkspaceIdAtom); + assertExists(workspaceId); + const [currentWorkspaceAtom] = getBlockSuiteWorkspaceAtom(workspaceId); + return get(currentWorkspaceAtom); +}); diff --git a/packages/common/infra/src/type.ts b/packages/common/infra/src/type.ts index 4467e27734..732c8d1d4d 100644 --- a/packages/common/infra/src/type.ts +++ b/packages/common/infra/src/type.ts @@ -201,7 +201,7 @@ export type UpdaterHandlers = { downloadUpdate: () => Promise; getConfig: () => Promise; setConfig: (newConfig: Partial) => Promise; - checkForUpdatesAndNotify: () => Promise<{ version: string } | null>; + checkForUpdates: () => Promise<{ version: string } | null>; }; export type WorkspaceHandlers = { diff --git a/packages/common/infra/tsconfig.json b/packages/common/infra/tsconfig.json index dadee14e7d..0941f63e4d 100644 --- a/packages/common/infra/tsconfig.json +++ b/packages/common/infra/tsconfig.json @@ -11,6 +11,9 @@ { "path": "../sdk" }, + { + "path": "../env" + }, { "path": "./tsconfig.node.json" } diff --git a/packages/common/infra/vite.config.ts b/packages/common/infra/vite.config.ts index ca5dc954e7..efd6f41b66 100644 --- a/packages/common/infra/vite.config.ts +++ b/packages/common/infra/vite.config.ts @@ -13,7 +13,7 @@ export default defineConfig({ entry: { blocksuite: resolve(root, 'src/blocksuite/index.ts'), index: resolve(root, 'src/index.ts'), - atom: resolve(root, 'src/atom.ts'), + atom: resolve(root, 'src/atom/index.ts'), command: resolve(root, 'src/command/index.ts'), type: resolve(root, 'src/type.ts'), 'core/event-emitter': resolve(root, 'src/core/event-emitter.ts'), diff --git a/packages/frontend/component/src/components/app-sidebar/app-updater-button/index.css.ts b/packages/frontend/component/src/components/app-sidebar/app-updater-button/index.css.ts index a2d56ad2ed..8e1aa32d92 100644 --- a/packages/frontend/component/src/components/app-sidebar/app-updater-button/index.css.ts +++ b/packages/frontend/component/src/components/app-sidebar/app-updater-button/index.css.ts @@ -85,12 +85,12 @@ export const installLabel = style({ flex: 1, fontSize: 'var(--affine-font-sm)', whiteSpace: 'nowrap', + justifyContent: 'space-between', }); export const installLabelNormal = style([ installLabel, { - justifyContent: 'space-between', selectors: { [`${root}:hover &, ${root}[data-updating=true] &`]: { display: 'none', @@ -103,6 +103,7 @@ export const installLabelHover = style([ installLabel, { display: 'none', + justifyContent: 'flex-start', selectors: { [`${root}:hover &, ${root}[data-updating=true] &`]: { display: 'flex', diff --git a/packages/frontend/component/src/components/app-sidebar/app-updater-button/index.tsx b/packages/frontend/component/src/components/app-sidebar/app-updater-button/index.tsx index d1c51a3b62..bf9025d78f 100644 --- a/packages/frontend/component/src/components/app-sidebar/app-updater-button/index.tsx +++ b/packages/frontend/component/src/components/app-sidebar/app-updater-button/index.tsx @@ -1,18 +1,9 @@ import { Unreachable } from '@affine/env/constant'; import { useAFFiNEI18N } from '@affine/i18n/hooks'; import { CloseIcon, NewIcon, ResetIcon } from '@blocksuite/icons'; -import { - changelogCheckedAtom, - currentChangelogUnreadAtom, - currentVersionAtom, - downloadProgressAtom, - updateAvailableAtom, - updateReadyAtom, - useAppUpdater, -} from '@toeverything/hooks/use-app-updater'; +import { useAppUpdater } from '@toeverything/hooks/use-app-updater'; import clsx from 'clsx'; -import { useAtomValue, useSetAtom } from 'jotai'; -import { startTransition, useCallback } from 'react'; +import { useCallback, useMemo } from 'react'; import { Tooltip } from '../../../ui/tooltip'; import * as styles from './index.css'; @@ -26,36 +17,178 @@ export interface AddPageButtonPureProps { version: string; allowAutoUpdate: boolean; } | null; + autoDownload: boolean; downloadProgress: number | null; appQuitting: boolean; className?: string; style?: React.CSSProperties; } +interface ButtonContentProps { + updateReady: boolean; + updateAvailable: { + version: string; + allowAutoUpdate: boolean; + } | null; + autoDownload: boolean; + downloadProgress: number | null; + appQuitting: boolean; + currentChangelogUnread: boolean; + onDismissCurrentChangelog: () => void; +} + +function DownloadUpdate({ updateAvailable }: ButtonContentProps) { + const t = useAFFiNEI18N(); + return ( +
    + + {t['com.affine.appUpdater.downloadUpdate']()} + + {updateAvailable?.version} +
    + ); +} + +function UpdateReady({ updateAvailable, appQuitting }: ButtonContentProps) { + const t = useAFFiNEI18N(); + return ( +
    +
    + + {t['com.affine.appUpdater.updateAvailable']()} + + {updateAvailable?.version} +
    + +
    + + + {t[appQuitting ? 'Loading' : 'com.affine.appUpdater.installUpdate']()} + +
    +
    + ); +} + +function DownloadingUpdate({ + updateAvailable, + downloadProgress, +}: ButtonContentProps) { + const t = useAFFiNEI18N(); + return ( +
    +
    + + {t['com.affine.appUpdater.downloading']()} + + {updateAvailable?.version} +
    + +
    +
    +
    +
    + ); +} + +function OpenDownloadPage({ updateAvailable }: ButtonContentProps) { + const t = useAFFiNEI18N(); + return ( + <> +
    + + {t['com.affine.appUpdater.updateAvailable']()} + + {updateAvailable?.version} +
    + +
    + + {t['com.affine.appUpdater.openDownloadPage']()} + +
    + + ); +} + +function WhatsNew({ onDismissCurrentChangelog }: ButtonContentProps) { + const t = useAFFiNEI18N(); + const onClickClose: React.MouseEventHandler = useCallback( + e => { + onDismissCurrentChangelog(); + e.stopPropagation(); + }, + [onDismissCurrentChangelog] + ); + return ( + <> +
    + + + {t['com.affine.appUpdater.whatsNew']()} + +
    +
    + +
    + + ); +} + +const getButtonContentRenderer = (props: ButtonContentProps) => { + if (props.updateReady) { + return UpdateReady; + } else if (props.updateAvailable?.allowAutoUpdate) { + if (props.autoDownload && props.updateAvailable.allowAutoUpdate) { + return DownloadingUpdate; + } else { + return DownloadUpdate; + } + } else if (props.updateAvailable && !props.updateAvailable?.allowAutoUpdate) { + return OpenDownloadPage; + } else if (props.currentChangelogUnread) { + return WhatsNew; + } + return null; +}; + export function AppUpdaterButtonPure({ updateReady, onClickUpdate, onDismissCurrentChangelog, currentChangelogUnread, updateAvailable, + autoDownload, downloadProgress, appQuitting, className, style, }: AddPageButtonPureProps) { - const t = useAFFiNEI18N(); + const contentProps = useMemo( + () => ({ + updateReady, + updateAvailable, + currentChangelogUnread, + autoDownload, + downloadProgress, + appQuitting, + onDismissCurrentChangelog, + }), + [ + updateReady, + updateAvailable, + currentChangelogUnread, + autoDownload, + downloadProgress, + appQuitting, + onDismissCurrentChangelog, + ] + ); - if (!updateAvailable && !currentChangelogUnread) { - return null; - } - - const updateAvailableNode = updateAvailable - ? updateAvailable.allowAutoUpdate - ? renderUpdateAvailableAllowAutoUpdate() - : renderUpdateAvailableNotAllowAutoUpdate() - : null; - const whatsNew = - !updateAvailable && currentChangelogUnread ? renderWhatsNew() : null; + const ContentComponent = getButtonContentRenderer(contentProps); const wrapWithTooltip = ( node: React.ReactElement, @@ -72,102 +205,38 @@ export function AppUpdaterButtonPure({ ); }; + const disabled = useMemo(() => { + if (appQuitting) { + return true; + } + + if (updateAvailable?.allowAutoUpdate) { + return !updateReady && autoDownload; + } + + return false; + }, [ + appQuitting, + autoDownload, + updateAvailable?.allowAutoUpdate, + updateReady, + ]); + return wrapWithTooltip( , updateAvailable?.version ); - - function renderUpdateAvailableAllowAutoUpdate() { - return ( -
    -
    - - {!updateReady - ? t['com.affine.appUpdater.downloading']() - : t['com.affine.appUpdater.updateAvailable']()} - - - {updateAvailable?.version} - -
    - - {updateReady ? ( -
    - - - {t[ - appQuitting ? 'Loading' : 'com.affine.appUpdater.installUpdate' - ]()} - -
    - ) : ( -
    -
    -
    - )} -
    - ); - } - - function renderUpdateAvailableNotAllowAutoUpdate() { - return ( - <> -
    - - {t['com.affine.appUpdater.updateAvailable']()} - - - {updateAvailable?.version} - -
    - -
    - - {t['com.affine.appUpdater.openDownloadPage']()} - -
    - - ); - } - - function renderWhatsNew() { - return ( - <> -
    - - - {t['com.affine.appUpdater.whatsNew']()} - -
    -
    { - onDismissCurrentChangelog(); - e.stopPropagation(); - }} - > - -
    - - ); - } } // Although it is called an input, it is actually a button. @@ -178,62 +247,64 @@ export function AppUpdaterButton({ className?: string; style?: React.CSSProperties; }) { - const currentChangelogUnread = useAtomValue(currentChangelogUnreadAtom); - const updateReady = useAtomValue(updateReadyAtom); - const updateAvailable = useAtomValue(updateAvailableAtom); - const downloadProgress = useAtomValue(downloadProgressAtom); - const currentVersion = useAtomValue(currentVersionAtom); - const { quitAndInstall, appQuitting } = useAppUpdater(); - const setChangelogCheckAtom = useSetAtom(changelogCheckedAtom); - - const dismissCurrentChangelog = useCallback(() => { - if (!currentVersion) { - return; - } - startTransition(() => - setChangelogCheckAtom(mapping => { - return { - ...mapping, - [currentVersion]: true, - }; - }) - ); - }, [currentVersion, setChangelogCheckAtom]); + const { + quitAndInstall, + appQuitting, + autoDownload, + downloadUpdate, + readChangelog, + changelogUnread, + updateReady, + updateAvailable, + downloadProgress, + currentVersion, + } = useAppUpdater(); const handleClickUpdate = useCallback(() => { if (updateReady) { quitAndInstall(); } else if (updateAvailable) { if (updateAvailable.allowAutoUpdate) { - // wait for download to finish + if (autoDownload) { + // wait for download to finish + } else { + downloadUpdate(); + } } else { window.open( `https://github.com/toeverything/AFFiNE/releases/tag/v${currentVersion}`, '_blank' ); } - } else if (currentChangelogUnread) { + } else if (changelogUnread) { window.open(runtimeConfig.changelogUrl, '_blank'); - dismissCurrentChangelog(); + readChangelog(); } else { throw new Unreachable(); } }, [ updateReady, - quitAndInstall, updateAvailable, - currentChangelogUnread, - dismissCurrentChangelog, + changelogUnread, + quitAndInstall, + autoDownload, + downloadUpdate, currentVersion, + readChangelog, ]); + if (!updateAvailable && !changelogUnread) { + return null; + } + return ( { const t = useAFFiNEI18N(); - const isCheckingForUpdates = useAtomValue(isCheckingForUpdatesAtom); - const updateAvailable = useAtomValue(updateAvailableAtom); - const updateReady = useAtomValue(updateReadyAtom); - const downloadProgress = useAtomValue(downloadProgressAtom); + const { updateAvailable, downloadProgress, updateReady, checkingForUpdates } = + useAppUpdater(); const buttonLabel = useMemo(() => { - if (updateAvailable && downloadProgress === null) { - return t['com.affine.aboutAFFiNE.checkUpdate.button.download'](); - } if (updateReady) { return t['com.affine.aboutAFFiNE.checkUpdate.button.restart'](); } + if (updateAvailable && downloadProgress === null) { + return t['com.affine.aboutAFFiNE.checkUpdate.button.download'](); + } if ( checkUpdateStatus === CheckUpdateStatus.LATEST || checkUpdateStatus === CheckUpdateStatus.ERROR @@ -47,16 +38,16 @@ const useUpdateStatusLabels = (checkUpdateStatus: CheckUpdateStatus) => { }, [checkUpdateStatus, downloadProgress, t, updateAvailable, updateReady]); const subtitleLabel = useMemo(() => { - if (updateAvailable && downloadProgress === null) { + if (updateReady) { + return t['com.affine.aboutAFFiNE.checkUpdate.subtitle.restart'](); + } else if (updateAvailable && downloadProgress === null) { return t['com.affine.aboutAFFiNE.checkUpdate.subtitle.update-available']({ version: updateAvailable.version, }); - } else if (isCheckingForUpdates) { + } else if (checkingForUpdates) { return t['com.affine.aboutAFFiNE.checkUpdate.subtitle.checking'](); } else if (updateAvailable && downloadProgress !== null) { return t['com.affine.aboutAFFiNE.checkUpdate.subtitle.downloading'](); - } else if (updateReady) { - return t['com.affine.aboutAFFiNE.checkUpdate.subtitle.restart'](); } else if (checkUpdateStatus === CheckUpdateStatus.ERROR) { return t['com.affine.aboutAFFiNE.checkUpdate.subtitle.error'](); } else if (checkUpdateStatus === CheckUpdateStatus.LATEST) { @@ -66,7 +57,7 @@ const useUpdateStatusLabels = (checkUpdateStatus: CheckUpdateStatus) => { }, [ checkUpdateStatus, downloadProgress, - isCheckingForUpdates, + checkingForUpdates, t, updateAvailable, updateReady, @@ -83,14 +74,14 @@ const useUpdateStatusLabels = (checkUpdateStatus: CheckUpdateStatus) => { error: checkUpdateStatus === CheckUpdateStatus.ERROR, })} > - {isCheckingForUpdates ? : null} + {checkingForUpdates ? : null} {subtitleLabel} ); }, [ checkUpdateStatus, downloadProgress, - isCheckingForUpdates, + checkingForUpdates, subtitleLabel, updateAvailable, updateReady, @@ -101,10 +92,14 @@ const useUpdateStatusLabels = (checkUpdateStatus: CheckUpdateStatus) => { export const UpdateCheckSection = () => { const t = useAFFiNEI18N(); - const { checkForUpdates, downloadUpdate, quitAndInstall } = useAppUpdater(); - const updateAvailable = useAtomValue(updateAvailableAtom); - const updateReady = useAtomValue(updateReadyAtom); - const downloadProgress = useAtomValue(downloadProgressAtom); + const { + checkForUpdates, + downloadUpdate, + quitAndInstall, + updateAvailable, + downloadProgress, + updateReady, + } = useAppUpdater(); const [checkUpdateStatus, setCheckUpdateStatus] = useState( CheckUpdateStatus.UNCHECK ); diff --git a/packages/frontend/core/src/components/affine/setting-modal/general-setting/appearance/date-format-setting.tsx b/packages/frontend/core/src/components/affine/setting-modal/general-setting/appearance/date-format-setting.tsx index fb1be173a9..06ee1aa6d4 100644 --- a/packages/frontend/core/src/components/affine/setting-modal/general-setting/appearance/date-format-setting.tsx +++ b/packages/frontend/core/src/components/affine/setting-modal/general-setting/appearance/date-format-setting.tsx @@ -1,11 +1,8 @@ import { Menu, MenuItem, MenuTrigger } from '@affine/component/ui/menu'; +import { dateFormatOptions, type DateFormats } from '@toeverything/infra/atom'; import dayjs from 'dayjs'; import { useCallback } from 'react'; -import { - dateFormatOptions, - type DateFormats, -} from '../../../../../atoms/settings'; import { useAppSettingHelper } from '../../../../../hooks/affine/use-app-setting-helper'; interface DateFormatMenuContentProps { diff --git a/packages/frontend/core/src/components/affine/setting-modal/general-setting/appearance/index.tsx b/packages/frontend/core/src/components/affine/setting-modal/general-setting/appearance/index.tsx index 076a0fad14..5988c8e15b 100644 --- a/packages/frontend/core/src/components/affine/setting-modal/general-setting/appearance/index.tsx +++ b/packages/frontend/core/src/components/affine/setting-modal/general-setting/appearance/index.tsx @@ -3,14 +3,14 @@ import { SettingHeader } from '@affine/component/setting-components'; import { SettingRow } from '@affine/component/setting-components'; import { SettingWrapper } from '@affine/component/setting-components'; import { useAFFiNEI18N } from '@affine/i18n/hooks'; -import { useTheme } from 'next-themes'; -import { useCallback } from 'react'; - import { type AppSetting, fontStyleOptions, windowFrameStyleOptions, -} from '../../../../../atoms/settings'; +} from '@toeverything/infra/atom'; +import { useTheme } from 'next-themes'; +import { useCallback } from 'react'; + import { useAppSettingHelper } from '../../../../../hooks/affine/use-app-setting-helper'; import { LanguageMenu } from '../../../language-menu'; import { DateFormatSetting } from './date-format-setting'; diff --git a/packages/frontend/core/src/components/page-detail-editor.tsx b/packages/frontend/core/src/components/page-detail-editor.tsx index 5ae209a5ea..1d0a13615a 100644 --- a/packages/frontend/core/src/components/page-detail-editor.tsx +++ b/packages/frontend/core/src/components/page-detail-editor.tsx @@ -8,6 +8,7 @@ import { useBlockSuitePageMeta } from '@toeverything/hooks/use-block-suite-page- import { useBlockSuiteWorkspacePage } from '@toeverything/hooks/use-block-suite-workspace-page'; import { pluginEditorAtom } from '@toeverything/infra/__internal__/plugin'; import { getCurrentStore } from '@toeverything/infra/atom'; +import { fontStyleOptions } from '@toeverything/infra/atom'; import clsx from 'clsx'; import { useAtomValue } from 'jotai'; import type { CSSProperties } from 'react'; @@ -15,7 +16,6 @@ import { memo, Suspense, useCallback, useMemo, useState } from 'react'; import { useLocation } from 'react-router-dom'; import { type PageMode, pageSettingFamily } from '../atoms'; -import { fontStyleOptions } from '../atoms/settings'; import { useAppSettingHelper } from '../hooks/affine/use-app-setting-helper'; import { useBlockSuiteMetaHelper } from '../hooks/affine/use-block-suite-meta-helper'; import { BlockSuiteEditor as Editor } from './blocksuite/block-suite-editor'; diff --git a/packages/frontend/core/src/components/root-app-sidebar/index.tsx b/packages/frontend/core/src/components/root-app-sidebar/index.tsx index 9696b991be..5956f64a1f 100644 --- a/packages/frontend/core/src/components/root-app-sidebar/index.tsx +++ b/packages/frontend/core/src/components/root-app-sidebar/index.tsx @@ -20,11 +20,6 @@ import { FolderIcon, SettingsIcon } from '@blocksuite/icons'; import type { Page } from '@blocksuite/store'; import { useDroppable } from '@dnd-kit/core'; import { useAsyncCallback } from '@toeverything/hooks/affine-async-hooks'; -import { - isAutoCheckUpdateAtom, - isAutoDownloadUpdateAtom, - useAppUpdater, -} from '@toeverything/hooks/use-app-updater'; import { useAtom, useAtomValue } from 'jotai'; import type { HTMLAttributes, ReactElement } from 'react'; import { forwardRef, useCallback, useEffect, useMemo } from 'react'; @@ -107,10 +102,6 @@ export const RootAppSidebar = ({ }: RootAppSidebarProps): ReactElement => { const currentWorkspaceId = currentWorkspace.id; const { appSettings } = useAppSettingHelper(); - const { toggleAutoCheck, toggleAutoDownload } = useAppUpdater(); - const { autoCheckUpdate, autoDownloadUpdate } = appSettings; - const isAutoDownload = useAtomValue(isAutoDownloadUpdateAtom); - const isAutoCheck = useAtomValue(isAutoCheckUpdateAtom); const blockSuiteWorkspace = currentWorkspace.blockSuiteWorkspace; const t = useAFFiNEI18N(); const [openUserWorkspaceList, setOpenUserWorkspaceList] = useAtom( @@ -159,26 +150,6 @@ export const RootAppSidebar = ({ } }, [sidebarOpen]); - useEffect(() => { - if (!environment.isDesktop) { - return; - } - - if (isAutoCheck !== autoCheckUpdate) { - toggleAutoCheck(autoCheckUpdate); - } - if (isAutoDownload !== autoDownloadUpdate) { - toggleAutoDownload(autoDownloadUpdate); - } - }, [ - autoCheckUpdate, - autoDownloadUpdate, - isAutoCheck, - isAutoDownload, - toggleAutoCheck, - toggleAutoDownload, - ]); - const [history, setHistory] = useHistoryAtom(); const router = useMemo(() => { return { diff --git a/packages/frontend/core/src/hooks/affine/use-app-setting-helper.ts b/packages/frontend/core/src/hooks/affine/use-app-setting-helper.ts index f918f8be83..1be32c0b8f 100644 --- a/packages/frontend/core/src/hooks/affine/use-app-setting-helper.ts +++ b/packages/frontend/core/src/hooks/affine/use-app-setting-helper.ts @@ -1,8 +1,7 @@ +import { type AppSetting, appSettingAtom } from '@toeverything/infra/atom'; import { useAtom } from 'jotai'; import { useCallback, useMemo } from 'react'; -import { type AppSetting, appSettingAtom } from '../../atoms/settings'; - export function useAppSettingHelper() { const [appSettings, setAppSettings] = useAtom(appSettingAtom); diff --git a/packages/frontend/core/src/pages/workspace/detail-page/detail-page.tsx b/packages/frontend/core/src/pages/workspace/detail-page/detail-page.tsx index a4aa1c82dd..62fd0b0838 100644 --- a/packages/frontend/core/src/pages/workspace/detail-page/detail-page.tsx +++ b/packages/frontend/core/src/pages/workspace/detail-page/detail-page.tsx @@ -11,6 +11,7 @@ import type { EditorContainer } from '@blocksuite/presets'; import type { Page, Workspace } from '@blocksuite/store'; import { useBlockSuitePageMeta } from '@toeverything/hooks/use-block-suite-page-meta'; import { + appSettingAtom, currentPageIdAtom, currentWorkspaceIdAtom, } from '@toeverything/infra/atom'; @@ -36,7 +37,6 @@ import type { Map as YMap } from 'yjs'; import { setPageModeAtom } from '../../../atoms'; import { collectionsCRUDAtom } from '../../../atoms/collections'; import { currentModeAtom } from '../../../atoms/mode'; -import { appSettingAtom } from '../../../atoms/settings'; import { AffineErrorBoundary } from '../../../components/affine/affine-error-boundary'; import { HubIsland } from '../../../components/affine/hub-island'; import { GlobalPageHistoryModal } from '../../../components/affine/page-history-modal'; diff --git a/packages/frontend/electron/src/main/application-menu/create.ts b/packages/frontend/electron/src/main/application-menu/create.ts index c57ee266f9..dd16bc3b6c 100644 --- a/packages/frontend/electron/src/main/application-menu/create.ts +++ b/packages/frontend/electron/src/main/application-menu/create.ts @@ -125,7 +125,7 @@ export function createApplicationMenu() { { label: 'Check for Updates', click: async () => { - await checkForUpdates(true); + await checkForUpdates(); }, }, ], diff --git a/packages/frontend/electron/src/main/updater/electron-updater.ts b/packages/frontend/electron/src/main/updater/electron-updater.ts index 7594664107..0cbba4d980 100644 --- a/packages/frontend/electron/src/main/updater/electron-updater.ts +++ b/packages/frontend/electron/src/main/updater/electron-updater.ts @@ -17,9 +17,9 @@ export const quitAndInstall = async () => { autoUpdater.quitAndInstall(); }; -let lastCheckTime = 0; - let downloading = false; +let configured = false; +let checkingUpdate = false; export type UpdaterConfig = { autoCheckUpdate: boolean; @@ -36,29 +36,39 @@ export const getConfig = (): UpdaterConfig => { }; export const setConfig = (newConfig: Partial = {}): void => { + configured = true; + Object.assign(config, newConfig); + + logger.info('Updater configured!', config); + + // if config.autoCheckUpdate is true, trigger a check + if (config.autoCheckUpdate) { + checkForUpdates().catch(err => { + logger.error('Error checking for updates', err); + }); + } }; -export const checkForUpdates = async (force = false) => { - if (disabled) { +export const checkForUpdates = async () => { + if (disabled || checkingUpdate) { return; } - - if ( - force || - (config.autoCheckUpdate && lastCheckTime + 1000 * 1800 < Date.now()) - ) { - lastCheckTime = Date.now(); - return await autoUpdater.checkForUpdates(); + checkingUpdate = true; + try { + const info = await autoUpdater.checkForUpdates(); + return info; + } finally { + checkingUpdate = false; } - return; }; export const downloadUpdate = async () => { - if (disabled) { + if (disabled || downloading) { return; } downloading = true; + updaterSubjects.downloadProgress.next(0); autoUpdater.downloadUpdate().catch(e => { downloading = false; logger.error('Failed to download update', e); @@ -96,19 +106,16 @@ export const registerUpdater = async () => { autoUpdater.setFeedURL(feedUrl); - // register events for checkForUpdatesAndNotify + // register events for checkForUpdates autoUpdater.on('checking-for-update', () => { logger.info('Checking for update'); }); autoUpdater.on('update-available', info => { logger.info('Update available', info); - if (config.autoDownloadUpdate && allowAutoUpdate && !downloading) { - downloading = true; - autoUpdater?.downloadUpdate().catch(e => { - downloading = false; - logger.error('Failed to download update', e); + if (config.autoDownloadUpdate && allowAutoUpdate) { + downloadUpdate().catch(err => { + console.error(err); }); - logger.info('Update available, downloading...', info); } updaterSubjects.updateAvailable.next({ version: info.version, @@ -137,9 +144,20 @@ export const registerUpdater = async () => { }); autoUpdater.forceDevUpdateConfig = isDev; + // check update whenever the window is activated + let lastCheckTime = 0; app.on('activate', () => { - checkForUpdates(false).catch(err => { - console.error(err); + (async () => { + if ( + configured && + config.autoCheckUpdate && + lastCheckTime + 1000 * 1800 < Date.now() + ) { + lastCheckTime = Date.now(); + await checkForUpdates(); + } + })().catch(err => { + logger.error('Error checking for updates', err); }); }); }; diff --git a/packages/frontend/electron/src/main/updater/index.ts b/packages/frontend/electron/src/main/updater/index.ts index 19d24aaaf3..0265db1e71 100644 --- a/packages/frontend/electron/src/main/updater/index.ts +++ b/packages/frontend/electron/src/main/updater/index.ts @@ -29,8 +29,8 @@ export const updaterHandlers = { ): Promise => { return setConfig(newConfig); }, - checkForUpdatesAndNotify: async () => { - const res = await checkForUpdates(true); + checkForUpdates: async () => { + const res = await checkForUpdates(); if (res) { const { updateInfo } = res; return { diff --git a/packages/frontend/hooks/package.json b/packages/frontend/hooks/package.json index 1a8d4f128d..de23d82f87 100644 --- a/packages/frontend/hooks/package.json +++ b/packages/frontend/hooks/package.json @@ -9,6 +9,7 @@ "foxact": "^0.2.20", "image-blob-reduce": "^4.1.0", "jotai": "^2.5.1", + "jotai-effect": "^0.2.3", "lodash.debounce": "^4.0.8", "p-queue": "^7.4.1", "react": "18.2.0", @@ -26,6 +27,7 @@ "@blocksuite/presets": "0.11.0-nightly-202312070955-2b5bb47", "@blocksuite/store": "0.11.0-nightly-202312070955-2b5bb47", "@testing-library/react": "^14.0.0", + "@toeverything/infra": "workspace:*", "@types/image-blob-reduce": "^4.1.3", "@types/lodash.debounce": "^4.0.7", "fake-indexeddb": "^5.0.0", diff --git a/packages/frontend/hooks/src/use-app-updater.ts b/packages/frontend/hooks/src/use-app-updater.ts index adf0c8e7f0..d4e28c1dc6 100644 --- a/packages/frontend/hooks/src/use-app-updater.ts +++ b/packages/frontend/hooks/src/use-app-updater.ts @@ -1,10 +1,13 @@ import { isBrowser } from '@affine/env/constant'; +import { appSettingAtom } from '@toeverything/infra/atom'; import type { UpdateMeta } from '@toeverything/infra/type'; -import { atom, useAtomValue, useSetAtom } from 'jotai'; +import { atom, useAtom, useAtomValue } from 'jotai'; import { atomWithObservable, atomWithStorage } from 'jotai/utils'; import { useCallback, useState } from 'react'; import { Observable } from 'rxjs'; +import { useAsyncCallback } from './affine-async-hooks'; + function rpcToObservable< T, H extends () => Promise, @@ -41,25 +44,21 @@ function rpcToObservable< }); } +// download complete, ready to install export const updateReadyAtom = atomWithObservable(() => { return rpcToObservable(null as UpdateMeta | null, { event: window.events?.updater.onUpdateReady, }); }); -export const updateAvailableStateAtom = atom(null); - -export const updateAvailableAtom = atomWithObservable(get => { - return rpcToObservable(get(updateAvailableStateAtom), { +// update available, but not downloaded yet +export const updateAvailableAtom = atomWithObservable(() => { + return rpcToObservable(null as UpdateMeta | null, { event: window.events?.updater.onUpdateAvailable, - onSubscribe: () => { - window.apis?.updater.checkForUpdatesAndNotify().catch(err => { - console.error(err); - }); - }, }); }); +// downloading new update export const downloadProgressAtom = atomWithObservable(() => { return rpcToObservable(null as number | null, { event: window.events?.updater.onDownloadProgress, @@ -71,6 +70,8 @@ export const changelogCheckedAtom = atomWithStorage>( {} ); +export const checkingForUpdatesAtom = atom(false); + export const currentVersionAtom = atom(async () => { if (!isBrowser) { return null; @@ -79,29 +80,43 @@ export const currentVersionAtom = atom(async () => { return currentVersion; }); -export const currentChangelogUnreadAtom = atom(async get => { - if (!isBrowser) { +const currentChangelogUnreadAtom = atom( + async get => { + if (!isBrowser) { + return false; + } + const mapping = get(changelogCheckedAtom); + const currentVersion = await get(currentVersionAtom); + if (currentVersion) { + return !mapping[currentVersion]; + } return false; + }, + async (get, set, v: boolean) => { + const currentVersion = await get(currentVersionAtom); + if (currentVersion) { + set(changelogCheckedAtom, mapping => { + return { + ...mapping, + [currentVersion]: v, + }; + }); + } } - const mapping = get(changelogCheckedAtom); - const currentVersion = await get(currentVersionAtom); - if (currentVersion) { - return !mapping[currentVersion]; - } - return false; -}); - -export const isCheckingForUpdatesAtom = atom(false); -export const isAutoDownloadUpdateAtom = atom(true); -export const isAutoCheckUpdateAtom = atom(true); +); export const useAppUpdater = () => { const [appQuitting, setAppQuitting] = useState(false); const updateReady = useAtomValue(updateReadyAtom); - const setUpdateAvailableState = useSetAtom(updateAvailableStateAtom); - const setIsCheckingForUpdates = useSetAtom(isCheckingForUpdatesAtom); - const setIsAutoCheckUpdate = useSetAtom(isAutoCheckUpdateAtom); - const setIsAutoDownloadUpdate = useSetAtom(isAutoDownloadUpdateAtom); + const [setting, setSetting] = useAtom(appSettingAtom); + const downloadProgress = useAtomValue(downloadProgressAtom); + const [changelogUnread, setChangelogUnread] = useAtom( + currentChangelogUnreadAtom + ); + + const [checkingForUpdates, setCheckingForUpdates] = useAtom( + checkingForUpdatesAtom + ); const quitAndInstall = useCallback(() => { if (updateReady) { @@ -114,73 +129,64 @@ export const useAppUpdater = () => { }, [updateReady]); const checkForUpdates = useCallback(async () => { - setIsCheckingForUpdates(true); + if (checkingForUpdates) { + return; + } + setCheckingForUpdates(true); try { - const updateInfo = await window.apis?.updater.checkForUpdatesAndNotify(); - setIsCheckingForUpdates(false); - if (updateInfo) { - const updateMeta: UpdateMeta = { - version: updateInfo.version, - allowAutoUpdate: false, - }; - setUpdateAvailableState(updateMeta); - return updateInfo.version; - } - return false; + const updateInfo = await window.apis?.updater.checkForUpdates(); + return updateInfo?.version ?? false; } catch (err) { - setIsCheckingForUpdates(false); console.error('Error checking for updates:', err); return null; + } finally { + setCheckingForUpdates(false); } - }, [setIsCheckingForUpdates, setUpdateAvailableState]); + }, [checkingForUpdates, setCheckingForUpdates]); const downloadUpdate = useCallback(() => { - window.apis?.updater - .downloadUpdate() - .then(() => {}) - .catch(err => { - console.error('Error downloading update:', err); - }); + window.apis?.updater.downloadUpdate().catch(err => { + console.error('Error downloading update:', err); + }); }, []); const toggleAutoDownload = useCallback( (enable: boolean) => { - window.apis?.updater - .setConfig({ - autoDownloadUpdate: enable, - }) - .then(() => { - setIsAutoDownloadUpdate(enable); - }) - .catch(err => { - console.error('Error setting auto download:', err); - }); + setSetting({ + autoDownloadUpdate: enable, + }); }, - [setIsAutoDownloadUpdate] + [setSetting] ); const toggleAutoCheck = useCallback( (enable: boolean) => { - window.apis?.updater - .setConfig({ - autoCheckUpdate: enable, - }) - .then(() => { - setIsAutoCheckUpdate(enable); - }) - .catch(err => { - console.error('Error setting auto check:', err); - }); + setSetting({ + autoCheckUpdate: enable, + }); }, - [setIsAutoCheckUpdate] + [setSetting] ); + const readChangelog = useAsyncCallback(async () => { + await setChangelogUnread(true); + }, [setChangelogUnread]); + return { quitAndInstall, - appQuitting, checkForUpdates, downloadUpdate, toggleAutoDownload, toggleAutoCheck, + appQuitting, + checkingForUpdates, + autoCheck: setting.autoCheckUpdate, + autoDownload: setting.autoDownloadUpdate, + changelogUnread, + readChangelog, + updateReady, + updateAvailable: useAtomValue(updateAvailableAtom), + downloadProgress, + currentVersion: useAtomValue(currentVersionAtom), }; }; diff --git a/packages/frontend/hooks/tsconfig.json b/packages/frontend/hooks/tsconfig.json index f0040e1558..9b142bb210 100644 --- a/packages/frontend/hooks/tsconfig.json +++ b/packages/frontend/hooks/tsconfig.json @@ -9,6 +9,7 @@ "references": [ { "path": "../../common/env" }, { "path": "../../common/y-indexeddb" }, - { "path": "../../common/debug" } + { "path": "../../common/debug" }, + { "path": "../../common/infra" } ] } diff --git a/packages/frontend/i18n/src/resources/en.json b/packages/frontend/i18n/src/resources/en.json index 4aa27db82a..3492354538 100644 --- a/packages/frontend/i18n/src/resources/en.json +++ b/packages/frontend/i18n/src/resources/en.json @@ -373,6 +373,7 @@ "com.affine.appUpdater.downloading": "Downloading", "com.affine.appUpdater.installUpdate": "Restart to install update", "com.affine.appUpdater.openDownloadPage": "Open download page", + "com.affine.appUpdater.downloadUpdate": "Download update", "com.affine.appUpdater.updateAvailable": "Update available", "com.affine.appUpdater.whatsNew": "Discover what's new!", "com.affine.appearanceSettings.clientBorder.description": "Customise the appearance of the client.", diff --git a/yarn.lock b/yarn.lock index 5f4dc4e6a6..444dedbeb0 100644 --- a/yarn.lock +++ b/yarn.lock @@ -402,6 +402,7 @@ __metadata: intl-segmenter-polyfill-rs: "npm:^0.1.6" jotai: "npm:^2.5.1" jotai-devtools: "npm:^0.7.0" + jotai-effect: "npm:^0.2.3" lit: "npm:^3.0.2" lodash-es: "npm:^4.17.21" lottie-web: "npm:^5.12.2" @@ -524,7 +525,6 @@ __metadata: peerDependencies: "@affine/templates": "workspace:*" "@blocksuite/global": 0.0.0-20230409084303-221991d4-nightly - "@toeverything/infra": "workspace:*" languageName: unknown linkType: soft @@ -13665,12 +13665,14 @@ __metadata: "@blocksuite/presets": "npm:0.11.0-nightly-202312070955-2b5bb47" "@blocksuite/store": "npm:0.11.0-nightly-202312070955-2b5bb47" "@testing-library/react": "npm:^14.0.0" + "@toeverything/infra": "workspace:*" "@types/image-blob-reduce": "npm:^4.1.3" "@types/lodash.debounce": "npm:^4.0.7" fake-indexeddb: "npm:^5.0.0" foxact: "npm:^0.2.20" image-blob-reduce: "npm:^4.1.0" jotai: "npm:^2.5.1" + jotai-effect: "npm:^0.2.3" lodash.debounce: "npm:^4.0.8" p-queue: "npm:^7.4.1" react: "npm:18.2.0" @@ -13709,6 +13711,7 @@ __metadata: resolution: "@toeverything/infra@workspace:packages/common/infra" dependencies: "@affine-test/fixtures": "workspace:*" + "@affine/env": "workspace:*" "@affine/sdk": "workspace:*" "@affine/templates": "workspace:*" "@blocksuite/blocks": "npm:0.11.0-nightly-202312070955-2b5bb47" From f88e67f5abdfb31f56d70c8647507cfc6b4a0400 Mon Sep 17 00:00:00 2001 From: Peng Xiao Date: Fri, 8 Dec 2023 04:01:36 +0000 Subject: [PATCH 53/68] fix(core): flaky local avartar test (#5229) it seems we should not reopen workspace card list just after created a new workspace --- .../e2e/local-first-avatar.spec.ts | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/tests/affine-local/e2e/local-first-avatar.spec.ts b/tests/affine-local/e2e/local-first-avatar.spec.ts index b352686406..deb1445a84 100644 --- a/tests/affine-local/e2e/local-first-avatar.spec.ts +++ b/tests/affine-local/e2e/local-first-avatar.spec.ts @@ -16,14 +16,11 @@ test('should create a page with a local first avatar and remove it', async ({ await waitForEditorLoad(page); await clickNewPageButton(page); await page.getByTestId('workspace-name').click(); - await page.getByTestId('new-workspace').click({ delay: 50 }); - await page - .getByTestId('create-workspace-input') - .pressSequentially('Test Workspace 1', { delay: 50 }); + await page.getByTestId('new-workspace').click(); + await page.getByTestId('create-workspace-input').fill('Test Workspace 1'); await page.getByTestId('create-workspace-create-button').click(); - await page.getByTestId('workspace-name').click({ - delay: 50, - }); + await page.waitForTimeout(1000); + await page.getByTestId('workspace-name').click(); await page.getByTestId('workspace-card').nth(1).click(); await page.getByTestId('settings-modal-trigger').click(); await page.getByTestId('current-workspace-label').click(); @@ -31,14 +28,10 @@ test('should create a page with a local first avatar and remove it', async ({ .getByTestId('upload-avatar') .setInputFiles(resolve(rootDir, 'tests', 'fixtures', 'smile.png')); await page.mouse.click(0, 0); - await page.getByTestId('workspace-name').click({ - delay: 50, - }); + await page.getByTestId('workspace-name').click(); await page.getByTestId('workspace-card').nth(0).click(); await page.waitForTimeout(1000); - await page.getByTestId('workspace-name').click({ - delay: 50, - }); + await page.getByTestId('workspace-name').click(); await page.getByTestId('workspace-card').nth(1).click(); const blobUrl = await page .getByTestId('workspace-avatar') From 52cfe4521ab5a83abed285c551d468bdaa16a8b8 Mon Sep 17 00:00:00 2001 From: JimmFly <447268514@qq.com> Date: Fri, 8 Dec 2023 04:44:08 +0000 Subject: [PATCH 54/68] feat(core): add present to edgeless sharing (#5140) --- .../cloud/share-header-right-item/index.tsx | 18 ++++-- .../cloud/share-header-right-item/present.tsx | 59 +++++++++++++++++++ .../share-header-right-item/styles.css.ts | 10 ++++ .../core/src/pages/share/share-header.tsx | 6 +- packages/frontend/i18n/src/resources/en.json | 3 +- 5 files changed, 90 insertions(+), 6 deletions(-) create mode 100644 packages/frontend/core/src/components/cloud/share-header-right-item/present.tsx diff --git a/packages/frontend/core/src/components/cloud/share-header-right-item/index.tsx b/packages/frontend/core/src/components/cloud/share-header-right-item/index.tsx index 564b657917..35aa14edaa 100644 --- a/packages/frontend/core/src/components/cloud/share-header-right-item/index.tsx +++ b/packages/frontend/core/src/components/cloud/share-header-right-item/index.tsx @@ -1,18 +1,28 @@ +import type { PageMode } from '../../../atoms'; import { useCurrentLoginStatus } from '../../../hooks/affine/use-current-login-status'; import { AuthenticatedItem } from './authenticated-item'; +import { PresentButton } from './present'; +import * as styles from './styles.css'; export type ShareHeaderRightItemProps = { workspaceId: string; pageId: string; + publishMode: PageMode; }; const ShareHeaderRightItem = ({ ...props }: ShareHeaderRightItemProps) => { const loginStatus = useCurrentLoginStatus(); - if (loginStatus === 'authenticated') { - return ; - } + const { publishMode } = props; + // TODO: Add TOC - return null; + return ( +
    + {loginStatus === 'authenticated' ? ( + + ) : null} + {publishMode === 'edgeless' ? : null} +
    + ); }; export default ShareHeaderRightItem; diff --git a/packages/frontend/core/src/components/cloud/share-header-right-item/present.tsx b/packages/frontend/core/src/components/cloud/share-header-right-item/present.tsx new file mode 100644 index 0000000000..563d6a346c --- /dev/null +++ b/packages/frontend/core/src/components/cloud/share-header-right-item/present.tsx @@ -0,0 +1,59 @@ +import { Button } from '@affine/component/ui/button'; +import { useAFFiNEI18N } from '@affine/i18n/hooks'; +import type { SurfaceService } from '@blocksuite/blocks'; +import { PresentationIcon } from '@blocksuite/icons'; +import { useCallback, useEffect, useState } from 'react'; + +import * as styles from './styles.css'; + +export const PresentButton = () => { + const t = useAFFiNEI18N(); + const [isPresent, setIsPresent] = useState(false); + + const handlePresent = useCallback(() => { + // TODO: use editor Atom + const editorRoot = document.querySelector('block-suite-root'); + if (!editorRoot || isPresent) return; + + // TODO: use surfaceService subAtom + const surfaceService = editorRoot?.spec.getService( + 'affine:surface' + ) as SurfaceService; + + surfaceService?.setNavigatorMode(true); + setIsPresent(true); + }, [isPresent]); + + useEffect(() => { + if (!isPresent) return; + + // TODO: use editor Atom + const editorRoot = document.querySelector('block-suite-root'); + if (!editorRoot) return; + + // TODO: use surfaceService subAtom + const surfaceService = editorRoot?.spec.getService( + 'affine:surface' + ) as SurfaceService; + + surfaceService.slots.edgelessToolUpdated.on(() => { + setIsPresent(surfaceService?.currentTool?.type === 'frameNavigator'); + }); + + return () => { + surfaceService.slots.edgelessToolUpdated.dispose(); + }; + }, [isPresent]); + + return ( + + ); +}; diff --git a/packages/frontend/core/src/components/cloud/share-header-right-item/styles.css.ts b/packages/frontend/core/src/components/cloud/share-header-right-item/styles.css.ts index 3000c5d257..389f92c4f7 100644 --- a/packages/frontend/core/src/components/cloud/share-header-right-item/styles.css.ts +++ b/packages/frontend/core/src/components/cloud/share-header-right-item/styles.css.ts @@ -13,3 +13,13 @@ export const iconWrapper = style({ }, }, }); +export const rightItemContainer = style({ + display: 'flex', + alignItems: 'center', + gap: '8px', + padding: '0 8px', +}); + +export const presentButton = style({ + gap: '4px', +}); diff --git a/packages/frontend/core/src/pages/share/share-header.tsx b/packages/frontend/core/src/pages/share/share-header.tsx index 675902637a..bbcf38f4be 100644 --- a/packages/frontend/core/src/pages/share/share-header.tsx +++ b/packages/frontend/core/src/pages/share/share-header.tsx @@ -30,7 +30,11 @@ export function ShareHeader({ /> } right={ - + } bottomBorder /> diff --git a/packages/frontend/i18n/src/resources/en.json b/packages/frontend/i18n/src/resources/en.json index 3492354538..8d2e58c3fc 100644 --- a/packages/frontend/i18n/src/resources/en.json +++ b/packages/frontend/i18n/src/resources/en.json @@ -1004,5 +1004,6 @@ "com.affine.history.empty-prompt.title": "Empty", "com.affine.history.empty-prompt.description": "This document is such a spring chicken, it hasn't sprouted a single historical sprig yet!", "com.affine.history.confirm-restore-modal.restore": "Restore", - "com.affine.history.confirm-restore-modal.hint": "You are about to restore the current version of the page to the latest version available. This action will overwrite any changes made prior to the latest version." + "com.affine.history.confirm-restore-modal.hint": "You are about to restore the current version of the page to the latest version available. This action will overwrite any changes made prior to the latest version.", + "com.affine.share-page.header.present": "Present" } From 17d584b3363b6869d58c9aa3c2252bd248574ad4 Mon Sep 17 00:00:00 2001 From: liuyi Date: Fri, 8 Dec 2023 05:00:58 +0000 Subject: [PATCH 55/68] refactor(server): use events system (#5149) --- packages/backend/server/src/event/events.ts | 19 ++---- packages/backend/server/src/event/index.ts | 3 +- packages/backend/server/src/event/types.ts | 7 +- .../backend/server/src/modules/doc/history.ts | 65 +++++++++++++------ .../backend/server/src/modules/doc/manager.ts | 44 +++++++++++-- .../server/src/modules/workspaces/resolver.ts | 15 +---- packages/backend/server/tests/doc.spec.ts | 4 +- packages/backend/server/tests/history.spec.ts | 61 ++++++----------- 8 files changed, 122 insertions(+), 96 deletions(-) diff --git a/packages/backend/server/src/event/events.ts b/packages/backend/server/src/event/events.ts index e98bb72440..025d664663 100644 --- a/packages/backend/server/src/event/events.ts +++ b/packages/backend/server/src/event/events.ts @@ -1,23 +1,18 @@ -import type { Snapshot, User, Workspace } from '@prisma/client'; +import type { Snapshot, Workspace } from '@prisma/client'; -import { ChangePayload, Flatten, Payload } from './types'; +import { Flatten, Payload } from './types'; interface EventDefinitions { - user: { - created: Payload; - updated: Payload>; - deleted: Payload; - }; - workspace: { - created: Payload; - updated: Payload>; deleted: Payload; }; snapshot: { - created: Payload; - updated: Payload>; + updated: Payload< + Pick & { + previous: Pick; + } + >; deleted: Payload>; }; } diff --git a/packages/backend/server/src/event/index.ts b/packages/backend/server/src/event/index.ts index 06b398ad04..0c70582e59 100644 --- a/packages/backend/server/src/event/index.ts +++ b/packages/backend/server/src/event/index.ts @@ -5,7 +5,7 @@ import { OnEvent as RawOnEvent, } from '@nestjs/event-emitter'; -import { Event, EventPayload } from './events'; +import type { Event, EventPayload } from './events'; @Injectable() export class EventEmitter { @@ -42,3 +42,4 @@ export const OnEvent = ( exports: [EventEmitter], }) export class EventModule {} +export { EventPayload }; diff --git a/packages/backend/server/src/event/types.ts b/packages/backend/server/src/event/types.ts index 2a4bb5771c..65d48b293d 100644 --- a/packages/backend/server/src/event/types.ts +++ b/packages/backend/server/src/event/types.ts @@ -3,11 +3,6 @@ export type Payload = { data: T; }; -export type ChangePayload = { - from: Partial; - to: Partial; -}; - export type Join = A extends '' ? B : `${A}.${B}`; @@ -33,6 +28,6 @@ export type Leaves = T extends Payload export type Flatten = Leaves extends infer R ? { // @ts-expect-error yo, ts can't make it - [K in R]: PathType extends Payload ? { data: U } : never; + [K in R]: PathType extends Payload ? U : never; } : never; diff --git a/packages/backend/server/src/modules/doc/history.ts b/packages/backend/server/src/modules/doc/history.ts index 7502355950..fa52ecda97 100644 --- a/packages/backend/server/src/modules/doc/history.ts +++ b/packages/backend/server/src/modules/doc/history.ts @@ -1,15 +1,15 @@ import { isDeepStrictEqual } from 'node:util'; import { Injectable, Logger } from '@nestjs/common'; -import { OnEvent } from '@nestjs/event-emitter'; import { Cron, CronExpression } from '@nestjs/schedule'; -import type { Snapshot } from '@prisma/client'; import { Config } from '../../config'; +import { type EventPayload, OnEvent } from '../../event'; import { metrics } from '../../metrics'; import { PrismaService } from '../../prisma'; import { SubscriptionStatus } from '../payment/service'; import { Permission } from '../workspaces/types'; +import { isEmptyBuffer } from './manager'; @Injectable() export class DocHistoryManager { @@ -19,16 +19,38 @@ export class DocHistoryManager { private readonly db: PrismaService ) {} - @OnEvent('doc:manager:snapshot:beforeUpdate') - async onDocUpdated(snapshot: Snapshot, forceCreate = false) { - const last = await this.last(snapshot.workspaceId, snapshot.id); + @OnEvent('workspace.deleted') + onWorkspaceDeleted(workspaceId: EventPayload<'workspace.deleted'>) { + return this.db.snapshotHistory.deleteMany({ + where: { + workspaceId, + }, + }); + } + + @OnEvent('snapshot.deleted') + onSnapshotDeleted({ workspaceId, id }: EventPayload<'snapshot.deleted'>) { + return this.db.snapshotHistory.deleteMany({ + where: { + workspaceId, + id, + }, + }); + } + + @OnEvent('snapshot.updated') + async onDocUpdated( + { workspaceId, id, previous }: EventPayload<'snapshot.updated'>, + forceCreate = false + ) { + const last = await this.last(workspaceId, id); let shouldCreateHistory = false; if (!last) { // never created shouldCreateHistory = true; - } else if (last.timestamp === snapshot.updatedAt) { + } else if (last.timestamp === previous.updatedAt) { // no change shouldCreateHistory = false; } else if ( @@ -36,16 +58,23 @@ export class DocHistoryManager { forceCreate || // last history created before interval in configs last.timestamp.getTime() < - snapshot.updatedAt.getTime() - this.config.doc.history.interval + previous.updatedAt.getTime() - this.config.doc.history.interval ) { shouldCreateHistory = true; } if (shouldCreateHistory) { // skip the history recording when no actual update on snapshot happended - if (last && isDeepStrictEqual(last.state, snapshot.state)) { + if (last && isDeepStrictEqual(last.state, previous.state)) { this.logger.debug( - `State matches, skip creating history record for ${snapshot.id} in workspace ${snapshot.workspaceId}` + `State matches, skip creating history record for ${id} in workspace ${workspaceId}` + ); + return; + } + + if (isEmptyBuffer(previous.blob)) { + this.logger.debug( + `Doc is empty, skip creating history record for ${id} in workspace ${workspaceId}` ); return; } @@ -56,12 +85,12 @@ export class DocHistoryManager { timestamp: true, }, data: { - workspaceId: snapshot.workspaceId, - id: snapshot.id, - timestamp: snapshot.updatedAt, - blob: snapshot.blob, - state: snapshot.state, - expiredAt: await this.getExpiredDateFromNow(snapshot.workspaceId), + workspaceId, + id, + timestamp: previous.updatedAt, + blob: previous.blob, + state: previous.state, + expiredAt: await this.getExpiredDateFromNow(workspaceId), }, }) .catch(() => { @@ -73,9 +102,7 @@ export class DocHistoryManager { description: 'How many times the snapshot history created', }) .add(1); - this.logger.log( - `History created for ${snapshot.id} in workspace ${snapshot.workspaceId}.` - ); + this.logger.log(`History created for ${id} in workspace ${workspaceId}.`); } } @@ -180,7 +207,7 @@ export class DocHistoryManager { } // save old snapshot as one history record - await this.onDocUpdated(oldSnapshot, true); + await this.onDocUpdated({ workspaceId, id, previous: oldSnapshot }, true); // WARN: // we should never do the snapshot updating in recovering, // which is not the solution in CRDT. diff --git a/packages/backend/server/src/modules/doc/manager.ts b/packages/backend/server/src/modules/doc/manager.ts index a1fd0faf4b..57151bb760 100644 --- a/packages/backend/server/src/modules/doc/manager.ts +++ b/packages/backend/server/src/modules/doc/manager.ts @@ -5,7 +5,6 @@ import { OnModuleDestroy, OnModuleInit, } from '@nestjs/common'; -import { EventEmitter2 } from '@nestjs/event-emitter'; import { Snapshot, Update } from '@prisma/client'; import { chunk } from 'lodash-es'; import { defer, retry } from 'rxjs'; @@ -20,6 +19,7 @@ import { import { Cache } from '../../cache'; import { Config } from '../../config'; +import { EventEmitter, type EventPayload, OnEvent } from '../../event'; import { metrics } from '../../metrics/metrics'; import { PrismaService } from '../../prisma'; import { mergeUpdatesInApplyWay as jwstMergeUpdates } from '../../storage'; @@ -71,7 +71,7 @@ function isStateNewer(lhs: Buffer, rhs: Buffer): boolean { return false; } -function isEmptyBuffer(buf: Buffer): boolean { +export function isEmptyBuffer(buf: Buffer): boolean { return ( buf.length === 0 || // 0x0000 @@ -102,7 +102,7 @@ export class DocManager implements OnModuleInit, OnModuleDestroy { private readonly db: PrismaService, private readonly config: Config, private readonly cache: Cache, - private readonly event: EventEmitter2 + private readonly event: EventEmitter ) {} onModuleInit() { @@ -224,6 +224,33 @@ export class DocManager implements OnModuleInit, OnModuleDestroy { } } + @OnEvent('workspace.deleted') + async onWorkspaceDeleted(workspaceId: string) { + await this.db.snapshot.deleteMany({ + where: { + workspaceId, + }, + }); + await this.db.update.deleteMany({ + where: { + workspaceId, + }, + }); + } + + @OnEvent('snapshot.deleted') + async onSnapshotDeleted({ + id, + workspaceId, + }: EventPayload<'snapshot.deleted'>) { + await this.db.update.deleteMany({ + where: { + id, + workspaceId, + }, + }); + } + /** * add update to manager for later processing. */ @@ -538,8 +565,17 @@ export class DocManager implements OnModuleInit, OnModuleDestroy { ...updates.map(u => u.blob) ); + await this.upsert(workspaceId, id, doc, last.seq); if (snapshot) { - this.event.emit('doc:manager:snapshot:beforeUpdate', snapshot); + this.event.emit('snapshot.updated', { + id, + workspaceId, + previous: { + blob: snapshot.blob, + state: snapshot.state, + updatedAt: snapshot.updatedAt, + }, + }); } const done = await this.upsert(workspaceId, id, doc, last.seq); diff --git a/packages/backend/server/src/modules/workspaces/resolver.ts b/packages/backend/server/src/modules/workspaces/resolver.ts index e1aae88a19..bbb772d76f 100644 --- a/packages/backend/server/src/modules/workspaces/resolver.ts +++ b/packages/backend/server/src/modules/workspaces/resolver.ts @@ -33,6 +33,7 @@ import type { import GraphQLUpload from 'graphql-upload/GraphQLUpload.mjs'; import { applyUpdate, Doc } from 'yjs'; +import { EventEmitter } from '../../event'; import { PrismaService } from '../../prisma'; import { StorageProvide } from '../../storage'; import { CloudThrottlerGuard, Throttle } from '../../throttler'; @@ -146,6 +147,7 @@ export class WorkspaceResolver { private readonly prisma: PrismaService, private readonly permissions: PermissionService, private readonly users: UsersService, + private readonly event: EventEmitter, @Inject(StorageProvide) private readonly storage: Storage ) {} @@ -388,18 +390,7 @@ export class WorkspaceResolver { }, }); - await this.prisma.$transaction([ - this.prisma.update.deleteMany({ - where: { - workspaceId: id, - }, - }), - this.prisma.snapshot.deleteMany({ - where: { - workspaceId: id, - }, - }), - ]); + this.event.emit('workspace.deleted', id); return true; } diff --git a/packages/backend/server/tests/doc.spec.ts b/packages/backend/server/tests/doc.spec.ts index 2fbec0be8a..76ff2a1ca1 100644 --- a/packages/backend/server/tests/doc.spec.ts +++ b/packages/backend/server/tests/doc.spec.ts @@ -1,7 +1,6 @@ import { mock } from 'node:test'; import type { INestApplication } from '@nestjs/common'; -import { EventEmitterModule } from '@nestjs/event-emitter'; import { Test, TestingModule } from '@nestjs/testing'; import test from 'ava'; import { register } from 'prom-client'; @@ -15,6 +14,7 @@ import { import { CacheModule } from '../src/cache'; import { Config, ConfigModule } from '../src/config'; +import { EventModule } from '../src/event'; import { DocManager, DocModule } from '../src/modules/doc'; import { PrismaModule, PrismaService } from '../src/prisma'; import { flushDB } from './utils'; @@ -24,7 +24,7 @@ const createModule = () => { imports: [ PrismaModule, CacheModule, - EventEmitterModule.forRoot(), + EventModule, ConfigModule.forRoot(), DocModule.forRoot(), ], diff --git a/packages/backend/server/tests/history.spec.ts b/packages/backend/server/tests/history.spec.ts index c2ed148574..0c77b1facd 100644 --- a/packages/backend/server/tests/history.spec.ts +++ b/packages/backend/server/tests/history.spec.ts @@ -6,6 +6,7 @@ import test from 'ava'; import * as Sinon from 'sinon'; import { ConfigModule } from '../src/config'; +import type { EventPayload } from '../src/event'; import { DocHistoryManager } from '../src/modules/doc'; import { PrismaModule, PrismaService } from '../src/prisma'; import { flushDB } from './utils'; @@ -41,21 +42,28 @@ test.afterEach(async () => { const snapshot: Snapshot = { workspaceId: '1', id: 'doc1', - blob: Buffer.from([0, 0]), - state: Buffer.from([0, 0]), + blob: Buffer.from([1, 0]), + state: Buffer.from([0]), seq: 0, updatedAt: new Date(), createdAt: new Date(), }; +function getEventData( + timestamp: Date = new Date() +): EventPayload<'snapshot.updated'> { + return { + workspaceId: snapshot.workspaceId, + id: snapshot.id, + previous: { ...snapshot, updatedAt: timestamp }, + }; +} + test('should create doc history if never created before', async t => { Sinon.stub(manager, 'last').resolves(null); const timestamp = new Date(); - await manager.onDocUpdated({ - ...snapshot, - updatedAt: timestamp, - }); + await manager.onDocUpdated(getEventData(timestamp)); const history = await db.snapshotHistory.findFirst({ where: { @@ -72,10 +80,7 @@ test('should not create history if timestamp equals to last record', async t => const timestamp = new Date(); Sinon.stub(manager, 'last').resolves({ timestamp, state: null }); - await manager.onDocUpdated({ - ...snapshot, - updatedAt: timestamp, - }); + await manager.onDocUpdated(getEventData(timestamp)); const history = await db.snapshotHistory.findFirst({ where: { @@ -94,10 +99,7 @@ test('should not create history if state equals to last record', async t => { state: snapshot.state, }); - await manager.onDocUpdated({ - ...snapshot, - updatedAt: timestamp, - }); + await manager.onDocUpdated(getEventData(timestamp)); const history = await db.snapshotHistory.findFirst({ where: { @@ -116,10 +118,7 @@ test('should not create history if time diff is less than interval config', asyn state: Buffer.from([0, 1]), }); - await manager.onDocUpdated({ - ...snapshot, - updatedAt: timestamp, - }); + await manager.onDocUpdated(getEventData(timestamp)); const history = await db.snapshotHistory.findFirst({ where: { @@ -138,10 +137,7 @@ test('should create history if time diff is larger than interval config and stat state: Buffer.from([0, 1]), }); - await manager.onDocUpdated({ - ...snapshot, - updatedAt: timestamp, - }); + await manager.onDocUpdated(getEventData(timestamp)); const history = await db.snapshotHistory.findFirst({ where: { @@ -160,13 +156,7 @@ test('should create history with force flag even if time diff in small', async t state: Buffer.from([0, 1]), }); - await manager.onDocUpdated( - { - ...snapshot, - updatedAt: timestamp, - }, - true - ); + await manager.onDocUpdated(getEventData(timestamp), true); const history = await db.snapshotHistory.findFirst({ where: { @@ -224,13 +214,7 @@ test('should correctly list all history records', async t => { test('should be able to get history data', async t => { const timestamp = new Date(); - await manager.onDocUpdated( - { - ...snapshot, - updatedAt: timestamp, - }, - true - ); + await manager.onDocUpdated(getEventData(timestamp), true); const history = await manager.get( snapshot.workspaceId, @@ -274,10 +258,7 @@ test('should be able to recover from history', async t => { }, }); const history1Timestamp = snapshot.updatedAt.getTime() - 10; - await manager.onDocUpdated({ - ...snapshot, - updatedAt: new Date(history1Timestamp), - }); + await manager.onDocUpdated(getEventData(new Date(history1Timestamp))); await manager.recover( snapshot.workspaceId, From df439877bd1be93cef901300951dba0f3cfa8d0d Mon Sep 17 00:00:00 2001 From: EYHN Date: Fri, 8 Dec 2023 05:21:03 +0000 Subject: [PATCH 56/68] fix(core): add requestidlecallback polyfill for safari (#5231) --- packages/frontend/core/src/index.tsx | 1 + .../src/polyfill/request-idle-callback.ts | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+) create mode 100644 packages/frontend/core/src/polyfill/request-idle-callback.ts diff --git a/packages/frontend/core/src/index.tsx b/packages/frontend/core/src/index.tsx index 3667442d56..b7cef0c072 100644 --- a/packages/frontend/core/src/index.tsx +++ b/packages/frontend/core/src/index.tsx @@ -1,5 +1,6 @@ import './polyfill/ses-lockdown'; import './polyfill/intl-segmenter'; +import './polyfill/request-idle-callback'; import { WorkspaceFallback } from '@affine/component/workspace'; import { assertExists } from '@blocksuite/global/utils'; diff --git a/packages/frontend/core/src/polyfill/request-idle-callback.ts b/packages/frontend/core/src/polyfill/request-idle-callback.ts new file mode 100644 index 0000000000..e3156d20df --- /dev/null +++ b/packages/frontend/core/src/polyfill/request-idle-callback.ts @@ -0,0 +1,19 @@ +window.requestIdleCallback = + window.requestIdleCallback || + function (cb) { + const start = Date.now(); + return setTimeout(function () { + cb({ + didTimeout: false, + timeRemaining: function () { + return Math.max(0, 50 - (Date.now() - start)); + }, + }); + }, 1); + }; + +window.cancelIdleCallback = + window.cancelIdleCallback || + function (id) { + clearTimeout(id); + }; From e93b497231390bbef81d64bd068c7d81305f0bc3 Mon Sep 17 00:00:00 2001 From: LongYinan Date: Fri, 8 Dec 2023 13:53:23 +0800 Subject: [PATCH 57/68] chore: also set version to helm charts in set-version.sh (#5100) --- .github/actions/deploy/deploy.mjs | 4 ++- .github/helm/affine/Chart.yaml | 2 +- .github/helm/affine/charts/graphql/Chart.yaml | 2 +- .github/helm/affine/charts/sync/Chart.yaml | 2 +- .github/workflows/deploy.yml | 7 ++++ scripts/set-version.sh | 32 +++++++++++++++++++ tools/commitlint/package.json | 2 +- 7 files changed, 46 insertions(+), 5 deletions(-) diff --git a/.github/actions/deploy/deploy.mjs b/.github/actions/deploy/deploy.mjs index 64baadd937..126d3b111d 100644 --- a/.github/actions/deploy/deploy.mjs +++ b/.github/actions/deploy/deploy.mjs @@ -1,6 +1,7 @@ import { execSync } from 'node:child_process'; const { + APP_VERSION, BUILD_TYPE, DEPLOY_HOST, CANARY_DEPLOY_HOST, @@ -79,6 +80,7 @@ const createHelmCommand = ({ isDryRun }) => { `--set global.ingress.enabled=true`, `--set-json global.ingress.annotations=\"{ \\"kubernetes.io/ingress.class\\": \\"gce\\", \\"kubernetes.io/ingress.allow-http\\": \\"true\\", \\"kubernetes.io/ingress.global-static-ip-name\\": \\"${staticIpName}\\" }\"`, `--set-string global.ingress.host="${host}"`, + `--set-string global.version="${APP_VERSION}"`, ...redisAndPostgres, `--set web.replicaCount=${webReplicaCount}`, `--set-string web.image.tag="${imageTag}"`, @@ -105,7 +107,7 @@ const createHelmCommand = ({ isDryRun }) => { `--set sync.replicaCount=${syncReplicaCount}`, `--set-string sync.image.tag="${imageTag}"`, ...serviceAnnotations, - `--version "0.0.0-${buildType}.${GIT_SHORT_HASH}" --timeout 10m`, + `--timeout 10m`, flag, ].join(' '); return deployCommand; diff --git a/.github/helm/affine/Chart.yaml b/.github/helm/affine/Chart.yaml index d2e490ed86..281ccd9bd0 100644 --- a/.github/helm/affine/Chart.yaml +++ b/.github/helm/affine/Chart.yaml @@ -3,4 +3,4 @@ name: affine description: AFFiNE cloud chart type: application version: 0.0.0 -appVersion: '0.7.0-canary.18' +appVersion: "0.10.3-canary.2" diff --git a/.github/helm/affine/charts/graphql/Chart.yaml b/.github/helm/affine/charts/graphql/Chart.yaml index acb3e90b7b..8a66ffa1ae 100644 --- a/.github/helm/affine/charts/graphql/Chart.yaml +++ b/.github/helm/affine/charts/graphql/Chart.yaml @@ -3,4 +3,4 @@ name: graphql description: AFFiNE GraphQL server type: application version: 0.0.0 -appVersion: '0.7.0-canary.18' +appVersion: "0.10.3-canary.2" diff --git a/.github/helm/affine/charts/sync/Chart.yaml b/.github/helm/affine/charts/sync/Chart.yaml index 9fde73dfcd..071318a561 100644 --- a/.github/helm/affine/charts/sync/Chart.yaml +++ b/.github/helm/affine/charts/sync/Chart.yaml @@ -3,4 +3,4 @@ name: sync description: A Helm chart for Kubernetes type: application version: 0.0.0 -appVersion: "0.7.0-canary.18" +appVersion: "0.10.3-canary.2" diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 31ec20581b..253270d81f 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -207,6 +207,12 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 + - name: setup deploy version + id: version + run: | + export APP_VERSION=`node -e "console.log(require('./package.json').version)"` + echo $APP_VERSION + echo "APP_VERSION=$APP_VERSION" >> "$GITHUB_OUTPUT" - name: Deploy to ${{ github.event.inputs.flavor }} uses: ./.github/actions/deploy with: @@ -217,6 +223,7 @@ jobs: cluster-name: ${{ secrets.GCP_CLUSTER_NAME }} cluster-location: ${{ secrets.GCP_CLUSTER_LOCATION }} env: + APP_VERSION: ${{ steps.version.outputs.APP_VERSION }} DEPLOY_HOST: ${{ secrets.DEPLOY_HOST }} CANARY_DEPLOY_HOST: ${{ secrets.CANARY_DEPLOY_HOST }} R2_ACCOUNT_ID: ${{ secrets.R2_ACCOUNT_ID }} diff --git a/scripts/set-version.sh b/scripts/set-version.sh index bf421bb821..448b638143 100755 --- a/scripts/set-version.sh +++ b/scripts/set-version.sh @@ -6,3 +6,35 @@ for DIR in $(yarn workspaces list --json | jq -r '.location'); do jq ".version = \"$1\"" "$DIR"/package.json > tmp.json && mv tmp.json "$DIR"/package.json fi done + +update_app_version_in_helm_charts() { + local file_path=$1 + local new_version=$2 + + # Check if file exists + if [ ! -f "$file_path" ]; then + echo "Error: File does not exist at $file_path." + return 1 + fi + + echo "Updating $file_path with appVersion $new_version" + + # Use sed to replace the appVersion value with the new version. + sed -i.bak -E "s/^appVersion:[[:space:]]+[\"']?.*[\"']?$/appVersion: \"$new_version\"/" "$file_path" + + # Check if sed command succeeded + if [ $? -ne 0 ]; then + echo "Error: Failed to update the appVersion." + return 1 + fi + + echo "appVersion in $file_path updated to $new_version" + + rm "$file_path".bak +} + +new_version=$1 + +update_app_version_in_helm_charts ".github/helm/affine/Chart.yaml" "$new_version" +update_app_version_in_helm_charts ".github/helm/affine/charts/graphql/Chart.yaml" "$new_version" +update_app_version_in_helm_charts ".github/helm/affine/charts/sync/Chart.yaml" "$new_version" diff --git a/tools/commitlint/package.json b/tools/commitlint/package.json index 6a47516f4b..08d92fd448 100644 --- a/tools/commitlint/package.json +++ b/tools/commitlint/package.json @@ -1,6 +1,6 @@ { "name": "@affine/commitlint-config", - "version": "0.0.0", + "version": "0.10.3-canary.2", "private": true, "devDependencies": { "@commitlint/cli": "^18.4.3", From 37a32d1f7da46b816bd9b4d55839f9cc586f4e03 Mon Sep 17 00:00:00 2001 From: LongYinan Date: Fri, 8 Dec 2023 06:08:54 +0000 Subject: [PATCH 58/68] chore: bump up rollup version to v4 (#5202) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [rollup](https://rollupjs.org/) ([source](https://togithub.com/rollup/rollup)) | [`^3.29.4` -> `^4.0.0`](https://renovatebot.com/diffs/npm/rollup/3.29.4/4.6.1) | [![age](https://developer.mend.io/api/mc/badges/age/npm/rollup/4.6.1?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/rollup/4.6.1?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/rollup/3.29.4/4.6.1?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/rollup/3.29.4/4.6.1?slim=true)](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes
    rollup/rollup (rollup) ### [`v4.6.1`](https://togithub.com/rollup/rollup/blob/HEAD/CHANGELOG.md#461) [Compare Source](https://togithub.com/rollup/rollup/compare/v4.6.0...v4.6.1) *2023-11-30* ##### Bug Fixes - Resolve a situation where declaring the same `var` several times was considered a conflict ([#​5276](https://togithub.com/rollup/rollup/issues/5276)) ##### Pull Requests - [#​5275](https://togithub.com/rollup/rollup/pull/5275): Add TNG as special sponsor ([@​lukastaegert](https://togithub.com/lukastaegert)) - [#​5276](https://togithub.com/rollup/rollup/pull/5276): Allow to redeclare parameters multiple times in nested scopes ([@​lukastaegert](https://togithub.com/lukastaegert)) ### [`v4.6.0`](https://togithub.com/rollup/rollup/blob/HEAD/CHANGELOG.md#460) [Compare Source](https://togithub.com/rollup/rollup/compare/v4.5.2...v4.6.0) *2023-11-26* ##### Features - Allow `this.addWatchFile` in all plugin hooks ([#​5270](https://togithub.com/rollup/rollup/issues/5270)) ##### Bug Fixes - Show helpful error when native binaries are not installed due to an `npm` issue ([#​5267](https://togithub.com/rollup/rollup/issues/5267)) - Do not access `this` context in `this.addWatchFile` so it does not need to be bound when passed around ([#​5270](https://togithub.com/rollup/rollup/issues/5270)) ##### Pull Requests - [#​5267](https://togithub.com/rollup/rollup/pull/5267): Add friendly error for npm bug ([@​sapphi-red](https://togithub.com/sapphi-red)) - [#​5270](https://togithub.com/rollup/rollup/pull/5270): Allow this.addWatchFile in all hooks ([@​lukastaegert](https://togithub.com/lukastaegert)) - [#​5272](https://togithub.com/rollup/rollup/pull/5272): Debug deployed graphs ([@​lukastaegert](https://togithub.com/lukastaegert)) ### [`v4.5.2`](https://togithub.com/rollup/rollup/blob/HEAD/CHANGELOG.md#452) [Compare Source](https://togithub.com/rollup/rollup/compare/v4.5.1...v4.5.2) *2023-11-24* ##### Bug Fixes - Handle files with UTF-8 BOM when using the commonjs plugin ([#​5268](https://togithub.com/rollup/rollup/issues/5268)) ##### Pull Requests - [#​5268](https://togithub.com/rollup/rollup/pull/5268): fix: strip BOM before calling transform hook ([@​TrickyPi](https://togithub.com/TrickyPi)) - [#​5269](https://togithub.com/rollup/rollup/pull/5269): chore(deps): lock file maintenance minor/patch updates ([@​renovate](https://togithub.com/renovate)\[bot]) ### [`v4.5.1`](https://togithub.com/rollup/rollup/blob/HEAD/CHANGELOG.md#451) [Compare Source](https://togithub.com/rollup/rollup/compare/v4.5.0...v4.5.1) *2023-11-21* ##### Bug Fixes - Do not error when a function expression uses the same name for a parameter and its id ([#​5262](https://togithub.com/rollup/rollup/issues/5262)) ##### Pull Requests - [#​5257](https://togithub.com/rollup/rollup/pull/5257): Fix graphs in docs, improve REPL colors ([@​lukastaegert](https://togithub.com/lukastaegert)) - [#​5262](https://togithub.com/rollup/rollup/pull/5262): Allow function expression parameters to shadow the function id ([@​lukastaegert](https://togithub.com/lukastaegert)) ### [`v4.5.0`](https://togithub.com/rollup/rollup/blob/HEAD/CHANGELOG.md#450) [Compare Source](https://togithub.com/rollup/rollup/compare/v4.4.1...v4.5.0) *2023-11-18* ##### Bug Fixes - Show a proper error when using native Rollup on armv7 musl Linux ([#​5255](https://togithub.com/rollup/rollup/issues/5255)) ##### Pull Requests - [#​5251](https://togithub.com/rollup/rollup/pull/5251): doc fix import assertions to attributes in API plugin development page ([@​lhapaipai](https://togithub.com/lhapaipai)) - [#​5253](https://togithub.com/rollup/rollup/pull/5253): chore(deps): lock file maintenance minor/patch updates ([@​renovate](https://togithub.com/renovate)\[bot]) - [#​5255](https://togithub.com/rollup/rollup/pull/5255): Error for armv7 musl build ([@​lukastaegert](https://togithub.com/lukastaegert)) ### [`v4.4.1`](https://togithub.com/rollup/rollup/blob/HEAD/CHANGELOG.md#441) [Compare Source](https://togithub.com/rollup/rollup/compare/v4.4.0...v4.4.1) *2023-11-14* ##### Bug Fixes - Do not flag duplicate function declarations in function scopes as syntax errors ([#​5248](https://togithub.com/rollup/rollup/issues/5248)) ##### Pull Requests - [#​5248](https://togithub.com/rollup/rollup/pull/5248): Allow functions to redeclare vars and functions in function scopes ([@​lukastaegert](https://togithub.com/lukastaegert)) ### [`v4.4.0`](https://togithub.com/rollup/rollup/blob/HEAD/CHANGELOG.md#440) [Compare Source](https://togithub.com/rollup/rollup/compare/v4.3.1...v4.4.0) *2023-11-12* ##### Features - Replace SWC linting with faster internal linting to error on duplicate declarations etc. ([#​5207](https://togithub.com/rollup/rollup/issues/5207)) ##### Bug Fixes - Show proper error when an entry exports non-existing bindings ([#​5207](https://togithub.com/rollup/rollup/issues/5207)) ##### Pull Requests - [#​5207](https://togithub.com/rollup/rollup/pull/5207): perf: run lint while constructing nodes ([@​sapphi-red](https://togithub.com/sapphi-red)) ### [`v4.3.1`](https://togithub.com/rollup/rollup/blob/HEAD/CHANGELOG.md#431) [Compare Source](https://togithub.com/rollup/rollup/compare/v4.3.0...v4.3.1) *2023-11-11* ##### Bug Fixes - Fix rename error when handling errors in watch mode ([#​5240](https://togithub.com/rollup/rollup/issues/5240)) - Prevent warning when using `--forceExit` ([#​5245](https://togithub.com/rollup/rollup/issues/5245)) ##### Pull Requests - [#​5240](https://togithub.com/rollup/rollup/pull/5240): fix: allow the name of Rollup Error to be modified ([@​TrickyPi](https://togithub.com/TrickyPi)) - [#​5243](https://togithub.com/rollup/rollup/pull/5243): chore(deps): lock file maintenance minor/patch updates ([@​renovate](https://togithub.com/renovate)\[bot]) - [#​5245](https://togithub.com/rollup/rollup/pull/5245): Ensure --forceExit works without warning ([@​lukastaegert](https://togithub.com/lukastaegert)) ### [`v4.3.0`](https://togithub.com/rollup/rollup/blob/HEAD/CHANGELOG.md#430) [Compare Source](https://togithub.com/rollup/rollup/compare/v4.2.0...v4.3.0) *2023-11-03* ##### Features - Add `forceExit` CLI flag for situations where the CLI does not exit gracefully ([#​5195](https://togithub.com/rollup/rollup/issues/5195)) ##### Bug Fixes - Properly catch errors when removing a temporary config file fails ([#​5198](https://togithub.com/rollup/rollup/issues/5198)) ##### Pull Requests - [#​5195](https://togithub.com/rollup/rollup/pull/5195): Add `forceExit` CLI flag ([@​raphael-theriault-swi](https://togithub.com/raphael-theriault-swi)) - [#​5198](https://togithub.com/rollup/rollup/pull/5198): fix: prevent `ENOENT` error on temp config removal ([@​jzempel](https://togithub.com/jzempel)) - [#​5237](https://togithub.com/rollup/rollup/pull/5237): chore: remove unused files and deps ([@​TrickyPi](https://togithub.com/TrickyPi)) - [#​5238](https://togithub.com/rollup/rollup/pull/5238): chore(deps): update dependency eslint-plugin-unicorn to v49 ([@​renovate](https://togithub.com/renovate)\[bot]) - [#​5239](https://togithub.com/rollup/rollup/pull/5239): chore(deps): lock file maintenance minor/patch updates ([@​renovate](https://togithub.com/renovate)\[bot]) ### [`v4.2.0`](https://togithub.com/rollup/rollup/blob/HEAD/CHANGELOG.md#420) [Compare Source](https://togithub.com/rollup/rollup/compare/v4.1.6...v4.2.0) *2023-10-31* ##### Features - Run parsing in multiple threads and introduce `parseAstAsync` helper function ([#​5202](https://togithub.com/rollup/rollup/issues/5202)) ##### Pull Requests - [#​5202](https://togithub.com/rollup/rollup/pull/5202): perf: introduce `parseAstAsync` and parallelize parsing AST ([@​sapphi-red](https://togithub.com/sapphi-red)) ### [`v4.1.6`](https://togithub.com/rollup/rollup/blob/HEAD/CHANGELOG.md#416) [Compare Source](https://togithub.com/rollup/rollup/compare/v4.1.5...v4.1.6) *2023-10-31* ##### Bug Fixes - Fix a bug where emtpy block comments in certain positions could freeze Rollup ([#​5231](https://togithub.com/rollup/rollup/issues/5231)) ##### Pull Requests - [#​5228](https://togithub.com/rollup/rollup/pull/5228): build: ensure rust toolchain components for linting are installed ([@​jerome-benoit](https://togithub.com/jerome-benoit)) - [#​5231](https://togithub.com/rollup/rollup/pull/5231): Render emtpy block comments after tree-shaken statements ([@​lukastaegert](https://togithub.com/lukastaegert)) - [#​5232](https://togithub.com/rollup/rollup/pull/5232): Revert specifying rustfmt and clippy in toolchain file as it breaks REPL build ([@​lukastaegert](https://togithub.com/lukastaegert)) ### [`v4.1.5`](https://togithub.com/rollup/rollup/blob/HEAD/CHANGELOG.md#415) [Compare Source](https://togithub.com/rollup/rollup/compare/v4.1.4...v4.1.5) *2023-10-28* ##### Bug Fixes - Fix an issue where actual entries that were also implicit entries could remain implicit ([#​5220](https://togithub.com/rollup/rollup/issues/5220)) ##### Pull Requests - [#​5209](https://togithub.com/rollup/rollup/pull/5209): Document Vite workaround for browser build ([@​curran](https://togithub.com/curran)) - [#​5215](https://togithub.com/rollup/rollup/pull/5215): chore(deps): update dependency lint-staged to v15 ([@​renovate](https://togithub.com/renovate)\[bot]) - [#​5216](https://togithub.com/rollup/rollup/pull/5216): chore(deps): lock file maintenance minor/patch updates ([@​renovate](https://togithub.com/renovate)\[bot]) - [#​5218](https://togithub.com/rollup/rollup/pull/5218): Update license plugin ([@​lukastaegert](https://togithub.com/lukastaegert)) - [#​5219](https://togithub.com/rollup/rollup/pull/5219): Fix error highlight in REPL ([@​lukastaegert](https://togithub.com/lukastaegert)) - [#​5220](https://togithub.com/rollup/rollup/pull/5220): Fix race condition when emitting implicitly dependent entries ([@​lukastaegert](https://togithub.com/lukastaegert)) - [#​5224](https://togithub.com/rollup/rollup/pull/5224): chore(deps): update actions/setup-node action to v4 ([@​renovate](https://togithub.com/renovate)\[bot]) - [#​5225](https://togithub.com/rollup/rollup/pull/5225): chore(deps): lock file maintenance minor/patch updates ([@​renovate](https://togithub.com/renovate)\[bot]) ### [`v4.1.4`](https://togithub.com/rollup/rollup/blob/HEAD/CHANGELOG.md#414) [Compare Source](https://togithub.com/rollup/rollup/compare/v4.1.3...v4.1.4) *2023-10-16* ##### Bug Fixes - Reduce sizes [@​rollup/browser](https://togithub.com/rollup/browser) and [@​rollup/wasm-node](https://togithub.com/rollup/wasm-node) WASM artifacts ([#​5204](https://togithub.com/rollup/rollup/issues/5204)) ##### Pull Requests - [#​5204](https://togithub.com/rollup/rollup/pull/5204): perf: shrink wasm size by avoid importing browserslist ([@​sapphi-red](https://togithub.com/sapphi-red)) ### [`v4.1.3`](https://togithub.com/rollup/rollup/blob/HEAD/CHANGELOG.md#413) [Compare Source](https://togithub.com/rollup/rollup/compare/v4.1.1...v4.1.3) *2023-10-15* ##### Bug Fixes - Fix WASM build as hash function was not exported ([#​5203](https://togithub.com/rollup/rollup/issues/5203)) ##### Pull Requests - [#​5203](https://togithub.com/rollup/rollup/pull/5203): fix: export xxhashBase64Url from wasm ([@​sapphi-red](https://togithub.com/sapphi-red)) ### [`v4.1.1`](https://togithub.com/rollup/rollup/blob/HEAD/CHANGELOG.md#411) [Compare Source](https://togithub.com/rollup/rollup/compare/v4.1.0...v4.1.1) *2023-10-15* ##### Bug Fixes - Improve Node parsing performance ([#​5201](https://togithub.com/rollup/rollup/issues/5201)) ##### Pull Requests - [#​5201](https://togithub.com/rollup/rollup/pull/5201): perf: use mimalloc for bindings_napi ([@​sapphi-red](https://togithub.com/sapphi-red)) ### [`v4.1.0`](https://togithub.com/rollup/rollup/blob/HEAD/CHANGELOG.md#410) [Compare Source](https://togithub.com/rollup/rollup/compare/v4.0.2...v4.1.0) *2023-10-14* ##### Features - Reduce memory usage of Rollup builds ([#​5133](https://togithub.com/rollup/rollup/issues/5133)) ##### Pull Requests - [#​5133](https://togithub.com/rollup/rollup/pull/5133): perf: reducing ast node memory overhead ([@​thebanjomatic](https://togithub.com/thebanjomatic)) - [#​5177](https://togithub.com/rollup/rollup/pull/5177): chore: explicitly set rust toolchain channel ([@​cijiugechu](https://togithub.com/cijiugechu)) - [#​5179](https://togithub.com/rollup/rollup/pull/5179): Update migration guide for Rollup 4 ([@​lukastaegert](https://togithub.com/lukastaegert)) - [#​5180](https://togithub.com/rollup/rollup/pull/5180): Resolve clippy errors ([@​cijiugechu](https://togithub.com/cijiugechu)) - [#​5183](https://togithub.com/rollup/rollup/pull/5183): Add clippy to pipeline and fix remaining issues ([@​lukastaegert](https://togithub.com/lukastaegert)) - [#​5184](https://togithub.com/rollup/rollup/pull/5184): docs: fix code example for `onLog` ([@​tjenkinson](https://togithub.com/tjenkinson)) - [#​5186](https://togithub.com/rollup/rollup/pull/5186): Improve wording for native artifacts in migration guide ([@​lukastaegert](https://togithub.com/lukastaegert)) - [#​5190](https://togithub.com/rollup/rollup/pull/5190): test: add verifyAst type ([@​TrickyPi](https://togithub.com/TrickyPi)) - [#​5196](https://togithub.com/rollup/rollup/pull/5196): chore(deps): update dependency rollup to v4 ([@​renovate](https://togithub.com/renovate)\[bot]) - [#​5197](https://togithub.com/rollup/rollup/pull/5197): chore(deps): lock file maintenance minor/patch updates ([@​renovate](https://togithub.com/renovate)\[bot]) ### [`v4.0.2`](https://togithub.com/rollup/rollup/blob/HEAD/CHANGELOG.md#402) [Compare Source](https://togithub.com/rollup/rollup/compare/v4.0.1...v4.0.2) *2023-10-06* ##### Bug Fixes - Fix annotation detection logic to not fail when a non-ASCII character precedes a double underscore ([#​5178](https://togithub.com/rollup/rollup/issues/5178)) ##### Pull Requests - [#​5178](https://togithub.com/rollup/rollup/pull/5178): Handle special characters before double underscores ([@​lukastaegert](https://togithub.com/lukastaegert)) ### [`v4.0.1`](https://togithub.com/rollup/rollup/blob/HEAD/CHANGELOG.md#401) [Compare Source](https://togithub.com/rollup/rollup/compare/v4.0.0...v4.0.1) *2023-10-06* ##### Bug Fixes - Do not panic on trailing semicolons after class methods ([#​5173](https://togithub.com/rollup/rollup/issues/5173)) - Add artifact for arm64 linux musl target ([#​5176](https://togithub.com/rollup/rollup/issues/5176)) ##### Pull Requests - [#​5172](https://togithub.com/rollup/rollup/pull/5172): chore(deps): lock file maintenance minor/patch updates ([@​renovate](https://togithub.com/renovate)\[bot]) - [#​5173](https://togithub.com/rollup/rollup/pull/5173): fix: ignores empty statements in class body that is returned by SWC parser ([@​TrickyPi](https://togithub.com/TrickyPi)) - [#​5176](https://togithub.com/rollup/rollup/pull/5176): Fix linux arm musl build ([@​lukastaegert](https://togithub.com/lukastaegert)) ### [`v4.0.0`](https://togithub.com/rollup/rollup/blob/HEAD/CHANGELOG.md#400) [Compare Source](https://togithub.com/rollup/rollup/compare/v3.29.4...v4.0.0) *2023-10-05* ##### BREAKING CHANGES ##### General Changes - The minimal required Node version is now 18.0.0 ([#​5142](https://togithub.com/rollup/rollup/issues/5142)) - The browser build now relies on a WASM artifact that needs to be provided as well ([#​5073](https://togithub.com/rollup/rollup/issues/5073)) - The NodeJS build now relies on an optional native binary; for unsupported platforms, users can use the `@rollup/wasm-node` package that has the same interface as Rollup but relies on WASM artifacts ([#​5073](https://togithub.com/rollup/rollup/issues/5073)) - The `INVALID_IMPORT_ASSERTION` error code has been replaced with `INVALID_IMPORT_ATTRIBUTE` ([#​5073](https://togithub.com/rollup/rollup/issues/5073)) - Rollup will now warn for `@__PURE__` and `@__NO_SIDE_EFFECTS__` annotations in invalid locations ([#​5165](https://togithub.com/rollup/rollup/issues/5165)) - If an entry module starts with a shebang comment `#!...`, this comment will be prepended to the output for `es` and `cjs` formats ([#​5163](https://togithub.com/rollup/rollup/issues/5163)) - File hashes will now use url-safe base64 encoded hashes ([#​5155](https://togithub.com/rollup/rollup/issues/5155)) - The maximum hash length has been reduced to 22 characters ([#​5155](https://togithub.com/rollup/rollup/issues/5155)) - The `RollupWarning` type has been removed in favor of the `RollupLog` type ([#​5147](https://togithub.com/rollup/rollup/issues/5147)) ##### Changes to Rollup Options - Acorn plugins are no longer supported, the `acornInjectPlugins` option has been removed ([#​5073](https://togithub.com/rollup/rollup/issues/5073)) - The `acorn` option has been removed ([#​5073](https://togithub.com/rollup/rollup/issues/5073)) - `output.externalImportAssertions` has been deprecated in favor of `output.externalImportAttributes` ([#​5073](https://togithub.com/rollup/rollup/issues/5073)) - `inlineDynamicImports`, `manualChunks` and `preserveModules` have been removed on input option level: Please use the corresponding output options of the same names ([#​5143](https://togithub.com/rollup/rollup/issues/5143)) - Removed output options ([#​5143](https://togithub.com/rollup/rollup/issues/5143)): - `output.experimentalDeepDynamicChunkOptimization`: This option is no longer needed as Rollup now always runs the full chunking algorithm - `output.dynamicImportFunction`: Use the `renderDynamicImport` plugin hook instead - `output.namespaceToStringTag`: Use `output.generatedCode.symbols` instead - `output.preferConst`: Use `output.generatedCode.constBindings` instead ##### Plugin API Changes - For `this.resolve`, the default of the `skipSelf` option is now `true` ([#​5142](https://togithub.com/rollup/rollup/issues/5142)) - `this.parse` now only supports the `allowReturnOutsideFunction` option for now ([#​5073](https://togithub.com/rollup/rollup/issues/5073)) - Import assertions now use the [new import attribute AST structure](https://togithub.com/estree/estree/blob/master/experimental/import-attributes.md) ([#​5073](https://togithub.com/rollup/rollup/issues/5073)) - "assertions" have been replaced with "attributes" in various places of the plugin interface ([#​5073](https://togithub.com/rollup/rollup/issues/5073)) - If the import of a module id is handled by the `load` hook of a plugin, `rollup.watch` no longer watches the actual file if the module id corresponds to a real path; if this is intended, then the plugin is responsible for calling `this.addWatchFile` for any dependency files ([#​5150](https://togithub.com/rollup/rollup/issues/5150)) - The normalized input options provided by `buildStart` and other hooks no longer contain an `onwarn` handler; plugins should use `onLog` instead ([#​5147](https://togithub.com/rollup/rollup/issues/5147)) - `this.moduleIds` has been removed from the plugin context: Use `this.getModuleIds()` instead ([#​5143](https://togithub.com/rollup/rollup/issues/5143)) - The `hasModuleSideEffects` flag has been removed from the `ModuleInfo` returned by `this.getModuleInfo()`: Use `moduleSideEffects` on the `ModuleInfo` instead ([#​5143](https://togithub.com/rollup/rollup/issues/5143)) ##### Features - Improve parsing speed by switching to a native SWC-based parser ([#​5073](https://togithub.com/rollup/rollup/issues/5073)) - Rollup will now warn for `@__PURE__` and `@__NO_SIDE_EFFECTS__` annotations in invalid locations ([#​5165](https://togithub.com/rollup/rollup/issues/5165)) - The parser is now exposed as a separate export `parseAst` ([#​5169](https://togithub.com/rollup/rollup/issues/5169)) ##### Bug Fixes - Rollup no longer tries to watch virtual files if their name corresponds to an actual file name; instead, plugins handle watching via `this.addWatchFile()` ([#​5150](https://togithub.com/rollup/rollup/issues/5150)) ##### Pull Requests - [#​5073](https://togithub.com/rollup/rollup/pull/5073): \[v4.0] Switch parser to SWC and introduce native/WASM code ([@​lukastaegert](https://togithub.com/lukastaegert)) - [#​5142](https://togithub.com/rollup/rollup/pull/5142): \[v4.0] Set the default of skipSelf to true ([@​TrickyPi](https://togithub.com/TrickyPi)) - [#​5143](https://togithub.com/rollup/rollup/pull/5143): \[v4.0] Remove deprecated features ([@​lukastaegert](https://togithub.com/lukastaegert)) - [#​5144](https://togithub.com/rollup/rollup/pull/5144): \[v4.0] Imporve the performance of generating ast and rollup ast nodes ([@​TrickyPi](https://togithub.com/TrickyPi)) - [#​5147](https://togithub.com/rollup/rollup/pull/5147): \[v4.0] Remove onwarn from normalized input options ([@​lukastaegert](https://togithub.com/lukastaegert)) - [#​5150](https://togithub.com/rollup/rollup/pull/5150): \[v4.0] feat: Do not watch files anymore if their content is returned by the load hook ([@​TrickyPi](https://togithub.com/TrickyPi)) - [#​5154](https://togithub.com/rollup/rollup/pull/5154): \[v4.0] Add parse option to allow return outside function ([@​lukastaegert](https://togithub.com/lukastaegert)) - [#​5155](https://togithub.com/rollup/rollup/pull/5155): \[v4.0] feat: implement hashing content in Rust ([@​TrickyPi](https://togithub.com/TrickyPi)) - [#​5157](https://togithub.com/rollup/rollup/pull/5157): \[v4.0] Handle empty exports ([@​lukastaegert](https://togithub.com/lukastaegert)) - [#​5160](https://togithub.com/rollup/rollup/pull/5160): chore(deps): lock file maintenance minor/patch updates ([@​renovate](https://togithub.com/renovate)\[bot]) - [#​5163](https://togithub.com/rollup/rollup/pull/5163): \[v4.0] feat: preserve shebang in entry module for CJS and ESM outputs ([@​TrickyPi](https://togithub.com/TrickyPi)) - [#​5164](https://togithub.com/rollup/rollup/pull/5164): \[v4.0] fix: also strip BOM from code strings in JS ([@​TrickyPi](https://togithub.com/TrickyPi)) - [#​5165](https://togithub.com/rollup/rollup/pull/5165): \[v4.0] warn for invalid annotations ([@​lukastaegert](https://togithub.com/lukastaegert)) - [#​5168](https://togithub.com/rollup/rollup/pull/5168): \[v4.0] Ensure we support new import attribute "with" syntax ([@​lukastaegert](https://togithub.com/lukastaegert)) - [#​5169](https://togithub.com/rollup/rollup/pull/5169): \[v4.0] Expose parser ([@​lukastaegert](https://togithub.com/lukastaegert))
    --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://developer.mend.io/github/toeverything/AFFiNE). --- tools/plugin-cli/package.json | 2 +- yarn.lock | 138 +++++++++++++++++++++++++++++++++- 2 files changed, 137 insertions(+), 3 deletions(-) diff --git a/tools/plugin-cli/package.json b/tools/plugin-cli/package.json index 03b05d6219..386c2a9ef0 100644 --- a/tools/plugin-cli/package.json +++ b/tools/plugin-cli/package.json @@ -16,7 +16,7 @@ "@toeverything/infra": "workspace:^", "@vanilla-extract/rollup-plugin": "^1.3.0", "@vitejs/plugin-vue": "^4.4.0", - "rollup": "^3.29.4", + "rollup": "^4.0.0", "rollup-plugin-swc3": "^0.10.2", "ts-node": "^10.9.1", "vue": "^3.3.4" diff --git a/yarn.lock b/yarn.lock index 444dedbeb0..1c3f3d4591 100644 --- a/yarn.lock +++ b/yarn.lock @@ -694,7 +694,7 @@ __metadata: "@toeverything/infra": "workspace:^" "@vanilla-extract/rollup-plugin": "npm:^1.3.0" "@vitejs/plugin-vue": "npm:^4.4.0" - rollup: "npm:^3.29.4" + rollup: "npm:^4.0.0" rollup-plugin-swc3: "npm:^0.10.2" ts-node: "npm:^10.9.1" vue: "npm:^3.3.4" @@ -11318,6 +11318,90 @@ __metadata: languageName: node linkType: hard +"@rollup/rollup-android-arm-eabi@npm:4.6.1": + version: 4.6.1 + resolution: "@rollup/rollup-android-arm-eabi@npm:4.6.1" + conditions: os=android & cpu=arm + languageName: node + linkType: hard + +"@rollup/rollup-android-arm64@npm:4.6.1": + version: 4.6.1 + resolution: "@rollup/rollup-android-arm64@npm:4.6.1" + conditions: os=android & cpu=arm64 + languageName: node + linkType: hard + +"@rollup/rollup-darwin-arm64@npm:4.6.1": + version: 4.6.1 + resolution: "@rollup/rollup-darwin-arm64@npm:4.6.1" + conditions: os=darwin & cpu=arm64 + languageName: node + linkType: hard + +"@rollup/rollup-darwin-x64@npm:4.6.1": + version: 4.6.1 + resolution: "@rollup/rollup-darwin-x64@npm:4.6.1" + conditions: os=darwin & cpu=x64 + languageName: node + linkType: hard + +"@rollup/rollup-linux-arm-gnueabihf@npm:4.6.1": + version: 4.6.1 + resolution: "@rollup/rollup-linux-arm-gnueabihf@npm:4.6.1" + conditions: os=linux & cpu=arm + languageName: node + linkType: hard + +"@rollup/rollup-linux-arm64-gnu@npm:4.6.1": + version: 4.6.1 + resolution: "@rollup/rollup-linux-arm64-gnu@npm:4.6.1" + conditions: os=linux & cpu=arm64 & libc=glibc + languageName: node + linkType: hard + +"@rollup/rollup-linux-arm64-musl@npm:4.6.1": + version: 4.6.1 + resolution: "@rollup/rollup-linux-arm64-musl@npm:4.6.1" + conditions: os=linux & cpu=arm64 & libc=musl + languageName: node + linkType: hard + +"@rollup/rollup-linux-x64-gnu@npm:4.6.1": + version: 4.6.1 + resolution: "@rollup/rollup-linux-x64-gnu@npm:4.6.1" + conditions: os=linux & cpu=x64 & libc=glibc + languageName: node + linkType: hard + +"@rollup/rollup-linux-x64-musl@npm:4.6.1": + version: 4.6.1 + resolution: "@rollup/rollup-linux-x64-musl@npm:4.6.1" + conditions: os=linux & cpu=x64 & libc=musl + languageName: node + linkType: hard + +"@rollup/rollup-win32-arm64-msvc@npm:4.6.1": + version: 4.6.1 + resolution: "@rollup/rollup-win32-arm64-msvc@npm:4.6.1" + conditions: os=win32 & cpu=arm64 + languageName: node + linkType: hard + +"@rollup/rollup-win32-ia32-msvc@npm:4.6.1": + version: 4.6.1 + resolution: "@rollup/rollup-win32-ia32-msvc@npm:4.6.1" + conditions: os=win32 & cpu=ia32 + languageName: node + linkType: hard + +"@rollup/rollup-win32-x64-msvc@npm:4.6.1": + version: 4.6.1 + resolution: "@rollup/rollup-win32-x64-msvc@npm:4.6.1" + conditions: os=win32 & cpu=x64 + languageName: node + linkType: hard + "@rushstack/node-core-library@npm:3.61.0": version: 3.61.0 resolution: "@rushstack/node-core-library@npm:3.61.0" @@ -32587,7 +32671,7 @@ __metadata: languageName: node linkType: hard -"rollup@npm:^2.25.0 || ^3.3.0, rollup@npm:^3.27.1, rollup@npm:^3.29.4": +"rollup@npm:^2.25.0 || ^3.3.0, rollup@npm:^3.27.1": version: 3.29.4 resolution: "rollup@npm:3.29.4" dependencies: @@ -32601,6 +32685,56 @@ __metadata: languageName: node linkType: hard +"rollup@npm:^4.0.0": + version: 4.6.1 + resolution: "rollup@npm:4.6.1" + dependencies: + "@rollup/rollup-android-arm-eabi": "npm:4.6.1" + "@rollup/rollup-android-arm64": "npm:4.6.1" + "@rollup/rollup-darwin-arm64": "npm:4.6.1" + "@rollup/rollup-darwin-x64": "npm:4.6.1" + "@rollup/rollup-linux-arm-gnueabihf": "npm:4.6.1" + "@rollup/rollup-linux-arm64-gnu": "npm:4.6.1" + "@rollup/rollup-linux-arm64-musl": "npm:4.6.1" + "@rollup/rollup-linux-x64-gnu": "npm:4.6.1" + "@rollup/rollup-linux-x64-musl": "npm:4.6.1" + "@rollup/rollup-win32-arm64-msvc": "npm:4.6.1" + "@rollup/rollup-win32-ia32-msvc": "npm:4.6.1" + "@rollup/rollup-win32-x64-msvc": "npm:4.6.1" + fsevents: "npm:~2.3.2" + dependenciesMeta: + "@rollup/rollup-android-arm-eabi": + optional: true + "@rollup/rollup-android-arm64": + optional: true + "@rollup/rollup-darwin-arm64": + optional: true + "@rollup/rollup-darwin-x64": + optional: true + "@rollup/rollup-linux-arm-gnueabihf": + optional: true + "@rollup/rollup-linux-arm64-gnu": + optional: true + "@rollup/rollup-linux-arm64-musl": + optional: true + "@rollup/rollup-linux-x64-gnu": + optional: true + "@rollup/rollup-linux-x64-musl": + optional: true + "@rollup/rollup-win32-arm64-msvc": + optional: true + "@rollup/rollup-win32-ia32-msvc": + optional: true + "@rollup/rollup-win32-x64-msvc": + optional: true + fsevents: + optional: true + bin: + rollup: dist/bin/rollup + checksum: 32fcbb3954597c27fe493d8dcebc24c3ddff8eab2150829cfb2161761038a9bd64873f51a90a6bfce522a70201318d764371e78ed294fc7aa019804f1dac7f08 + languageName: node + linkType: hard + "run-async@npm:^2.4.0": version: 2.4.1 resolution: "run-async@npm:2.4.1" From 0be087b5d71892918ed3274dbddadac20d65f09e Mon Sep 17 00:00:00 2001 From: LongYinan Date: Fri, 8 Dec 2023 06:39:16 +0000 Subject: [PATCH 59/68] ci: fix rust build during deployment (#5233) --- .github/actions/build-rust/action.yml | 5 ++++- .github/workflows/deploy.yml | 4 ++-- packages/backend/storage/package.json | 2 +- packages/frontend/native/package.json | 2 +- yarn.lock | 12 ++++++------ 5 files changed, 14 insertions(+), 11 deletions(-) diff --git a/.github/actions/build-rust/action.yml b/.github/actions/build-rust/action.yml index 08f230cef9..cf396ea372 100644 --- a/.github/actions/build-rust/action.yml +++ b/.github/actions/build-rust/action.yml @@ -32,7 +32,9 @@ runs: - name: Set CC if: ${{ contains(inputs.target, 'linux') && inputs.package != '@affine/native' }} shell: bash - run: echo "CC=clang" >> "$GITHUB_ENV" + run: | + echo "CC=clang" >> "$GITHUB_ENV" + echo "TARGET_CC=clang" >> "$GITHUB_ENV" - name: Cache cargo uses: actions/cache@v3 @@ -50,3 +52,4 @@ runs: yarn workspace ${{ inputs.package }} nx build ${{ inputs.package }} --target ${{ inputs.target }} --use-napi-cross env: NX_CLOUD_ACCESS_TOKEN: ${{ inputs.nx_token }} + DEBUG: 'napi:*' diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 253270d81f..52e03ae9c8 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -69,7 +69,7 @@ jobs: - uses: actions/checkout@v4 - name: Setup Node.js uses: ./.github/actions/setup-node - - name: Setup Rust + - name: Build Rust uses: ./.github/actions/build-rust with: target: 'x86_64-unknown-linux-gnu' @@ -90,7 +90,7 @@ jobs: - uses: actions/checkout@v4 - name: Setup Node.js uses: ./.github/actions/setup-node - - name: Setup Rust + - name: Build Rust uses: ./.github/actions/build-rust with: target: 'aarch64-unknown-linux-gnu' diff --git a/packages/backend/storage/package.json b/packages/backend/storage/package.json index 87f4002f67..5f2827ef08 100644 --- a/packages/backend/storage/package.json +++ b/packages/backend/storage/package.json @@ -35,7 +35,7 @@ "version": "napi version" }, "devDependencies": { - "@napi-rs/cli": "3.0.0-alpha.12", + "@napi-rs/cli": "3.0.0-alpha.15", "lib0": "^0.2.87", "nx": "^17.1.3", "nx-cloud": "^16.5.2", diff --git a/packages/frontend/native/package.json b/packages/frontend/native/package.json index eb01946abe..117d59b4e7 100644 --- a/packages/frontend/native/package.json +++ b/packages/frontend/native/package.json @@ -35,7 +35,7 @@ } }, "devDependencies": { - "@napi-rs/cli": "3.0.0-alpha.12", + "@napi-rs/cli": "3.0.0-alpha.15", "@types/node": "^20.9.3", "@types/uuid": "^9.0.7", "ava": "^6.0.0", diff --git a/yarn.lock b/yarn.lock index 1c3f3d4591..4fa2928e3a 100644 --- a/yarn.lock +++ b/yarn.lock @@ -656,7 +656,7 @@ __metadata: version: 0.0.0-use.local resolution: "@affine/native@workspace:packages/frontend/native" dependencies: - "@napi-rs/cli": "npm:3.0.0-alpha.12" + "@napi-rs/cli": "npm:3.0.0-alpha.15" "@types/node": "npm:^20.9.3" "@types/uuid": "npm:^9.0.7" ava: "npm:^6.0.0" @@ -821,7 +821,7 @@ __metadata: version: 0.0.0-use.local resolution: "@affine/storage@workspace:packages/backend/storage" dependencies: - "@napi-rs/cli": "npm:3.0.0-alpha.12" + "@napi-rs/cli": "npm:3.0.0-alpha.15" lib0: "npm:^0.2.87" nx: "npm:^17.1.3" nx-cloud: "npm:^16.5.2" @@ -7411,9 +7411,9 @@ __metadata: languageName: node linkType: hard -"@napi-rs/cli@npm:3.0.0-alpha.12": - version: 3.0.0-alpha.12 - resolution: "@napi-rs/cli@npm:3.0.0-alpha.12" +"@napi-rs/cli@npm:3.0.0-alpha.15": + version: 3.0.0-alpha.15 + resolution: "@napi-rs/cli@npm:3.0.0-alpha.15" dependencies: "@napi-rs/cross-toolchain": "npm:^0.0.12" "@octokit/rest": "npm:^20.0.2" @@ -7441,7 +7441,7 @@ __metadata: bin: napi: dist/cli.js napi-raw: cli.mjs - checksum: 50911df427f970f6926dc62e083c740b8b342e2181c65a56f4f0758d96995d110b5762fffafc1124628b6192987986b3bba93adf25921eda39c81034cd1dff54 + checksum: e4223d226bf4412241a130a559867c1d0ed74b2ad2068853db31eb385520b2b4ebaf886900741713d8c5a840c50765d3069e2361296a819ffdfcab0a020ef700 languageName: node linkType: hard From 285fd367ebebbfadcb1722c8d5b1726d10e8439b Mon Sep 17 00:00:00 2001 From: LongYinan Date: Fri, 8 Dec 2023 06:57:55 +0000 Subject: [PATCH 60/68] chore: bump up undici version to v6 (#5204) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [undici](https://undici.nodejs.org) ([source](https://togithub.com/nodejs/undici)) | [`^5.27.2` -> `^6.0.0`](https://renovatebot.com/diffs/npm/undici/5.28.0/6.0.1) | [![age](https://developer.mend.io/api/mc/badges/age/npm/undici/6.0.1?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/undici/6.0.1?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/undici/5.28.0/6.0.1?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/undici/5.28.0/6.0.1?slim=true)](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes
    nodejs/undici (undici) ### [`v6.0.1`](https://togithub.com/nodejs/undici/releases/tag/v6.0.1) [Compare Source](https://togithub.com/nodejs/undici/compare/v6.0.0...v6.0.1) #### What's Changed - fix: stream error timings by [@​ronag](https://togithub.com/ronag) in [https://github.com/nodejs/undici/pull/2497](https://togithub.com/nodejs/undici/pull/2497) **Full Changelog**: https://github.com/nodejs/undici/compare/v6.0.0...v6.0.1 ### [`v6.0.0`](https://togithub.com/nodejs/undici/releases/tag/v6.0.0) [Compare Source](https://togithub.com/nodejs/undici/compare/v5.28.2...v6.0.0) #### What's Changed - 16 eol by [@​ronag](https://togithub.com/ronag) in [https://github.com/nodejs/undici/pull/2480](https://togithub.com/nodejs/undici/pull/2480) - update spec & wpts by [@​KhafraDev](https://togithub.com/KhafraDev) in [https://github.com/nodejs/undici/pull/2482](https://togithub.com/nodejs/undici/pull/2482) - version cleanup by [@​KhafraDev](https://togithub.com/KhafraDev) in [https://github.com/nodejs/undici/pull/2483](https://togithub.com/nodejs/undici/pull/2483) - perf: avoid Response initialization by [@​tsctx](https://togithub.com/tsctx) in [https://github.com/nodejs/undici/pull/2489](https://togithub.com/nodejs/undici/pull/2489) - perf: optimize `parseHeaders` by [@​tsctx](https://togithub.com/tsctx) in [https://github.com/nodejs/undici/pull/2492](https://togithub.com/nodejs/undici/pull/2492) - chore: fix typo by [@​tsctx](https://togithub.com/tsctx) in [https://github.com/nodejs/undici/pull/2490](https://togithub.com/nodejs/undici/pull/2490) - feat: print attempted addresses on ConnectTimeoutError by [@​fengmk2](https://togithub.com/fengmk2) in [https://github.com/nodejs/undici/pull/2494](https://togithub.com/nodejs/undici/pull/2494) - Expose HTTP errors that are not meant to be retried by [@​MzUgM](https://togithub.com/MzUgM) in [https://github.com/nodejs/undici/pull/2496](https://togithub.com/nodejs/undici/pull/2496) **Full Changelog**: https://github.com/nodejs/undici/compare/v5.28.2...v6.0.0 ### [`v5.28.2`](https://togithub.com/nodejs/undici/releases/tag/v5.28.2) [Compare Source](https://togithub.com/nodejs/undici/compare/v5.28.1...v5.28.2) #### What's Changed - fix: remove optional chainning for compatible with Nodejs12 and below by [@​bugb](https://togithub.com/bugb) in [https://github.com/nodejs/undici/pull/2470](https://togithub.com/nodejs/undici/pull/2470) - fix: remove `node:` prefix by [@​tsctx](https://togithub.com/tsctx) in [https://github.com/nodejs/undici/pull/2471](https://togithub.com/nodejs/undici/pull/2471) - perf: avoid Headers initialization by [@​tsctx](https://togithub.com/tsctx) in [https://github.com/nodejs/undici/pull/2468](https://togithub.com/nodejs/undici/pull/2468) - fix: handle SharedArrayBuffer correctly by [@​tsctx](https://togithub.com/tsctx) in [https://github.com/nodejs/undici/pull/2466](https://togithub.com/nodejs/undici/pull/2466) - fix: Add `null` type to `signal` in `RequestInit` by [@​gebsh](https://togithub.com/gebsh) in [https://github.com/nodejs/undici/pull/2455](https://togithub.com/nodejs/undici/pull/2455) - fix: correctly handle data URL with hashes. by [@​tsctx](https://togithub.com/tsctx) in [https://github.com/nodejs/undici/pull/2475](https://togithub.com/nodejs/undici/pull/2475) - fix: check response for timinginfo allow flag by [@​ToshB](https://togithub.com/ToshB) in [https://github.com/nodejs/undici/pull/2477](https://togithub.com/nodejs/undici/pull/2477) - Make call to onBodySent conditional in RetryHandler by [@​MzUgM](https://togithub.com/MzUgM) in [https://github.com/nodejs/undici/pull/2478](https://togithub.com/nodejs/undici/pull/2478) - refactor: better integrity check by [@​tsctx](https://togithub.com/tsctx) in [https://github.com/nodejs/undici/pull/2462](https://togithub.com/nodejs/undici/pull/2462) - fix: Added support for inline URL username:password proxy auth by [@​matt-way](https://togithub.com/matt-way) in [https://github.com/nodejs/undici/pull/2473](https://togithub.com/nodejs/undici/pull/2473) - build(deps-dev): bump jsdom from 22.1.0 to 23.0.0 by [@​dependabot](https://togithub.com/dependabot) in [https://github.com/nodejs/undici/pull/2472](https://togithub.com/nodejs/undici/pull/2472) - build(deps-dev): bump sinon from 16.1.3 to 17.0.1 by [@​dependabot](https://togithub.com/dependabot) in [https://github.com/nodejs/undici/pull/2405](https://togithub.com/nodejs/undici/pull/2405) - build(deps): bump ossf/scorecard-action from 2.2.0 to 2.3.1 by [@​dependabot](https://togithub.com/dependabot) in [https://github.com/nodejs/undici/pull/2396](https://togithub.com/nodejs/undici/pull/2396) - build(deps): bump actions/setup-node from 3.8.1 to 4.0.0 by [@​dependabot](https://togithub.com/dependabot) in [https://github.com/nodejs/undici/pull/2395](https://togithub.com/nodejs/undici/pull/2395) - build(deps): bump step-security/harden-runner from 2.5.0 to 2.6.0 by [@​dependabot](https://togithub.com/dependabot) in [https://github.com/nodejs/undici/pull/2392](https://togithub.com/nodejs/undici/pull/2392) - build(deps-dev): bump formdata-node from 4.4.1 to 6.0.3 by [@​dependabot](https://togithub.com/dependabot) in [https://github.com/nodejs/undici/pull/2389](https://togithub.com/nodejs/undici/pull/2389) - build(deps): bump actions/upload-artifact from 3.1.2 to 3.1.3 by [@​dependabot](https://togithub.com/dependabot) in [https://github.com/nodejs/undici/pull/2302](https://togithub.com/nodejs/undici/pull/2302) #### New Contributors - [@​bugb](https://togithub.com/bugb) made their first contribution in [https://github.com/nodejs/undici/pull/2470](https://togithub.com/nodejs/undici/pull/2470) - [@​gebsh](https://togithub.com/gebsh) made their first contribution in [https://github.com/nodejs/undici/pull/2455](https://togithub.com/nodejs/undici/pull/2455) - [@​ToshB](https://togithub.com/ToshB) made their first contribution in [https://github.com/nodejs/undici/pull/2477](https://togithub.com/nodejs/undici/pull/2477) - [@​MzUgM](https://togithub.com/MzUgM) made their first contribution in [https://github.com/nodejs/undici/pull/2478](https://togithub.com/nodejs/undici/pull/2478) - [@​matt-way](https://togithub.com/matt-way) made their first contribution in [https://github.com/nodejs/undici/pull/2473](https://togithub.com/nodejs/undici/pull/2473) **Full Changelog**: https://github.com/nodejs/undici/compare/v5.28.1...v5.28.2 ### [`v5.28.1`](https://togithub.com/nodejs/undici/releases/tag/v5.28.1) [Compare Source](https://togithub.com/nodejs/undici/compare/v5.28.0...v5.28.1) #### What's Changed - perf: Improve `normalizeMethod` by [@​tsctx](https://togithub.com/tsctx) in [https://github.com/nodejs/undici/pull/2456](https://togithub.com/nodejs/undici/pull/2456) - fix: dispatch error handling by [@​ronag](https://togithub.com/ronag) in [https://github.com/nodejs/undici/pull/2459](https://togithub.com/nodejs/undici/pull/2459) - perf(request): optimize if headers are given by [@​tsctx](https://togithub.com/tsctx) in [https://github.com/nodejs/undici/pull/2454](https://togithub.com/nodejs/undici/pull/2454) **Full Changelog**: https://github.com/nodejs/undici/compare/v5.28.0...v5.28.1
    --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://developer.mend.io/github/toeverything/AFFiNE). --- packages/frontend/electron/package.json | 2 +- yarn.lock | 13 +++++++++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/packages/frontend/electron/package.json b/packages/frontend/electron/package.json index d41b310016..4eb74bdc3b 100644 --- a/packages/frontend/electron/package.json +++ b/packages/frontend/electron/package.json @@ -64,7 +64,7 @@ "semver": "^7.5.4", "tinykeys": "^2.1.0", "ts-node": "^10.9.1", - "undici": "^5.27.2", + "undici": "^6.0.0", "uuid": "^9.0.1", "vitest": "0.34.6", "which": "^4.0.0", diff --git a/yarn.lock b/yarn.lock index 4fa2928e3a..ddf34e3b7d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -500,7 +500,7 @@ __metadata: semver: "npm:^7.5.4" tinykeys: "npm:^2.1.0" ts-node: "npm:^10.9.1" - undici: "npm:^5.27.2" + undici: "npm:^6.0.0" uuid: "npm:^9.0.1" vitest: "npm:0.34.6" which: "npm:^4.0.0" @@ -35177,7 +35177,7 @@ __metadata: languageName: node linkType: hard -"undici@npm:^5.22.1, undici@npm:^5.27.2": +"undici@npm:^5.22.1": version: 5.28.0 resolution: "undici@npm:5.28.0" dependencies: @@ -35186,6 +35186,15 @@ __metadata: languageName: node linkType: hard +"undici@npm:^6.0.0": + version: 6.0.1 + resolution: "undici@npm:6.0.1" + dependencies: + "@fastify/busboy": "npm:^2.0.0" + checksum: 48d7f3c9aa9e1ca3fb2488c8aa25838e9163d3a7f1e41d695ed110006abc26648cf97c15d76abfd896fe16128e34136c8a7e0723e0583451ed9f34aaa37513ad + languageName: node + linkType: hard + "unicode-canonical-property-names-ecmascript@npm:^2.0.0": version: 2.0.0 resolution: "unicode-canonical-property-names-ecmascript@npm:2.0.0" From 2269e68bd9a8d05a96ece99aa7667392fe372902 Mon Sep 17 00:00:00 2001 From: LongYinan Date: Fri, 8 Dec 2023 08:06:46 +0000 Subject: [PATCH 61/68] chore: bump up p-queue version to v8 (#5235) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [p-queue](https://togithub.com/sindresorhus/p-queue) | [`^7.4.1` -> `^8.0.0`](https://renovatebot.com/diffs/npm/p-queue/7.4.1/8.0.0) | [![age](https://developer.mend.io/api/mc/badges/age/npm/p-queue/8.0.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/p-queue/8.0.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/p-queue/7.4.1/8.0.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/p-queue/7.4.1/8.0.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes
    sindresorhus/p-queue (p-queue) ### [`v8.0.0`](https://togithub.com/sindresorhus/p-queue/releases/tag/v8.0.0) [Compare Source](https://togithub.com/sindresorhus/p-queue/compare/v7.4.1...v8.0.0) ##### Breaking - Require Node.js 18 [`68dfe95`](https://togithub.com/sindresorhus/p-queue/commit/68dfe95) - Removed the `AbortError` export. It now throws the built-in DOMException when using the `signal` option. [`68dfe95`](https://togithub.com/sindresorhus/p-queue/commit/68dfe95) - TypeScript: Rename `DefaultAddOptions` type to `QueueAddOptions`
    --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://developer.mend.io/github/toeverything/AFFiNE). --- packages/frontend/hooks/package.json | 2 +- yarn.lock | 20 ++++++++++---------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/packages/frontend/hooks/package.json b/packages/frontend/hooks/package.json index de23d82f87..51eaf9ae09 100644 --- a/packages/frontend/hooks/package.json +++ b/packages/frontend/hooks/package.json @@ -11,7 +11,7 @@ "jotai": "^2.5.1", "jotai-effect": "^0.2.3", "lodash.debounce": "^4.0.8", - "p-queue": "^7.4.1", + "p-queue": "^8.0.0", "react": "18.2.0", "rxjs": "^7.8.1", "swr": "2.2.4", diff --git a/yarn.lock b/yarn.lock index ddf34e3b7d..8caeefb7e1 100644 --- a/yarn.lock +++ b/yarn.lock @@ -13758,7 +13758,7 @@ __metadata: jotai: "npm:^2.5.1" jotai-effect: "npm:^0.2.3" lodash.debounce: "npm:^4.0.8" - p-queue: "npm:^7.4.1" + p-queue: "npm:^8.0.0" react: "npm:18.2.0" rxjs: "npm:^7.8.1" swr: "npm:2.2.4" @@ -29869,13 +29869,13 @@ __metadata: languageName: node linkType: hard -"p-queue@npm:^7.4.1": - version: 7.4.1 - resolution: "p-queue@npm:7.4.1" +"p-queue@npm:^8.0.0": + version: 8.0.0 + resolution: "p-queue@npm:8.0.0" dependencies: eventemitter3: "npm:^5.0.1" - p-timeout: "npm:^5.0.2" - checksum: 82934551f20a38cc19b31cda7200f2db93ca99b8c642d3ac861d12a7a9160eb32235738a8cd53f1a7ea0c7b52d6c0bb27644b6461e9a51e6a59f1e8d65904b78 + p-timeout: "npm:^6.1.2" + checksum: 3d11784d48e5713989f712ccf33899157e88860a84c0e694fb8a1477f01ef1594a7633698ec1a4aebd38020f452a87adbe07733137c069f2fa5c392fe8e3fe99 languageName: node linkType: hard @@ -29898,10 +29898,10 @@ __metadata: languageName: node linkType: hard -"p-timeout@npm:^5.0.2": - version: 5.1.0 - resolution: "p-timeout@npm:5.1.0" - checksum: f5cd4e17301ff1ff1d8dbf2817df0ad88c6bba99349fc24d8d181827176ad4f8aca649190b8a5b1a428dfd6ddc091af4606835d3e0cb0656e04045da5c9e270c +"p-timeout@npm:^6.1.2": + version: 6.1.2 + resolution: "p-timeout@npm:6.1.2" + checksum: ca3ede368d792bd86fcfa4e133220536382225d31e5f62e2cedb8280df267b25f6684aa0056b22e8aa538cc85014b310058d8fdddeb0a1ff363093d56e87ac3a languageName: node linkType: hard From feed400462d2eae7336a1f11b4777517877e127e Mon Sep 17 00:00:00 2001 From: LongYinan Date: Fri, 8 Dec 2023 09:57:11 +0000 Subject: [PATCH 62/68] chore: bump up vite version to v5 (#5203) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [vite](https://vitejs.dev) ([source](https://togithub.com/vitejs/vite/tree/HEAD/packages/vite)) | [`^4.4.11` -> `^5.0.0`](https://renovatebot.com/diffs/npm/vite/4.5.1/5.0.6) | [![age](https://developer.mend.io/api/mc/badges/age/npm/vite/5.0.6?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/vite/5.0.6?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/vite/4.5.1/5.0.6?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/vite/4.5.1/5.0.6?slim=true)](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes
    vitejs/vite (vite) ### [`v5.0.6`](https://togithub.com/vitejs/vite/blob/HEAD/packages/vite/CHANGELOG.md#small506-2023-12-06-small) [Compare Source](https://togithub.com/vitejs/vite/compare/v5.0.5...v5.0.6) - perf: in-memory public files check ([#​15195](https://togithub.com/vitejs/vite/issues/15195)) ([0f9e1bf](https://togithub.com/vitejs/vite/commit/0f9e1bf)), closes [#​15195](https://togithub.com/vitejs/vite/issues/15195) - chore: remove unneccessary eslint-disable-next-line regexp/no-unused-capturing-group ([#​15247](https://togithub.com/vitejs/vite/issues/15247)) ([35a5bcf](https://togithub.com/vitejs/vite/commit/35a5bcf)), closes [#​15247](https://togithub.com/vitejs/vite/issues/15247) ### [`v5.0.5`](https://togithub.com/vitejs/vite/blob/HEAD/packages/vite/CHANGELOG.md#small505-2023-12-04-small) [Compare Source](https://togithub.com/vitejs/vite/compare/v5.0.4...v5.0.5) - fix: emit `vite:preloadError` for chunks without deps ([#​15203](https://togithub.com/vitejs/vite/issues/15203)) ([d8001c5](https://togithub.com/vitejs/vite/commit/d8001c5)), closes [#​15203](https://togithub.com/vitejs/vite/issues/15203) - fix: esbuild glob import resolve error ([#​15140](https://togithub.com/vitejs/vite/issues/15140)) ([676804d](https://togithub.com/vitejs/vite/commit/676804d)), closes [#​15140](https://togithub.com/vitejs/vite/issues/15140) - fix: json error with position ([#​15225](https://togithub.com/vitejs/vite/issues/15225)) ([14be75f](https://togithub.com/vitejs/vite/commit/14be75f)), closes [#​15225](https://togithub.com/vitejs/vite/issues/15225) - fix: proxy html path should be encoded ([#​15223](https://togithub.com/vitejs/vite/issues/15223)) ([5b85040](https://togithub.com/vitejs/vite/commit/5b85040)), closes [#​15223](https://togithub.com/vitejs/vite/issues/15223) - fix(deps): update all non-major dependencies ([#​15233](https://togithub.com/vitejs/vite/issues/15233)) ([ad3adda](https://togithub.com/vitejs/vite/commit/ad3adda)), closes [#​15233](https://togithub.com/vitejs/vite/issues/15233) - fix(hmr): don't consider CSS dep as a circular dep ([#​15229](https://togithub.com/vitejs/vite/issues/15229)) ([5f2cdec](https://togithub.com/vitejs/vite/commit/5f2cdec)), closes [#​15229](https://togithub.com/vitejs/vite/issues/15229) - feat: add '\*.mov' to client.d.ts ([#​15189](https://togithub.com/vitejs/vite/issues/15189)) ([d93a211](https://togithub.com/vitejs/vite/commit/d93a211)), closes [#​15189](https://togithub.com/vitejs/vite/issues/15189) - feat(server): allow disabling built-in shortcuts ([#​15218](https://togithub.com/vitejs/vite/issues/15218)) ([7fd7c6c](https://togithub.com/vitejs/vite/commit/7fd7c6c)), closes [#​15218](https://togithub.com/vitejs/vite/issues/15218) - chore: replace 'some' with 'includes' in resolveEnvPrefix ([#​15220](https://togithub.com/vitejs/vite/issues/15220)) ([ee12f30](https://togithub.com/vitejs/vite/commit/ee12f30)), closes [#​15220](https://togithub.com/vitejs/vite/issues/15220) - chore: update the website url for homepage in package.json ([#​15181](https://togithub.com/vitejs/vite/issues/15181)) ([282bd8f](https://togithub.com/vitejs/vite/commit/282bd8f)), closes [#​15181](https://togithub.com/vitejs/vite/issues/15181) - chore: update vitest to 1.0.0-beta.6 ([#​15194](https://togithub.com/vitejs/vite/issues/15194)) ([2fce647](https://togithub.com/vitejs/vite/commit/2fce647)), closes [#​15194](https://togithub.com/vitejs/vite/issues/15194) - refactor: make HMR agnostic to environment ([#​15179](https://togithub.com/vitejs/vite/issues/15179)) ([0571b7c](https://togithub.com/vitejs/vite/commit/0571b7c)), closes [#​15179](https://togithub.com/vitejs/vite/issues/15179) - refactor: use dedicated regex methods ([#​15228](https://togithub.com/vitejs/vite/issues/15228)) ([0348137](https://togithub.com/vitejs/vite/commit/0348137)), closes [#​15228](https://togithub.com/vitejs/vite/issues/15228) - perf: remove debug only prettifyUrl call ([#​15204](https://togithub.com/vitejs/vite/issues/15204)) ([73e971f](https://togithub.com/vitejs/vite/commit/73e971f)), closes [#​15204](https://togithub.com/vitejs/vite/issues/15204) - perf: skip computing sourceRoot in injectSourcesContent ([#​15207](https://togithub.com/vitejs/vite/issues/15207)) ([1df1fd1](https://togithub.com/vitejs/vite/commit/1df1fd1)), closes [#​15207](https://togithub.com/vitejs/vite/issues/15207) ### [`v5.0.4`](https://togithub.com/vitejs/vite/blob/HEAD/packages/vite/CHANGELOG.md#small504-2023-11-29-small) [Compare Source](https://togithub.com/vitejs/vite/compare/v5.0.3...v5.0.4) - fix: bindCLIShortcuts to proper server ([#​15162](https://togithub.com/vitejs/vite/issues/15162)) ([67ac572](https://togithub.com/vitejs/vite/commit/67ac572)), closes [#​15162](https://togithub.com/vitejs/vite/issues/15162) - fix: revert "fix: js fallback sourcemap content should be using original content ([#​15135](https://togithub.com/vitejs/vite/issues/15135))" ([#​15178](https://togithub.com/vitejs/vite/issues/15178)) ([d2a2493](https://togithub.com/vitejs/vite/commit/d2a2493)), closes [#​15135](https://togithub.com/vitejs/vite/issues/15135) [#​15178](https://togithub.com/vitejs/vite/issues/15178) - fix(define): allow define process.env ([#​15173](https://togithub.com/vitejs/vite/issues/15173)) ([ec401da](https://togithub.com/vitejs/vite/commit/ec401da)), closes [#​15173](https://togithub.com/vitejs/vite/issues/15173) - fix(resolve): respect order of browser in mainFields when resolving ([#​15137](https://togithub.com/vitejs/vite/issues/15137)) ([4a111aa](https://togithub.com/vitejs/vite/commit/4a111aa)), closes [#​15137](https://togithub.com/vitejs/vite/issues/15137) - feat: preserve vite.middlewares connect instance after restarts ([#​15166](https://togithub.com/vitejs/vite/issues/15166)) ([9474c4b](https://togithub.com/vitejs/vite/commit/9474c4b)), closes [#​15166](https://togithub.com/vitejs/vite/issues/15166) - refactor: align with Promise.withResolvers() ([#​15171](https://togithub.com/vitejs/vite/issues/15171)) ([642f9bc](https://togithub.com/vitejs/vite/commit/642f9bc)), closes [#​15171](https://togithub.com/vitejs/vite/issues/15171) ### [`v5.0.3`](https://togithub.com/vitejs/vite/blob/HEAD/packages/vite/CHANGELOG.md#small503-2023-11-28-small) [Compare Source](https://togithub.com/vitejs/vite/compare/v5.0.2...v5.0.3) - fix: `generateCodeFrame` infinite loop ([#​15093](https://togithub.com/vitejs/vite/issues/15093)) ([6619de7](https://togithub.com/vitejs/vite/commit/6619de7)), closes [#​15093](https://togithub.com/vitejs/vite/issues/15093) - fix: js fallback sourcemap content should be using original content ([#​15135](https://togithub.com/vitejs/vite/issues/15135)) ([227d56d](https://togithub.com/vitejs/vite/commit/227d56d)), closes [#​15135](https://togithub.com/vitejs/vite/issues/15135) - fix(css): render correct asset url when CSS chunk name is nested ([#​15154](https://togithub.com/vitejs/vite/issues/15154)) ([ef403c0](https://togithub.com/vitejs/vite/commit/ef403c0)), closes [#​15154](https://togithub.com/vitejs/vite/issues/15154) - fix(css): use non-nested chunk name if facadeModule is not CSS file ([#​15155](https://togithub.com/vitejs/vite/issues/15155)) ([811e392](https://togithub.com/vitejs/vite/commit/811e392)), closes [#​15155](https://togithub.com/vitejs/vite/issues/15155) - fix(dev): bind plugin context functions ([#​14569](https://togithub.com/vitejs/vite/issues/14569)) ([cb3243c](https://togithub.com/vitejs/vite/commit/cb3243c)), closes [#​14569](https://togithub.com/vitejs/vite/issues/14569) - chore(deps): update all non-major dependencies ([#​15145](https://togithub.com/vitejs/vite/issues/15145)) ([7ff2c0a](https://togithub.com/vitejs/vite/commit/7ff2c0a)), closes [#​15145](https://togithub.com/vitejs/vite/issues/15145) - build: handle latest json-stable-stringify replacement ([#​15049](https://togithub.com/vitejs/vite/issues/15049)) ([bcc4a61](https://togithub.com/vitejs/vite/commit/bcc4a61)), closes [#​15049](https://togithub.com/vitejs/vite/issues/15049) ### [`v5.0.2`](https://togithub.com/vitejs/vite/blob/HEAD/packages/vite/CHANGELOG.md#small502-2023-11-21-small) [Compare Source](https://togithub.com/vitejs/vite/compare/v5.0.1...v5.0.2) - fix: make htmlFallback more permissive ([#​15059](https://togithub.com/vitejs/vite/issues/15059)) ([6fcceeb](https://togithub.com/vitejs/vite/commit/6fcceeb)), closes [#​15059](https://togithub.com/vitejs/vite/issues/15059) ### [`v5.0.1`](https://togithub.com/vitejs/vite/blob/HEAD/packages/vite/CHANGELOG.md#small501-2023-11-21-small) - test: avoid read check when running as root ([#​14884](https://togithub.com/vitejs/vite/issues/14884)) ([1d9516c](https://togithub.com/vitejs/vite/commit/1d9516c)), closes [#​14884](https://togithub.com/vitejs/vite/issues/14884) - perf(hmr): skip traversed modules when checking circular imports ([#​15034](https://togithub.com/vitejs/vite/issues/15034)) ([41e437f](https://togithub.com/vitejs/vite/commit/41e437f)), closes [#​15034](https://togithub.com/vitejs/vite/issues/15034) - fix: run htmlFallbackMiddleware for no accept header requests ([#​15025](https://togithub.com/vitejs/vite/issues/15025)) ([b93dfe3](https://togithub.com/vitejs/vite/commit/b93dfe3)), closes [#​15025](https://togithub.com/vitejs/vite/issues/15025) - fix: update type CSSModulesOptions interface ([#​14987](https://togithub.com/vitejs/vite/issues/14987)) ([d0b2153](https://togithub.com/vitejs/vite/commit/d0b2153)), closes [#​14987](https://togithub.com/vitejs/vite/issues/14987) - fix(legacy): error in build with --watch and manifest enabled ([#​14450](https://togithub.com/vitejs/vite/issues/14450)) ([b9ee620](https://togithub.com/vitejs/vite/commit/b9ee620)), closes [#​14450](https://togithub.com/vitejs/vite/issues/14450) - chore: add comment about crossorigin attribute for script module ([#​15040](https://togithub.com/vitejs/vite/issues/15040)) ([03c371e](https://togithub.com/vitejs/vite/commit/03c371e)), closes [#​15040](https://togithub.com/vitejs/vite/issues/15040) - chore: cleanup v5 beta changelog ([#​14694](https://togithub.com/vitejs/vite/issues/14694)) ([531d3cb](https://togithub.com/vitejs/vite/commit/531d3cb)), closes [#​14694](https://togithub.com/vitejs/vite/issues/14694) ### [`v5.0.0`](https://togithub.com/vitejs/vite/blob/HEAD/packages/vite/CHANGELOG.md#500-2023-11-16)
    --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about these updates again. --- - [ ] If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://developer.mend.io/github/toeverything/AFFiNE). --- package.json | 4 +- packages/common/infra/package.json | 2 +- packages/common/sdk/package.json | 2 +- packages/common/y-indexeddb/package.json | 2 +- packages/common/y-provider/package.json | 2 +- packages/frontend/component/package.json | 2 +- tools/cli/package.json | 2 +- yarn.lock | 249 +++++++++++------------ 8 files changed, 128 insertions(+), 137 deletions(-) diff --git a/package.json b/package.json index 0b394bb8dc..9b08143d76 100644 --- a/package.json +++ b/package.json @@ -107,7 +107,7 @@ "string-width": "^7.0.0", "ts-node": "^10.9.1", "typescript": "^5.3.2", - "vite": "^5.0.1", + "vite": "^5.0.6", "vite-plugin-istanbul": "^5.0.0", "vite-plugin-static-copy": "^0.17.1", "vite-tsconfig-paths": "^4.2.1", @@ -117,7 +117,7 @@ }, "packageManager": "yarn@4.0.1", "resolutions": { - "vite": "^4.4.11", + "vite": "^5.0.6", "array-buffer-byte-length": "npm:@nolyfill/array-buffer-byte-length@latest", "array-includes": "npm:@nolyfill/array-includes@latest", "array.prototype.flat": "npm:@nolyfill/array.prototype.flat@latest", diff --git a/packages/common/infra/package.json b/packages/common/infra/package.json index 7da35fcbf9..5852cffc6e 100644 --- a/packages/common/infra/package.json +++ b/packages/common/infra/package.json @@ -75,7 +75,7 @@ "nanoid": "^5.0.3", "react": "^18.2.0", "rxjs": "^7.8.1", - "vite": "^4.4.11", + "vite": "^5.0.6", "vite-plugin-dts": "3.6.0", "vitest": "0.34.6", "yjs": "^13.6.10" diff --git a/packages/common/sdk/package.json b/packages/common/sdk/package.json index 9221f906be..1e09fab600 100644 --- a/packages/common/sdk/package.json +++ b/packages/common/sdk/package.json @@ -31,7 +31,7 @@ "zod": "^3.22.4" }, "devDependencies": { - "vite": "^4.4.11", + "vite": "^5.0.6", "vite-plugin-dts": "3.6.0" } } diff --git a/packages/common/y-indexeddb/package.json b/packages/common/y-indexeddb/package.json index 57359f9f33..34db30b2bf 100644 --- a/packages/common/y-indexeddb/package.json +++ b/packages/common/y-indexeddb/package.json @@ -40,7 +40,7 @@ "@blocksuite/blocks": "0.11.0-nightly-202312070955-2b5bb47", "@blocksuite/store": "0.11.0-nightly-202312070955-2b5bb47", "fake-indexeddb": "^5.0.0", - "vite": "^4.4.11", + "vite": "^5.0.6", "vite-plugin-dts": "3.6.0", "vitest": "0.34.6", "y-indexeddb": "^9.0.11", diff --git a/packages/common/y-provider/package.json b/packages/common/y-provider/package.json index fcdd780ccd..73b37c9190 100644 --- a/packages/common/y-provider/package.json +++ b/packages/common/y-provider/package.json @@ -25,7 +25,7 @@ }, "devDependencies": { "@blocksuite/store": "0.11.0-nightly-202312070955-2b5bb47", - "vite": "^4.4.11", + "vite": "^5.0.6", "vite-plugin-dts": "3.6.0", "vitest": "0.34.6", "yjs": "^13.6.10" diff --git a/packages/frontend/component/package.json b/packages/frontend/component/package.json index 62289f3a16..6c6bea5ab5 100644 --- a/packages/frontend/component/package.json +++ b/packages/frontend/component/package.json @@ -101,7 +101,7 @@ "storybook": "^7.5.3", "storybook-dark-mode": "^3.0.1", "typescript": "^5.3.2", - "vite": "^4.4.11", + "vite": "^5.0.6", "vitest": "0.34.6", "yjs": "^13.6.10" }, diff --git a/tools/cli/package.json b/tools/cli/package.json index ef8db93657..12e741b926 100644 --- a/tools/cli/package.json +++ b/tools/cli/package.json @@ -17,7 +17,7 @@ }, "dependencies": { "dotenv": "^16.3.1", - "vite": "^4.4.11" + "vite": "^5.0.6" }, "peerDependencies": { "ts-node": "*" diff --git a/yarn.lock b/yarn.lock index 8caeefb7e1..2bdcf4d680 100644 --- a/yarn.lock +++ b/yarn.lock @@ -186,7 +186,7 @@ __metadata: "@magic-works/i18n-codegen": "npm:^0.5.0" dotenv: "npm:^16.3.1" ts-node: "npm:^10.9.1" - vite: "npm:^4.4.11" + vite: "npm:^5.0.6" peerDependencies: ts-node: "*" bin: @@ -298,7 +298,7 @@ __metadata: storybook-dark-mode: "npm:^3.0.1" typescript: "npm:^5.3.2" uuid: "npm:^9.0.1" - vite: "npm:^4.4.11" + vite: "npm:^5.0.6" vitest: "npm:0.34.6" yjs: "npm:^13.6.10" peerDependencies: @@ -642,7 +642,7 @@ __metadata: string-width: "npm:^7.0.0" ts-node: "npm:^10.9.1" typescript: "npm:^5.3.2" - vite: "npm:^5.0.1" + vite: "npm:^5.0.6" vite-plugin-istanbul: "npm:^5.0.0" vite-plugin-static-copy: "npm:^0.17.1" vite-tsconfig-paths: "npm:^4.2.1" @@ -713,7 +713,7 @@ __metadata: "@blocksuite/presets": "npm:0.11.0-nightly-202312070955-2b5bb47" "@blocksuite/store": "npm:0.11.0-nightly-202312070955-2b5bb47" jotai: "npm:^2.5.1" - vite: "npm:^4.4.11" + vite: "npm:^5.0.6" vite-plugin-dts: "npm:3.6.0" zod: "npm:^3.22.4" languageName: unknown @@ -5250,9 +5250,9 @@ __metadata: languageName: node linkType: hard -"@esbuild/android-arm64@npm:0.19.7": - version: 0.19.7 - resolution: "@esbuild/android-arm64@npm:0.19.7" +"@esbuild/android-arm64@npm:0.19.8": + version: 0.19.8 + resolution: "@esbuild/android-arm64@npm:0.19.8" conditions: os=android & cpu=arm64 languageName: node linkType: hard @@ -5278,9 +5278,9 @@ __metadata: languageName: node linkType: hard -"@esbuild/android-arm@npm:0.19.7": - version: 0.19.7 - resolution: "@esbuild/android-arm@npm:0.19.7" +"@esbuild/android-arm@npm:0.19.8": + version: 0.19.8 + resolution: "@esbuild/android-arm@npm:0.19.8" conditions: os=android & cpu=arm languageName: node linkType: hard @@ -5306,9 +5306,9 @@ __metadata: languageName: node linkType: hard -"@esbuild/android-x64@npm:0.19.7": - version: 0.19.7 - resolution: "@esbuild/android-x64@npm:0.19.7" +"@esbuild/android-x64@npm:0.19.8": + version: 0.19.8 + resolution: "@esbuild/android-x64@npm:0.19.8" conditions: os=android & cpu=x64 languageName: node linkType: hard @@ -5334,9 +5334,9 @@ __metadata: languageName: node linkType: hard -"@esbuild/darwin-arm64@npm:0.19.7": - version: 0.19.7 - resolution: "@esbuild/darwin-arm64@npm:0.19.7" +"@esbuild/darwin-arm64@npm:0.19.8": + version: 0.19.8 + resolution: "@esbuild/darwin-arm64@npm:0.19.8" conditions: os=darwin & cpu=arm64 languageName: node linkType: hard @@ -5362,9 +5362,9 @@ __metadata: languageName: node linkType: hard -"@esbuild/darwin-x64@npm:0.19.7": - version: 0.19.7 - resolution: "@esbuild/darwin-x64@npm:0.19.7" +"@esbuild/darwin-x64@npm:0.19.8": + version: 0.19.8 + resolution: "@esbuild/darwin-x64@npm:0.19.8" conditions: os=darwin & cpu=x64 languageName: node linkType: hard @@ -5390,9 +5390,9 @@ __metadata: languageName: node linkType: hard -"@esbuild/freebsd-arm64@npm:0.19.7": - version: 0.19.7 - resolution: "@esbuild/freebsd-arm64@npm:0.19.7" +"@esbuild/freebsd-arm64@npm:0.19.8": + version: 0.19.8 + resolution: "@esbuild/freebsd-arm64@npm:0.19.8" conditions: os=freebsd & cpu=arm64 languageName: node linkType: hard @@ -5418,9 +5418,9 @@ __metadata: languageName: node linkType: hard -"@esbuild/freebsd-x64@npm:0.19.7": - version: 0.19.7 - resolution: "@esbuild/freebsd-x64@npm:0.19.7" +"@esbuild/freebsd-x64@npm:0.19.8": + version: 0.19.8 + resolution: "@esbuild/freebsd-x64@npm:0.19.8" conditions: os=freebsd & cpu=x64 languageName: node linkType: hard @@ -5446,9 +5446,9 @@ __metadata: languageName: node linkType: hard -"@esbuild/linux-arm64@npm:0.19.7": - version: 0.19.7 - resolution: "@esbuild/linux-arm64@npm:0.19.7" +"@esbuild/linux-arm64@npm:0.19.8": + version: 0.19.8 + resolution: "@esbuild/linux-arm64@npm:0.19.8" conditions: os=linux & cpu=arm64 languageName: node linkType: hard @@ -5474,9 +5474,9 @@ __metadata: languageName: node linkType: hard -"@esbuild/linux-arm@npm:0.19.7": - version: 0.19.7 - resolution: "@esbuild/linux-arm@npm:0.19.7" +"@esbuild/linux-arm@npm:0.19.8": + version: 0.19.8 + resolution: "@esbuild/linux-arm@npm:0.19.8" conditions: os=linux & cpu=arm languageName: node linkType: hard @@ -5502,9 +5502,9 @@ __metadata: languageName: node linkType: hard -"@esbuild/linux-ia32@npm:0.19.7": - version: 0.19.7 - resolution: "@esbuild/linux-ia32@npm:0.19.7" +"@esbuild/linux-ia32@npm:0.19.8": + version: 0.19.8 + resolution: "@esbuild/linux-ia32@npm:0.19.8" conditions: os=linux & cpu=ia32 languageName: node linkType: hard @@ -5530,9 +5530,9 @@ __metadata: languageName: node linkType: hard -"@esbuild/linux-loong64@npm:0.19.7": - version: 0.19.7 - resolution: "@esbuild/linux-loong64@npm:0.19.7" +"@esbuild/linux-loong64@npm:0.19.8": + version: 0.19.8 + resolution: "@esbuild/linux-loong64@npm:0.19.8" conditions: os=linux & cpu=loong64 languageName: node linkType: hard @@ -5558,9 +5558,9 @@ __metadata: languageName: node linkType: hard -"@esbuild/linux-mips64el@npm:0.19.7": - version: 0.19.7 - resolution: "@esbuild/linux-mips64el@npm:0.19.7" +"@esbuild/linux-mips64el@npm:0.19.8": + version: 0.19.8 + resolution: "@esbuild/linux-mips64el@npm:0.19.8" conditions: os=linux & cpu=mips64el languageName: node linkType: hard @@ -5586,9 +5586,9 @@ __metadata: languageName: node linkType: hard -"@esbuild/linux-ppc64@npm:0.19.7": - version: 0.19.7 - resolution: "@esbuild/linux-ppc64@npm:0.19.7" +"@esbuild/linux-ppc64@npm:0.19.8": + version: 0.19.8 + resolution: "@esbuild/linux-ppc64@npm:0.19.8" conditions: os=linux & cpu=ppc64 languageName: node linkType: hard @@ -5614,9 +5614,9 @@ __metadata: languageName: node linkType: hard -"@esbuild/linux-riscv64@npm:0.19.7": - version: 0.19.7 - resolution: "@esbuild/linux-riscv64@npm:0.19.7" +"@esbuild/linux-riscv64@npm:0.19.8": + version: 0.19.8 + resolution: "@esbuild/linux-riscv64@npm:0.19.8" conditions: os=linux & cpu=riscv64 languageName: node linkType: hard @@ -5642,9 +5642,9 @@ __metadata: languageName: node linkType: hard -"@esbuild/linux-s390x@npm:0.19.7": - version: 0.19.7 - resolution: "@esbuild/linux-s390x@npm:0.19.7" +"@esbuild/linux-s390x@npm:0.19.8": + version: 0.19.8 + resolution: "@esbuild/linux-s390x@npm:0.19.8" conditions: os=linux & cpu=s390x languageName: node linkType: hard @@ -5670,9 +5670,9 @@ __metadata: languageName: node linkType: hard -"@esbuild/linux-x64@npm:0.19.7": - version: 0.19.7 - resolution: "@esbuild/linux-x64@npm:0.19.7" +"@esbuild/linux-x64@npm:0.19.8": + version: 0.19.8 + resolution: "@esbuild/linux-x64@npm:0.19.8" conditions: os=linux & cpu=x64 languageName: node linkType: hard @@ -5698,9 +5698,9 @@ __metadata: languageName: node linkType: hard -"@esbuild/netbsd-x64@npm:0.19.7": - version: 0.19.7 - resolution: "@esbuild/netbsd-x64@npm:0.19.7" +"@esbuild/netbsd-x64@npm:0.19.8": + version: 0.19.8 + resolution: "@esbuild/netbsd-x64@npm:0.19.8" conditions: os=netbsd & cpu=x64 languageName: node linkType: hard @@ -5726,9 +5726,9 @@ __metadata: languageName: node linkType: hard -"@esbuild/openbsd-x64@npm:0.19.7": - version: 0.19.7 - resolution: "@esbuild/openbsd-x64@npm:0.19.7" +"@esbuild/openbsd-x64@npm:0.19.8": + version: 0.19.8 + resolution: "@esbuild/openbsd-x64@npm:0.19.8" conditions: os=openbsd & cpu=x64 languageName: node linkType: hard @@ -5754,9 +5754,9 @@ __metadata: languageName: node linkType: hard -"@esbuild/sunos-x64@npm:0.19.7": - version: 0.19.7 - resolution: "@esbuild/sunos-x64@npm:0.19.7" +"@esbuild/sunos-x64@npm:0.19.8": + version: 0.19.8 + resolution: "@esbuild/sunos-x64@npm:0.19.8" conditions: os=sunos & cpu=x64 languageName: node linkType: hard @@ -5782,9 +5782,9 @@ __metadata: languageName: node linkType: hard -"@esbuild/win32-arm64@npm:0.19.7": - version: 0.19.7 - resolution: "@esbuild/win32-arm64@npm:0.19.7" +"@esbuild/win32-arm64@npm:0.19.8": + version: 0.19.8 + resolution: "@esbuild/win32-arm64@npm:0.19.8" conditions: os=win32 & cpu=arm64 languageName: node linkType: hard @@ -5810,9 +5810,9 @@ __metadata: languageName: node linkType: hard -"@esbuild/win32-ia32@npm:0.19.7": - version: 0.19.7 - resolution: "@esbuild/win32-ia32@npm:0.19.7" +"@esbuild/win32-ia32@npm:0.19.8": + version: 0.19.8 + resolution: "@esbuild/win32-ia32@npm:0.19.8" conditions: os=win32 & cpu=ia32 languageName: node linkType: hard @@ -5838,9 +5838,9 @@ __metadata: languageName: node linkType: hard -"@esbuild/win32-x64@npm:0.19.7": - version: 0.19.7 - resolution: "@esbuild/win32-x64@npm:0.19.7" +"@esbuild/win32-x64@npm:0.19.8": + version: 0.19.8 + resolution: "@esbuild/win32-x64@npm:0.19.8" conditions: os=win32 & cpu=x64 languageName: node linkType: hard @@ -13812,7 +13812,7 @@ __metadata: react: "npm:^18.2.0" rxjs: "npm:^7.8.1" tinykeys: "npm:^2.1.0" - vite: "npm:^4.4.11" + vite: "npm:^5.0.6" vite-plugin-dts: "npm:3.6.0" vitest: "npm:0.34.6" yjs: "npm:^13.6.10" @@ -13856,7 +13856,7 @@ __metadata: fake-indexeddb: "npm:^5.0.0" idb: "npm:^8.0.0" nanoid: "npm:^5.0.3" - vite: "npm:^4.4.11" + vite: "npm:^5.0.6" vite-plugin-dts: "npm:3.6.0" vitest: "npm:0.34.6" y-indexeddb: "npm:^9.0.11" @@ -20612,7 +20612,7 @@ __metadata: languageName: node linkType: hard -"esbuild@npm:^0.18.0, esbuild@npm:^0.18.10": +"esbuild@npm:^0.18.0": version: 0.18.20 resolution: "esbuild@npm:0.18.20" dependencies: @@ -20689,32 +20689,32 @@ __metadata: languageName: node linkType: hard -"esbuild@npm:^0.19.7": - version: 0.19.7 - resolution: "esbuild@npm:0.19.7" +"esbuild@npm:^0.19.3, esbuild@npm:^0.19.7": + version: 0.19.8 + resolution: "esbuild@npm:0.19.8" dependencies: - "@esbuild/android-arm": "npm:0.19.7" - "@esbuild/android-arm64": "npm:0.19.7" - "@esbuild/android-x64": "npm:0.19.7" - "@esbuild/darwin-arm64": "npm:0.19.7" - "@esbuild/darwin-x64": "npm:0.19.7" - "@esbuild/freebsd-arm64": "npm:0.19.7" - "@esbuild/freebsd-x64": "npm:0.19.7" - "@esbuild/linux-arm": "npm:0.19.7" - "@esbuild/linux-arm64": "npm:0.19.7" - "@esbuild/linux-ia32": "npm:0.19.7" - "@esbuild/linux-loong64": "npm:0.19.7" - "@esbuild/linux-mips64el": "npm:0.19.7" - "@esbuild/linux-ppc64": "npm:0.19.7" - "@esbuild/linux-riscv64": "npm:0.19.7" - "@esbuild/linux-s390x": "npm:0.19.7" - "@esbuild/linux-x64": "npm:0.19.7" - "@esbuild/netbsd-x64": "npm:0.19.7" - "@esbuild/openbsd-x64": "npm:0.19.7" - "@esbuild/sunos-x64": "npm:0.19.7" - "@esbuild/win32-arm64": "npm:0.19.7" - "@esbuild/win32-ia32": "npm:0.19.7" - "@esbuild/win32-x64": "npm:0.19.7" + "@esbuild/android-arm": "npm:0.19.8" + "@esbuild/android-arm64": "npm:0.19.8" + "@esbuild/android-x64": "npm:0.19.8" + "@esbuild/darwin-arm64": "npm:0.19.8" + "@esbuild/darwin-x64": "npm:0.19.8" + "@esbuild/freebsd-arm64": "npm:0.19.8" + "@esbuild/freebsd-x64": "npm:0.19.8" + "@esbuild/linux-arm": "npm:0.19.8" + "@esbuild/linux-arm64": "npm:0.19.8" + "@esbuild/linux-ia32": "npm:0.19.8" + "@esbuild/linux-loong64": "npm:0.19.8" + "@esbuild/linux-mips64el": "npm:0.19.8" + "@esbuild/linux-ppc64": "npm:0.19.8" + "@esbuild/linux-riscv64": "npm:0.19.8" + "@esbuild/linux-s390x": "npm:0.19.8" + "@esbuild/linux-x64": "npm:0.19.8" + "@esbuild/netbsd-x64": "npm:0.19.8" + "@esbuild/openbsd-x64": "npm:0.19.8" + "@esbuild/sunos-x64": "npm:0.19.8" + "@esbuild/win32-arm64": "npm:0.19.8" + "@esbuild/win32-ia32": "npm:0.19.8" + "@esbuild/win32-x64": "npm:0.19.8" dependenciesMeta: "@esbuild/android-arm": optional: true @@ -20762,7 +20762,7 @@ __metadata: optional: true bin: esbuild: bin/esbuild - checksum: 326b9d98a77c5f2fb9a535b292bdc67c88bdfb4a19d29a221d65fd69f4800faea1f34947e8e6bc25ca3bd5db01f61c6968fec91f8c335e21e29b50330d90bd89 + checksum: 8c440db4689948626dbc4122a03575c378e86e630e5de3789464504cd474bf3a1fd7c9402ed79eb8aa2f83e5cfd75872c8607d6255a05e540065b42750e89afe languageName: node linkType: hard @@ -22229,7 +22229,7 @@ __metadata: languageName: node linkType: hard -"fsevents@npm:^2.3.2, fsevents@npm:~2.3.2": +"fsevents@npm:^2.3.2, fsevents@npm:~2.3.2, fsevents@npm:~2.3.3": version: 2.3.3 resolution: "fsevents@npm:2.3.3" dependencies: @@ -22248,7 +22248,7 @@ __metadata: languageName: node linkType: hard -"fsevents@patch:fsevents@npm%3A^2.3.2#optional!builtin, fsevents@patch:fsevents@npm%3A~2.3.2#optional!builtin": +"fsevents@patch:fsevents@npm%3A^2.3.2#optional!builtin, fsevents@patch:fsevents@npm%3A~2.3.2#optional!builtin, fsevents@patch:fsevents@npm%3A~2.3.3#optional!builtin": version: 2.3.3 resolution: "fsevents@patch:fsevents@npm%3A2.3.3#optional!builtin::version=2.3.3&hash=df0bf1" dependencies: @@ -28708,7 +28708,7 @@ __metadata: languageName: node linkType: hard -"nanoid@npm:^3.3.3, nanoid@npm:^3.3.6": +"nanoid@npm:^3.3.3, nanoid@npm:^3.3.7": version: 3.3.7 resolution: "nanoid@npm:3.3.7" bin: @@ -28717,16 +28717,7 @@ __metadata: languageName: node linkType: hard -"nanoid@npm:^5.0.1, nanoid@npm:^5.0.3": - version: 5.0.3 - resolution: "nanoid@npm:5.0.3" - bin: - nanoid: bin/nanoid.js - checksum: 419f083464f91e148fa8f313d898e3271b2c148aa711d37c6251e5689b119d2e3ac766d5fa26e53214896969e9e9c6ccbce7af679c966d24490b1b5df94ffb5d - languageName: node - linkType: hard - -"nanoid@npm:^5.0.4": +"nanoid@npm:^5.0.1, nanoid@npm:^5.0.3, nanoid@npm:^5.0.4": version: 5.0.4 resolution: "nanoid@npm:5.0.4" bin: @@ -30870,14 +30861,14 @@ __metadata: languageName: node linkType: hard -"postcss@npm:^8.3.6, postcss@npm:^8.4.21, postcss@npm:^8.4.27, postcss@npm:^8.4.31": - version: 8.4.31 - resolution: "postcss@npm:8.4.31" +"postcss@npm:^8.3.6, postcss@npm:^8.4.21, postcss@npm:^8.4.31, postcss@npm:^8.4.32": + version: 8.4.32 + resolution: "postcss@npm:8.4.32" dependencies: - nanoid: "npm:^3.3.6" + nanoid: "npm:^3.3.7" picocolors: "npm:^1.0.0" source-map-js: "npm:^1.0.2" - checksum: 1a6653e72105907377f9d4f2cd341d8d90e3fde823a5ddea1e2237aaa56933ea07853f0f2758c28892a1d70c53bbaca200eb8b80f8ed55f13093003dbec5afa0 + checksum: 28084864122f29148e1f632261c408444f5ead0e0b9ea9bd9729d0468818ebe73fe5dc0075acd50c1365dbe639b46a79cba27d355ec857723a24bc9af0f18525 languageName: node linkType: hard @@ -32671,7 +32662,7 @@ __metadata: languageName: node linkType: hard -"rollup@npm:^2.25.0 || ^3.3.0, rollup@npm:^3.27.1": +"rollup@npm:^2.25.0 || ^3.3.0": version: 3.29.4 resolution: "rollup@npm:3.29.4" dependencies: @@ -32685,7 +32676,7 @@ __metadata: languageName: node linkType: hard -"rollup@npm:^4.0.0": +"rollup@npm:^4.0.0, rollup@npm:^4.2.0": version: 4.6.1 resolution: "rollup@npm:4.6.1" dependencies: @@ -35988,16 +35979,16 @@ __metadata: languageName: node linkType: hard -"vite@npm:^4.4.11": - version: 4.5.1 - resolution: "vite@npm:4.5.1" +"vite@npm:^5.0.6": + version: 5.0.6 + resolution: "vite@npm:5.0.6" dependencies: - esbuild: "npm:^0.18.10" - fsevents: "npm:~2.3.2" - postcss: "npm:^8.4.27" - rollup: "npm:^3.27.1" + esbuild: "npm:^0.19.3" + fsevents: "npm:~2.3.3" + postcss: "npm:^8.4.32" + rollup: "npm:^4.2.0" peerDependencies: - "@types/node": ">= 14" + "@types/node": ^18.0.0 || >=20.0.0 less: "*" lightningcss: ^1.21.0 sass: "*" @@ -36024,7 +36015,7 @@ __metadata: optional: true bin: vite: bin/vite.js - checksum: 2ea9c030a5718ca0adaaa0ecc54402a725cff59131cf80bc84d0237f59c98168803ee59d23e697b98b1184be3af6c6edc2e81517f769c62159f11531b3341a4e + checksum: c4647591c76ad5a3b818efef37fb23d793512be832b7daa6c54719f24b0dbadfe383b18cf0896e2c4eaf9d1acab031b3caeaa36570b79ce9da2be6a328d27a1e languageName: node linkType: hard @@ -36976,7 +36967,7 @@ __metadata: resolution: "y-provider@workspace:packages/common/y-provider" dependencies: "@blocksuite/store": "npm:0.11.0-nightly-202312070955-2b5bb47" - vite: "npm:^4.4.11" + vite: "npm:^5.0.6" vite-plugin-dts: "npm:3.6.0" vitest: "npm:0.34.6" yjs: "npm:^13.6.10" From 5979162a5ceaab313e0dd86e8ea702eceebf0ce3 Mon Sep 17 00:00:00 2001 From: Peng Xiao Date: Fri, 8 Dec 2023 10:12:20 +0000 Subject: [PATCH 63/68] fix(component): theme flickering (#5238) Add color-scheme to html so that the web will use system scheme when scripts has not being loaded; Use `(prefers-color-scheme: dark)` so that the css vars do not defer load based on `data-theme`, which is set by next-themes (which is deferred). --- packages/frontend/component/src/theme/theme.css.ts | 8 ++++++-- packages/frontend/core/.webpack/template.html | 1 + 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/packages/frontend/component/src/theme/theme.css.ts b/packages/frontend/component/src/theme/theme.css.ts index 24187dc84a..c471d45a1f 100644 --- a/packages/frontend/component/src/theme/theme.css.ts +++ b/packages/frontend/component/src/theme/theme.css.ts @@ -11,8 +11,12 @@ globalStyle('html', { vars: lightCssVariables, }); -globalStyle('html[data-theme="dark"]', { - vars: darkCssVariables, +globalStyle('html', { + '@media': { + '(prefers-color-scheme: dark)': { + vars: darkCssVariables, + }, + }, }); if (process.env.NODE_ENV === 'development') { diff --git a/packages/frontend/core/.webpack/template.html b/packages/frontend/core/.webpack/template.html index 4c0ee95014..0b8b6e4710 100644 --- a/packages/frontend/core/.webpack/template.html +++ b/packages/frontend/core/.webpack/template.html @@ -2,6 +2,7 @@ + Date: Sat, 9 Dec 2023 04:45:13 +0000 Subject: [PATCH 64/68] chore(env): fix lint error (#5240) --- packages/common/env/src/workspace.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/common/env/src/workspace.ts b/packages/common/env/src/workspace.ts index b92b8e3521..4ac9e7d4d3 100644 --- a/packages/common/env/src/workspace.ts +++ b/packages/common/env/src/workspace.ts @@ -109,7 +109,7 @@ export const settingPanel = { Export: 'export', Sync: 'sync', } as const; -export const settingPanelValues = [...Object.values(settingPanel)] as const; +export const settingPanelValues = Object.values(settingPanel); export type SettingPanel = (typeof settingPanel)[keyof typeof settingPanel]; // built-in workspaces From a066dfb108e91db22beebc13771efefb8b7e6bd0 Mon Sep 17 00:00:00 2001 From: Nadeshiko Manju Date: Sat, 9 Dec 2023 15:41:20 +0800 Subject: [PATCH 65/68] chore: add sha512sum for the released files (#5242) --- .github/workflows/nightly-build.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/nightly-build.yml b/.github/workflows/nightly-build.yml index a8930db8c0..2a0de72264 100644 --- a/.github/workflows/nightly-build.yml +++ b/.github/workflows/nightly-build.yml @@ -231,6 +231,11 @@ jobs: node ./packages/frontend/electron/scripts/generate-yml.js env: RELEASE_VERSION: ${{ needs.set-build-version.outputs.version }} + - name: Generate SHA512 checksums + run: | + sha512sum *-linux-* > SHA512SUMS.txt + sha512sum *-macos-* >> SHA512SUMS.txt + sha512sum *-windows-* >> SHA512SUMS.txt - name: Create Release Draft uses: softprops/action-gh-release@v1 env: @@ -241,6 +246,7 @@ jobs: tag_name: ${{ needs.set-build-version.outputs.version }} prerelease: true files: | + ./SHA512SUMS.txt ./VERSION ./*.zip ./*.dmg From c1bb4670136f4ed3c15593c635d826438e158ccb Mon Sep 17 00:00:00 2001 From: Joooye_34 Date: Sat, 9 Dec 2023 07:42:04 +0000 Subject: [PATCH 66/68] refactor(core): use debug log replace console when command registry (#5237) --- packages/common/infra/package.json | 1 + packages/common/infra/src/command/registry.ts | 11 +++++++---- packages/common/infra/tsconfig.json | 3 +++ yarn.lock | 1 + 4 files changed, 12 insertions(+), 4 deletions(-) diff --git a/packages/common/infra/package.json b/packages/common/infra/package.json index 5852cffc6e..f3696205f0 100644 --- a/packages/common/infra/package.json +++ b/packages/common/infra/package.json @@ -54,6 +54,7 @@ "dev": "vite build --watch" }, "dependencies": { + "@affine/debug": "workspace:*", "@affine/env": "workspace:*", "@affine/sdk": "workspace:*", "@blocksuite/blocks": "0.11.0-nightly-202312070955-2b5bb47", diff --git a/packages/common/infra/src/command/registry.ts b/packages/common/infra/src/command/registry.ts index 11443a93e1..c77292d4c3 100644 --- a/packages/common/infra/src/command/registry.ts +++ b/packages/common/infra/src/command/registry.ts @@ -1,3 +1,4 @@ +import { DebugLogger } from '@affine/debug'; // @ts-expect-error upstream type is wrong import { tinykeys } from 'tinykeys'; @@ -7,12 +8,14 @@ import { createAffineCommand, } from './command'; +const commandLogger = new DebugLogger('command:registry'); + export const AffineCommandRegistry = new (class { readonly commands: Map = new Map(); register(options: AffineCommandOptions) { if (this.commands.has(options.id)) { - console.warn(`Command ${options.id} already registered.`); + commandLogger.warn(`Command ${options.id} already registered.`); return () => {}; } const command = createAffineCommand(options); @@ -38,17 +41,17 @@ export const AffineCommandRegistry = new (class { }); } - console.debug(`Registered command ${command.id}`); + commandLogger.debug(`Registered command ${command.id}`); return () => { unsubKb?.(); this.commands.delete(command.id); - console.debug(`Unregistered command ${command.id}`); + commandLogger.debug(`Unregistered command ${command.id}`); }; } get(id: string): AffineCommand | undefined { if (!this.commands.has(id)) { - console.warn(`Command ${id} not registered.`); + commandLogger.warn(`Command ${id} not registered.`); return undefined; } return this.commands.get(id); diff --git a/packages/common/infra/tsconfig.json b/packages/common/infra/tsconfig.json index 0941f63e4d..1e81c00cd2 100644 --- a/packages/common/infra/tsconfig.json +++ b/packages/common/infra/tsconfig.json @@ -14,6 +14,9 @@ { "path": "../env" }, + { + "path": "../debug" + }, { "path": "./tsconfig.node.json" } diff --git a/yarn.lock b/yarn.lock index 2bdcf4d680..d6958401ab 100644 --- a/yarn.lock +++ b/yarn.lock @@ -13795,6 +13795,7 @@ __metadata: resolution: "@toeverything/infra@workspace:packages/common/infra" dependencies: "@affine-test/fixtures": "workspace:*" + "@affine/debug": "workspace:*" "@affine/env": "workspace:*" "@affine/sdk": "workspace:*" "@affine/templates": "workspace:*" From 255d25d20ca8ce6ad59d5b08d728bdbd7ed57979 Mon Sep 17 00:00:00 2001 From: LongYinan Date: Sun, 10 Dec 2023 07:20:58 +0000 Subject: [PATCH 67/68] chore: bump up @opentelemetry/host-metrics version to ^0.34.0 (#5234) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [@opentelemetry/host-metrics](https://togithub.com/open-telemetry/opentelemetry-js-contrib/tree/main/packages/opentelemetry-host-metrics#readme) ([source](https://togithub.com/open-telemetry/opentelemetry-js-contrib)) | [`^0.33.2` -> `^0.34.0`](https://renovatebot.com/diffs/npm/@opentelemetry%2fhost-metrics/0.33.2/0.34.0) | [![age](https://developer.mend.io/api/mc/badges/age/npm/@opentelemetry%2fhost-metrics/0.34.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/@opentelemetry%2fhost-metrics/0.34.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/@opentelemetry%2fhost-metrics/0.33.2/0.34.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/@opentelemetry%2fhost-metrics/0.33.2/0.34.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes
    open-telemetry/opentelemetry-js-contrib (@​opentelemetry/host-metrics) ### [`v0.34.0`](https://togithub.com/open-telemetry/opentelemetry-js-contrib/compare/607d375595da3ab51b7f773ac360900121c4361b...c7e7000b7bf79b0b107c448b403c2613a9b9e2c1) [Compare Source](https://togithub.com/open-telemetry/opentelemetry-js-contrib/compare/607d375595da3ab51b7f773ac360900121c4361b...c7e7000b7bf79b0b107c448b403c2613a9b9e2c1)
    --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://developer.mend.io/github/toeverything/AFFiNE). --- packages/backend/server/package.json | 2 +- yarn.lock | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/backend/server/package.json b/packages/backend/server/package.json index d39a8f9cc7..4c39a3c984 100644 --- a/packages/backend/server/package.json +++ b/packages/backend/server/package.json @@ -41,7 +41,7 @@ "@opentelemetry/core": "^1.18.1", "@opentelemetry/exporter-prometheus": "^0.45.1", "@opentelemetry/exporter-zipkin": "^1.18.1", - "@opentelemetry/host-metrics": "^0.33.2", + "@opentelemetry/host-metrics": "^0.34.0", "@opentelemetry/instrumentation": "^0.45.1", "@opentelemetry/instrumentation-graphql": "^0.36.0", "@opentelemetry/instrumentation-http": "^0.45.1", diff --git a/yarn.lock b/yarn.lock index d6958401ab..e3055874a6 100644 --- a/yarn.lock +++ b/yarn.lock @@ -750,7 +750,7 @@ __metadata: "@opentelemetry/core": "npm:^1.18.1" "@opentelemetry/exporter-prometheus": "npm:^0.45.1" "@opentelemetry/exporter-zipkin": "npm:^1.18.1" - "@opentelemetry/host-metrics": "npm:^0.33.2" + "@opentelemetry/host-metrics": "npm:^0.34.0" "@opentelemetry/instrumentation": "npm:^0.45.1" "@opentelemetry/instrumentation-graphql": "npm:^0.36.0" "@opentelemetry/instrumentation-http": "npm:^0.45.1" @@ -9339,15 +9339,15 @@ __metadata: languageName: node linkType: hard -"@opentelemetry/host-metrics@npm:^0.33.2": - version: 0.33.2 - resolution: "@opentelemetry/host-metrics@npm:0.33.2" +"@opentelemetry/host-metrics@npm:^0.34.0": + version: 0.34.0 + resolution: "@opentelemetry/host-metrics@npm:0.34.0" dependencies: "@opentelemetry/sdk-metrics": "npm:^1.8.0" systeminformation: "npm:^5.0.0" peerDependencies: "@opentelemetry/api": ^1.3.0 - checksum: 35140ecb2c4e97ab49873411a9e81a23238cf392112212f936f238091a6572c0802d6364ccea428cb7f0595cb28f4cbafbe6fa5c23510ebb1243cf7f398871e5 + checksum: 54f6a6c2f2ab8f236dc5f0d32d71771339f211c8e492afad45394e15067178491181823aa66ebe43c4d832fa9f6785b7fdd5fad515c92a6785c6ee1f81df2a38 languageName: node linkType: hard From f0c70b92f4905f27fb3ba6fd1cff9ca52b885bb9 Mon Sep 17 00:00:00 2001 From: LongYinan Date: Sun, 10 Dec 2023 07:33:07 +0000 Subject: [PATCH 68/68] chore: bump up google-github-actions/setup-gcloud action to v2 (#5241) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [google-github-actions/setup-gcloud](https://togithub.com/google-github-actions/setup-gcloud) | action | major | `v1` -> `v2` | --- ### Release Notes
    google-github-actions/setup-gcloud (google-github-actions/setup-gcloud) ### [`v2`](https://togithub.com/google-github-actions/setup-gcloud/releases/tag/v2) [Compare Source](https://togithub.com/google-github-actions/setup-gcloud/compare/v1...v2) **:warning: This version requires Node 20 or later!** Floating v2 alias
    --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://developer.mend.io/github/toeverything/AFFiNE). --- .github/actions/deploy/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/deploy/action.yml b/.github/actions/deploy/action.yml index 58213a8673..e4245c0d78 100644 --- a/.github/actions/deploy/action.yml +++ b/.github/actions/deploy/action.yml @@ -34,7 +34,7 @@ runs: project_id: '${{ inputs.gcp-project-id }}' - name: 'Setup gcloud cli' - uses: 'google-github-actions/setup-gcloud@v1' + uses: 'google-github-actions/setup-gcloud@v2' with: install_components: 'gke-gcloud-auth-plugin'