From a10aeca82021dd71d952afde7b960cf342e21a1c Mon Sep 17 00:00:00 2001 From: regischen Date: Fri, 22 Dec 2023 18:04:05 +0800 Subject: [PATCH 001/110] feat: bump blocksuite (#5386) --- 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 | 257 ++++++++++-------- 16 files changed, 209 insertions(+), 176 deletions(-) diff --git a/packages/common/env/package.json b/packages/common/env/package.json index add53d04b9..46f924bb20 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-202312212326-e2b48df", - "@blocksuite/store": "0.11.0-nightly-202312212326-e2b48df", + "@blocksuite/global": "0.11.0-nightly-202312220916-e3abcbb", + "@blocksuite/store": "0.11.0-nightly-202312220916-e3abcbb", "react": "18.2.0", "react-dom": "18.2.0", "vitest": "1.0.4", diff --git a/packages/common/infra/package.json b/packages/common/infra/package.json index 7faa431032..982672f299 100644 --- a/packages/common/infra/package.json +++ b/packages/common/infra/package.json @@ -62,9 +62,9 @@ "@affine/debug": "workspace:*", "@affine/env": "workspace:*", "@affine/sdk": "workspace:*", - "@blocksuite/blocks": "0.11.0-nightly-202312212326-e2b48df", - "@blocksuite/global": "0.11.0-nightly-202312212326-e2b48df", - "@blocksuite/store": "0.11.0-nightly-202312212326-e2b48df", + "@blocksuite/blocks": "0.11.0-nightly-202312220916-e3abcbb", + "@blocksuite/global": "0.11.0-nightly-202312220916-e3abcbb", + "@blocksuite/store": "0.11.0-nightly-202312220916-e3abcbb", "jotai": "^2.5.1", "jotai-effect": "^0.2.3", "tinykeys": "^2.1.0", @@ -73,8 +73,8 @@ "devDependencies": { "@affine-test/fixtures": "workspace:*", "@affine/templates": "workspace:*", - "@blocksuite/lit": "0.11.0-nightly-202312212326-e2b48df", - "@blocksuite/presets": "0.11.0-nightly-202312212326-e2b48df", + "@blocksuite/lit": "0.11.0-nightly-202312220916-e3abcbb", + "@blocksuite/presets": "0.11.0-nightly-202312220916-e3abcbb", "@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 8d6e99346b..09e13d00ec 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-202312212326-e2b48df", - "@blocksuite/blocks": "0.11.0-nightly-202312212326-e2b48df", - "@blocksuite/global": "0.11.0-nightly-202312212326-e2b48df", - "@blocksuite/presets": "0.11.0-nightly-202312212326-e2b48df", - "@blocksuite/store": "0.11.0-nightly-202312212326-e2b48df", + "@blocksuite/block-std": "0.11.0-nightly-202312220916-e3abcbb", + "@blocksuite/blocks": "0.11.0-nightly-202312220916-e3abcbb", + "@blocksuite/global": "0.11.0-nightly-202312220916-e3abcbb", + "@blocksuite/presets": "0.11.0-nightly-202312220916-e3abcbb", + "@blocksuite/store": "0.11.0-nightly-202312220916-e3abcbb", "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 e11486fec0..7843f70381 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-202312212326-e2b48df", - "@blocksuite/store": "0.11.0-nightly-202312212326-e2b48df", + "@blocksuite/blocks": "0.11.0-nightly-202312220916-e3abcbb", + "@blocksuite/store": "0.11.0-nightly-202312220916-e3abcbb", "fake-indexeddb": "^5.0.0", "vite": "^5.0.6", "vite-plugin-dts": "3.6.0", diff --git a/packages/common/y-provider/package.json b/packages/common/y-provider/package.json index 2a603f7dbe..579af7a822 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-202312212326-e2b48df", + "@blocksuite/store": "0.11.0-nightly-202312220916-e3abcbb", "vite": "^5.0.6", "vite-plugin-dts": "3.6.0", "vitest": "1.0.4", diff --git a/packages/frontend/component/package.json b/packages/frontend/component/package.json index c59ed2ef05..95f6d1b2a9 100644 --- a/packages/frontend/component/package.json +++ b/packages/frontend/component/package.json @@ -72,12 +72,12 @@ "uuid": "^9.0.1" }, "devDependencies": { - "@blocksuite/blocks": "0.11.0-nightly-202312212326-e2b48df", - "@blocksuite/global": "0.11.0-nightly-202312212326-e2b48df", + "@blocksuite/blocks": "0.11.0-nightly-202312220916-e3abcbb", + "@blocksuite/global": "0.11.0-nightly-202312220916-e3abcbb", "@blocksuite/icons": "2.1.36", - "@blocksuite/lit": "0.11.0-nightly-202312212326-e2b48df", - "@blocksuite/presets": "0.11.0-nightly-202312212326-e2b48df", - "@blocksuite/store": "0.11.0-nightly-202312212326-e2b48df", + "@blocksuite/lit": "0.11.0-nightly-202312220916-e3abcbb", + "@blocksuite/presets": "0.11.0-nightly-202312220916-e3abcbb", + "@blocksuite/store": "0.11.0-nightly-202312220916-e3abcbb", "@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 762da4ebc6..215f7f47e0 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-202312212326-e2b48df", - "@blocksuite/blocks": "0.11.0-nightly-202312212326-e2b48df", - "@blocksuite/global": "0.11.0-nightly-202312212326-e2b48df", + "@blocksuite/block-std": "0.11.0-nightly-202312220916-e3abcbb", + "@blocksuite/blocks": "0.11.0-nightly-202312220916-e3abcbb", + "@blocksuite/global": "0.11.0-nightly-202312220916-e3abcbb", "@blocksuite/icons": "2.1.36", - "@blocksuite/inline": "0.11.0-nightly-202312212326-e2b48df", - "@blocksuite/lit": "0.11.0-nightly-202312212326-e2b48df", - "@blocksuite/presets": "0.11.0-nightly-202312212326-e2b48df", - "@blocksuite/store": "0.11.0-nightly-202312212326-e2b48df", + "@blocksuite/inline": "0.11.0-nightly-202312220916-e3abcbb", + "@blocksuite/lit": "0.11.0-nightly-202312220916-e3abcbb", + "@blocksuite/presets": "0.11.0-nightly-202312220916-e3abcbb", + "@blocksuite/store": "0.11.0-nightly-202312220916-e3abcbb", "@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 52fda6c7cb..7a755f9ca1 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-202312212326-e2b48df", - "@blocksuite/lit": "0.11.0-nightly-202312212326-e2b48df", - "@blocksuite/presets": "0.11.0-nightly-202312212326-e2b48df", - "@blocksuite/store": "0.11.0-nightly-202312212326-e2b48df", + "@blocksuite/blocks": "0.11.0-nightly-202312220916-e3abcbb", + "@blocksuite/lit": "0.11.0-nightly-202312220916-e3abcbb", + "@blocksuite/presets": "0.11.0-nightly-202312220916-e3abcbb", + "@blocksuite/store": "0.11.0-nightly-202312220916-e3abcbb", "@electron-forge/cli": "^7.2.0", "@electron-forge/core": "^7.2.0", "@electron-forge/core-utils": "^7.2.0", diff --git a/packages/frontend/hooks/package.json b/packages/frontend/hooks/package.json index 40b245689c..d83466ab05 100644 --- a/packages/frontend/hooks/package.json +++ b/packages/frontend/hooks/package.json @@ -20,12 +20,12 @@ "@affine/debug": "workspace:*", "@affine/env": "workspace:*", "@affine/workspace": "workspace:*", - "@blocksuite/block-std": "0.11.0-nightly-202312212326-e2b48df", - "@blocksuite/blocks": "0.11.0-nightly-202312212326-e2b48df", - "@blocksuite/global": "0.11.0-nightly-202312212326-e2b48df", - "@blocksuite/lit": "0.11.0-nightly-202312212326-e2b48df", - "@blocksuite/presets": "0.11.0-nightly-202312212326-e2b48df", - "@blocksuite/store": "0.11.0-nightly-202312212326-e2b48df", + "@blocksuite/block-std": "0.11.0-nightly-202312220916-e3abcbb", + "@blocksuite/blocks": "0.11.0-nightly-202312220916-e3abcbb", + "@blocksuite/global": "0.11.0-nightly-202312220916-e3abcbb", + "@blocksuite/lit": "0.11.0-nightly-202312220916-e3abcbb", + "@blocksuite/presets": "0.11.0-nightly-202312220916-e3abcbb", + "@blocksuite/store": "0.11.0-nightly-202312220916-e3abcbb", "@testing-library/react": "^14.0.0", "@toeverything/infra": "workspace:*", "@types/image-blob-reduce": "^4.1.3", 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 e3e8b05663..e8c0e0ce1d 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-202312212326-e2b48df", - "@blocksuite/blocks": "0.11.0-nightly-202312212326-e2b48df", - "@blocksuite/global": "0.11.0-nightly-202312212326-e2b48df", - "@blocksuite/store": "0.11.0-nightly-202312212326-e2b48df", + "@blocksuite/block-std": "0.11.0-nightly-202312220916-e3abcbb", + "@blocksuite/blocks": "0.11.0-nightly-202312220916-e3abcbb", + "@blocksuite/global": "0.11.0-nightly-202312220916-e3abcbb", + "@blocksuite/store": "0.11.0-nightly-202312220916-e3abcbb", "@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 016ba419f3..da3b6389fc 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-202312212326-e2b48df", - "@blocksuite/blocks": "0.11.0-nightly-202312212326-e2b48df", - "@blocksuite/global": "0.11.0-nightly-202312212326-e2b48df", - "@blocksuite/store": "0.11.0-nightly-202312212326-e2b48df", + "@blocksuite/block-std": "0.11.0-nightly-202312220916-e3abcbb", + "@blocksuite/blocks": "0.11.0-nightly-202312220916-e3abcbb", + "@blocksuite/global": "0.11.0-nightly-202312220916-e3abcbb", + "@blocksuite/store": "0.11.0-nightly-202312220916-e3abcbb", "@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 2700a16d27..ae1613780f 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-202312212326-e2b48df", - "@blocksuite/blocks": "0.11.0-nightly-202312212326-e2b48df", - "@blocksuite/global": "0.11.0-nightly-202312212326-e2b48df", - "@blocksuite/store": "0.11.0-nightly-202312212326-e2b48df", + "@blocksuite/block-std": "0.11.0-nightly-202312220916-e3abcbb", + "@blocksuite/blocks": "0.11.0-nightly-202312220916-e3abcbb", + "@blocksuite/global": "0.11.0-nightly-202312220916-e3abcbb", + "@blocksuite/store": "0.11.0-nightly-202312220916-e3abcbb", "@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 56ffc66e76..e90e11c7a5 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-202312212326-e2b48df", - "@blocksuite/blocks": "0.11.0-nightly-202312212326-e2b48df", - "@blocksuite/global": "0.11.0-nightly-202312212326-e2b48df", - "@blocksuite/store": "0.11.0-nightly-202312212326-e2b48df", + "@blocksuite/block-std": "0.11.0-nightly-202312220916-e3abcbb", + "@blocksuite/blocks": "0.11.0-nightly-202312220916-e3abcbb", + "@blocksuite/global": "0.11.0-nightly-202312220916-e3abcbb", + "@blocksuite/store": "0.11.0-nightly-202312220916-e3abcbb", "@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 b1e782745f..65b13c22be 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-202312212326-e2b48df", - "@blocksuite/blocks": "0.11.0-nightly-202312212326-e2b48df", - "@blocksuite/global": "0.11.0-nightly-202312212326-e2b48df", - "@blocksuite/store": "0.11.0-nightly-202312212326-e2b48df", + "@blocksuite/block-std": "0.11.0-nightly-202312220916-e3abcbb", + "@blocksuite/blocks": "0.11.0-nightly-202312220916-e3abcbb", + "@blocksuite/global": "0.11.0-nightly-202312220916-e3abcbb", + "@blocksuite/store": "0.11.0-nightly-202312220916-e3abcbb", "@playwright/test": "^1.39.0" }, "version": "0.11.0" diff --git a/tests/storybook/package.json b/tests/storybook/package.json index 016ba15ae3..1d3aa0572d 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-202312212326-e2b48df", - "@blocksuite/blocks": "0.11.0-nightly-202312212326-e2b48df", - "@blocksuite/global": "0.11.0-nightly-202312212326-e2b48df", + "@blocksuite/block-std": "0.11.0-nightly-202312220916-e3abcbb", + "@blocksuite/blocks": "0.11.0-nightly-202312220916-e3abcbb", + "@blocksuite/global": "0.11.0-nightly-202312220916-e3abcbb", "@blocksuite/icons": "2.1.36", - "@blocksuite/inline": "0.11.0-nightly-202312212326-e2b48df", - "@blocksuite/lit": "0.11.0-nightly-202312212326-e2b48df", - "@blocksuite/presets": "0.11.0-nightly-202312212326-e2b48df", - "@blocksuite/store": "0.11.0-nightly-202312212326-e2b48df", + "@blocksuite/inline": "0.11.0-nightly-202312220916-e3abcbb", + "@blocksuite/lit": "0.11.0-nightly-202312220916-e3abcbb", + "@blocksuite/presets": "0.11.0-nightly-202312220916-e3abcbb", + "@blocksuite/store": "0.11.0-nightly-202312220916-e3abcbb", "@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 257c5f6c9f..5b92dcfbe3 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-202312212326-e2b48df" - "@blocksuite/blocks": "npm:0.11.0-nightly-202312212326-e2b48df" - "@blocksuite/global": "npm:0.11.0-nightly-202312212326-e2b48df" - "@blocksuite/store": "npm:0.11.0-nightly-202312212326-e2b48df" + "@blocksuite/block-std": "npm:0.11.0-nightly-202312220916-e3abcbb" + "@blocksuite/blocks": "npm:0.11.0-nightly-202312220916-e3abcbb" + "@blocksuite/global": "npm:0.11.0-nightly-202312220916-e3abcbb" + "@blocksuite/store": "npm:0.11.0-nightly-202312220916-e3abcbb" "@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-202312212326-e2b48df" - "@blocksuite/blocks": "npm:0.11.0-nightly-202312212326-e2b48df" - "@blocksuite/global": "npm:0.11.0-nightly-202312212326-e2b48df" - "@blocksuite/store": "npm:0.11.0-nightly-202312212326-e2b48df" + "@blocksuite/block-std": "npm:0.11.0-nightly-202312220916-e3abcbb" + "@blocksuite/blocks": "npm:0.11.0-nightly-202312220916-e3abcbb" + "@blocksuite/global": "npm:0.11.0-nightly-202312220916-e3abcbb" + "@blocksuite/store": "npm:0.11.0-nightly-202312220916-e3abcbb" "@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-202312212326-e2b48df" - "@blocksuite/blocks": "npm:0.11.0-nightly-202312212326-e2b48df" - "@blocksuite/global": "npm:0.11.0-nightly-202312212326-e2b48df" - "@blocksuite/store": "npm:0.11.0-nightly-202312212326-e2b48df" + "@blocksuite/block-std": "npm:0.11.0-nightly-202312220916-e3abcbb" + "@blocksuite/blocks": "npm:0.11.0-nightly-202312220916-e3abcbb" + "@blocksuite/global": "npm:0.11.0-nightly-202312220916-e3abcbb" + "@blocksuite/store": "npm:0.11.0-nightly-202312220916-e3abcbb" "@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-202312212326-e2b48df" - "@blocksuite/blocks": "npm:0.11.0-nightly-202312212326-e2b48df" - "@blocksuite/global": "npm:0.11.0-nightly-202312212326-e2b48df" - "@blocksuite/store": "npm:0.11.0-nightly-202312212326-e2b48df" + "@blocksuite/block-std": "npm:0.11.0-nightly-202312220916-e3abcbb" + "@blocksuite/blocks": "npm:0.11.0-nightly-202312220916-e3abcbb" + "@blocksuite/global": "npm:0.11.0-nightly-202312220916-e3abcbb" + "@blocksuite/store": "npm:0.11.0-nightly-202312220916-e3abcbb" "@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-202312212326-e2b48df" - "@blocksuite/blocks": "npm:0.11.0-nightly-202312212326-e2b48df" - "@blocksuite/global": "npm:0.11.0-nightly-202312212326-e2b48df" - "@blocksuite/store": "npm:0.11.0-nightly-202312212326-e2b48df" + "@blocksuite/block-std": "npm:0.11.0-nightly-202312220916-e3abcbb" + "@blocksuite/blocks": "npm:0.11.0-nightly-202312220916-e3abcbb" + "@blocksuite/global": "npm:0.11.0-nightly-202312220916-e3abcbb" + "@blocksuite/store": "npm:0.11.0-nightly-202312220916-e3abcbb" "@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-202312212326-e2b48df" - "@blocksuite/global": "npm:0.11.0-nightly-202312212326-e2b48df" + "@blocksuite/blocks": "npm:0.11.0-nightly-202312220916-e3abcbb" + "@blocksuite/global": "npm:0.11.0-nightly-202312220916-e3abcbb" "@blocksuite/icons": "npm:2.1.36" - "@blocksuite/lit": "npm:0.11.0-nightly-202312212326-e2b48df" - "@blocksuite/presets": "npm:0.11.0-nightly-202312212326-e2b48df" - "@blocksuite/store": "npm:0.11.0-nightly-202312212326-e2b48df" + "@blocksuite/lit": "npm:0.11.0-nightly-202312220916-e3abcbb" + "@blocksuite/presets": "npm:0.11.0-nightly-202312220916-e3abcbb" + "@blocksuite/store": "npm:0.11.0-nightly-202312220916-e3abcbb" "@dnd-kit/core": "npm:^6.0.8" "@dnd-kit/modifiers": "npm:^7.0.0" "@dnd-kit/sortable": "npm:^8.0.0" @@ -351,14 +351,14 @@ __metadata: "@affine/templates": "workspace:*" "@affine/workspace": "workspace:*" "@aws-sdk/client-s3": "npm:3.433.0" - "@blocksuite/block-std": "npm:0.11.0-nightly-202312212326-e2b48df" - "@blocksuite/blocks": "npm:0.11.0-nightly-202312212326-e2b48df" - "@blocksuite/global": "npm:0.11.0-nightly-202312212326-e2b48df" + "@blocksuite/block-std": "npm:0.11.0-nightly-202312220916-e3abcbb" + "@blocksuite/blocks": "npm:0.11.0-nightly-202312220916-e3abcbb" + "@blocksuite/global": "npm:0.11.0-nightly-202312220916-e3abcbb" "@blocksuite/icons": "npm:2.1.36" - "@blocksuite/inline": "npm:0.11.0-nightly-202312212326-e2b48df" - "@blocksuite/lit": "npm:0.11.0-nightly-202312212326-e2b48df" - "@blocksuite/presets": "npm:0.11.0-nightly-202312212326-e2b48df" - "@blocksuite/store": "npm:0.11.0-nightly-202312212326-e2b48df" + "@blocksuite/inline": "npm:0.11.0-nightly-202312220916-e3abcbb" + "@blocksuite/lit": "npm:0.11.0-nightly-202312220916-e3abcbb" + "@blocksuite/presets": "npm:0.11.0-nightly-202312220916-e3abcbb" + "@blocksuite/store": "npm:0.11.0-nightly-202312220916-e3abcbb" "@dnd-kit/core": "npm:^6.0.8" "@dnd-kit/sortable": "npm:^8.0.0" "@emotion/cache": "npm:^11.11.0" @@ -468,10 +468,10 @@ __metadata: "@affine/sdk": "workspace:*" "@affine/templates": "workspace:*" "@affine/vue-hello-world-plugin": "workspace:*" - "@blocksuite/blocks": "npm:0.11.0-nightly-202312212326-e2b48df" - "@blocksuite/lit": "npm:0.11.0-nightly-202312212326-e2b48df" - "@blocksuite/presets": "npm:0.11.0-nightly-202312212326-e2b48df" - "@blocksuite/store": "npm:0.11.0-nightly-202312212326-e2b48df" + "@blocksuite/blocks": "npm:0.11.0-nightly-202312220916-e3abcbb" + "@blocksuite/lit": "npm:0.11.0-nightly-202312220916-e3abcbb" + "@blocksuite/presets": "npm:0.11.0-nightly-202312220916-e3abcbb" + "@blocksuite/store": "npm:0.11.0-nightly-202312220916-e3abcbb" "@electron-forge/cli": "npm:^7.2.0" "@electron-forge/core": "npm:^7.2.0" "@electron-forge/core-utils": "npm:^7.2.0" @@ -520,8 +520,8 @@ __metadata: version: 0.0.0-use.local resolution: "@affine/env@workspace:packages/common/env" dependencies: - "@blocksuite/global": "npm:0.11.0-nightly-202312212326-e2b48df" - "@blocksuite/store": "npm:0.11.0-nightly-202312212326-e2b48df" + "@blocksuite/global": "npm:0.11.0-nightly-202312220916-e3abcbb" + "@blocksuite/store": "npm:0.11.0-nightly-202312220916-e3abcbb" lit: "npm:^3.0.2" react: "npm:18.2.0" react-dom: "npm:18.2.0" @@ -711,11 +711,11 @@ __metadata: version: 0.0.0-use.local resolution: "@affine/sdk@workspace:packages/common/sdk" dependencies: - "@blocksuite/block-std": "npm:0.11.0-nightly-202312212326-e2b48df" - "@blocksuite/blocks": "npm:0.11.0-nightly-202312212326-e2b48df" - "@blocksuite/global": "npm:0.11.0-nightly-202312212326-e2b48df" - "@blocksuite/presets": "npm:0.11.0-nightly-202312212326-e2b48df" - "@blocksuite/store": "npm:0.11.0-nightly-202312212326-e2b48df" + "@blocksuite/block-std": "npm:0.11.0-nightly-202312220916-e3abcbb" + "@blocksuite/blocks": "npm:0.11.0-nightly-202312220916-e3abcbb" + "@blocksuite/global": "npm:0.11.0-nightly-202312220916-e3abcbb" + "@blocksuite/presets": "npm:0.11.0-nightly-202312220916-e3abcbb" + "@blocksuite/store": "npm:0.11.0-nightly-202312220916-e3abcbb" jotai: "npm:^2.5.1" vite: "npm:^5.0.6" vite-plugin-dts: "npm:3.6.0" @@ -840,14 +840,14 @@ __metadata: dependencies: "@affine/component": "workspace:*" "@affine/i18n": "workspace:*" - "@blocksuite/block-std": "npm:0.11.0-nightly-202312212326-e2b48df" - "@blocksuite/blocks": "npm:0.11.0-nightly-202312212326-e2b48df" - "@blocksuite/global": "npm:0.11.0-nightly-202312212326-e2b48df" + "@blocksuite/block-std": "npm:0.11.0-nightly-202312220916-e3abcbb" + "@blocksuite/blocks": "npm:0.11.0-nightly-202312220916-e3abcbb" + "@blocksuite/global": "npm:0.11.0-nightly-202312220916-e3abcbb" "@blocksuite/icons": "npm:2.1.36" - "@blocksuite/inline": "npm:0.11.0-nightly-202312212326-e2b48df" - "@blocksuite/lit": "npm:0.11.0-nightly-202312212326-e2b48df" - "@blocksuite/presets": "npm:0.11.0-nightly-202312212326-e2b48df" - "@blocksuite/store": "npm:0.11.0-nightly-202312212326-e2b48df" + "@blocksuite/inline": "npm:0.11.0-nightly-202312220916-e3abcbb" + "@blocksuite/lit": "npm:0.11.0-nightly-202312220916-e3abcbb" + "@blocksuite/presets": "npm:0.11.0-nightly-202312220916-e3abcbb" + "@blocksuite/store": "npm:0.11.0-nightly-202312220916-e3abcbb" "@dnd-kit/sortable": "npm:^8.0.0" "@storybook/addon-actions": "npm:^7.5.3" "@storybook/addon-essentials": "npm:^7.5.3" @@ -4077,29 +4077,29 @@ __metadata: languageName: node linkType: hard -"@blocksuite/block-std@npm:0.11.0-nightly-202312212326-e2b48df": - version: 0.11.0-nightly-202312212326-e2b48df - resolution: "@blocksuite/block-std@npm:0.11.0-nightly-202312212326-e2b48df" +"@blocksuite/block-std@npm:0.11.0-nightly-202312220916-e3abcbb": + version: 0.11.0-nightly-202312220916-e3abcbb + resolution: "@blocksuite/block-std@npm:0.11.0-nightly-202312220916-e3abcbb" dependencies: - "@blocksuite/global": "npm:0.11.0-nightly-202312212326-e2b48df" + "@blocksuite/global": "npm:0.11.0-nightly-202312220916-e3abcbb" lz-string: "npm:^1.5.0" w3c-keyname: "npm:^2.2.8" zod: "npm:^3.22.4" peerDependencies: - "@blocksuite/store": 0.11.0-nightly-202312212326-e2b48df - checksum: 43302954cd31c745a887d0a4faada527c3b584747b908d07ac98cccbc82ccd31b5ca7e92ee97e2b15aefac095133e6534383b848a686ac33878c4406043e9215 + "@blocksuite/store": 0.11.0-nightly-202312220916-e3abcbb + checksum: bb1e7aae8310b09976af186566194eeae50d49518ada0571993d093afed029e8e1487258cc9fdc1b87b4961e05664408fbf7def2ffd01664bd80702481793eca languageName: node linkType: hard -"@blocksuite/blocks@npm:0.11.0-nightly-202312212326-e2b48df": - version: 0.11.0-nightly-202312212326-e2b48df - resolution: "@blocksuite/blocks@npm:0.11.0-nightly-202312212326-e2b48df" +"@blocksuite/blocks@npm:0.11.0-nightly-202312220916-e3abcbb": + version: 0.11.0-nightly-202312220916-e3abcbb + resolution: "@blocksuite/blocks@npm:0.11.0-nightly-202312220916-e3abcbb" dependencies: - "@blocksuite/block-std": "npm:0.11.0-nightly-202312212326-e2b48df" - "@blocksuite/global": "npm:0.11.0-nightly-202312212326-e2b48df" - "@blocksuite/inline": "npm:0.11.0-nightly-202312212326-e2b48df" - "@blocksuite/lit": "npm:0.11.0-nightly-202312212326-e2b48df" - "@blocksuite/store": "npm:0.11.0-nightly-202312212326-e2b48df" + "@blocksuite/block-std": "npm:0.11.0-nightly-202312220916-e3abcbb" + "@blocksuite/global": "npm:0.11.0-nightly-202312220916-e3abcbb" + "@blocksuite/inline": "npm:0.11.0-nightly-202312220916-e3abcbb" + "@blocksuite/lit": "npm:0.11.0-nightly-202312220916-e3abcbb" + "@blocksuite/store": "npm:0.11.0-nightly-202312220916-e3abcbb" "@floating-ui/dom": "npm:^1.5.3" "@toeverything/theme": "npm:^0.7.27" "@types/hast": "npm:^3.0.3" @@ -4133,16 +4133,16 @@ __metadata: unified: "npm:^11.0.4" webfontloader: "npm:^1.6.28" zod: "npm:^3.22.4" - checksum: 48cd02a389317477c866618c898a2d4839fbb4466752c2de295159fd6c073bde903a1fc46ae2ffcf823ce2e0e01cbb49db406ae728c53f27f14ef5e4159b3078 + checksum: 4d489d9b07240e10f395889cff888a0827d755be546dcc8a59394ac9562efadb18bc7af395d0fb64d31a14fda1582a0834a3f7f543ca3cfbf6ede063c1db02c7 languageName: node linkType: hard -"@blocksuite/global@npm:0.11.0-nightly-202312212326-e2b48df": - version: 0.11.0-nightly-202312212326-e2b48df - resolution: "@blocksuite/global@npm:0.11.0-nightly-202312212326-e2b48df" +"@blocksuite/global@npm:0.11.0-nightly-202312220916-e3abcbb": + version: 0.11.0-nightly-202312220916-e3abcbb + resolution: "@blocksuite/global@npm:0.11.0-nightly-202312220916-e3abcbb" dependencies: zod: "npm:^3.22.4" - checksum: 3121af8a225e012b836b94c40923227a9d0b999d7c2f68b7eabcaf15fed77788f662a38d87bba664231d591ac363e9cd48b6f234625b938ae674ca4c372d908f + checksum: 90cadce741fe6917175848637fceddd90f8d18270ce95d92fd7c3035805e5add96dc363a20c6c1d89402f0d932ae0afcbba2d99afe65a624118b57cfdebcb13c languageName: node linkType: hard @@ -4156,56 +4156,57 @@ __metadata: languageName: node linkType: hard -"@blocksuite/inline@npm:0.11.0-nightly-202312212326-e2b48df": - version: 0.11.0-nightly-202312212326-e2b48df - resolution: "@blocksuite/inline@npm:0.11.0-nightly-202312212326-e2b48df" +"@blocksuite/inline@npm:0.11.0-nightly-202312220916-e3abcbb": + version: 0.11.0-nightly-202312220916-e3abcbb + resolution: "@blocksuite/inline@npm:0.11.0-nightly-202312220916-e3abcbb" dependencies: - "@blocksuite/global": "npm:0.11.0-nightly-202312212326-e2b48df" + "@blocksuite/global": "npm:0.11.0-nightly-202312220916-e3abcbb" zod: "npm:^3.22.4" peerDependencies: lit: ^3.0.2 yjs: ^13 - checksum: 3ccc79d45731ae1d326d79d9dbc5c3c4583c9b6bd7c67b03565eaca3378242df26351283b0b3ced7ba0c9ccc7e343be3413c1490f71e5e9784017db57f5bde92 + checksum: 33f68338338981d43304e7408757ede7269bd5eb8be2fe92ec5e5a35dbbc20095fbec9bf26878d7e88484302bd4c466806bdc48c871c97aeab0c2d456fd062ab languageName: node linkType: hard -"@blocksuite/lit@npm:0.11.0-nightly-202312212326-e2b48df": - version: 0.11.0-nightly-202312212326-e2b48df - resolution: "@blocksuite/lit@npm:0.11.0-nightly-202312212326-e2b48df" +"@blocksuite/lit@npm:0.11.0-nightly-202312220916-e3abcbb": + version: 0.11.0-nightly-202312220916-e3abcbb + resolution: "@blocksuite/lit@npm:0.11.0-nightly-202312220916-e3abcbb" dependencies: - "@blocksuite/global": "npm:0.11.0-nightly-202312212326-e2b48df" - "@blocksuite/inline": "npm:0.11.0-nightly-202312212326-e2b48df" + "@blocksuite/global": "npm:0.11.0-nightly-202312220916-e3abcbb" + "@blocksuite/inline": "npm:0.11.0-nightly-202312220916-e3abcbb" lit: "npm:^3.1.0" peerDependencies: - "@blocksuite/block-std": 0.11.0-nightly-202312212326-e2b48df - "@blocksuite/store": 0.11.0-nightly-202312212326-e2b48df - checksum: 53d9b672de67a4d2108d132faa76b74f68e6ae926ce6c4e8de9f13f82d34fe19f619a93c1a347ea69833293c3f365d66684b5cdfe5c0ab066d1f9d5e24959512 + "@blocksuite/block-std": 0.11.0-nightly-202312220916-e3abcbb + "@blocksuite/store": 0.11.0-nightly-202312220916-e3abcbb + checksum: af7835d4facd1e4a1339ec69a3069c0e49042d76a5af40cd5ad4763f845806b0c95b8464e2a26a74fe92397fd01e928ee30168e7dbbf86d111711c1c8f3503f4 languageName: node linkType: hard -"@blocksuite/presets@npm:0.11.0-nightly-202312212326-e2b48df": - version: 0.11.0-nightly-202312212326-e2b48df - resolution: "@blocksuite/presets@npm:0.11.0-nightly-202312212326-e2b48df" +"@blocksuite/presets@npm:0.11.0-nightly-202312220916-e3abcbb": + version: 0.11.0-nightly-202312220916-e3abcbb + resolution: "@blocksuite/presets@npm:0.11.0-nightly-202312220916-e3abcbb" dependencies: - "@blocksuite/block-std": "npm:0.11.0-nightly-202312212326-e2b48df" - "@blocksuite/blocks": "npm:0.11.0-nightly-202312212326-e2b48df" - "@blocksuite/global": "npm:0.11.0-nightly-202312212326-e2b48df" - "@blocksuite/inline": "npm:0.11.0-nightly-202312212326-e2b48df" - "@blocksuite/lit": "npm:0.11.0-nightly-202312212326-e2b48df" - "@blocksuite/store": "npm:0.11.0-nightly-202312212326-e2b48df" + "@blocksuite/block-std": "npm:0.11.0-nightly-202312220916-e3abcbb" + "@blocksuite/blocks": "npm:0.11.0-nightly-202312220916-e3abcbb" + "@blocksuite/global": "npm:0.11.0-nightly-202312220916-e3abcbb" + "@blocksuite/inline": "npm:0.11.0-nightly-202312220916-e3abcbb" + "@blocksuite/lit": "npm:0.11.0-nightly-202312220916-e3abcbb" + "@blocksuite/store": "npm:0.11.0-nightly-202312220916-e3abcbb" + "@fal-ai/serverless-client": "npm:^0.7.3" "@toeverything/theme": "npm:^0.7.27" lit: "npm:^3.1.0" openai: "npm:^4.20.1" - checksum: 21d3a8e569b8beb6a3a446a814b2aa131eb2f9315dc436943b58ce702a1d6ffdfcfd6371c0de54b7c45e9821d121002820918ce617a0077c9d495f535bf8345e + checksum: c065ed1ac04eef103170650bdb81af7aca6d8f1b9d72253251397345d908c09e6daf78eed2a408b273caf3d109900ad84f4a60fc54fd6f7b062f93b5e23c92f4 languageName: node linkType: hard -"@blocksuite/store@npm:0.11.0-nightly-202312212326-e2b48df": - version: 0.11.0-nightly-202312212326-e2b48df - resolution: "@blocksuite/store@npm:0.11.0-nightly-202312212326-e2b48df" +"@blocksuite/store@npm:0.11.0-nightly-202312220916-e3abcbb": + version: 0.11.0-nightly-202312220916-e3abcbb + resolution: "@blocksuite/store@npm:0.11.0-nightly-202312220916-e3abcbb" dependencies: - "@blocksuite/global": "npm:0.11.0-nightly-202312212326-e2b48df" - "@blocksuite/inline": "npm:0.11.0-nightly-202312212326-e2b48df" + "@blocksuite/global": "npm:0.11.0-nightly-202312220916-e3abcbb" + "@blocksuite/inline": "npm:0.11.0-nightly-202312220916-e3abcbb" "@types/flexsearch": "npm:^0.7.3" flexsearch: "npm:0.7.21" idb-keyval: "npm:^6.2.1" @@ -4218,7 +4219,7 @@ __metadata: peerDependencies: async-call-rpc: ^6 yjs: ^13 - checksum: 3666801967eb301ca9df5f605bcb27d6e780e8883af5f9bc964898056c4558d5bbdfe12d24c61eb1ea6d3156ab9687ab28f2b9905dc50d7b54b7fbd9d71029a3 + checksum: fe615c626b412c5f48406a6617e950f55388e3253540cd02978e3155f3a573adc68539c3b521c40d04da7932eb8a73af30b8262cb34f478fb0b88bc0b28f9153 languageName: node linkType: hard @@ -5902,6 +5903,17 @@ __metadata: languageName: node linkType: hard +"@fal-ai/serverless-client@npm:^0.7.3": + version: 0.7.4 + resolution: "@fal-ai/serverless-client@npm:0.7.4" + dependencies: + "@msgpack/msgpack": "npm:^3.0.0-beta2" + robot3: "npm:^0.4.1" + uuid-random: "npm:^1.3.2" + checksum: 2df2a3de60b637b2cfe57e08429f79e0ac7f604777f7e761839b28795be049e714f3f1f338c4fb35a18e575d4c58b82c7244680877adf5d83094ba6625de4851 + languageName: node + linkType: hard + "@fal-works/esbuild-plugin-global-externals@npm:^2.1.2": version: 2.1.2 resolution: "@fal-works/esbuild-plugin-global-externals@npm:2.1.2" @@ -7391,6 +7403,13 @@ __metadata: languageName: node linkType: hard +"@msgpack/msgpack@npm:^3.0.0-beta2": + version: 3.0.0-beta2 + resolution: "@msgpack/msgpack@npm:3.0.0-beta2" + checksum: d02f9221aa152cbd2977d1f56dc591baa2a37420a694cbc7e54ff0724f56ac0523e94de010e56bb845d67a1f2226c1761064b5777e63e9fc26884f4144d391a7 + languageName: node + linkType: hard + "@mswjs/cookies@npm:^1.1.0": version: 1.1.0 resolution: "@mswjs/cookies@npm:1.1.0" @@ -13744,12 +13763,12 @@ __metadata: "@affine/debug": "workspace:*" "@affine/env": "workspace:*" "@affine/workspace": "workspace:*" - "@blocksuite/block-std": "npm:0.11.0-nightly-202312212326-e2b48df" - "@blocksuite/blocks": "npm:0.11.0-nightly-202312212326-e2b48df" - "@blocksuite/global": "npm:0.11.0-nightly-202312212326-e2b48df" - "@blocksuite/lit": "npm:0.11.0-nightly-202312212326-e2b48df" - "@blocksuite/presets": "npm:0.11.0-nightly-202312212326-e2b48df" - "@blocksuite/store": "npm:0.11.0-nightly-202312212326-e2b48df" + "@blocksuite/block-std": "npm:0.11.0-nightly-202312220916-e3abcbb" + "@blocksuite/blocks": "npm:0.11.0-nightly-202312220916-e3abcbb" + "@blocksuite/global": "npm:0.11.0-nightly-202312220916-e3abcbb" + "@blocksuite/lit": "npm:0.11.0-nightly-202312220916-e3abcbb" + "@blocksuite/presets": "npm:0.11.0-nightly-202312220916-e3abcbb" + "@blocksuite/store": "npm:0.11.0-nightly-202312220916-e3abcbb" "@testing-library/react": "npm:^14.0.0" "@toeverything/infra": "workspace:*" "@types/image-blob-reduce": "npm:^4.1.3" @@ -13800,11 +13819,11 @@ __metadata: "@affine/env": "workspace:*" "@affine/sdk": "workspace:*" "@affine/templates": "workspace:*" - "@blocksuite/blocks": "npm:0.11.0-nightly-202312212326-e2b48df" - "@blocksuite/global": "npm:0.11.0-nightly-202312212326-e2b48df" - "@blocksuite/lit": "npm:0.11.0-nightly-202312212326-e2b48df" - "@blocksuite/presets": "npm:0.11.0-nightly-202312212326-e2b48df" - "@blocksuite/store": "npm:0.11.0-nightly-202312212326-e2b48df" + "@blocksuite/blocks": "npm:0.11.0-nightly-202312220916-e3abcbb" + "@blocksuite/global": "npm:0.11.0-nightly-202312220916-e3abcbb" + "@blocksuite/lit": "npm:0.11.0-nightly-202312220916-e3abcbb" + "@blocksuite/presets": "npm:0.11.0-nightly-202312220916-e3abcbb" + "@blocksuite/store": "npm:0.11.0-nightly-202312220916-e3abcbb" "@testing-library/react": "npm:^14.0.0" async-call-rpc: "npm:^6.3.1" electron: "link:../../frontend/electron/node_modules/electron" @@ -13853,8 +13872,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-202312212326-e2b48df" - "@blocksuite/store": "npm:0.11.0-nightly-202312212326-e2b48df" + "@blocksuite/blocks": "npm:0.11.0-nightly-202312220916-e3abcbb" + "@blocksuite/store": "npm:0.11.0-nightly-202312220916-e3abcbb" fake-indexeddb: "npm:^5.0.0" idb: "npm:^8.0.0" nanoid: "npm:^5.0.3" @@ -32668,6 +32687,13 @@ __metadata: languageName: node linkType: hard +"robot3@npm:^0.4.1": + version: 0.4.1 + resolution: "robot3@npm:0.4.1" + checksum: bab48cf0be9c26caeca0bb11a0c7abac813db67dd76c406cfd9ac828562c1cf504ce3775f87b157eb33ac62cda4763421513ecc6f2780266d19cc0f9590eb3bf + languageName: node + linkType: hard + "rollup-plugin-inject@npm:^3.0.0": version: 3.0.2 resolution: "rollup-plugin-inject@npm:3.0.2" @@ -35773,6 +35799,13 @@ __metadata: languageName: node linkType: hard +"uuid-random@npm:^1.3.2": + version: 1.3.2 + resolution: "uuid-random@npm:1.3.2" + checksum: 9070c876651e1893f9255dddab2edc177ba34196660065be074050e4143405382b7f0f5fb922b666ebfd0794a6ef7b9f6acb627865df7b2978edb0da6b448f1d + languageName: node + linkType: hard + "uuid@npm:9.0.1, uuid@npm:^9.0.0, uuid@npm:^9.0.1": version: 9.0.1 resolution: "uuid@npm:9.0.1" @@ -37018,7 +37051,7 @@ __metadata: version: 0.0.0-use.local resolution: "y-provider@workspace:packages/common/y-provider" dependencies: - "@blocksuite/store": "npm:0.11.0-nightly-202312212326-e2b48df" + "@blocksuite/store": "npm:0.11.0-nightly-202312220916-e3abcbb" vite: "npm:^5.0.6" vite-plugin-dts: "npm:3.6.0" vitest: "npm:1.0.4" From 05025bf59a53085237b8136c1f28cdf6c2a3b691 Mon Sep 17 00:00:00 2001 From: EYHN Date: Mon, 25 Dec 2023 03:24:12 +0000 Subject: [PATCH 002/110] refactor(core): remove outline plugin and layout atom (#5326) @affine/outline is no longer used, this PR deletes this plugin and deletes the code that is no longer used --- README.md | 1 - .../common/infra/src/__internal__/plugin.ts | 1 - packages/common/infra/src/atom/index.ts | 1 - packages/common/infra/src/atom/layout.ts | 34 ------ packages/common/infra/src/type.ts | 10 -- .../frontend/core/.webpack/runtime-config.ts | 2 - .../core/src/bootstrap/plugins/setup.ts | 95 +--------------- packages/frontend/electron/package.json | 1 - packages/plugins/outline/package.json | 28 ----- packages/plugins/outline/project.json | 26 ----- packages/plugins/outline/src/app.tsx | 107 ------------------ packages/plugins/outline/src/index.ts | 41 ------- packages/plugins/outline/tsconfig.json | 17 --- tests/affine-cloud/e2e/collaboration.spec.ts | 3 +- tests/affine-plugin/e2e/basic.spec.ts | 1 - yarn.lock | 15 --- 16 files changed, 3 insertions(+), 380 deletions(-) delete mode 100644 packages/common/infra/src/atom/layout.ts delete mode 100644 packages/plugins/outline/package.json delete mode 100644 packages/plugins/outline/project.json delete mode 100644 packages/plugins/outline/src/app.tsx delete mode 100644 packages/plugins/outline/src/index.ts delete mode 100644 packages/plugins/outline/tsconfig.json diff --git a/README.md b/README.md index c73b6c911a..c33ee9b262 100644 --- a/README.md +++ b/README.md @@ -126,7 +126,6 @@ If you have questions, you are welcome to contact us. One of the best places to | ---------------------------------------------------------------- | ----------------------------------------- | ------ | | [@affine/copilot-plugin](./packages/plugins/copilot) | AI Copilot that help you document writing | ๐Ÿšง | | [@affine/image-preview-plugin](./packages/plugins/image-preview) | Component for previewing an image | โœ… | -| [@affine/outline](./packages/plugins/outline) | Outline for your document | โœ… | ## Upstreams diff --git a/packages/common/infra/src/__internal__/plugin.ts b/packages/common/infra/src/__internal__/plugin.ts index 9e2840939a..7071e8b9df 100644 --- a/packages/common/infra/src/__internal__/plugin.ts +++ b/packages/common/infra/src/__internal__/plugin.ts @@ -36,7 +36,6 @@ export const pluginPackageJson = atom< export const enabledPluginAtom = atomWithStorage('affine-enabled-plugin', [ '@affine/image-preview-plugin', - '@affine/outline-plugin', ]); export const pluginHeaderItemAtom = atom< diff --git a/packages/common/infra/src/atom/index.ts b/packages/common/infra/src/atom/index.ts index 8b5f2a3104..30785f552b 100644 --- a/packages/common/infra/src/atom/index.ts +++ b/packages/common/infra/src/atom/index.ts @@ -2,7 +2,6 @@ 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/layout.ts b/packages/common/infra/src/atom/layout.ts deleted file mode 100644 index ed6ec20fe7..0000000000 --- a/packages/common/infra/src/atom/layout.ts +++ /dev/null @@ -1,34 +0,0 @@ -import type { ExpectedLayout } from '@affine/sdk/entry'; -import { atom } from 'jotai'; - -const contentLayoutBaseAtom = atom('editor'); - -type SetStateAction = Value | ((prev: Value) => Value); -export const contentLayoutAtom = atom< - ExpectedLayout, - [SetStateAction], - void ->( - get => get(contentLayoutBaseAtom), - (_, set, layout) => { - set(contentLayoutBaseAtom, prev => { - let setV: (prev: ExpectedLayout) => ExpectedLayout; - if (typeof layout !== 'function') { - setV = () => layout; - } else { - setV = layout; - } - const nextValue = setV(prev); - if (nextValue === 'editor') { - return nextValue; - } - if (nextValue.first !== 'editor') { - throw new Error('The first element of the layout should be editor.'); - } - if (nextValue.splitPercentage && nextValue.splitPercentage < 70) { - throw new Error('The split percentage should be greater than 70.'); - } - return nextValue; - }); - } -); diff --git a/packages/common/infra/src/type.ts b/packages/common/infra/src/type.ts index cdda8bfe28..b08e8c2f0c 100644 --- a/packages/common/infra/src/type.ts +++ b/packages/common/infra/src/type.ts @@ -1,6 +1,4 @@ -import type { ExpectedLayout } from '@affine/sdk/entry'; import type Buffer from 'buffer'; -import type { WritableAtom } from 'jotai'; import { z } from 'zod'; import type { AppConfigSchema } from './app-config-storage.js'; @@ -33,14 +31,6 @@ export const packageJsonOutputSchema = z.object({ }), }); -type SetStateAction = Value | ((prev: Value) => Value); - -export type ContentLayoutAtom = WritableAtom< - ExpectedLayout, - [SetStateAction], - void ->; - export abstract class HandlerManager< Namespace extends string, Handlers extends Record, diff --git a/packages/frontend/core/.webpack/runtime-config.ts b/packages/frontend/core/.webpack/runtime-config.ts index 6faf651feb..4921c3191b 100644 --- a/packages/frontend/core/.webpack/runtime-config.ts +++ b/packages/frontend/core/.webpack/runtime-config.ts @@ -63,7 +63,6 @@ export function getRuntimeConfig(buildFlags: BuildFlags): RuntimeConfig { '/plugins/hello-world', '/plugins/image-preview', '/plugins/vue-hello-world', - '/plugins/outline', ], enableTestProperties: true, enableBroadcastChannelProvider: true, @@ -105,7 +104,6 @@ export function getRuntimeConfig(buildFlags: BuildFlags): RuntimeConfig { '/plugins/hello-world', '/plugins/image-preview', '/plugins/vue-hello-world', - '/plugins/outline', ], enablePlugin: process.env.ENABLE_PLUGIN ? process.env.ENABLE_PLUGIN === 'true' diff --git a/packages/frontend/core/src/bootstrap/plugins/setup.ts b/packages/frontend/core/src/bootstrap/plugins/setup.ts index eb848ce174..15c473a899 100644 --- a/packages/frontend/core/src/bootstrap/plugins/setup.ts +++ b/packages/frontend/core/src/bootstrap/plugins/setup.ts @@ -1,10 +1,5 @@ import { DebugLogger } from '@affine/debug'; -import type { - CallbackMap, - ExpectedLayout, - LayoutNode, - PluginContext, -} from '@affine/sdk/entry'; +import type { CallbackMap, PluginContext } from '@affine/sdk/entry'; import { AffineFormatBarWidget } from '@blocksuite/blocks'; import { assertExists } from '@blocksuite/global/utils'; import { @@ -12,10 +7,7 @@ import { pluginEditorAtom, pluginHeaderItemAtom, pluginSettingAtom, - pluginWindowAtom, } from '@toeverything/infra/__internal__/plugin'; -import { contentLayoutAtom, currentPageIdAtom } from '@toeverything/infra/atom'; -import { atom } from 'jotai'; import { Provider } from 'jotai/react'; import type { createStore } from 'jotai/vanilla'; import { createElement, type PropsWithChildren } from 'react'; @@ -31,83 +23,6 @@ const permissionLogger = new DebugLogger('plugins:permission'); const importLogger = new DebugLogger('plugins:import'); const entryLogger = new DebugLogger('plugins:entry'); -const pushLayoutAtom = atom< - null, - // fixme: check plugin name here - [ - pluginName: string, - create: (root: HTMLElement) => () => void, - options: - | { - maxWidth: (number | undefined)[]; - } - | undefined, - ], - void ->(null, (_, set, pluginName, callback, options) => { - set(pluginWindowAtom, items => ({ - ...items, - [pluginName]: callback, - })); - set(contentLayoutAtom, layout => { - if (layout === 'editor') { - return { - direction: 'horizontal', - first: 'editor', - second: pluginName, - splitPercentage: 70, - maxWidth: options?.maxWidth, - }; - } else { - return { - direction: 'horizontal', - first: 'editor', - splitPercentage: 70, - second: { - direction: 'horizontal', - first: pluginName, - second: layout.second, - splitPercentage: 50, - }, - } satisfies ExpectedLayout; - } - }); - addCleanup(pluginName, () => { - set(deleteLayoutAtom, pluginName); - }); -}); - -const deleteLayoutAtom = atom(null, (_, set, id) => { - set(pluginWindowAtom, items => { - const newItems = { ...items }; - delete newItems[id]; - return newItems; - }); - const removeLayout = (layout: LayoutNode): LayoutNode | string => { - if (typeof layout === 'string') { - return layout; - } - if (layout.first === id) { - return layout.second; - } else if (layout.second === id) { - return layout.first; - } else { - return { - ...layout, - second: removeLayout(layout.second), - }; - } - }; - - set(contentLayoutAtom, layout => { - if (layout === 'editor') { - return 'editor'; - } else { - return removeLayout(layout) as ExpectedLayout; - } - }); -}); - const setupWeakMap = new WeakMap< ReturnType, ReturnType @@ -124,11 +39,6 @@ export function createSetup(rootStore: ReturnType) { } function createSetupImpl(rootStore: ReturnType) { - // clean up plugin windows when switching to other pages - rootStore.sub(currentPageIdAtom, () => { - rootStore.set(contentLayoutAtom, 'editor'); - }); - // module -> importName -> updater[] const _rootImportsMap = new Map>(); const rootImportsMapSetupPromise = setupImportsMap(_rootImportsMap, { @@ -145,9 +55,6 @@ function createSetupImpl(rootStore: ReturnType) { '@blocksuite/inline': import('@blocksuite/inline'), '@affine/sdk/entry': { rootStore, - currentPageIdAtom: currentPageIdAtom, - pushLayoutAtom: pushLayoutAtom, - deleteLayoutAtom: deleteLayoutAtom, }, '@blocksuite/global/utils': import('@blocksuite/global/utils'), '@toeverything/infra/atom': import('@toeverything/infra/atom'), diff --git a/packages/frontend/electron/package.json b/packages/frontend/electron/package.json index 7a755f9ca1..6928300a75 100644 --- a/packages/frontend/electron/package.json +++ b/packages/frontend/electron/package.json @@ -28,7 +28,6 @@ "@affine/hello-world-plugin": "workspace:*", "@affine/image-preview-plugin": "workspace:*", "@affine/native": "workspace:*", - "@affine/outline-plugin": "workspace:*", "@affine/sdk": "workspace:*", "@affine/templates": "workspace:*", "@affine/vue-hello-world-plugin": "workspace:*", diff --git a/packages/plugins/outline/package.json b/packages/plugins/outline/package.json deleted file mode 100644 index a0c0b333d4..0000000000 --- a/packages/plugins/outline/package.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "name": "@affine/outline-plugin", - "type": "module", - "private": true, - "description": "Outline plugin", - "version": "0.11.0", - "scripts": { - "dev": "af dev", - "build": "af build" - }, - "affinePlugin": { - "release": "development", - "entry": { - "core": "./src/index.ts" - } - }, - "dependencies": { - "@affine/component": "workspace:*", - "@affine/sdk": "workspace:*", - "@blocksuite/icons": "2.1.36" - }, - "devDependencies": { - "@affine/plugin-cli": "workspace:*", - "jotai": "^2.5.1", - "react": "18.2.0", - "react-dom": "18.2.0" - } -} diff --git a/packages/plugins/outline/project.json b/packages/plugins/outline/project.json deleted file mode 100644 index 2f09ea1644..0000000000 --- a/packages/plugins/outline/project.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "name": "@affine/outline-plugin", - "$schema": "../../../node_modules/nx/schemas/project-schema.json", - "namedInputs": { - "default": [ - "{projectRoot}/**/*", - "{workspaceRoot}/tools/plugin-cli/src/**/*", - "sharedGlobals" - ] - }, - "targets": { - "build": { - "executor": "nx:run-script", - "options": { - "script": "build" - }, - "dependsOn": ["^build"], - "inputs": ["default"], - "outputs": [ - "{workspaceRoot}/packages/frontend/core/public/plugins/outline", - "{workspaceRoot}/packages/frontend/electron/dist/plugins/outline" - ] - } - }, - "tags": ["plugin"] -} diff --git a/packages/plugins/outline/src/app.tsx b/packages/plugins/outline/src/app.tsx deleted file mode 100644 index c22b0a2c61..0000000000 --- a/packages/plugins/outline/src/app.tsx +++ /dev/null @@ -1,107 +0,0 @@ -import { IconButton } from '@affine/component/ui/button'; -import { Tooltip } from '@affine/component/ui/tooltip'; -import { - currentPageIdAtom, - currentWorkspaceAtom, - deleteLayoutAtom, - pushLayoutAtom, -} from '@affine/sdk/entry'; -import { TOCNotesPanel } from '@blocksuite/blocks'; -import { assertExists } from '@blocksuite/global/utils'; -import { RightSidebarIcon } from '@blocksuite/icons'; -import { useAtomValue, useSetAtom } from 'jotai'; -import type { ComponentType, PropsWithChildren } from 'react'; -import { useCallback, useRef, useState } from 'react'; -import { createRoot } from 'react-dom/client'; - -const Outline = () => { - const tocPanelRef = useRef(null); - const currentPageId = useAtomValue(currentPageIdAtom); - assertExists(currentPageId, 'current page id'); - const currentWorkspace = useAtomValue(currentWorkspaceAtom); - const currentPage = currentWorkspace.getPage(currentPageId); - assertExists(currentPage, 'current page'); - - if (!tocPanelRef.current) { - tocPanelRef.current = new TOCNotesPanel(); - } - - if (currentPage !== tocPanelRef.current?.page) { - (tocPanelRef.current as TOCNotesPanel).page = currentPage; - } - - return ( -
{ - if (container) { - assertExists(tocPanelRef.current); - container.append(tocPanelRef.current); - } - }, [])} - /> - ); -}; - -export const HeaderItem = ({ - Provider, -}: { - Provider: ComponentType; -}) => { - const [open, setOpen] = useState(false); - const pushLayout = useSetAtom(pushLayoutAtom); - const deleteLayout = useSetAtom(deleteLayoutAtom); - const [container, setContainer] = useState(null); - - return ( - - { - if (!open) { - setOpen(true); - pushLayout( - '@affine/outline-plugin', - div => { - const root = createRoot(div); - - div.style.height = '100%'; - - root.render( - - - - ); - return () => { - root.unmount(); - }; - }, - { - maxWidth: [undefined, 300], - } - ); - } else { - setOpen(false); - deleteLayout('@affine/outline-plugin'); - } - }, [Provider, deleteLayout, open, pushLayout])} - > - - - - ); -}; diff --git a/packages/plugins/outline/src/index.ts b/packages/plugins/outline/src/index.ts deleted file mode 100644 index 30eacb92f0..0000000000 --- a/packages/plugins/outline/src/index.ts +++ /dev/null @@ -1,41 +0,0 @@ -import type { PluginContext } from '@affine/sdk/entry'; -import { registerTOCComponents } from '@blocksuite/blocks'; -import { createElement } from 'react'; -import { createRoot } from 'react-dom/client'; - -import { HeaderItem } from './app'; - -export const entry = (context: PluginContext) => { - console.log('register outline'); - - context.register('headerItem', div => { - registerTOCComponents(components => { - for (const compName in components) { - if (window.customElements.get(compName)) continue; - - window.customElements.define( - compName, - components[compName as keyof typeof components] - ); - } - }); - - div.style.height = '100%'; - - const root = createRoot(div); - root.render( - createElement( - context.utils.PluginProvider, - {}, - createElement(HeaderItem, { - Provider: context.utils.PluginProvider, - }) - ) - ); - return () => { - root.unmount(); - }; - }); - - return () => {}; -}; diff --git a/packages/plugins/outline/tsconfig.json b/packages/plugins/outline/tsconfig.json deleted file mode 100644 index ab06e69674..0000000000 --- a/packages/plugins/outline/tsconfig.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "extends": "../../../tsconfig.json", - "include": ["./src"], - "compilerOptions": { - "noEmit": false, - "outDir": "lib", - "jsx": "preserve" - }, - "references": [ - { - "path": "../../common/sdk" - }, - { - "path": "../../frontend/component" - } - ] -} diff --git a/tests/affine-cloud/e2e/collaboration.spec.ts b/tests/affine-cloud/e2e/collaboration.spec.ts index 8c065aea13..f167cdb650 100644 --- a/tests/affine-cloud/e2e/collaboration.spec.ts +++ b/tests/affine-cloud/e2e/collaboration.spec.ts @@ -236,7 +236,8 @@ test('can sync svg between different browsers', async ({ page, browser }) => { const image = page.locator('affine-image'); page.evaluate(async () => { - window.showOpenFilePicker = undefined; + // https://github.com/toeverything/blocksuite/blob/master/packages/blocks/src/_common/utils/filesys.ts#L20 + (window as any).showOpenFilePicker = undefined; }); const title = getBlockSuiteEditorTitle(page); diff --git a/tests/affine-plugin/e2e/basic.spec.ts b/tests/affine-plugin/e2e/basic.spec.ts index d2fa6de3a1..b554d1d0d3 100644 --- a/tests/affine-plugin/e2e/basic.spec.ts +++ b/tests/affine-plugin/e2e/basic.spec.ts @@ -26,7 +26,6 @@ test('plugin should exist', async ({ page }) => { '@affine/hello-world-plugin', '@affine/image-preview-plugin', '@affine/vue-hello-world-plugin', - '@affine/outline-plugin', ]; expect(packageJson).toEqual( plugins diff --git a/yarn.lock b/yarn.lock index 5b92dcfbe3..4108de4783 100644 --- a/yarn.lock +++ b/yarn.lock @@ -464,7 +464,6 @@ __metadata: "@affine/hello-world-plugin": "workspace:*" "@affine/image-preview-plugin": "workspace:*" "@affine/native": "workspace:*" - "@affine/outline-plugin": "workspace:*" "@affine/sdk": "workspace:*" "@affine/templates": "workspace:*" "@affine/vue-hello-world-plugin": "workspace:*" @@ -675,20 +674,6 @@ __metadata: languageName: unknown linkType: soft -"@affine/outline-plugin@workspace:*, @affine/outline-plugin@workspace:packages/plugins/outline": - version: 0.0.0-use.local - resolution: "@affine/outline-plugin@workspace:packages/plugins/outline" - dependencies: - "@affine/component": "workspace:*" - "@affine/plugin-cli": "workspace:*" - "@affine/sdk": "workspace:*" - "@blocksuite/icons": "npm:2.1.36" - jotai: "npm:^2.5.1" - react: "npm:18.2.0" - react-dom: "npm:18.2.0" - languageName: unknown - linkType: soft - "@affine/plugin-cli@workspace:*, @affine/plugin-cli@workspace:tools/plugin-cli": version: 0.0.0-use.local resolution: "@affine/plugin-cli@workspace:tools/plugin-cli" From e1bd13a018253ef8571a14008531bafa6c24f965 Mon Sep 17 00:00:00 2001 From: EYHN Date: Mon, 25 Dec 2023 03:34:22 +0000 Subject: [PATCH 003/110] refactor(core): remove adapter (#5324) workspace adapter is no longer used. --- packages/common/env/src/workspace.ts | 52 ------------------- .../frontend/core/src/adapters/cloud/ui.tsx | 15 ------ .../core/src/adapters/local/index.tsx | 17 ------ packages/frontend/core/src/adapters/shared.ts | 15 ------ .../frontend/core/src/adapters/workspace.ts | 35 ------------- .../components/adapter-worksapce-wrapper.tsx | 14 ----- .../setting-modal/workspace-setting/index.tsx | 4 +- .../core/src/layouts/workspace-layout.tsx | 6 +-- .../swr-config-provider.tsx} | 10 ++-- 9 files changed, 8 insertions(+), 160 deletions(-) delete mode 100644 packages/frontend/core/src/adapters/cloud/ui.tsx delete mode 100644 packages/frontend/core/src/adapters/local/index.tsx delete mode 100644 packages/frontend/core/src/adapters/shared.ts delete mode 100644 packages/frontend/core/src/adapters/workspace.ts delete mode 100644 packages/frontend/core/src/components/adapter-worksapce-wrapper.tsx rename packages/frontend/core/src/{components/cloud/provider.tsx => providers/swr-config-provider.tsx} (87%) diff --git a/packages/common/env/src/workspace.ts b/packages/common/env/src/workspace.ts index 9f99f5c077..9381241e95 100644 --- a/packages/common/env/src/workspace.ts +++ b/packages/common/env/src/workspace.ts @@ -1,5 +1,3 @@ -import type { PropsWithChildren, ReactNode } from 'react'; - export enum WorkspaceSubPath { ALL = 'all', Collection = 'collection', @@ -8,18 +6,6 @@ export enum WorkspaceSubPath { SHARED = 'shared', } -export enum ReleaseType { - // if workspace is not released yet, we will not show it in the workspace list - UNRELEASED = 'unreleased', - STABLE = 'stable', -} - -export enum LoadPriority { - HIGH = 1, - MEDIUM = 2, - LOW = 3, -} - export enum WorkspaceFlavour { /** * New AFFiNE Cloud Workspace using Nest.js Server. @@ -27,41 +13,3 @@ export enum WorkspaceFlavour { AFFINE_CLOUD = 'affine-cloud', LOCAL = 'local', } - -export const settingPanel = { - General: 'general', - Collaboration: 'collaboration', - Publish: 'publish', - Export: 'export', - Sync: 'sync', -} as const; -export const settingPanelValues = Object.values(settingPanel); -export type SettingPanel = (typeof settingPanel)[keyof typeof settingPanel]; - -export type WorkspaceHeaderProps = { - rightSlot?: ReactNode; - currentEntry: - | { - subPath: WorkspaceSubPath; - } - | { - pageId: string; - }; -}; - -interface FC

{ - (props: P): ReactNode; -} - -export interface WorkspaceUISchema { - Provider: FC; - LoginCard?: FC; -} - -export interface WorkspaceAdapter { - releaseType: ReleaseType; - flavour: Flavour; - // The Adapter will be loaded according to the priority - loadPriority: LoadPriority; - UI: WorkspaceUISchema; -} diff --git a/packages/frontend/core/src/adapters/cloud/ui.tsx b/packages/frontend/core/src/adapters/cloud/ui.tsx deleted file mode 100644 index 9548d3d4a6..0000000000 --- a/packages/frontend/core/src/adapters/cloud/ui.tsx +++ /dev/null @@ -1,15 +0,0 @@ -import type { WorkspaceUISchema } from '@affine/env/workspace'; -import { lazy } from 'react'; - -import { Provider } from '../shared'; - -const LoginCard = lazy(() => - import('../../components/cloud/login-card').then(({ LoginCard }) => ({ - default: LoginCard, - })) -); - -export const UI = { - Provider, - LoginCard, -} satisfies WorkspaceUISchema; diff --git a/packages/frontend/core/src/adapters/local/index.tsx b/packages/frontend/core/src/adapters/local/index.tsx deleted file mode 100644 index 4abdd9700c..0000000000 --- a/packages/frontend/core/src/adapters/local/index.tsx +++ /dev/null @@ -1,17 +0,0 @@ -import type { WorkspaceAdapter } from '@affine/env/workspace'; -import { - LoadPriority, - ReleaseType, - WorkspaceFlavour, -} from '@affine/env/workspace'; - -import { Provider } from '../shared'; - -export const LocalAdapter: WorkspaceAdapter = { - releaseType: ReleaseType.STABLE, - flavour: WorkspaceFlavour.LOCAL, - loadPriority: LoadPriority.LOW, - UI: { - Provider, - }, -}; diff --git a/packages/frontend/core/src/adapters/shared.ts b/packages/frontend/core/src/adapters/shared.ts deleted file mode 100644 index 6a075b042f..0000000000 --- a/packages/frontend/core/src/adapters/shared.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { lazy } from 'react'; - -export const Provider = lazy(() => - import('../components/cloud/provider').then(({ Provider }) => ({ - default: Provider, - })) -); - -export const NewWorkspaceSettingDetail = lazy(() => - import('../components/affine/new-workspace-setting-detail').then( - ({ WorkspaceSettingDetail }) => ({ - default: WorkspaceSettingDetail, - }) - ) -); diff --git a/packages/frontend/core/src/adapters/workspace.ts b/packages/frontend/core/src/adapters/workspace.ts deleted file mode 100644 index 7ef8e67950..0000000000 --- a/packages/frontend/core/src/adapters/workspace.ts +++ /dev/null @@ -1,35 +0,0 @@ -import { Unreachable } from '@affine/env/constant'; -import type { - WorkspaceAdapter, - WorkspaceUISchema, -} from '@affine/env/workspace'; -import { - LoadPriority, - ReleaseType, - WorkspaceFlavour, -} from '@affine/env/workspace'; - -import { UI as CloudUI } from './cloud/ui'; -import { LocalAdapter } from './local'; - -export const WorkspaceAdapters = { - [WorkspaceFlavour.LOCAL]: LocalAdapter, - [WorkspaceFlavour.AFFINE_CLOUD]: { - releaseType: ReleaseType.UNRELEASED, - flavour: WorkspaceFlavour.AFFINE_CLOUD, - loadPriority: LoadPriority.HIGH, - UI: CloudUI, - }, -} satisfies { - [Key in WorkspaceFlavour]: WorkspaceAdapter; -}; - -export function getUIAdapter( - flavour: Flavour -): WorkspaceUISchema { - const ui = WorkspaceAdapters[flavour].UI as WorkspaceUISchema; - if (!ui) { - throw new Unreachable(); - } - return ui; -} diff --git a/packages/frontend/core/src/components/adapter-worksapce-wrapper.tsx b/packages/frontend/core/src/components/adapter-worksapce-wrapper.tsx deleted file mode 100644 index fda0cdec77..0000000000 --- a/packages/frontend/core/src/components/adapter-worksapce-wrapper.tsx +++ /dev/null @@ -1,14 +0,0 @@ -import { waitForCurrentWorkspaceAtom } from '@affine/workspace/atom'; -import { assertExists } from '@blocksuite/global/utils'; -import { useAtomValue } from 'jotai'; -import type { FC, PropsWithChildren } from 'react'; - -import { WorkspaceAdapters } from '../adapters/workspace'; - -export const AdapterProviderWrapper: FC = ({ children }) => { - const currentWorkspace = useAtomValue(waitForCurrentWorkspaceAtom); - - const Provider = WorkspaceAdapters[currentWorkspace.flavour].UI.Provider; - assertExists(Provider); - return {children}; -}; diff --git a/packages/frontend/core/src/components/affine/setting-modal/workspace-setting/index.tsx b/packages/frontend/core/src/components/affine/setting-modal/workspace-setting/index.tsx index 87b6956cc6..be9c6dd83a 100644 --- a/packages/frontend/core/src/components/affine/setting-modal/workspace-setting/index.tsx +++ b/packages/frontend/core/src/components/affine/setting-modal/workspace-setting/index.tsx @@ -1,7 +1,7 @@ import type { WorkspaceMetadata } from '@affine/workspace/metadata'; -import { NewWorkspaceSettingDetail } from '../../../../adapters/shared'; import { useIsWorkspaceOwner } from '../../../../hooks/affine/use-is-workspace-owner'; +import { WorkspaceSettingDetail } from '../../new-workspace-setting-detail'; export const WorkspaceSetting = ({ workspaceMetadata, @@ -10,7 +10,7 @@ export const WorkspaceSetting = ({ }) => { const isOwner = useIsWorkspaceOwner(workspaceMetadata); return ( - diff --git a/packages/frontend/core/src/layouts/workspace-layout.tsx b/packages/frontend/core/src/layouts/workspace-layout.tsx index e903416643..207e1a6624 100644 --- a/packages/frontend/core/src/layouts/workspace-layout.tsx +++ b/packages/frontend/core/src/layouts/workspace-layout.tsx @@ -27,7 +27,6 @@ import { useLocation, useParams } from 'react-router-dom'; import { Map as YMap } from 'yjs'; import { openQuickSearchModalAtom, openSettingModalAtom } from '../atoms'; -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'; @@ -41,6 +40,7 @@ import { AllWorkspaceModals, CurrentWorkspaceModals, } from '../providers/modal-provider'; +import { SWRConfigProvider } from '../providers/swr-config-provider'; import { pathGenerator } from '../shared'; const CMDKQuickSearchModal = lazy(() => @@ -78,7 +78,7 @@ export const WorkspaceLayout = function WorkspaceLayout({ children, }: PropsWithChildren) { return ( - + {/* load all workspaces is costly, do not block the whole UI */} @@ -87,7 +87,7 @@ export const WorkspaceLayout = function WorkspaceLayout({ }> {children} - + ); }; diff --git a/packages/frontend/core/src/components/cloud/provider.tsx b/packages/frontend/core/src/providers/swr-config-provider.tsx similarity index 87% rename from packages/frontend/core/src/components/cloud/provider.tsx rename to packages/frontend/core/src/providers/swr-config-provider.tsx index 6b9daf4d24..fcdbc2b3bc 100644 --- a/packages/frontend/core/src/components/cloud/provider.tsx +++ b/packages/frontend/core/src/providers/swr-config-provider.tsx @@ -7,7 +7,7 @@ import { useCallback } from 'react'; import type { SWRConfiguration } from 'swr'; import { SWRConfig } from 'swr'; -const cloudConfig: SWRConfiguration = { +const swrConfig: SWRConfiguration = { suspense: true, use: [ useSWRNext => (key, fetcher, config) => { @@ -49,10 +49,6 @@ const cloudConfig: SWRConfiguration = { ], }; -export const Provider = (props: PropsWithChildren): ReactNode => { - if (!runtimeConfig.enableCloud) { - return props.children; - } - - return {props.children}; +export const SWRConfigProvider = (props: PropsWithChildren): ReactNode => { + return {props.children}; }; From 9493bd99f9b4e3f2b25b2e142bc892d709e9ccaf Mon Sep 17 00:00:00 2001 From: EYHN Date: Mon, 25 Dec 2023 03:34:28 +0000 Subject: [PATCH 004/110] refactor(infra): move currentPageAtom to core (#5332) Remove `currentPageAtom` from `infra` to `frontend/core.` --- packages/common/infra/src/atom/index.ts | 1 - packages/common/infra/src/atom/workspace.ts | 3 --- packages/common/sdk/src/entry.ts | 1 - packages/frontend/core/src/atoms/mode.ts | 3 ++- .../affine/affine-error-boundary/error-basic/info-logger.tsx | 3 ++- packages/frontend/core/src/components/pure/cmdk/data.tsx | 3 ++- packages/frontend/core/src/hooks/current/use-current-page.ts | 3 ++- .../core/src/pages/workspace/detail-page/detail-page.tsx | 4 ++-- 8 files changed, 10 insertions(+), 11 deletions(-) delete mode 100644 packages/common/infra/src/atom/workspace.ts diff --git a/packages/common/infra/src/atom/index.ts b/packages/common/infra/src/atom/index.ts index 30785f552b..978d7fa366 100644 --- a/packages/common/infra/src/atom/index.ts +++ b/packages/common/infra/src/atom/index.ts @@ -4,4 +4,3 @@ export const loadedPluginNameAtom = atom([]); export * from './root-store'; export * from './settings'; -export * from './workspace'; diff --git a/packages/common/infra/src/atom/workspace.ts b/packages/common/infra/src/atom/workspace.ts deleted file mode 100644 index 871333c835..0000000000 --- a/packages/common/infra/src/atom/workspace.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { atom } from 'jotai'; - -export const currentPageIdAtom = atom(null); diff --git a/packages/common/sdk/src/entry.ts b/packages/common/sdk/src/entry.ts index 7421ebeb1e..2cbda2c265 100644 --- a/packages/common/sdk/src/entry.ts +++ b/packages/common/sdk/src/entry.ts @@ -60,6 +60,5 @@ export declare const pushLayoutAtom: WritableAtom< void >; export declare const deleteLayoutAtom: WritableAtom; -export declare const currentPageIdAtom: Atom; export declare const currentWorkspaceAtom: Atom>; export declare const rootStore: ReturnType; diff --git a/packages/frontend/core/src/atoms/mode.ts b/packages/frontend/core/src/atoms/mode.ts index 641f6f8186..3a79f90a75 100644 --- a/packages/frontend/core/src/atoms/mode.ts +++ b/packages/frontend/core/src/atoms/mode.ts @@ -1,8 +1,9 @@ -import { currentPageIdAtom } from '@toeverything/infra/atom'; import { atom } from 'jotai/vanilla'; import { pageSettingFamily } from './index'; +export const currentPageIdAtom = atom(null); + export const currentModeAtom = atom<'page' | 'edgeless'>(get => { const pageId = get(currentPageIdAtom); if (!pageId) { diff --git a/packages/frontend/core/src/components/affine/affine-error-boundary/error-basic/info-logger.tsx b/packages/frontend/core/src/components/affine/affine-error-boundary/error-basic/info-logger.tsx index d347a99b64..7297885c3d 100644 --- a/packages/frontend/core/src/components/affine/affine-error-boundary/error-basic/info-logger.tsx +++ b/packages/frontend/core/src/components/affine/affine-error-boundary/error-basic/info-logger.tsx @@ -2,11 +2,12 @@ import { currentWorkspaceAtom, workspaceListAtom, } from '@affine/workspace/atom'; -import { currentPageIdAtom } from '@toeverything/infra/atom'; import { useAtomValue } from 'jotai/react'; import { useEffect } from 'react'; import { useLocation, useParams } from 'react-router-dom'; +import { currentPageIdAtom } from '../../../../atoms/mode'; + export interface DumpInfoProps { error: any; } diff --git a/packages/frontend/core/src/components/pure/cmdk/data.tsx b/packages/frontend/core/src/components/pure/cmdk/data.tsx index f3f0003d53..612824d780 100644 --- a/packages/frontend/core/src/components/pure/cmdk/data.tsx +++ b/packages/frontend/core/src/components/pure/cmdk/data.tsx @@ -12,7 +12,7 @@ import { useBlockSuitePageMeta, usePageMetaHelper, } from '@toeverything/hooks/use-block-suite-page-meta'; -import { currentPageIdAtom, getCurrentStore } from '@toeverything/infra/atom'; +import { getCurrentStore } from '@toeverything/infra/atom'; import { type AffineCommand, AffineCommandRegistry, @@ -29,6 +29,7 @@ import { recentPageIdsBaseAtom, } from '../../../atoms'; import { collectionsCRUDAtom } from '../../../atoms/collections'; +import { currentPageIdAtom } from '../../../atoms/mode'; import { useNavigateHelper } from '../../../hooks/use-navigate-helper'; import { WorkspaceSubPath } from '../../../shared'; import { usePageHelper } from '../../blocksuite/block-suite-page-list/utils'; diff --git a/packages/frontend/core/src/hooks/current/use-current-page.ts b/packages/frontend/core/src/hooks/current/use-current-page.ts index 8b16a611c3..66095003d0 100644 --- a/packages/frontend/core/src/hooks/current/use-current-page.ts +++ b/packages/frontend/core/src/hooks/current/use-current-page.ts @@ -1,8 +1,9 @@ import { waitForCurrentWorkspaceAtom } from '@affine/workspace/atom'; import { useBlockSuiteWorkspacePage } from '@toeverything/hooks/use-block-suite-workspace-page'; -import { currentPageIdAtom } from '@toeverything/infra/atom'; import { useAtomValue } from 'jotai'; +import { currentPageIdAtom } from '../../atoms/mode'; + export const useCurrentPage = () => { const currentPageId = useAtomValue(currentPageIdAtom); const currentWorkspace = useAtomValue(waitForCurrentWorkspaceAtom); 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 99216d5ad5..fb850561b1 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,7 +11,7 @@ import type { AffineEditorContainer } from '@blocksuite/presets'; import type { Page, Workspace } from '@blocksuite/store'; import { useBlockSuitePageMeta } from '@toeverything/hooks/use-block-suite-page-meta'; import { useWorkspaceStatus } from '@toeverything/hooks/use-workspace-status'; -import { appSettingAtom, currentPageIdAtom } from '@toeverything/infra/atom'; +import { appSettingAtom } from '@toeverything/infra/atom'; import { useAtom, useAtomValue, useSetAtom } from 'jotai'; import { memo, @@ -26,7 +26,7 @@ import type { Map as YMap } from 'yjs'; import { setPageModeAtom } from '../../../atoms'; import { collectionsCRUDAtom } from '../../../atoms/collections'; -import { currentModeAtom } from '../../../atoms/mode'; +import { currentModeAtom, currentPageIdAtom } from '../../../atoms/mode'; import { AffineErrorBoundary } from '../../../components/affine/affine-error-boundary'; import { HubIsland } from '../../../components/affine/hub-island'; import { GlobalPageHistoryModal } from '../../../components/affine/page-history-modal'; From 56f05803827106bdad531e467682217b903e26aa Mon Sep 17 00:00:00 2001 From: EYHN Date: Mon, 25 Dec 2023 06:58:11 +0000 Subject: [PATCH 005/110] fix(workspace): fix svg file with xml header (#5388) --- .../utils/__tests__/buffer-to-blob.spec.ts | 5 +++++ .../workspace/src/utils/buffer-to-blob.ts | 21 +++++++++++++------ 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/packages/frontend/workspace/src/utils/__tests__/buffer-to-blob.spec.ts b/packages/frontend/workspace/src/utils/__tests__/buffer-to-blob.spec.ts index 1aa471b055..8c474966d5 100644 --- a/packages/frontend/workspace/src/utils/__tests__/buffer-to-blob.spec.ts +++ b/packages/frontend/workspace/src/utils/__tests__/buffer-to-blob.spec.ts @@ -9,5 +9,10 @@ describe('isSvgBuffer', () => { expect(isSvgBuffer(Buffer.from(''))).toBe(true); expect(isSvgBuffer(Buffer.from(' \n\r\t'))).toBe(true); expect(isSvgBuffer(Buffer.from('<123>'))).toBe(false); + expect( + isSvgBuffer( + Buffer.from('') + ) + ).toBe(true); }); }); diff --git a/packages/frontend/workspace/src/utils/buffer-to-blob.ts b/packages/frontend/workspace/src/utils/buffer-to-blob.ts index 2ff1d9e1e7..2d642233fb 100644 --- a/packages/frontend/workspace/src/utils/buffer-to-blob.ts +++ b/packages/frontend/workspace/src/utils/buffer-to-blob.ts @@ -1,7 +1,7 @@ import isSvg from 'is-svg'; function fastCheckIsNotSvg(buffer: Uint8Array) { - // check first non-whitespace character is not ' Date: Mon, 25 Dec 2023 07:09:49 +0000 Subject: [PATCH 006/110] fix(core): fix flickering workspace list (#5391) --- packages/frontend/core/src/pages/index.tsx | 25 +++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/packages/frontend/core/src/pages/index.tsx b/packages/frontend/core/src/pages/index.tsx index 110903a03f..6e2d118260 100644 --- a/packages/frontend/core/src/pages/index.tsx +++ b/packages/frontend/core/src/pages/index.tsx @@ -1,7 +1,8 @@ import { Menu } from '@affine/component/ui/menu'; +import { WorkspaceFallback } from '@affine/component/workspace'; import { workspaceListAtom } from '@affine/workspace/atom'; import { useAtomValue } from 'jotai'; -import { lazy, useEffect } from 'react'; +import { lazy, useEffect, useLayoutEffect, useState } from 'react'; import { type LoaderFunction, redirect } from 'react-router-dom'; import { createFirstAppData } from '../bootstrap/first-app-data'; @@ -24,10 +25,14 @@ export const loader: LoaderFunction = async () => { }; export const Component = () => { + // navigating and creating may be slow, to avoid flickering, we show workspace fallback + const [navigating, setNavigating] = useState(false); + const [creating, setCreating] = useState(false); + const list = useAtomValue(workspaceListAtom); const { openPage } = useNavigateHelper(); - useEffect(() => { + useLayoutEffect(() => { if (list.length === 0) { return; } @@ -36,14 +41,24 @@ export const Component = () => { const lastId = localStorage.getItem('last_workspace_id'); const openWorkspace = list.find(w => w.id === lastId) ?? list[0]; openPage(openWorkspace.id, WorkspaceSubPath.ALL); + setNavigating(true); }, [list, openPage]); useEffect(() => { - createFirstAppData().catch(err => { - console.error('Failed to create first app data', err); - }); + setCreating(true); + createFirstAppData() + .catch(err => { + console.error('Failed to create first app data', err); + }) + .finally(() => { + setCreating(false); + }); }, []); + if (navigating || creating) { + return ; + } + // TODO: We need a no workspace page return ( <> From 555d40c3da22ab645110809c86791438c8d50a00 Mon Sep 17 00:00:00 2001 From: DarkSky <25152247+darkskygit@users.noreply.github.com> Date: Mon, 25 Dec 2023 23:14:08 +0800 Subject: [PATCH 007/110] fix: use prefix in electron to prevent formdata bug (#5395) --- packages/frontend/workspace/src/impl/cloud/blob.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/packages/frontend/workspace/src/impl/cloud/blob.ts b/packages/frontend/workspace/src/impl/cloud/blob.ts index 824eb9f31f..20eb5f259a 100644 --- a/packages/frontend/workspace/src/impl/cloud/blob.ts +++ b/packages/frontend/workspace/src/impl/cloud/blob.ts @@ -10,6 +10,14 @@ import { fetcher } from '../../affine/gql'; import type { BlobStorage } from '../../engine/blob'; import { bufferToBlob } from '../../utils/buffer-to-blob'; +function getBaseUrl(): string { + if (environment.isDesktop) { + return runtimeConfig.serverUrlPrefix; + } + const { protocol, hostname, port } = window.location; + return `${protocol}//${hostname}${port ? `:${port}` : ''}`; +} + export const createAffineCloudBlobStorage = ( workspaceId: string ): BlobStorage => { @@ -21,7 +29,7 @@ export const createAffineCloudBlobStorage = ( ? key : `/api/workspaces/${workspaceId}/blobs/${key}`; - return fetchWithTraceReport(suffix).then(async res => { + return fetchWithTraceReport(getBaseUrl() + suffix).then(async res => { if (!res.ok) { // status not in the range 200-299 return null; From 972de5283308c630012c02872736005d9d0544f7 Mon Sep 17 00:00:00 2001 From: Peng Xiao Date: Tue, 26 Dec 2023 06:21:59 +0000 Subject: [PATCH 008/110] fix(core): remove plugins settings (#5337) depend on https://github.com/toeverything/AFFiNE/pull/5324 --- .../component/src/ui/loading/styles.css.ts | 1 - .../setting-modal/general-setting/index.tsx | 11 ----- .../setting-modal/setting-sidebar/index.tsx | 3 -- .../setting-modal/workspace-setting/index.tsx | 2 +- .../delete-leave-workspace/delete/index.tsx | 0 .../delete/style.css.ts | 0 .../delete-leave-workspace/index.tsx | 4 +- .../enable-cloud.tsx | 8 ++-- .../new-workspace-setting-detail/export.tsx | 0 .../new-workspace-setting-detail/index.tsx | 2 +- .../new-workspace-setting-detail/labels.tsx | 0 .../new-workspace-setting-detail/members.tsx | 21 ++++---- .../new-workspace-setting-detail/profile.tsx | 10 ++-- .../new-workspace-setting-detail/storage.tsx | 0 .../new-workspace-setting-detail/style.css.ts | 0 .../new-workspace-setting-detail/types.ts | 0 .../core/src/components/cloud/login-card.tsx | 48 ------------------- tests/affine-local/e2e/settings.spec.ts | 10 ---- tests/kit/utils/setting.ts | 3 -- 19 files changed, 25 insertions(+), 98 deletions(-) rename packages/frontend/core/src/components/affine/{ => setting-modal/workspace-setting}/new-workspace-setting-detail/delete-leave-workspace/delete/index.tsx (100%) rename packages/frontend/core/src/components/affine/{ => setting-modal/workspace-setting}/new-workspace-setting-detail/delete-leave-workspace/delete/style.css.ts (100%) rename packages/frontend/core/src/components/affine/{ => setting-modal/workspace-setting}/new-workspace-setting-detail/delete-leave-workspace/index.tsx (97%) rename packages/frontend/core/src/components/affine/{ => setting-modal/workspace-setting}/new-workspace-setting-detail/enable-cloud.tsx (89%) rename packages/frontend/core/src/components/affine/{ => setting-modal/workspace-setting}/new-workspace-setting-detail/export.tsx (100%) rename packages/frontend/core/src/components/affine/{ => setting-modal/workspace-setting}/new-workspace-setting-detail/index.tsx (97%) rename packages/frontend/core/src/components/affine/{ => setting-modal/workspace-setting}/new-workspace-setting-detail/labels.tsx (100%) rename packages/frontend/core/src/components/affine/{ => setting-modal/workspace-setting}/new-workspace-setting-detail/members.tsx (92%) rename packages/frontend/core/src/components/affine/{ => setting-modal/workspace-setting}/new-workspace-setting-detail/profile.tsx (95%) rename packages/frontend/core/src/components/affine/{ => setting-modal/workspace-setting}/new-workspace-setting-detail/storage.tsx (100%) rename packages/frontend/core/src/components/affine/{ => setting-modal/workspace-setting}/new-workspace-setting-detail/style.css.ts (100%) rename packages/frontend/core/src/components/affine/{ => setting-modal/workspace-setting}/new-workspace-setting-detail/types.ts (100%) delete mode 100644 packages/frontend/core/src/components/cloud/login-card.tsx diff --git a/packages/frontend/component/src/ui/loading/styles.css.ts b/packages/frontend/component/src/ui/loading/styles.css.ts index 94f92627c4..11e4d366d9 100644 --- a/packages/frontend/component/src/ui/loading/styles.css.ts +++ b/packages/frontend/component/src/ui/loading/styles.css.ts @@ -12,7 +12,6 @@ export const loading = style({ [speedVar]: '1.5s', }, textRendering: 'optimizeLegibility', - WebkitFontSmoothing: 'antialiased', transform: 'rotate(-90deg)', animation: `${rotate} ${speedVar} infinite linear`, }); diff --git a/packages/frontend/core/src/components/affine/setting-modal/general-setting/index.tsx b/packages/frontend/core/src/components/affine/setting-modal/general-setting/index.tsx index 31e344396f..4c359206c2 100644 --- a/packages/frontend/core/src/components/affine/setting-modal/general-setting/index.tsx +++ b/packages/frontend/core/src/components/affine/setting-modal/general-setting/index.tsx @@ -3,7 +3,6 @@ import { AppearanceIcon, InformationIcon, KeyboardIcon, - PluginIcon, } from '@blocksuite/icons'; import type { ReactElement, SVGProps } from 'react'; @@ -14,13 +13,11 @@ import { AppearanceSettings } from './appearance'; import { BillingSettings } from './billing'; import { PaymentIcon, UpgradeIcon } from './icons'; import { AFFiNECloudPlans } from './plans'; -import { Plugins } from './plugins'; import { Shortcuts } from './shortcuts'; export type GeneralSettingKeys = | 'shortcuts' | 'appearance' - | 'plugins' | 'about' | 'plans' | 'billing'; @@ -52,12 +49,6 @@ export const useGeneralSettingList = (): GeneralSettingList => { icon: KeyboardIcon, testId: 'shortcuts-panel-trigger', }, - { - key: 'plugins', - title: 'Plugins', - icon: PluginIcon, - testId: 'plugins-panel-trigger', - }, { key: 'about', title: t['com.affine.aboutAFFiNE.title'](), @@ -96,8 +87,6 @@ export const GeneralSetting = ({ generalKey }: GeneralSettingProps) => { return ; case 'appearance': return ; - case 'plugins': - return ; case 'about': return ; case 'plans': 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 8c0c3a8735..dab5785095 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 @@ -127,9 +127,6 @@ export const SettingSidebar = ({
{generalSettingList.map(({ title, icon, key, testId }) => { - if (!runtimeConfig.enablePlugin && key === 'plugins') { - return null; - } return (
{ const canAdjustAvatar = !workspaceIsLoading && avatarUrl && isOwner; return ( -
+
{ -
{t['Workspace Name']()}
+
{t['Workspace Name']()}
{ - const t = useAFFiNEI18N(); - const loginStatus = useCurrentLoginStatus(); - - const onSignInClick = useAsyncCallback(async () => { - await signInCloud(); - }, []); - - if (loginStatus === 'authenticated') { - return ; - } - return ( - -
- -
{' '} - {t['Sign in']()} -
- ); -}; - -const UserCard = () => { - const user = useCurrentUser(); - return ( -
- -
-
{user.name}
-
{user.email}
-
-
- ); -}; diff --git a/tests/affine-local/e2e/settings.spec.ts b/tests/affine-local/e2e/settings.spec.ts index ba5e866aa2..6a0f2d0383 100644 --- a/tests/affine-local/e2e/settings.spec.ts +++ b/tests/affine-local/e2e/settings.spec.ts @@ -4,7 +4,6 @@ import { waitForEditorLoad } from '@affine-test/kit/utils/page-logic'; import { openAboutPanel, openAppearancePanel, - openPluginsPanel, openSettingModal, openShortcutsPanel, } from '@affine-test/kit/utils/setting'; @@ -79,15 +78,6 @@ test('Open shortcuts panel', async ({ page }) => { await expect(title).toBeVisible(); }); -test('Open plugins panel', async ({ page }) => { - await openHomePage(page); - await waitForEditorLoad(page); - await openSettingModal(page); - await openPluginsPanel(page); - const title = page.getByTestId('plugins-title'); - await expect(title).toBeVisible(); -}); - test('Open about panel', async ({ page }) => { await openHomePage(page); await waitForEditorLoad(page); diff --git a/tests/kit/utils/setting.ts b/tests/kit/utils/setting.ts index 94d1c2e598..07d709613d 100644 --- a/tests/kit/utils/setting.ts +++ b/tests/kit/utils/setting.ts @@ -19,9 +19,6 @@ export async function openAppearancePanel(page: Page) { export async function openShortcutsPanel(page: Page) { await page.getByTestId('shortcuts-panel-trigger').click(); } -export async function openPluginsPanel(page: Page) { - await page.getByTestId('plugins-panel-trigger').click(); -} export async function openAboutPanel(page: Page) { await page.getByTestId('about-panel-trigger').click(); From 03b68e2654d07312f1248213bf76066c75adb326 Mon Sep 17 00:00:00 2001 From: LongYinan Date: Tue, 26 Dec 2023 06:50:27 +0000 Subject: [PATCH 009/110] chore: bump up @vitejs/plugin-vue version to v5 (#5394) 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 | |---|---|---|---|---|---| | [@vitejs/plugin-vue](https://togithub.com/vitejs/vite-plugin-vue/tree/main/packages/plugin-vue#readme) ([source](https://togithub.com/vitejs/vite-plugin-vue/tree/HEAD/packages/plugin-vue)) | [`^4.4.0` -> `^5.0.0`](https://renovatebot.com/diffs/npm/@vitejs%2fplugin-vue/4.5.0/5.0.0) | [![age](https://developer.mend.io/api/mc/badges/age/npm/@vitejs%2fplugin-vue/5.0.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/@vitejs%2fplugin-vue/5.0.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/@vitejs%2fplugin-vue/4.5.0/5.0.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/@vitejs%2fplugin-vue/4.5.0/5.0.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes
vitejs/vite-plugin-vue (@​vitejs/plugin-vue) ### [`v5.0.0`](https://togithub.com/vitejs/vite-plugin-vue/blob/HEAD/packages/plugin-vue/CHANGELOG.md#500-2023-12-25) - **Breaking:** drop `reactivityTransform` support - **Breaking:** drop Node 14/16 support - **Breaking:** drop Vite 4.x support - Vue 3.4 template AST reuse support - Vue 3.4 compile-time flag `__VUE_PROD_HYDRATION_MISMATCH_DETAILS__` support - Added `customElement` option - Deprecated `defineModel` option
--- ### 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 | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/tools/plugin-cli/package.json b/tools/plugin-cli/package.json index 371279ed43..69a74a0c58 100644 --- a/tools/plugin-cli/package.json +++ b/tools/plugin-cli/package.json @@ -14,7 +14,7 @@ "@swc/core": "^1.3.93", "@toeverything/infra": "workspace:^", "@vanilla-extract/rollup-plugin": "^1.3.0", - "@vitejs/plugin-vue": "^4.4.0", + "@vitejs/plugin-vue": "^5.0.0", "rollup": "^4.0.0", "rollup-plugin-swc3": "^0.10.2", "ts-node": "^10.9.1", diff --git a/yarn.lock b/yarn.lock index 4108de4783..ee59d5e26c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -682,7 +682,7 @@ __metadata: "@swc/core": "npm:^1.3.93" "@toeverything/infra": "workspace:^" "@vanilla-extract/rollup-plugin": "npm:^1.3.0" - "@vitejs/plugin-vue": "npm:^4.4.0" + "@vitejs/plugin-vue": "npm:^5.0.0" rollup: "npm:^4.0.0" rollup-plugin-swc3: "npm:^0.10.2" ts-node: "npm:^10.9.1" @@ -15343,13 +15343,13 @@ __metadata: languageName: node linkType: hard -"@vitejs/plugin-vue@npm:^4.4.0": - version: 4.5.0 - resolution: "@vitejs/plugin-vue@npm:4.5.0" +"@vitejs/plugin-vue@npm:^5.0.0": + version: 5.0.0 + resolution: "@vitejs/plugin-vue@npm:5.0.0" peerDependencies: - vite: ^4.0.0 || ^5.0.0 + vite: ^5.0.0 vue: ^3.2.25 - checksum: 15be17e5792eb7cfcf0ab0439eb40f53c0b6248ac32dbd01a2b1a315deb74724232ece7f607e1c2cd36241f6e2e9bdfc96dfdb495bfac8d272926e28e841a5ab + checksum: aeca2f80403b9a37f7000dd6a627a3a13913089415065df5aba88832cf16ff459f56776e5c68a6a7b0a1381721646eb33dc8709112cabb94d0e24b7c3f82f086 languageName: node linkType: hard From 080f636c1f7d3435cdcb946131de0979d6e9a5de Mon Sep 17 00:00:00 2001 From: Cats Juice Date: Tue, 26 Dec 2023 07:01:33 +0000 Subject: [PATCH 010/110] fix(core): correct title of onboarding article-2 (#5387) --- .../affine/onboarding/articles/article-2.tsx | 13 ++++--------- .../components/affine/onboarding/articles/index.tsx | 2 +- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/packages/frontend/core/src/components/affine/onboarding/articles/article-2.tsx b/packages/frontend/core/src/components/affine/onboarding/articles/article-2.tsx index 9c84a1af01..ee18fbf6b5 100644 --- a/packages/frontend/core/src/components/affine/onboarding/articles/article-2.tsx +++ b/packages/frontend/core/src/components/affine/onboarding/articles/article-2.tsx @@ -8,12 +8,7 @@ import { BlogLink } from './blog-link'; export const article2: Array = [ { - children: ( -

- Learning with earning with -
retrieval practice -

- ), + children:

Learning with retrieval practice

, offset: { x: -824, y: 0 }, }, { @@ -150,14 +145,14 @@ export const article2: Array = [ { children: , edgelessOnly: true, - position: { x: -300, y: 0 }, + position: { x: -200, y: -50 }, fromPosition: { x: 300, y: -300 }, }, { children: , edgelessOnly: true, - position: { x: -360, y: -20 }, + position: { x: -260, y: -70 }, fromPosition: { x: -360, y: -100 }, enterDelay: 300, customStyle: { @@ -170,7 +165,7 @@ export const article2: Array = [ { children: , edgelessOnly: true, - position: { x: 0, y: 0 }, + position: { x: 50, y: 0 }, fromPosition: { x: 2000, y: -2000 }, }, ]; diff --git a/packages/frontend/core/src/components/affine/onboarding/articles/index.tsx b/packages/frontend/core/src/components/affine/onboarding/articles/index.tsx index d10e28e559..1671220a71 100644 --- a/packages/frontend/core/src/components/affine/onboarding/articles/index.tsx +++ b/packages/frontend/core/src/components/affine/onboarding/articles/index.tsx @@ -158,7 +158,7 @@ const paperBriefs = { '2': (
-

Learning with earning with retrieval practice

+

Learning with retrieval practice

Are there any specific techniques to make the process of learning more effective? From f25814b31c9b286a89d083bbd4bf42e21a795fd0 Mon Sep 17 00:00:00 2001 From: JimmFly <447268514@qq.com> Date: Tue, 26 Dec 2023 07:13:44 +0000 Subject: [PATCH 011/110] chore(core): add background color to questionnaire (#5396) --- .../src/components/auth-components/onboarding-page.css.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/frontend/component/src/components/auth-components/onboarding-page.css.ts b/packages/frontend/component/src/components/auth-components/onboarding-page.css.ts index 997e26696e..a79594a3e7 100644 --- a/packages/frontend/component/src/components/auth-components/onboarding-page.css.ts +++ b/packages/frontend/component/src/components/auth-components/onboarding-page.css.ts @@ -7,6 +7,7 @@ export const scrollableContainer = style({ alignItems: 'center', height: '100vh', padding: '0 200px', + backgroundColor: 'var(--affine-background-primary-color)', '@media': { 'screen and (max-width: 1024px)': { padding: '80px 36px', From 3024b5cc63ebbe0ad9e38f3995a4bd3da0f34514 Mon Sep 17 00:00:00 2001 From: Joooye_34 Date: Tue, 26 Dec 2023 07:24:29 +0000 Subject: [PATCH 012/110] ci: define tag name to fix nightly release failing (#5397) --- .github/workflows/release-desktop.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/release-desktop.yml b/.github/workflows/release-desktop.yml index 12beff675d..4e187e93d0 100644 --- a/.github/workflows/release-desktop.yml +++ b/.github/workflows/release-desktop.yml @@ -361,6 +361,7 @@ jobs: uses: softprops/action-gh-release@v1 with: name: ${{ needs.before-make.outputs.RELEASE_VERSION }} + tag_name: ${{ (github.ref_type == 'tag' && github.ref_name) || needs.before-make.outputs.RELEASE_VERSION }} body: '' draft: ${{ github.event.inputs.is-draft }} prerelease: ${{ github.event.inputs.is-pre-release }} From c59a6a833c9dd620f46749d2f825204f9a8a4ab6 Mon Sep 17 00:00:00 2001 From: Peng Xiao Date: Tue, 26 Dec 2023 07:37:41 +0000 Subject: [PATCH 013/110] fix(core): workpace list blink issue on open (#5400) --- .../core/src/components/root-app-sidebar/index.tsx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) 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 6162ec023a..151e3181cd 100644 --- a/packages/frontend/core/src/components/root-app-sidebar/index.tsx +++ b/packages/frontend/core/src/components/root-app-sidebar/index.tsx @@ -30,7 +30,7 @@ import { useAsyncCallback } from '@toeverything/hooks/affine-async-hooks'; import { useAtom, useAtomValue } from 'jotai'; import { nanoid } from 'nanoid'; import type { HTMLAttributes, ReactElement } from 'react'; -import { forwardRef, useCallback, useEffect, useMemo } from 'react'; +import { forwardRef, Suspense, useCallback, useEffect, useMemo } from 'react'; import { openWorkspaceListModalAtom } from '../../atoms'; import { useHistoryAtom } from '../../atoms/history'; @@ -218,7 +218,11 @@ export const RootAppSidebar = ({ rootOptions={{ open: openUserWorkspaceList, }} - items={} + items={ + + + + } contentOptions={{ // hide trigger sideOffset: -58, From fafcfbce6da6c2e1df46f81167dfed40d1d5294f Mon Sep 17 00:00:00 2001 From: Peng Xiao Date: Tue, 26 Dec 2023 07:47:11 +0000 Subject: [PATCH 014/110] fix(core): about setting blink issue (#5399) --- .../components/affine/setting-modal/index.tsx | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) 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 8c33e1b645..b92abedf63 100644 --- a/packages/frontend/core/src/components/affine/setting-modal/index.tsx +++ b/packages/frontend/core/src/components/affine/setting-modal/index.tsx @@ -126,20 +126,20 @@ export const SettingModal = ({ >

- {activeTab === 'workspace' && workspaceMetadata ? ( - }> + }> + {activeTab === 'workspace' && workspaceMetadata ? ( - - ) : null} - {generalSettingList.some(v => v.key === activeTab) ? ( - - ) : null} - {activeTab === 'account' && loginStatus === 'authenticated' ? ( - - ) : null} + ) : null} + {generalSettingList.some(v => v.key === activeTab) ? ( + + ) : null} + {activeTab === 'account' && loginStatus === 'authenticated' ? ( + + ) : null} +
Date: Tue, 26 Dec 2023 07:57:03 +0000 Subject: [PATCH 015/110] fix(electron): set stable base url to app.affine.pro (#5401) close TOV-282 --- packages/frontend/electron/src/main/config.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/frontend/electron/src/main/config.ts b/packages/frontend/electron/src/main/config.ts index 22272d5cd2..14ef8a7c9f 100644 --- a/packages/frontend/electron/src/main/config.ts +++ b/packages/frontend/electron/src/main/config.ts @@ -24,7 +24,7 @@ export const mode = process.env.NODE_ENV; export const isDev = mode === 'development'; const API_URL_MAPPING = { - stable: `https://insider.affine.pro`, // Let insider be stable environment temporarily. + stable: `https://app.affine.pro`, beta: `https://insider.affine.pro`, canary: `https://affine.fail`, internal: `https://insider.affine.pro`, From 285d2a7219b93ece5259b9a99b1090c84170ddbc Mon Sep 17 00:00:00 2001 From: Peng Xiao Date: Tue, 26 Dec 2023 08:07:17 +0000 Subject: [PATCH 016/110] fix(core): trash page footer display issue (#5402) Before ![image.png](https://graphite-user-uploaded-assets-prod.s3.amazonaws.com/T2klNLEk0wxLh4NRDzhk/eb5e5b18-c4a2-469b-8763-be34c39ba736.png) After ![image.png](https://graphite-user-uploaded-assets-prod.s3.amazonaws.com/T2klNLEk0wxLh4NRDzhk/7b3ef339-0cb5-44fe-9e75-cec0e97d28b7.png) --- .../src/components/pure/trash-page-footer/styles.css.ts | 7 ------- 1 file changed, 7 deletions(-) diff --git a/packages/frontend/core/src/components/pure/trash-page-footer/styles.css.ts b/packages/frontend/core/src/components/pure/trash-page-footer/styles.css.ts index 8895b4118d..0dc24e3db2 100644 --- a/packages/frontend/core/src/components/pure/trash-page-footer/styles.css.ts +++ b/packages/frontend/core/src/components/pure/trash-page-footer/styles.css.ts @@ -17,13 +17,6 @@ export const deleteHintContainer = style({ gap: '16px', backgroundColor: 'var(--affine-background-primary-color)', borderTop: '1px solid var(--affine-border-color)', - selectors: { - '&[data-has-background="false"]': { - backgroundColor: 'transparent', - borderTop: 'none', - padding: '14px 0', - }, - }, }); export const deleteHintText = style({ fontSize: '15px', From 8042140fe8a0a016d7e1021b86305701d8c5bc69 Mon Sep 17 00:00:00 2001 From: LongYinan Date: Tue, 26 Dec 2023 08:20:35 +0000 Subject: [PATCH 017/110] chore: bump up @types/supertest version to v6 (#5376) 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 | |---|---|---|---|---|---| | [@types/supertest](https://togithub.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/supertest) ([source](https://togithub.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/supertest)) | [`^2.0.16` -> `^6.0.0`](https://renovatebot.com/diffs/npm/@types%2fsupertest/2.0.16/6.0.1) | [![age](https://developer.mend.io/api/mc/badges/age/npm/@types%2fsupertest/6.0.1?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/@types%2fsupertest/6.0.1?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/@types%2fsupertest/2.0.16/6.0.1?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/@types%2fsupertest/2.0.16/6.0.1?slim=true)](https://docs.renovatebot.com/merge-confidence/) | --- ### 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 | 33 ++++++++++++++++++---------- 2 files changed, 22 insertions(+), 13 deletions(-) diff --git a/packages/backend/server/package.json b/packages/backend/server/package.json index ea2ddcf98f..acb35425ca 100644 --- a/packages/backend/server/package.json +++ b/packages/backend/server/package.json @@ -101,7 +101,7 @@ "@types/on-headers": "^1.0.3", "@types/pretty-time": "^1.1.5", "@types/sinon": "^17.0.2", - "@types/supertest": "^2.0.16", + "@types/supertest": "^6.0.0", "@types/ws": "^8.5.10", "ava": "^6.0.0", "c8": "^8.0.1", diff --git a/yarn.lock b/yarn.lock index ee59d5e26c..b5af308b48 100644 --- a/yarn.lock +++ b/yarn.lock @@ -764,7 +764,7 @@ __metadata: "@types/on-headers": "npm:^1.0.3" "@types/pretty-time": "npm:^1.1.5" "@types/sinon": "npm:^17.0.2" - "@types/supertest": "npm:^2.0.16" + "@types/supertest": "npm:^6.0.0" "@types/ws": "npm:^8.5.10" ava: "npm:^6.0.0" c8: "npm:^8.0.1" @@ -14117,7 +14117,7 @@ __metadata: languageName: node linkType: hard -"@types/cookiejar@npm:*": +"@types/cookiejar@npm:^2.1.5": version: 2.1.5 resolution: "@types/cookiejar@npm:2.1.5" checksum: 04d5990e87b6387532d15a87d9ec9b2eb783039291193863751dcfd7fc723a3b3aa30ce4c06b03975cba58632e933772f1ff031af23eaa3ac7f94e71afa6e073 @@ -14605,6 +14605,13 @@ __metadata: languageName: node linkType: hard +"@types/methods@npm:^1.1.4": + version: 1.1.4 + resolution: "@types/methods@npm:1.1.4" + checksum: ad2a7178486f2fd167750f3eb920ab032a947ff2e26f55c86670a6038632d790b46f52e5b6ead5823f1e53fc68028f1e9ddd15cfead7903e04517c88debd72b1 + languageName: node + linkType: hard + "@types/mime-types@npm:^2.1.0": version: 2.1.4 resolution: "@types/mime-types@npm:2.1.4" @@ -14928,22 +14935,24 @@ __metadata: languageName: node linkType: hard -"@types/superagent@npm:*": - version: 4.1.22 - resolution: "@types/superagent@npm:4.1.22" +"@types/superagent@npm:^8.1.0": + version: 8.1.1 + resolution: "@types/superagent@npm:8.1.1" dependencies: - "@types/cookiejar": "npm:*" + "@types/cookiejar": "npm:^2.1.5" + "@types/methods": "npm:^1.1.4" "@types/node": "npm:*" - checksum: f847c3e681e8a9cc6b3cf5f72b24e5ee50bef1715a46b0258e51edd506be556ee342e636c40c123d5b005739e2f1f0090564f9197a18715410e7b6cf0498ed82 + checksum: 02b987833cf0d85da9b137fd296fe8ad25a470d60f7e9d81a6ed3f8f8a5d6bace8780816bd35885e2928f467e819a4aa509879a7da0f28018ab1453845eb91e2 languageName: node linkType: hard -"@types/supertest@npm:^2.0.16": - version: 2.0.16 - resolution: "@types/supertest@npm:2.0.16" +"@types/supertest@npm:^6.0.0": + version: 6.0.1 + resolution: "@types/supertest@npm:6.0.1" dependencies: - "@types/superagent": "npm:*" - checksum: 2fc998ea698e0467cdbe3bea0ebce2027ea3a45a13e51a6cecb0435f44b486faecf99c34d8702d2d7fe033e6e09fdd2b374af52ecc8d0c69a1deec66b8c0dd52 + "@types/methods": "npm:^1.1.4" + "@types/superagent": "npm:^8.1.0" + checksum: 3d854d9c90f22da6ae2e99dc3434d1345b34ff2333ba61cd2393fdec395c3ea3fd90c8a7e3d68c5ec96aa2c27bd8af322bdc788b9fd527852ec49806fc7a40e2 languageName: node linkType: hard From cb4f6d30af45ede467f623e7f389dae695e6b53d Mon Sep 17 00:00:00 2001 From: LongYinan Date: Tue, 26 Dec 2023 08:32:07 +0000 Subject: [PATCH 018/110] chore: bump up react-i18next version to v14 (#5375) 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 | |---|---|---|---|---|---| | [react-i18next](https://togithub.com/i18next/react-i18next) | [`^13.3.0` -> `^14.0.0`](https://renovatebot.com/diffs/npm/react-i18next/13.5.0/14.0.0) | [![age](https://developer.mend.io/api/mc/badges/age/npm/react-i18next/14.0.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/react-i18next/14.0.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/react-i18next/13.5.0/14.0.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/react-i18next/13.5.0/14.0.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes
i18next/react-i18next (react-i18next) ### [`v14.0.0`](https://togithub.com/i18next/react-i18next/blob/HEAD/CHANGELOG.md#1400) [Compare Source](https://togithub.com/i18next/react-i18next/compare/v13.5.0...v14.0.0) - types: reportNamespaces is now optional, should fix [1693](https://togithub.com/i18next/react-i18next/issues/1693)
--- ### 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/i18n/package.json | 2 +- packages/frontend/i18n/src/index.ts | 1 - yarn.lock | 10 +++++----- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/packages/frontend/i18n/package.json b/packages/frontend/i18n/package.json index 4b4e70cba7..b451233687 100644 --- a/packages/frontend/i18n/package.json +++ b/packages/frontend/i18n/package.json @@ -28,7 +28,7 @@ }, "dependencies": { "i18next": "^23.5.1", - "react-i18next": "^13.3.0" + "react-i18next": "^14.0.0" }, "devDependencies": { "@types/prettier": "^3.0.0", diff --git a/packages/frontend/i18n/src/index.ts b/packages/frontend/i18n/src/index.ts index 8987941ef5..848548ef51 100644 --- a/packages/frontend/i18n/src/index.ts +++ b/packages/frontend/i18n/src/index.ts @@ -68,7 +68,6 @@ const standardizeLocale = (language: string) => { }; export const createI18n = (): I18nextProviderProps['i18n'] => { - // @ts-expect-error ts bug const i18n: I18nextProviderProps['i18n'] = i18next.createInstance(); i18n .use(initReactI18next) diff --git a/yarn.lock b/yarn.lock index b5af308b48..5d30c0de9d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -569,7 +569,7 @@ __metadata: "@types/prettier": "npm:^3.0.0" i18next: "npm:^23.5.1" prettier: "npm:^3.0.3" - react-i18next: "npm:^13.3.0" + react-i18next: "npm:^14.0.0" ts-node: "npm:^10.9.1" typescript: "npm:^5.2.2" languageName: unknown @@ -31682,9 +31682,9 @@ __metadata: languageName: node linkType: hard -"react-i18next@npm:^13.3.0": - version: 13.5.0 - resolution: "react-i18next@npm:13.5.0" +"react-i18next@npm:^14.0.0": + version: 14.0.0 + resolution: "react-i18next@npm:14.0.0" dependencies: "@babel/runtime": "npm:^7.22.5" html-parse-stringify: "npm:^3.0.1" @@ -31696,7 +31696,7 @@ __metadata: optional: true react-native: optional: true - checksum: 903b486d112cd0aa40bdc3afaefd0c32b91c0a1e3e3561367c8d91ddc0fbad9945f1d630c3ddcd4764795fc00e0887252e2d337256a825caf3a86de038f6b2db + checksum: e445768c576c5993e723375c030071e720abacc830c1810acfcec5c27185cba95affb11c0f71bb551ce98d30f6723e179de7f771487b1a1a6a9077821c5ec1f9 languageName: node linkType: hard From 62fbab4f78118ff3cd8a9a274236c12da1490935 Mon Sep 17 00:00:00 2001 From: JimmFly Date: Tue, 26 Dec 2023 20:23:28 +0800 Subject: [PATCH 019/110] fix(core): avatars are not aligned (#5404) --- .../core/src/components/pure/file-upload/index.tsx | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) 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 8d09b530a5..c0b25d8aa0 100644 --- a/packages/frontend/core/src/components/pure/file-upload/index.tsx +++ b/packages/frontend/core/src/components/pure/file-upload/index.tsx @@ -1,4 +1,3 @@ -import { styled } from '@affine/component'; import { Button } from '@affine/component/ui/button'; import { useAFFiNEI18N } from '@affine/i18n/hooks'; import type { ChangeEvent, PropsWithChildren } from 'react'; @@ -42,7 +41,7 @@ export const Upload = ({ } return ( - +
{children ?? } - +
); }; - -const UploadStyle = styled('div')(() => { - return { - display: 'inline-block', - }; -}); From c02ec5f7b9ba33b62ecfa460f5419a3e8ed7bb1d Mon Sep 17 00:00:00 2001 From: Peng Xiao Date: Tue, 26 Dec 2023 20:27:20 +0800 Subject: [PATCH 020/110] fix(infra): workaround for self-referencing in storybook (#5406) --- tests/storybook/.storybook/main.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tests/storybook/.storybook/main.ts b/tests/storybook/.storybook/main.ts index d32668187a..9f86440d8d 100644 --- a/tests/storybook/.storybook/main.ts +++ b/tests/storybook/.storybook/main.ts @@ -49,6 +49,11 @@ export default { '@toeverything/infra': fileURLToPath( new URL('../../../packages/common/infra/src', import.meta.url) ), + // workaround for https://github.com/vitejs/vite/issues/9731 + // it seems vite does not resolve self reference correctly? + '@affine/core': fileURLToPath( + new URL('../../../packages/frontend/core/src', import.meta.url) + ), }, }, plugins: [ From 3903a1c1d6bfdb649136eef8ac9e6fb3ddd4b4c9 Mon Sep 17 00:00:00 2001 From: LongYinan Date: Tue, 26 Dec 2023 12:40:10 +0000 Subject: [PATCH 021/110] ci: update actions/upload-artifact and actions/download-artifact (#5408) --- .github/actions/download-core/action.yml | 2 +- .github/workflows/build-test.yml | 26 +++++++++++----------- .github/workflows/deploy.yml | 16 +++++++------- .github/workflows/publish-storybook.yml | 2 +- .github/workflows/release-desktop.yml | 28 ++++++++++++------------ .github/workflows/windows-signer.yml | 4 ++-- 6 files changed, 39 insertions(+), 39 deletions(-) diff --git a/.github/actions/download-core/action.yml b/.github/actions/download-core/action.yml index c70fcfbe9b..2746bd8455 100644 --- a/.github/actions/download-core/action.yml +++ b/.github/actions/download-core/action.yml @@ -9,7 +9,7 @@ runs: using: 'composite' steps: - name: Download tar.gz - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4 with: name: core path: . diff --git a/.github/workflows/build-test.yml b/.github/workflows/build-test.yml index d95161ad8f..ad0978fa25 100644 --- a/.github/workflows/build-test.yml +++ b/.github/workflows/build-test.yml @@ -140,7 +140,7 @@ jobs: - name: Upload test results if: ${{ failure() }} - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: test-results-e2e-plugin path: ./test-results @@ -169,7 +169,7 @@ jobs: - name: Upload test results if: ${{ failure() }} - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: test-results-e2e-${{ matrix.shard }} path: ./test-results @@ -194,7 +194,7 @@ jobs: - name: Upload test results if: ${{ failure() }} - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: test-results-e2e-migration path: ./tests/affine-migration/test-results @@ -216,7 +216,7 @@ jobs: full-cache: true - name: Download affine.linux-x64-gnu.node - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4 with: name: affine.linux-x64-gnu.node path: ./packages/frontend/native @@ -269,7 +269,7 @@ jobs: package: '@affine/native' nx_token: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }} - name: Upload ${{ steps.filename.outputs.filename }} - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: ${{ steps.filename.outputs.filename }} path: ./packages/frontend/native/${{ steps.filename.outputs.filename }} @@ -296,7 +296,7 @@ jobs: package: '@affine/storage' nx_token: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }} - name: Upload storage.node - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: storage.node path: ./packages/backend/storage/storage.node @@ -320,7 +320,7 @@ jobs: - name: zip core run: tar -czf dist.tar.gz --directory=packages/frontend/core/dist . - name: Upload core artifact - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: core path: dist.tar.gz @@ -381,7 +381,7 @@ jobs: DATABASE_URL: postgresql://affine:affine@localhost:5432/affine - name: Download storage.node - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4 with: name: storage.node path: ./packages/backend/server @@ -470,13 +470,13 @@ jobs: yarn workspace @affine/server data-migration 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 + uses: actions/download-artifact@v4 with: name: storage.node path: ./packages/backend/server - name: Download affine.linux-x64-gnu.node - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4 with: name: affine.linux-x64-gnu.node path: ./packages/frontend/native @@ -490,7 +490,7 @@ jobs: - name: Upload test results if: ${{ failure() }} - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: test-results-e2e-server path: ./tests/affine-cloud/test-results @@ -554,7 +554,7 @@ jobs: echo "filename=affine.$PLATFORM_ARCH_ABI.node" >> "$GITHUB_OUTPUT" - name: Download ${{ steps.filename.outputs.filename }} - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4 with: name: ${{ steps.filename.outputs.filename }} path: ./packages/frontend/native @@ -596,7 +596,7 @@ jobs: - name: Upload test results if: ${{ failure() }} - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: test-results-e2e-${{ matrix.spec.os }}-${{ matrix.spec.arch }} path: ./test-results diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 57827411bf..328f006850 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -32,7 +32,7 @@ jobs: - name: Build Server run: yarn workspace @affine/server build - name: Upload server dist - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: server-dist path: ./packages/backend/server/dist @@ -65,7 +65,7 @@ jobs: SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} SENTRY_DSN: ${{ secrets.SENTRY_DSN }} - name: Upload core artifact - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: core path: ./packages/frontend/core/dist @@ -89,7 +89,7 @@ jobs: package: '@affine/storage' nx_token: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }} - name: Upload storage.node - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: storage.node path: ./packages/backend/storage/storage.node @@ -113,7 +113,7 @@ jobs: package: '@affine/storage' nx_token: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }} - name: Upload storage.node - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: storage.arm64.node path: ./packages/backend/storage/storage.node @@ -130,22 +130,22 @@ jobs: steps: - uses: actions/checkout@v4 - name: Download core artifact - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4 with: name: core path: ./packages/frontend/core/dist - name: Download server dist - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4 with: name: server-dist path: ./packages/backend/server/dist - name: Download storage.node - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4 with: name: storage.node path: ./packages/backend/server - name: Download storage.node arm64 - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4 with: name: storage.arm64.node path: ./packages/backend/storage diff --git a/.github/workflows/publish-storybook.yml b/.github/workflows/publish-storybook.yml index 166e795196..9d2b40df5e 100644 --- a/.github/workflows/publish-storybook.yml +++ b/.github/workflows/publish-storybook.yml @@ -44,7 +44,7 @@ jobs: env: CHROMATIC_PROJECT_TOKEN: ${{ secrets.CHROMATIC_PROJECT_TOKEN }} NODE_OPTIONS: ${{ env.NODE_OPTIONS }} - - uses: actions/upload-artifact@v3 + - uses: actions/upload-artifact@v4 if: always() with: name: chromatic-build-artifacts-${{ github.run_id }} diff --git a/.github/workflows/release-desktop.yml b/.github/workflows/release-desktop.yml index 4e187e93d0..78f96b09cd 100644 --- a/.github/workflows/release-desktop.yml +++ b/.github/workflows/release-desktop.yml @@ -61,7 +61,7 @@ jobs: SKIP_NX_CACHE: 'true' - name: Upload core artifact - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: core path: packages/frontend/electron/resources/web-static @@ -111,7 +111,7 @@ jobs: target: ${{ matrix.spec.target }} package: '@affine/native' nx_token: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }} - - uses: actions/download-artifact@v3 + - uses: actions/download-artifact@v4 with: name: core path: packages/frontend/electron/resources/web-static @@ -147,7 +147,7 @@ jobs: mv packages/frontend/electron/out/*/make/AppImage/x64/*.AppImage ./builds/affine-${{ env.BUILD_TYPE }}-linux-x64.AppImage - name: Upload Artifact - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: affine-${{ matrix.spec.platform }}-${{ matrix.spec.arch }}-builds path: builds @@ -187,7 +187,7 @@ jobs: target: ${{ matrix.spec.target }} package: '@affine/native' nx_token: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }} - - uses: actions/download-artifact@v3 + - uses: actions/download-artifact@v4 with: name: core path: packages/frontend/electron/resources/web-static @@ -216,7 +216,7 @@ jobs: run: Compress-Archive -CompressionLevel Fastest -Path packages/frontend/electron/out/* -DestinationPath archive.zip - name: Save packaged artifacts for signing - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: packaged-${{ matrix.spec.platform }}-${{ matrix.spec.arch }} path: | @@ -250,7 +250,7 @@ jobs: timeout-minutes: 10 uses: ./.github/actions/setup-node - name: Download and overwrite packaged artifacts - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4 with: name: signed-packaged-${{ matrix.spec.platform }}-${{ matrix.spec.arch }} path: . @@ -271,7 +271,7 @@ jobs: echo $FILES_TO_BE_SIGNED - name: Save installer for signing - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: installer-${{ matrix.spec.platform }}-${{ matrix.spec.arch }} path: archive.zip @@ -297,7 +297,7 @@ jobs: runs-on: ${{ matrix.spec.runner }} steps: - name: Download and overwrite installer artifacts - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4 with: name: signed-installer-${{ matrix.spec.platform }}-${{ matrix.spec.arch }} path: . @@ -312,7 +312,7 @@ jobs: mv packages/frontend/electron/out/*/make/squirrel.windows/x64/*.msi ./builds/affine-${{ env.BUILD_TYPE }}-windows-x64.msi - name: Upload Artifact - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: affine-${{ matrix.spec.platform }}-${{ matrix.spec.arch }}-builds path: builds @@ -323,29 +323,29 @@ jobs: steps: - uses: actions/checkout@v4 - - uses: actions/download-artifact@v3 + - uses: actions/download-artifact@v4 with: name: core path: web-static - name: Zip web-static run: zip -r web-static.zip web-static - name: Download Artifacts (macos-x64) - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4 with: name: affine-darwin-x64-builds path: ./ - name: Download Artifacts (macos-arm64) - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4 with: name: affine-darwin-arm64-builds path: ./ - name: Download Artifacts (windows-x64) - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4 with: name: affine-win32-x64-builds path: ./ - name: Download Artifacts (linux-x64) - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4 with: name: affine-linux-x64-builds path: ./ diff --git a/.github/workflows/windows-signer.yml b/.github/workflows/windows-signer.yml index 36229ff390..b5c8c36fde 100644 --- a/.github/workflows/windows-signer.yml +++ b/.github/workflows/windows-signer.yml @@ -14,7 +14,7 @@ jobs: env: ARCHIVE_DIR: ${{ github.run_id }}-${{ github.run_attempt }}-${{ inputs.artifact-name }} steps: - - uses: actions/download-artifact@v3 + - uses: actions/download-artifact@v4 with: name: ${{ inputs.artifact-name }} path: ${{ env.ARCHIVE_DIR }} @@ -36,7 +36,7 @@ jobs: cd ${{ env.ARCHIVE_DIR }} 7za a signed.zip .\out\* - name: upload - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: signed-${{ inputs.artifact-name }} path: ${{ env.ARCHIVE_DIR }}/signed.zip From 265ee8166697e132e577e0a8b9a227612e255a2a Mon Sep 17 00:00:00 2001 From: EYHN Date: Wed, 27 Dec 2023 02:49:59 +0000 Subject: [PATCH 022/110] refactor(infra): remove old plugin system (#5411) plugin system need redesign --- .eslintignore | 2 - .eslintrc.js | 2 - .github/actions/setup-node/action.yml | 9 - .github/labeler.yml | 15 - .github/workflows/build-test.yml | 41 - .github/workflows/deploy.yml | 2 - .github/workflows/publish-storybook.yml | 2 - .github/workflows/release-desktop.yml | 5 - README.md | 14 - docs/BUILDING.md | 8 +- docs/contributing/tutorial.md | 1 - package.json | 2 - packages/common/env/src/global.ts | 2 - packages/common/infra/package.json | 1 - .../common/infra/src/__internal__/plugin.ts | 53 - packages/common/infra/src/atom/index.ts | 4 - packages/common/infra/tsconfig.json | 3 - packages/common/infra/vite.config.ts | 1 - packages/common/sdk/.gitignore | 4 - packages/common/sdk/package.json | 37 - packages/common/sdk/project.json | 22 - packages/common/sdk/src/entry.ts | 64 - packages/common/sdk/src/server.ts | 4 - packages/common/sdk/tsconfig.json | 15 - packages/common/sdk/tsconfig.node.json | 12 - packages/common/sdk/vite.config.ts | 23 - .../frontend/core/.webpack/runtime-config.ts | 18 - .../frontend/core/.webpack/webpack.config.ts | 16 +- .../frontend/core/src/_plugin/index.test.tsx | 50 - .../bootstrap/plugins/endowments/fercher.ts | 86 -- .../src/bootstrap/plugins/endowments/timer.ts | 110 -- .../bootstrap/plugins/setup-imports-map.ts | 22 - .../core/src/bootstrap/plugins/setup.ts | 483 ------- .../core/src/bootstrap/register-plugins.ts | 134 -- .../general-setting/plugins/index.tsx | 97 -- .../general-setting/plugins/style.css.ts | 16 - .../image-preview}/hooks/use-zoom.tsx | 0 .../components/image-preview}/index.css.ts | 0 .../components/image-preview}/index.jotai.ts | 0 .../src/components/image-preview}/index.tsx | 10 +- .../src/components/page-detail-editor.tsx | 25 - .../components/pure/plugin-header/index.tsx | 44 - .../pure/plugin-header/styles.css.ts | 8 - packages/frontend/core/src/index.tsx | 8 - .../workspace/detail-page/detail-page.tsx | 5 + .../core/src/pages/workspace/trash-page.tsx | 1 - packages/frontend/core/tsconfig.json | 3 - packages/frontend/electron/package.json | 5 - packages/frontend/electron/project.json | 9 +- packages/frontend/electron/scripts/common.ts | 9 +- .../electron/scripts/generate-assets.ts | 8 - packages/frontend/electron/tsconfig.json | 3 - packages/frontend/electron/tsconfig.node.json | 6 +- packages/plugins/copilot/README.md | 3 - packages/plugins/copilot/package.json | 41 - packages/plugins/copilot/project.json | 26 - .../plugins/copilot/src/UI/debug-content.tsx | 37 - .../plugins/copilot/src/UI/detail-content.tsx | 72 -- .../plugins/copilot/src/UI/header-item.tsx | 47 - packages/plugins/copilot/src/UI/index.css.ts | 43 - packages/plugins/copilot/src/core/chat.ts | 101 -- .../components/conversation-list/index.css.ts | 9 - .../components/conversation-list/index.tsx | 22 - .../core/components/conversation/index.css.ts | 80 -- .../core/components/conversation/index.tsx | 73 -- .../copilot/src/core/components/divider.tsx | 5 - .../core/components/following-up/index.css.ts | 20 - .../core/components/following-up/index.tsx | 19 - .../plugins/copilot/src/core/hooks/index.ts | 179 --- .../src/core/langchain/message-history.ts | 154 --- .../plugins/copilot/src/core/prompts/index.ts | 30 - .../copilot/src/core/prompts/output-parser.ts | 8 - packages/plugins/copilot/src/index.ts | 40 - packages/plugins/copilot/tsconfig.json | 19 - packages/plugins/hello-world/package.json | 25 - packages/plugins/hello-world/project.json | 26 - packages/plugins/hello-world/src/app.tsx | 18 - packages/plugins/hello-world/src/index.ts | 32 - packages/plugins/hello-world/tsconfig.json | 17 - packages/plugins/image-preview/package.json | 29 - packages/plugins/image-preview/project.json | 26 - packages/plugins/image-preview/src/app.tsx | 11 - .../image-preview/src/component/toast.ts | 21 - packages/plugins/image-preview/src/index.ts | 18 - packages/plugins/image-preview/tsconfig.json | 17 - .../plugins/vue-hello-world/.eslintrc.json | 10 - packages/plugins/vue-hello-world/package.json | 26 - packages/plugins/vue-hello-world/project.json | 26 - packages/plugins/vue-hello-world/src/app.vue | 17 - .../plugins/vue-hello-world/src/global.d.ts | 5 - packages/plugins/vue-hello-world/src/index.ts | 18 - .../plugins/vue-hello-world/tsconfig.json | 14 - tests/affine-plugin/e2e/basic.spec.ts | 40 - tests/affine-plugin/package.json | 13 - tests/affine-plugin/playwright.config.ts | 63 - tests/affine-plugin/tsconfig.json | 16 - tests/kit/utils/load-page.ts | 4 - tests/storybook/.storybook/preview.tsx | 5 - tests/storybook/project.json | 1 - .../stories/image-preview-modal.stories.tsx | 3 +- tests/storybook/tsconfig.json | 3 - tools/cli/src/bin/dev-core.ts | 10 - tools/cli/src/util/infra.ts | 15 - tools/commitlint/.commitlintrc.json | 5 +- tools/plugin-cli/package.json | 23 - tools/plugin-cli/src/af.mjs | 16 - tools/plugin-cli/src/af.ts | 180 --- tools/plugin-cli/tsconfig.json | 15 - tsconfig.json | 25 - yarn.lock | 1127 +---------------- 110 files changed, 46 insertions(+), 4426 deletions(-) delete mode 100644 packages/common/infra/src/__internal__/plugin.ts delete mode 100644 packages/common/sdk/.gitignore delete mode 100644 packages/common/sdk/package.json delete mode 100644 packages/common/sdk/project.json delete mode 100644 packages/common/sdk/src/entry.ts delete mode 100644 packages/common/sdk/src/server.ts delete mode 100644 packages/common/sdk/tsconfig.json delete mode 100644 packages/common/sdk/tsconfig.node.json delete mode 100644 packages/common/sdk/vite.config.ts delete mode 100644 packages/frontend/core/src/_plugin/index.test.tsx delete mode 100644 packages/frontend/core/src/bootstrap/plugins/endowments/fercher.ts delete mode 100644 packages/frontend/core/src/bootstrap/plugins/endowments/timer.ts delete mode 100644 packages/frontend/core/src/bootstrap/plugins/setup-imports-map.ts delete mode 100644 packages/frontend/core/src/bootstrap/plugins/setup.ts delete mode 100644 packages/frontend/core/src/bootstrap/register-plugins.ts delete mode 100644 packages/frontend/core/src/components/affine/setting-modal/general-setting/plugins/index.tsx delete mode 100644 packages/frontend/core/src/components/affine/setting-modal/general-setting/plugins/style.css.ts rename packages/{plugins/image-preview/src/component => frontend/core/src/components/image-preview}/hooks/use-zoom.tsx (100%) rename packages/{plugins/image-preview/src/component => frontend/core/src/components/image-preview}/index.css.ts (100%) rename packages/{plugins/image-preview/src/component => frontend/core/src/components/image-preview}/index.jotai.ts (100%) rename packages/{plugins/image-preview/src/component => frontend/core/src/components/image-preview}/index.tsx (98%) delete mode 100644 packages/frontend/core/src/components/pure/plugin-header/index.tsx delete mode 100644 packages/frontend/core/src/components/pure/plugin-header/styles.css.ts delete mode 100644 packages/plugins/copilot/README.md delete mode 100644 packages/plugins/copilot/package.json delete mode 100644 packages/plugins/copilot/project.json delete mode 100644 packages/plugins/copilot/src/UI/debug-content.tsx delete mode 100644 packages/plugins/copilot/src/UI/detail-content.tsx delete mode 100644 packages/plugins/copilot/src/UI/header-item.tsx delete mode 100644 packages/plugins/copilot/src/UI/index.css.ts delete mode 100644 packages/plugins/copilot/src/core/chat.ts delete mode 100644 packages/plugins/copilot/src/core/components/conversation-list/index.css.ts delete mode 100644 packages/plugins/copilot/src/core/components/conversation-list/index.tsx delete mode 100644 packages/plugins/copilot/src/core/components/conversation/index.css.ts delete mode 100644 packages/plugins/copilot/src/core/components/conversation/index.tsx delete mode 100644 packages/plugins/copilot/src/core/components/divider.tsx delete mode 100644 packages/plugins/copilot/src/core/components/following-up/index.css.ts delete mode 100644 packages/plugins/copilot/src/core/components/following-up/index.tsx delete mode 100644 packages/plugins/copilot/src/core/hooks/index.ts delete mode 100644 packages/plugins/copilot/src/core/langchain/message-history.ts delete mode 100644 packages/plugins/copilot/src/core/prompts/index.ts delete mode 100644 packages/plugins/copilot/src/core/prompts/output-parser.ts delete mode 100644 packages/plugins/copilot/src/index.ts delete mode 100644 packages/plugins/copilot/tsconfig.json delete mode 100644 packages/plugins/hello-world/package.json delete mode 100644 packages/plugins/hello-world/project.json delete mode 100644 packages/plugins/hello-world/src/app.tsx delete mode 100644 packages/plugins/hello-world/src/index.ts delete mode 100644 packages/plugins/hello-world/tsconfig.json delete mode 100644 packages/plugins/image-preview/package.json delete mode 100644 packages/plugins/image-preview/project.json delete mode 100644 packages/plugins/image-preview/src/app.tsx delete mode 100644 packages/plugins/image-preview/src/component/toast.ts delete mode 100644 packages/plugins/image-preview/src/index.ts delete mode 100644 packages/plugins/image-preview/tsconfig.json delete mode 100644 packages/plugins/vue-hello-world/.eslintrc.json delete mode 100644 packages/plugins/vue-hello-world/package.json delete mode 100644 packages/plugins/vue-hello-world/project.json delete mode 100644 packages/plugins/vue-hello-world/src/app.vue delete mode 100644 packages/plugins/vue-hello-world/src/global.d.ts delete mode 100644 packages/plugins/vue-hello-world/src/index.ts delete mode 100644 packages/plugins/vue-hello-world/tsconfig.json delete mode 100644 tests/affine-plugin/e2e/basic.spec.ts delete mode 100644 tests/affine-plugin/package.json delete mode 100644 tests/affine-plugin/playwright.config.ts delete mode 100644 tests/affine-plugin/tsconfig.json delete mode 100644 tools/plugin-cli/package.json delete mode 100755 tools/plugin-cli/src/af.mjs delete mode 100644 tools/plugin-cli/src/af.ts delete mode 100644 tools/plugin-cli/tsconfig.json diff --git a/.eslintignore b/.eslintignore index c661e0c283..1b4baef2f6 100644 --- a/.eslintignore +++ b/.eslintignore @@ -11,6 +11,4 @@ e2e-dist-* static web-static public -packages/common/sdk/src/*.d.ts -packages/common/sdk/src/*.js packages/frontend/i18n/src/i18n-generated.ts diff --git a/.eslintrc.js b/.eslintrc.js index 5e5566f176..3d6b4d2cb1 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -69,10 +69,8 @@ const allPackages = [ 'packages/common/debug', 'packages/common/env', 'packages/common/infra', - 'packages/common/sdk', 'packages/common/theme', 'packages/common/y-indexeddb', - 'packages/plugins/copilot', 'tools/cli', 'tests/storybook', ]; diff --git a/.github/actions/setup-node/action.yml b/.github/actions/setup-node/action.yml index 79d2602c77..52ebc58143 100644 --- a/.github/actions/setup-node/action.yml +++ b/.github/actions/setup-node/action.yml @@ -25,10 +25,6 @@ inputs: description: 'Build infra' required: false default: 'true' - build-plugins: - description: 'Build plugins' - required: false - default: 'true' nmHoistingLimits: description: 'Set nmHoistingLimits in .yarnrc.yml' required: false @@ -195,8 +191,3 @@ runs: shell: bash if: inputs.build-infra == 'true' run: yarn run build:infra - - - name: Build Plugins - if: inputs.build-plugins == 'true' - shell: bash - run: yarn run build:plugins diff --git a/.github/labeler.yml b/.github/labeler.yml index 41ed2112f8..6f0259a3a8 100644 --- a/.github/labeler.yml +++ b/.github/labeler.yml @@ -19,26 +19,11 @@ mod:dev: - 'tools/cli/**/*' - 'packages/common/debug/**/*' -mod:plugin: - - changed-files: - - any-glob-to-any-file: - - 'packages/plugins/**/*' - -plugin:copilot: - - changed-files: - - any-glob-to-any-file: - - 'packages/plugins/copilot/**/*' - mod:infra: - changed-files: - any-glob-to-any-file: - 'packages/common/infra/**/*' -mod:sdk: - - changed-files: - - any-glob-to-any-file: - - 'packages/common/sdk/**/*' - mod:plugin-cli: - changed-files: - any-glob-to-any-file: diff --git a/.github/workflows/build-test.yml b/.github/workflows/build-test.yml index ad0978fa25..f2ab1e4792 100644 --- a/.github/workflows/build-test.yml +++ b/.github/workflows/build-test.yml @@ -108,44 +108,6 @@ jobs: 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@v4 - with: - name: test-results-e2e-plugin - path: ./test-results - if-no-files-found: ignore - e2e-test: name: E2E Test runs-on: ubuntu-latest @@ -255,7 +217,6 @@ jobs: extra-flags: workspaces focus @affine/native electron-install: false build-infra: false - build-plugins: false - name: Setup filename id: filename shell: bash @@ -288,7 +249,6 @@ jobs: extra-flags: workspaces focus @affine/storage electron-install: false build-infra: false - build-plugins: false - name: Build Rust uses: ./.github/actions/build-rust with: @@ -312,7 +272,6 @@ jobs: 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 diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 328f006850..8606e23e29 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -48,8 +48,6 @@ jobs: uses: ./.github/actions/setup-version - name: Setup Node.js uses: ./.github/actions/setup-node - - name: Build Plugins - run: yarn run build:plugins - name: Build Core run: yarn nx build @affine/core --skip-nx-cache env: diff --git a/.github/workflows/publish-storybook.yml b/.github/workflows/publish-storybook.yml index 9d2b40df5e..5ad11dc9c6 100644 --- a/.github/workflows/publish-storybook.yml +++ b/.github/workflows/publish-storybook.yml @@ -32,8 +32,6 @@ jobs: uses: ./.github/actions/setup-node with: electron-install: false - - name: Build Plugins - run: yarn run build:plugins - uses: chromaui/action-next@v1 with: workingDir: tests/storybook diff --git a/.github/workflows/release-desktop.yml b/.github/workflows/release-desktop.yml index 78f96b09cd..51c046585c 100644 --- a/.github/workflows/release-desktop.yml +++ b/.github/workflows/release-desktop.yml @@ -102,7 +102,6 @@ jobs: with: extra-flags: workspaces focus @affine/electron @affine/monorepo hard-link-nm: false - build-plugins: false nmHoistingLimits: workspaces enableScripts: false - name: Build AFFiNE native @@ -179,7 +178,6 @@ jobs: with: extra-flags: workspaces focus @affine/electron @affine/monorepo hard-link-nm: false - build-plugins: false nmHoistingLimits: workspaces - name: Build AFFiNE native uses: ./.github/actions/build-rust @@ -192,9 +190,6 @@ jobs: name: core path: packages/frontend/electron/resources/web-static - - name: Build Plugins - run: yarn run build:plugins - - name: Build Desktop Layers run: yarn workspace @affine/electron build diff --git a/README.md b/README.md index c33ee9b262..645725c488 100644 --- a/README.md +++ b/README.md @@ -113,20 +113,6 @@ If you have questions, you are welcome to contact us. One of the best places to | [@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 - -> Plugins are a way to extend the functionality of AFFiNE. You can use plugins to add new blocks, new features, and even new ways to edit content. -> -> (Currently, the plugin system is under heavy development. You will see the plugin system in the canary release.) - -- [@affine/sdk](./packages/common/sdk) - SDK for developing plugins -- [@affine/plugin-cli](./tools/plugin-cli) - CLI for developing plugins - -| Official Plugin | Description | Status | -| ---------------------------------------------------------------- | ----------------------------------------- | ------ | -| [@affine/copilot-plugin](./packages/plugins/copilot) | AI Copilot that help you document writing | ๐Ÿšง | -| [@affine/image-preview-plugin](./packages/plugins/image-preview) | Component for previewing an image | โœ… | - ## Upstreams We would also like to give thanks to open-source projects that make AFFiNE possible: diff --git a/docs/BUILDING.md b/docs/BUILDING.md index d90d609654..28ac41d3a2 100644 --- a/docs/BUILDING.md +++ b/docs/BUILDING.md @@ -73,12 +73,6 @@ yarn workspace @affine/native build yarn run build:infra ``` -### Build Plugins - -```sh -yarn run build:plugins -``` - ### Build Server Dependencies ```sh @@ -102,7 +96,7 @@ yarn test ### E2E Test ```shell -# there are `affine-local`, `affine-migration`, `affine-local`, `affine-plugin`, `affine-prototype` e2e tests, +# there are `affine-local`, `affine-migration`, `affine-local`, `affine-prototype` e2e tests, # which are run under different situations. cd tests/affine-local yarn e2e diff --git a/docs/contributing/tutorial.md b/docs/contributing/tutorial.md index 07bd19ad1d..39be0c964d 100644 --- a/docs/contributing/tutorial.md +++ b/docs/contributing/tutorial.md @@ -17,7 +17,6 @@ The codebase is organized as follows: - `packages/` contains all code running in production. - `backend/` contains backend code, more information from . - `frontend/` contains frontend code, including the web app, the electron app and business libraries. - - `plugins/` contains all build-in plugins. - `common` contains the isomorphic code or basic libraries without business. - `tools/` contains tools to help developing or CI, not used in production. - `tests/` contains testings across different libraries, including e2e testings and integration testings. diff --git a/package.json b/package.json index 171dfa6190..9f47d575c7 100644 --- a/package.json +++ b/package.json @@ -24,7 +24,6 @@ "build:electron": "yarn nx build @affine/electron", "build:storage": "yarn nx run-many -t build -p @affine/storage", "build:infra": "yarn nx run-many -t build --projects=tag:infra", - "build:plugins": "yarn nx run-many -t build --projects=tag:plugin", "build:storybook": "yarn nx build @affine/storybook", "start:web-static": "yarn workspace @affine/core static-server", "start:storybook": "yarn exec serve tests/storybook/storybook-static -l 6006", @@ -58,7 +57,6 @@ "devDependencies": { "@affine-test/kit": "workspace:*", "@affine/cli": "workspace:*", - "@affine/plugin-cli": "workspace:*", "@commitlint/cli": "^18.4.3", "@commitlint/config-conventional": "^18.4.3", "@faker-js/faker": "^8.3.1", diff --git a/packages/common/env/src/global.ts b/packages/common/env/src/global.ts index 8709d98008..7e9527be4e 100644 --- a/packages/common/env/src/global.ts +++ b/packages/common/env/src/global.ts @@ -12,8 +12,6 @@ export const blockSuiteFeatureFlags = z.object({ }); export const runtimeFlagsSchema = z.object({ - enablePlugin: z.boolean(), - builtinPlugins: z.array(z.string()), enableTestProperties: z.boolean(), enableBroadcastChannelProvider: z.boolean(), enableDebugPage: z.boolean(), diff --git a/packages/common/infra/package.json b/packages/common/infra/package.json index 982672f299..5a6bff9a4b 100644 --- a/packages/common/infra/package.json +++ b/packages/common/infra/package.json @@ -61,7 +61,6 @@ "dependencies": { "@affine/debug": "workspace:*", "@affine/env": "workspace:*", - "@affine/sdk": "workspace:*", "@blocksuite/blocks": "0.11.0-nightly-202312220916-e3abcbb", "@blocksuite/global": "0.11.0-nightly-202312220916-e3abcbb", "@blocksuite/store": "0.11.0-nightly-202312220916-e3abcbb", diff --git a/packages/common/infra/src/__internal__/plugin.ts b/packages/common/infra/src/__internal__/plugin.ts deleted file mode 100644 index 7071e8b9df..0000000000 --- a/packages/common/infra/src/__internal__/plugin.ts +++ /dev/null @@ -1,53 +0,0 @@ -import type { CallbackMap } from '@affine/sdk/entry'; -import { assertExists } from '@blocksuite/global/utils'; -import { atomWithStorage } from 'jotai/utils'; -import { atom } from 'jotai/vanilla'; -import type { z } from 'zod'; - -import type { packageJsonOutputSchema } from '../type.js'; - -export const builtinPluginPaths = new Set(runtimeConfig.builtinPlugins); - -const pluginCleanupMap = new Map void>>(); - -export function addCleanup( - pluginName: string, - cleanup: () => void -): () => void { - if (!pluginCleanupMap.has(pluginName)) { - pluginCleanupMap.set(pluginName, new Set()); - } - const cleanupSet = pluginCleanupMap.get(pluginName); - assertExists(cleanupSet); - cleanupSet.add(cleanup); - return () => { - cleanupSet.delete(cleanup); - }; -} - -export function invokeCleanup(pluginName: string) { - pluginCleanupMap.get(pluginName)?.forEach(cleanup => cleanup()); - pluginCleanupMap.delete(pluginName); -} - -export const pluginPackageJson = atom< - z.infer[] ->([]); - -export const enabledPluginAtom = atomWithStorage('affine-enabled-plugin', [ - '@affine/image-preview-plugin', -]); - -export const pluginHeaderItemAtom = atom< - Record ->({}); - -export const pluginSettingAtom = atom>( - {} -); - -export const pluginEditorAtom = atom>({}); - -export const pluginWindowAtom = atom< - Record () => void> ->({}); diff --git a/packages/common/infra/src/atom/index.ts b/packages/common/infra/src/atom/index.ts index 978d7fa366..12fc228d9d 100644 --- a/packages/common/infra/src/atom/index.ts +++ b/packages/common/infra/src/atom/index.ts @@ -1,6 +1,2 @@ -import { atom } from 'jotai'; - -export const loadedPluginNameAtom = atom([]); - export * from './root-store'; export * from './settings'; diff --git a/packages/common/infra/tsconfig.json b/packages/common/infra/tsconfig.json index 1e81c00cd2..3deffb8634 100644 --- a/packages/common/infra/tsconfig.json +++ b/packages/common/infra/tsconfig.json @@ -8,9 +8,6 @@ "outDir": "lib" }, "references": [ - { - "path": "../sdk" - }, { "path": "../env" }, diff --git a/packages/common/infra/vite.config.ts b/packages/common/infra/vite.config.ts index 03baf6f2a7..6055b068fe 100644 --- a/packages/common/infra/vite.config.ts +++ b/packages/common/infra/vite.config.ts @@ -19,7 +19,6 @@ export default defineConfig({ 'core/event-emitter': resolve(root, 'src/core/event-emitter.ts'), 'preload/electron': resolve(root, 'src/preload/electron.ts'), 'app-config-storage': resolve(root, 'src/app-config-storage.ts'), - '__internal__/plugin': resolve(root, 'src/__internal__/plugin.ts'), }, formats: ['es', 'cjs'], name: 'AffineInfra', diff --git a/packages/common/sdk/.gitignore b/packages/common/sdk/.gitignore deleted file mode 100644 index 3dca72d418..0000000000 --- a/packages/common/sdk/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -src/entry.d.ts -src/entry.d.ts.map -src/entry.js -src/entry.js.map diff --git a/packages/common/sdk/package.json b/packages/common/sdk/package.json deleted file mode 100644 index 09e13d00ec..0000000000 --- a/packages/common/sdk/package.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "name": "@affine/sdk", - "version": "0.11.0", - "type": "module", - "scripts": { - "build": "vite build", - "dev": "vite build --watch" - }, - "exports": { - "./entry": { - "types": "./dist/src/entry.d.ts", - "import": "./dist/entry.js", - "require": "./dist/entry.cjs" - }, - "./server": { - "types": "./dist/src/server.d.ts", - "import": "./dist/server.js", - "require": "./dist/server.cjs" - } - }, - "files": [ - "dist" - ], - "dependencies": { - "@blocksuite/block-std": "0.11.0-nightly-202312220916-e3abcbb", - "@blocksuite/blocks": "0.11.0-nightly-202312220916-e3abcbb", - "@blocksuite/global": "0.11.0-nightly-202312220916-e3abcbb", - "@blocksuite/presets": "0.11.0-nightly-202312220916-e3abcbb", - "@blocksuite/store": "0.11.0-nightly-202312220916-e3abcbb", - "jotai": "^2.5.1", - "zod": "^3.22.4" - }, - "devDependencies": { - "vite": "^5.0.6", - "vite-plugin-dts": "3.6.0" - } -} diff --git a/packages/common/sdk/project.json b/packages/common/sdk/project.json deleted file mode 100644 index 749b2e7b53..0000000000 --- a/packages/common/sdk/project.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "name": "sdk", - "$schema": "../../../node_modules/nx/schemas/project-schema.json", - "projectType": "library", - "sourceRoot": "packages/common/sdk/src", - "targets": { - "build": { - "executor": "@nx/vite:build", - "options": { - "outputPath": "packages/common/sdk/dist" - } - }, - "serve": { - "executor": "@nx/vite:build", - "options": { - "outputPath": "packages/common/sdk/dist", - "watch": true - } - } - }, - "tags": ["infra"] -} diff --git a/packages/common/sdk/src/entry.ts b/packages/common/sdk/src/entry.ts deleted file mode 100644 index 2cbda2c265..0000000000 --- a/packages/common/sdk/src/entry.ts +++ /dev/null @@ -1,64 +0,0 @@ -import type { BaseSelection } from '@blocksuite/block-std'; -import type { AffineEditorContainer } from '@blocksuite/presets'; -import type { Page } from '@blocksuite/store'; -import type { Workspace } from '@blocksuite/store'; -import type { Atom, getDefaultStore } from 'jotai/vanilla'; -import type { WritableAtom } from 'jotai/vanilla/atom'; -import type { FunctionComponent } from 'react'; - -export type Part = 'headerItem' | 'editor' | 'setting' | 'formatBar'; - -export type CallbackMap = { - headerItem: (root: HTMLElement) => () => void; - editor: (root: HTMLElement, editor: AffineEditorContainer) => () => void; - setting: (root: HTMLElement) => () => void; - formatBar: ( - root: HTMLElement, - page: Page, - getBlockRange: () => BaseSelection[] - ) => () => void; -}; - -export interface PluginContext { - register: (part: T, callback: CallbackMap[T]) => void; - utils: { - PluginProvider: FunctionComponent; // make more clear - }; -} - -export type LayoutDirection = 'horizontal' | 'vertical'; -export type LayoutNode = LayoutParentNode | string; -export type LayoutParentNode = { - direction: LayoutDirection; - splitPercentage: number; // 0 - 100 - first: string; - second: LayoutNode; - maxWidth?: (number | undefined)[]; -}; - -export type ExpectedLayout = - | { - direction: 'horizontal'; - // the first element is always the editor - first: 'editor'; - second: LayoutNode; - // the percentage should be greater than 70 - splitPercentage: number; - } - | 'editor'; - -export declare const pushLayoutAtom: WritableAtom< - null, - | [ - string, - (div: HTMLDivElement) => () => void, - { - maxWidth: (number | undefined)[]; - }, - ] - | [string, (div: HTMLDivElement) => () => void], - void ->; -export declare const deleteLayoutAtom: WritableAtom; -export declare const currentWorkspaceAtom: Atom>; -export declare const rootStore: ReturnType; diff --git a/packages/common/sdk/src/server.ts b/packages/common/sdk/src/server.ts deleted file mode 100644 index f7f88e3c48..0000000000 --- a/packages/common/sdk/src/server.ts +++ /dev/null @@ -1,4 +0,0 @@ -export interface ServerContext { - registerCommand: (command: string, fn: (...args: any[]) => any) => void; - unregisterCommand: (command: string) => void; -} diff --git a/packages/common/sdk/tsconfig.json b/packages/common/sdk/tsconfig.json deleted file mode 100644 index 33871974ad..0000000000 --- a/packages/common/sdk/tsconfig.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "extends": "../../../tsconfig.json", - "include": ["./src"], - "compilerOptions": { - "composite": true, - "noEmit": false, - "moduleResolution": "bundler", - "outDir": "lib" - }, - "references": [ - { - "path": "./tsconfig.node.json" - } - ] -} diff --git a/packages/common/sdk/tsconfig.node.json b/packages/common/sdk/tsconfig.node.json deleted file mode 100644 index 097adbc4e3..0000000000 --- a/packages/common/sdk/tsconfig.node.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "extends": "../../../tsconfig.json", - "compilerOptions": { - "composite": true, - "module": "ESNext", - "moduleResolution": "Node", - "allowSyntheticDefaultImports": true, - "outDir": "lib", - "noEmit": false - }, - "include": ["vite.config.ts"] -} diff --git a/packages/common/sdk/vite.config.ts b/packages/common/sdk/vite.config.ts deleted file mode 100644 index d158eff203..0000000000 --- a/packages/common/sdk/vite.config.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { resolve } from 'node:path'; - -import { fileURLToPath } from 'url'; -import { defineConfig } from 'vite'; -import dts from 'vite-plugin-dts'; - -const root = fileURLToPath(new URL('.', import.meta.url)); - -export default defineConfig({ - build: { - minify: false, - lib: { - entry: { - entry: resolve(root, 'src/entry.ts'), - server: resolve(root, 'src/server.ts'), - }, - }, - rollupOptions: { - external: [/^jotai/, /^@blocksuite/, 'zod'], - }, - }, - plugins: [dts()], -}); diff --git a/packages/frontend/core/.webpack/runtime-config.ts b/packages/frontend/core/.webpack/runtime-config.ts index 4921c3191b..6c24f96807 100644 --- a/packages/frontend/core/.webpack/runtime-config.ts +++ b/packages/frontend/core/.webpack/runtime-config.ts @@ -13,8 +13,6 @@ const editorFlags: BlockSuiteFeatureFlags = { export function getRuntimeConfig(buildFlags: BuildFlags): RuntimeConfig { const buildPreset: Record = { stable: { - enablePlugin: true, - builtinPlugins: ['/plugins/image-preview'], enableTestProperties: false, enableBroadcastChannelProvider: true, enableDebugPage: true, @@ -57,13 +55,6 @@ export function getRuntimeConfig(buildFlags: BuildFlags): RuntimeConfig { }, // canary will be aggressive and enable all features canary: { - enablePlugin: true, - builtinPlugins: [ - '/plugins/copilot', - '/plugins/hello-world', - '/plugins/image-preview', - '/plugins/vue-hello-world', - ], enableTestProperties: true, enableBroadcastChannelProvider: true, enableDebugPage: true, @@ -99,15 +90,6 @@ export function getRuntimeConfig(buildFlags: BuildFlags): RuntimeConfig { const currentBuildPreset = buildPreset[currentBuild]; const environmentPreset = { - builtinPlugins: [ - '/plugins/copilot', - '/plugins/hello-world', - '/plugins/image-preview', - '/plugins/vue-hello-world', - ], - enablePlugin: process.env.ENABLE_PLUGIN - ? process.env.ENABLE_PLUGIN === 'true' - : currentBuildPreset.enablePlugin, enableTestProperties: process.env.ENABLE_TEST_PROPERTIES ? process.env.ENABLE_TEST_PROPERTIES === 'true' : currentBuildPreset.enableTestProperties, diff --git a/packages/frontend/core/.webpack/webpack.config.ts b/packages/frontend/core/.webpack/webpack.config.ts index b78b4545d7..a9c82e0c38 100644 --- a/packages/frontend/core/.webpack/webpack.config.ts +++ b/packages/frontend/core/.webpack/webpack.config.ts @@ -1,4 +1,4 @@ -import { createConfiguration, rootPath, getPublicPath } from './config.js'; +import { createConfiguration, rootPath } from './config.js'; import { merge } from 'webpack-merge'; import { join, resolve } from 'node:path'; import type { BuildFlags } from '@affine/cli/config'; @@ -20,7 +20,6 @@ export default async function (cli_env: any, _: any) { return merge(config, { entry: { app: resolve(rootPath, 'src/index.tsx'), - '_plugin/index.test': resolve(rootPath, 'src/_plugin/index.test.tsx'), }, plugins: [ new HTMLPlugin({ @@ -35,19 +34,6 @@ export default async function (cli_env: any, _: any) { DESCRIPTION, }, }), - new HTMLPlugin({ - template: join(rootPath, '.webpack', 'template.html'), - inject: 'body', - scriptLoading: 'module', - minify: false, - publicPath: getPublicPath(flags), - chunks: ['_plugin/index.test'], - filename: '_plugin/index.html', - templateParameters: { - GIT_SHORT_SHA: gitShortHash(), - DESCRIPTION, - }, - }), ], }); } diff --git a/packages/frontend/core/src/_plugin/index.test.tsx b/packages/frontend/core/src/_plugin/index.test.tsx deleted file mode 100644 index 5c0b3cde7f..0000000000 --- a/packages/frontend/core/src/_plugin/index.test.tsx +++ /dev/null @@ -1,50 +0,0 @@ -import '../polyfill/intl-segmenter'; - -import { assertExists } from '@blocksuite/global/utils'; -import { - getCurrentStore, - loadedPluginNameAtom, -} from '@toeverything/infra/atom'; -import { use } from 'foxact/use'; -import { useAtomValue } from 'jotai'; -import { Provider } from 'jotai/react'; -import { StrictMode } from 'react'; -import { createRoot } from 'react-dom/client'; - -import { createSetup } from '../bootstrap/plugins/setup'; -import { bootstrapPluginSystem } from '../bootstrap/register-plugins'; - -async function main() { - const { setup } = await import('../bootstrap/setup'); - const rootStore = getCurrentStore(); - setup(); - createSetup(rootStore); - const pluginRegisterPromise = bootstrapPluginSystem(rootStore); - const root = document.getElementById('app'); - assertExists(root); - - const App = () => { - use(pluginRegisterPromise); - const plugins = useAtomValue(loadedPluginNameAtom); - return ( -
-
- Successfully loaded plugins: -
- {plugins.map(plugin => { - return
{plugin}
; - })} -
- ); - }; - - createRoot(root).render( - - - - - - ); -} - -await main(); diff --git a/packages/frontend/core/src/bootstrap/plugins/endowments/fercher.ts b/packages/frontend/core/src/bootstrap/plugins/endowments/fercher.ts deleted file mode 100644 index eee2d0abf4..0000000000 --- a/packages/frontend/core/src/bootstrap/plugins/endowments/fercher.ts +++ /dev/null @@ -1,86 +0,0 @@ -export interface FetchOptions { - fetch?: typeof fetch; - signal?: AbortSignal; - - normalizeURL?(url: string): string; - - /** - * Virtualize a url - * @param url URL to be rewrite - * @param direction Direction of this rewrite. - * 'in' means the url is from the outside world and should be virtualized. - * 'out' means the url is from the inside world and should be de-virtualized to fetch the real target. - */ - rewriteURL?(url: string, direction: 'in' | 'out'): string; - - replaceRequest?(request: Request): Request | PromiseLike; - - replaceResponse?(response: Response): Response | PromiseLike; - - canConnect?(url: string): boolean | PromiseLike; -} - -export function createFetch(options: FetchOptions) { - const { - fetch: _fetch = fetch, - signal, - rewriteURL, - replaceRequest, - replaceResponse, - canConnect, - normalizeURL, - } = options; - - return async function fetch(input: RequestInfo, init?: RequestInit) { - let request = new Request(input, { - ...init, - signal: getMergedSignal(init?.signal, signal) || null, - }); - - if (normalizeURL) request = new Request(normalizeURL(request.url), request); - if (canConnect && !(await canConnect(request.url))) - throw new TypeError('Failed to fetch'); - if (rewriteURL) - request = new Request(rewriteURL(request.url, 'out'), request); - if (replaceRequest) request = await replaceRequest(request); - - let response = await _fetch(request); - - if (rewriteURL) { - const { url, redirected, type } = response; - // Note: Response constructor does not allow us to set the url of a response. - // we have to define the own property on it. This is not a good simulation. - // To prevent get the original url by Response.prototype.[[get url]].call(response) - // we copy a response and set it's url to empty. - response = new Response(response.body, response); - Object.defineProperties(response, { - url: { value: url, configurable: true }, - redirected: { value: redirected, configurable: true }, - type: { value: type, configurable: true }, - }); - Object.defineProperty(response, 'url', { - configurable: true, - value: rewriteURL(url, 'in'), - }); - } - if (replaceResponse) response = await replaceResponse(response); - return response; - }; -} - -function getMergedSignal( - signal: AbortSignal | undefined | null, - signal2: AbortSignal | undefined | null -) { - if (!signal) return signal2; - if (!signal2) return signal; - - const abortController = new AbortController(); - signal.addEventListener('abort', () => abortController.abort(), { - once: true, - }); - signal2.addEventListener('abort', () => abortController.abort(), { - once: true, - }); - return abortController.signal; -} diff --git a/packages/frontend/core/src/bootstrap/plugins/endowments/timer.ts b/packages/frontend/core/src/bootstrap/plugins/endowments/timer.ts deleted file mode 100644 index cd7ea13ef4..0000000000 --- a/packages/frontend/core/src/bootstrap/plugins/endowments/timer.ts +++ /dev/null @@ -1,110 +0,0 @@ -type Handler = (...args: any[]) => void; - -export interface Timers { - setTimeout: (handler: Handler, timeout?: number, ...args: any[]) => number; - clearTimeout: (handle: number) => void; - setInterval: (handler: Handler, timeout?: number, ...args: any[]) => number; - clearInterval: (handle: number) => void; - requestAnimationFrame: (callback: Handler) => number; - cancelAnimationFrame: (handle: number) => void; - requestIdleCallback?: typeof window.requestIdleCallback | undefined; - cancelIdleCallback?: typeof window.cancelIdleCallback | undefined; - queueMicrotask: typeof window.queueMicrotask; -} - -export function createTimers( - abortSignal: AbortSignal, - originalTimes: Timers = { - requestAnimationFrame, - cancelAnimationFrame, - requestIdleCallback: - typeof requestIdleCallback === 'function' - ? requestIdleCallback - : undefined, - cancelIdleCallback: - typeof cancelIdleCallback === 'function' ? cancelIdleCallback : undefined, - setTimeout, - clearTimeout, - setInterval, - clearInterval, - queueMicrotask, - } -): Timers { - const { - requestAnimationFrame: _requestAnimationFrame, - cancelAnimationFrame: _cancelAnimationFrame, - setInterval: _setInterval, - clearInterval: _clearInterval, - setTimeout: _setTimeout, - clearTimeout: _clearTimeout, - cancelIdleCallback: _cancelIdleCallback, - requestIdleCallback: _requestIdleCallback, - queueMicrotask: _queueMicrotask, - } = originalTimes; - - const interval_timer_id: number[] = []; - const idle_id: number[] = []; - const raf_id: number[] = []; - - abortSignal.addEventListener( - 'abort', - () => { - raf_id.forEach(_cancelAnimationFrame); - interval_timer_id.forEach(_clearInterval); - _cancelIdleCallback && idle_id.forEach(_cancelIdleCallback); - }, - { once: true } - ); - - return { - // id is a positive number, it never repeats. - requestAnimationFrame(callback) { - raf_id[raf_id.length] = _requestAnimationFrame(callback); - return raf_id.length; - }, - cancelAnimationFrame(handle) { - const id = raf_id[handle - 1]; - if (!id) return; - _cancelAnimationFrame(id); - }, - setInterval(handler, timeout) { - interval_timer_id[interval_timer_id.length] = (_setInterval as any)( - handler, - timeout - ); - return interval_timer_id.length; - }, - clearInterval(id) { - if (!id) return; - const handle = interval_timer_id[id - 1]; - if (!handle) return; - _clearInterval(handle); - }, - setTimeout(handler, timeout) { - idle_id[idle_id.length] = (_setTimeout as any)(handler, timeout); - return idle_id.length; - }, - clearTimeout(id) { - if (!id) return; - const handle = idle_id[id - 1]; - if (!handle) return; - _clearTimeout(handle); - }, - requestIdleCallback: _requestIdleCallback - ? function requestIdleCallback(callback, options) { - idle_id[idle_id.length] = _requestIdleCallback(callback, options); - return idle_id.length; - } - : undefined, - cancelIdleCallback: _cancelIdleCallback - ? function cancelIdleCallback(handle) { - const id = idle_id[handle - 1]; - if (!id) return; - _cancelIdleCallback(id); - } - : undefined, - queueMicrotask(callback) { - _queueMicrotask(() => abortSignal.aborted || callback()); - }, - }; -} diff --git a/packages/frontend/core/src/bootstrap/plugins/setup-imports-map.ts b/packages/frontend/core/src/bootstrap/plugins/setup-imports-map.ts deleted file mode 100644 index 6e92f2fbf9..0000000000 --- a/packages/frontend/core/src/bootstrap/plugins/setup-imports-map.ts +++ /dev/null @@ -1,22 +0,0 @@ -type ExportsPromiseOrExports = - | Promise<{ [key: string]: any }> - | { [key: string]: any }; - -export async function setupImportsMap( - map: Map>, - imports: Record -) { - for (const [key, value] of Object.entries(imports)) { - let module: { [key: string]: any }; - if (value instanceof Promise) { - module = await value; - } else { - module = value; - } - const moduleMap = new Map(); - map.set(key, moduleMap); - for (const [exportName, exportValue] of Object.entries(module)) { - moduleMap.set(exportName, exportValue); - } - } -} diff --git a/packages/frontend/core/src/bootstrap/plugins/setup.ts b/packages/frontend/core/src/bootstrap/plugins/setup.ts deleted file mode 100644 index 15c473a899..0000000000 --- a/packages/frontend/core/src/bootstrap/plugins/setup.ts +++ /dev/null @@ -1,483 +0,0 @@ -import { DebugLogger } from '@affine/debug'; -import type { CallbackMap, PluginContext } from '@affine/sdk/entry'; -import { AffineFormatBarWidget } from '@blocksuite/blocks'; -import { assertExists } from '@blocksuite/global/utils'; -import { - addCleanup, - pluginEditorAtom, - pluginHeaderItemAtom, - pluginSettingAtom, -} from '@toeverything/infra/__internal__/plugin'; -import { Provider } from 'jotai/react'; -import type { createStore } from 'jotai/vanilla'; -import { createElement, type PropsWithChildren } from 'react'; - -import { createFetch } from './endowments/fercher'; -import { createTimers } from './endowments/timer'; -import { setupImportsMap } from './setup-imports-map'; - -// DO NOT REMOVE INVISIBLE CHARACTERS -const dynamicImportKey = '$hโ€_import'; - -const permissionLogger = new DebugLogger('plugins:permission'); -const importLogger = new DebugLogger('plugins:import'); -const entryLogger = new DebugLogger('plugins:entry'); - -const setupWeakMap = new WeakMap< - ReturnType, - ReturnType ->(); - -export function createSetup(rootStore: ReturnType) { - if (setupWeakMap.has(rootStore)) { - // eslint-disable-next-line @typescript-eslint/no-non-null-assertion - return setupWeakMap.get(rootStore)!; - } - const setup = createSetupImpl(rootStore); - setupWeakMap.set(rootStore, setup); - return setup; -} - -function createSetupImpl(rootStore: ReturnType) { - // module -> importName -> updater[] - const _rootImportsMap = new Map>(); - const rootImportsMapSetupPromise = setupImportsMap(_rootImportsMap, { - react: import('react'), - 'react/jsx-runtime': import('react/jsx-runtime'), - 'react-dom': import('react-dom'), - 'react-dom/client': import('react-dom/client'), - jotai: import('jotai'), - 'jotai/utils': import('jotai/utils'), - swr: import('swr'), - '@affine/component': import('@affine/component'), - '@blocksuite/icons': import('@blocksuite/icons'), - '@blocksuite/blocks': import('@blocksuite/blocks'), - '@blocksuite/inline': import('@blocksuite/inline'), - '@affine/sdk/entry': { - rootStore, - }, - '@blocksuite/global/utils': import('@blocksuite/global/utils'), - '@toeverything/infra/atom': import('@toeverything/infra/atom'), - '@affine/component/ui/button': import('@affine/component/ui/button'), - '@affine/component/ui/tooltip': import('@affine/component/ui/tooltip'), - }); - - // pluginName -> module -> importName -> updater[] - const _pluginNestedImportsMap = new Map< - string, - Map> - >(); - - const pluginImportsFunctionMap = new Map< - string, - (newUpdaters: [string, [string, ((val: any) => void)[]][]][]) => void - >(); - const createImports = (pluginName: string) => { - if (pluginImportsFunctionMap.has(pluginName)) { - // eslint-disable-next-line @typescript-eslint/no-non-null-assertion - return pluginImportsFunctionMap.get(pluginName)!; - } - const imports = ( - newUpdaters: [string, [string, ((val: any) => void)[]][]][] - ) => { - // eslint-disable-next-line @typescript-eslint/no-non-null-assertion - const currentImportMap = _pluginNestedImportsMap.get(pluginName)!; - importLogger.debug('currentImportMap', pluginName, currentImportMap); - - for (const [module, moduleUpdaters] of newUpdaters) { - importLogger.debug('imports module', module, moduleUpdaters); - let moduleImports = _rootImportsMap.get(module); - if (!moduleImports) { - moduleImports = currentImportMap.get(module); - } - if (moduleImports) { - for (const [importName, importUpdaters] of moduleUpdaters) { - const updateImport = (value: any) => { - for (const importUpdater of importUpdaters) { - importUpdater(value); - } - }; - if (moduleImports.has(importName)) { - const val = moduleImports.get(importName); - updateImport(val); - } - } - } else { - console.error( - 'cannot find module in plugin import map', - module, - currentImportMap, - _pluginNestedImportsMap - ); - } - } - }; - pluginImportsFunctionMap.set(pluginName, imports); - return imports; - }; - - const abortController = new AbortController(); - - const pluginFetch = createFetch({}); - const timer = createTimers(abortController.signal); - - const sharedGlobalThis = Object.assign(Object.create(null), timer, { - Object: globalThis.Object, - fetch: pluginFetch, - ReadableStream: globalThis.ReadableStream, - Symbol: globalThis.Symbol, - Error: globalThis.Error, - TypeError: globalThis.TypeError, - RangeError: globalThis.RangeError, - console: globalThis.console, - crypto: globalThis.crypto, - }); - - const dynamicImportMap = new Map< - string, - (moduleName: string) => Promise - >(); - - const createOrGetDynamicImport = (baseUrl: string, pluginName: string) => { - if (dynamicImportMap.has(pluginName)) { - // eslint-disable-next-line @typescript-eslint/no-non-null-assertion - return dynamicImportMap.get(pluginName)!; - } - const dynamicImport = async (moduleName: string): Promise => { - const codeUrl = `${baseUrl}/${moduleName}`; - const analysisUrl = `${baseUrl}/${moduleName}.json`; - const response = await fetch(codeUrl); - const analysisResponse = await fetch(analysisUrl); - const analysis = await analysisResponse.json(); - const exports = analysis.exports as string[]; - const code = await response.text(); - const moduleCompartment = new Compartment( - createOrGetGlobalThis( - pluginName, - // use singleton here to avoid infinite loop - createOrGetDynamicImport(pluginName, baseUrl) - ) - ); - const entryPoint = moduleCompartment.evaluate(code, { - __evadeHtmlCommentTest__: true, - }); - const moduleExports = {} as Record; - const setVarProxy = new Proxy( - {}, - { - get(_, p: string): any { - return (newValue: any) => { - moduleExports[p] = newValue; - }; - }, - } - ); - entryPoint({ - imports: createImports(pluginName), - liveVar: setVarProxy, - onceVar: setVarProxy, - }); - importLogger.debug('import', moduleName, exports, moduleExports); - return moduleExports; - }; - dynamicImportMap.set(pluginName, dynamicImport); - return dynamicImport; - }; - - const globalThisMap = new Map(); - - const createOrGetGlobalThis = ( - pluginName: string, - dynamicImport: (moduleName: string) => Promise - ) => { - if (globalThisMap.has(pluginName)) { - // eslint-disable-next-line @typescript-eslint/no-non-null-assertion - return globalThisMap.get(pluginName)!; - } - const pluginGlobalThis = Object.assign( - Object.create(null), - sharedGlobalThis, - { - // fixme: vite build output bundle will have this, we should remove it - process: Object.freeze({ - env: { - NODE_ENV: process.env.NODE_ENV, - }, - }), - // dynamic import function - [dynamicImportKey]: dynamicImport, - // UNSAFE: React will read `window` and `document` - window: new Proxy( - {}, - { - get(_, key) { - permissionLogger.debug(`${pluginName} is accessing window`, key); - if (sharedGlobalThis[key]) return sharedGlobalThis[key]; - const result = Reflect.get(window, key); - if (typeof result === 'function') { - if (result === ShadowRoot) { - return result; - } - return function (...args: any[]) { - permissionLogger.debug( - `${pluginName} is calling window`, - key, - args - ); - return result.apply(window, args); - }; - } - permissionLogger.debug('window', key, result); - return result; - }, - } - ), - document: new Proxy( - {}, - { - get(_, key) { - permissionLogger.debug( - `${pluginName} is accessing document`, - key - ); - if (sharedGlobalThis[key]) return sharedGlobalThis[key]; - const result = Reflect.get(document, key); - if (typeof result === 'function') { - return function (...args: any[]) { - permissionLogger.debug( - `${pluginName} is calling window`, - key, - args - ); - return result.apply(document, args); - }; - } - permissionLogger.debug('document', key, result); - return result; - }, - } - ), - navigator: globalThis.navigator, - - MouseEvent: globalThis.MouseEvent, - KeyboardEvent: globalThis.KeyboardEvent, - CustomEvent: globalThis.CustomEvent, - - // copilot uses these - Date: globalThis.Date, - Math: globalThis.Math, - URL: globalThis.URL, - URLSearchParams: globalThis.URLSearchParams, - Headers: globalThis.Headers, - TextEncoder: globalThis.TextEncoder, - TextDecoder: globalThis.TextDecoder, - Request: globalThis.Request, - - // image-preview uses these - Blob: globalThis.Blob, - ClipboardItem: globalThis.ClipboardItem, - - // vue uses these - Element: globalThis.Element, - SVGElement: globalThis.SVGElement, - - // fixme: use our own db api - indexedDB: globalThis.indexedDB, - IDBRequest: globalThis.IDBRequest, - IDBDatabase: globalThis.IDBDatabase, - IDBCursorWithValue: globalThis.IDBCursorWithValue, - IDBFactory: globalThis.IDBFactory, - IDBKeyRange: globalThis.IDBKeyRange, - IDBOpenDBRequest: globalThis.IDBOpenDBRequest, - IDBTransaction: globalThis.IDBTransaction, - IDBObjectStore: globalThis.IDBObjectStore, - IDBIndex: globalThis.IDBIndex, - IDBCursor: globalThis.IDBCursor, - IDBVersionChangeEvent: globalThis.IDBVersionChangeEvent, - } - ); - pluginGlobalThis.global = pluginGlobalThis; - globalThisMap.set(pluginName, pluginGlobalThis); - return pluginGlobalThis; - }; - - const setupPluginCode = async ( - baseUrl: string, - pluginName: string, - filename: string - ) => { - await rootImportsMapSetupPromise; - if (!_pluginNestedImportsMap.has(pluginName)) { - _pluginNestedImportsMap.set(pluginName, new Map()); - } - // eslint-disable-next-line @typescript-eslint/no-non-null-assertion - const currentImportMap = _pluginNestedImportsMap.get(pluginName)!; - const isMissingPackage = (name: string) => - _rootImportsMap.has(name) && !currentImportMap.has(name); - - const bundleAnalysis = await fetch(`${baseUrl}/${filename}.json`).then( - res => res.json() - ); - const moduleExports = bundleAnalysis.exports as Record; - const moduleImports = bundleAnalysis.imports as string[]; - const moduleReexports = bundleAnalysis.reexports as Record< - string, - [localName: string, exportedName: string][] - >; - await Promise.all( - moduleImports.map(name => { - if (isMissingPackage(name)) { - return Promise.resolve(); - } else { - importLogger.debug('missing package', name); - return setupPluginCode(baseUrl, pluginName, name); - } - }) - ); - const code = await fetch( - `${baseUrl}/${filename.replace(/^\.\//, '')}` - ).then(res => res.text()); - importLogger.debug('evaluating', filename); - const moduleCompartment = new Compartment( - createOrGetGlobalThis( - pluginName, - // use singleton here to avoid infinite loop - createOrGetDynamicImport(baseUrl, pluginName) - ) - ); - const entryPoint = moduleCompartment.evaluate(code, { - __evadeHtmlCommentTest__: true, - }); - const moduleExportsMap = new Map(); - const setVarProxy = new Proxy( - {}, - { - get(_, p: string): any { - return (newValue: any) => { - moduleExportsMap.set(p, newValue); - }; - }, - } - ); - currentImportMap.set(filename, moduleExportsMap); - entryPoint({ - imports: createImports(pluginName), - liveVar: setVarProxy, - onceVar: setVarProxy, - }); - - for (const [newExport, [originalExport]] of Object.entries(moduleExports)) { - if (newExport === originalExport) continue; - const value = moduleExportsMap.get(originalExport); - moduleExportsMap.set(newExport, value); - moduleExportsMap.delete(originalExport); - } - - for (const [name, reexports] of Object.entries(moduleReexports)) { - const targetExports = currentImportMap.get(filename); - const moduleExports = currentImportMap.get(name); - assertExists(targetExports); - assertExists(moduleExports); - for (const [exportedName, localName] of reexports) { - const exportedValue: any = moduleExports.get(exportedName); - assertExists(exportedValue); - targetExports.set(localName, exportedValue); - } - } - }; - - const PluginProvider = ({ children }: PropsWithChildren) => - createElement( - Provider, - { - store: rootStore, - }, - children - ); - - const evaluatePluginEntry = (pluginName: string) => { - // eslint-disable-next-line @typescript-eslint/no-non-null-assertion - const currentImportMap = _pluginNestedImportsMap.get(pluginName)!; - const pluginExports = currentImportMap.get('index.js'); - assertExists(pluginExports); - const entryFunction = pluginExports.get('entry'); - const cleanup = entryFunction({ - register: (part, callback) => { - entryLogger.info(`Registering ${pluginName} to ${part}`); - if (part === 'headerItem') { - rootStore.set(pluginHeaderItemAtom, items => ({ - ...items, - [pluginName]: callback as CallbackMap['headerItem'], - })); - addCleanup(pluginName, () => { - rootStore.set(pluginHeaderItemAtom, items => { - const newItems = { ...items }; - delete newItems[pluginName]; - return newItems; - }); - }); - } else if (part === 'editor') { - rootStore.set(pluginEditorAtom, items => ({ - ...items, - [pluginName]: callback as CallbackMap['editor'], - })); - addCleanup(pluginName, () => { - rootStore.set(pluginEditorAtom, items => { - const newItems = { ...items }; - delete newItems[pluginName]; - return newItems; - }); - }); - } else if (part === 'setting') { - rootStore.set(pluginSettingAtom, items => ({ - ...items, - [pluginName]: callback as CallbackMap['setting'], - })); - addCleanup(pluginName, () => { - rootStore.set(pluginSettingAtom, items => { - const newItems = { ...items }; - delete newItems[pluginName]; - return newItems; - }); - }); - } else if (part === 'formatBar') { - const register = (widget: AffineFormatBarWidget) => { - const div = document.createElement('div'); - const root = widget.host; - const cleanup = (callback as CallbackMap['formatBar'])( - div, - widget.page, - () => { - return root.selection.value; - } - ); - addCleanup(pluginName, () => { - AffineFormatBarWidget.customElements.delete(register); - cleanup(); - }); - return div; - }; - AffineFormatBarWidget.customElements.add(register); - } else { - throw new Error(`Unknown part: ${part}`); - } - }, - utils: { - PluginProvider, - }, - }); - if (typeof cleanup !== 'function') { - throw new Error('Plugin entry must return a function'); - } - addCleanup(pluginName, cleanup); - }; - return { - _rootImportsMap, - _pluginNestedImportsMap, - createImports, - createOrGetDynamicImport, - setupPluginCode, - evaluatePluginEntry, - createOrGetGlobalThis, - }; -} diff --git a/packages/frontend/core/src/bootstrap/register-plugins.ts b/packages/frontend/core/src/bootstrap/register-plugins.ts deleted file mode 100644 index 348208f60b..0000000000 --- a/packages/frontend/core/src/bootstrap/register-plugins.ts +++ /dev/null @@ -1,134 +0,0 @@ -import { DebugLogger } from '@affine/debug'; -import { - builtinPluginPaths, - enabledPluginAtom, - invokeCleanup, - pluginPackageJson, -} from '@toeverything/infra/__internal__/plugin'; -import { - getCurrentStore, - loadedPluginNameAtom, -} from '@toeverything/infra/atom'; -import { packageJsonOutputSchema } from '@toeverything/infra/type'; -import type { z } from 'zod'; - -import { createSetup } from './plugins/setup'; - -const logger = new DebugLogger('register-plugins'); - -declare global { - // eslint-disable-next-line no-var - var __pluginPackageJson__: unknown[]; -} - -Object.defineProperty(globalThis, '__pluginPackageJson__', { - get() { - return getCurrentStore().get(pluginPackageJson); - }, -}); - -export async function bootstrapPluginSystem( - rootStore: ReturnType -) { - const { evaluatePluginEntry, setupPluginCode } = createSetup(rootStore); - rootStore.sub(enabledPluginAtom, () => { - const added = new Set(); - const removed = new Set(); - const enabledPlugin = new Set(rootStore.get(enabledPluginAtom)); - enabledPlugin.forEach(pluginName => { - if (!enabledPluginSet.has(pluginName)) { - added.add(pluginName); - } - }); - enabledPluginSet.forEach(pluginName => { - if (!enabledPlugin.has(pluginName)) { - removed.add(pluginName); - } - }); - // update plugins - enabledPluginSet.clear(); - enabledPlugin.forEach(pluginName => { - enabledPluginSet.add(pluginName); - }); - added.forEach(pluginName => { - evaluatePluginEntry(pluginName); - }); - removed.forEach(pluginName => { - invokeCleanup(pluginName); - }); - }); - const enabledPluginSet = new Set(rootStore.get(enabledPluginAtom)); - const loadedAssets = new Set(); - - // we will load all plugins in parallel from builtinPlugins - return Promise.all( - [...builtinPluginPaths].map(url => { - return fetch(`${url}/package.json`) - .then(async res => { - const packageJson = (await res.json()) as z.infer< - typeof packageJsonOutputSchema - >; - packageJsonOutputSchema.parse(packageJson); - const { - name: pluginName, - affinePlugin: { - release, - entry: { core }, - assets, - }, - } = packageJson; - rootStore.set(pluginPackageJson, json => [...json, packageJson]); - logger.debug(`registering plugin ${pluginName}`); - logger.debug(`package.json: ${packageJson}`); - if (!release && !runtimeConfig.enablePlugin) { - return; - } - const baseURL = url; - const entryURL = `${baseURL}/${core}`; - rootStore.set(loadedPluginNameAtom, prev => [...prev, pluginName]); - await setupPluginCode(baseURL, pluginName, core); - console.log(`prepareImports for ${pluginName} done`); - await fetch(entryURL).then(async () => { - if (assets.length > 0) { - await Promise.all( - assets.map(async (asset: string) => { - const loadedAssetName = `${pluginName}_${asset}`; - // todo(himself65): add assets into shadow dom - if (loadedAssets.has(loadedAssetName)) { - return; - } - if (asset.endsWith('.css')) { - loadedAssets.add(loadedAssetName); - const res = await fetch(`${baseURL}/${asset}`); - if (res.ok) { - // todo: how to put css file into sandbox? - return res.text().then(text => { - const style = document.createElement('style'); - style.setAttribute('plugin-id', pluginName); - style.textContent = text; - document.head.append(style); - }); - } - return null; - } else { - return; - } - }) - ); - } - if (!enabledPluginSet.has(pluginName)) { - logger.debug(`plugin ${pluginName} is not enabled`); - } else { - logger.debug(`plugin ${pluginName} is enabled`); - evaluatePluginEntry(pluginName); - } - }); - }) - .catch(e => { - console.error(`error when fetch plugin from ${url}`, e); - }); - }) - ).then(() => { - console.info('All plugins loaded'); - }); -} diff --git a/packages/frontend/core/src/components/affine/setting-modal/general-setting/plugins/index.tsx b/packages/frontend/core/src/components/affine/setting-modal/general-setting/plugins/index.tsx deleted file mode 100644 index 02d29e954f..0000000000 --- a/packages/frontend/core/src/components/affine/setting-modal/general-setting/plugins/index.tsx +++ /dev/null @@ -1,97 +0,0 @@ -import { Switch } from '@affine/component'; -import { SettingHeader } from '@affine/component/setting-components'; -import { useAFFiNEI18N } from '@affine/i18n/hooks'; -import type { CallbackMap } from '@affine/sdk/entry'; -import { - addCleanup, - enabledPluginAtom, - pluginPackageJson, - pluginSettingAtom, -} from '@toeverything/infra/__internal__/plugin'; -import { loadedPluginNameAtom } from '@toeverything/infra/atom'; -import type { packageJsonOutputSchema } from '@toeverything/infra/type'; -import { useAtom, useAtomValue } from 'jotai/react'; -import { startTransition, useCallback, useMemo } from 'react'; -import type { z } from 'zod'; - -import { pluginItemStyle } from './style.css'; - -type PluginItemProps = { - json: z.infer; -}; - -type PluginSettingDetailProps = { - pluginName: string; - create: CallbackMap['setting']; -}; - -const PluginSettingDetail = ({ - pluginName, - create, -}: PluginSettingDetailProps) => { - return ( -
{ - if (ref) { - const cleanup = create(ref); - addCleanup(pluginName, cleanup); - } - }, - [pluginName, create] - )} - /> - ); -}; - -const PluginItem = ({ json }: PluginItemProps) => { - const [plugins, setEnabledPlugins] = useAtom(enabledPluginAtom); - const checked = useMemo( - () => plugins.includes(json.name), - [json.name, plugins] - ); - const create = useAtomValue(pluginSettingAtom)[json.name]; - return ( -
-
- {json.name} - { - startTransition(() => { - setEnabledPlugins(plugins => { - if (checked) { - return [...plugins, json.name]; - } else { - return plugins.filter(plugin => plugin !== json.name); - } - }); - }); - }, - [json.name, setEnabledPlugins] - )} - /> -
-
{json.description}
- {create && } -
- ); -}; - -export const Plugins = () => { - const t = useAFFiNEI18N(); - const loadedPlugins = useAtomValue(loadedPluginNameAtom); - return ( - <> - - {useAtomValue(pluginPackageJson).map(json => ( - - ))} - - ); -}; diff --git a/packages/frontend/core/src/components/affine/setting-modal/general-setting/plugins/style.css.ts b/packages/frontend/core/src/components/affine/setting-modal/general-setting/plugins/style.css.ts deleted file mode 100644 index 0f122181e4..0000000000 --- a/packages/frontend/core/src/components/affine/setting-modal/general-setting/plugins/style.css.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { style } from '@vanilla-extract/css'; - -export const settingWrapperStyle = style({ - flexGrow: 1, - display: 'flex', - justifyContent: 'flex-end', - minWidth: '150px', - maxWidth: '250px', -}); - -export const pluginItemStyle = style({ - borderBottom: '1px solid var(--affine-border-color)', - transition: '0.3s', - padding: '24px 8px', - fontSize: 'var(--affine-font-sm)', -}); diff --git a/packages/plugins/image-preview/src/component/hooks/use-zoom.tsx b/packages/frontend/core/src/components/image-preview/hooks/use-zoom.tsx similarity index 100% rename from packages/plugins/image-preview/src/component/hooks/use-zoom.tsx rename to packages/frontend/core/src/components/image-preview/hooks/use-zoom.tsx diff --git a/packages/plugins/image-preview/src/component/index.css.ts b/packages/frontend/core/src/components/image-preview/index.css.ts similarity index 100% rename from packages/plugins/image-preview/src/component/index.css.ts rename to packages/frontend/core/src/components/image-preview/index.css.ts diff --git a/packages/plugins/image-preview/src/component/index.jotai.ts b/packages/frontend/core/src/components/image-preview/index.jotai.ts similarity index 100% rename from packages/plugins/image-preview/src/component/index.jotai.ts rename to packages/frontend/core/src/components/image-preview/index.jotai.ts diff --git a/packages/plugins/image-preview/src/component/index.tsx b/packages/frontend/core/src/components/image-preview/index.tsx similarity index 98% rename from packages/plugins/image-preview/src/component/index.tsx rename to packages/frontend/core/src/components/image-preview/index.tsx index c34f0804cc..bc81976909 100644 --- a/packages/plugins/image-preview/src/component/index.tsx +++ b/packages/frontend/core/src/components/image-preview/index.tsx @@ -1,3 +1,4 @@ +import { toast } from '@affine/component'; import { Button, IconButton } from '@affine/component/ui/button'; import { Tooltip } from '@affine/component/ui/tooltip'; import type { ImageBlockModel } from '@blocksuite/blocks'; @@ -19,6 +20,7 @@ import { useAtom } from 'jotai'; import type { PropsWithChildren, ReactElement } from 'react'; import { Suspense, useCallback } from 'react'; import { useEffect, useRef, useState } from 'react'; +import ReactDOM from 'react-dom'; import type { FallbackProps } from 'react-error-boundary'; import { ErrorBoundary } from 'react-error-boundary'; import useSWR from 'swr'; @@ -41,7 +43,6 @@ import { unloaded, } from './index.css'; import { hasAnimationPlayedAtom, previewBlockIdAtom } from './index.jotai'; -import { toast } from './toast'; export type ImagePreviewModalProps = { workspace: Workspace; @@ -440,7 +441,7 @@ const ImagePreviewModalImpl = ( return; } const dataUrl = URL.createObjectURL(blob); - global.navigator.clipboard + navigator.clipboard .write([new ClipboardItem({ 'image/png': blob })]) .then(() => { console.log('Image copied to clipboard'); @@ -554,7 +555,7 @@ export const ImagePreviewModal = ( return null; } - return ( + return ReactDOM.createPortal(
-
+ , + document.body ); }; diff --git a/packages/frontend/core/src/components/page-detail-editor.tsx b/packages/frontend/core/src/components/page-detail-editor.tsx index 00a9a5538d..3a0545d511 100644 --- a/packages/frontend/core/src/components/page-detail-editor.tsx +++ b/packages/frontend/core/src/components/page-detail-editor.tsx @@ -4,8 +4,6 @@ import { assertExists, DisposableGroup } from '@blocksuite/global/utils'; import type { AffineEditorContainer } from '@blocksuite/presets'; import type { Page, Workspace } from '@blocksuite/store'; 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'; @@ -110,31 +108,8 @@ const PageDetailEditorMain = memo(function PageDetailEditorMain({ disposableGroup.add(onLoad(page, editor)); } - // todo: remove the following - // for now this is required for the image-preview plugin to work - const rootStore = getCurrentStore(); - const editorItems = rootStore.get(pluginEditorAtom); - let disposes: (() => void)[] = []; - const renderTimeout = window.setTimeout(() => { - disposes = Object.entries(editorItems).map(([id, editorItem]) => { - const div = document.createElement('div'); - div.setAttribute('plugin-id', id); - const cleanup = editorItem(div, editor); - assertExists(parent); - document.body.append(div); - return () => { - cleanup(); - div.remove(); - }; - }); - }); - return () => { disposableGroup.dispose(); - clearTimeout(renderTimeout); - window.setTimeout(() => { - disposes.forEach(dispose => dispose()); - }); }; }, [onLoad, page] diff --git a/packages/frontend/core/src/components/pure/plugin-header/index.tsx b/packages/frontend/core/src/components/pure/plugin-header/index.tsx deleted file mode 100644 index 6156691546..0000000000 --- a/packages/frontend/core/src/components/pure/plugin-header/index.tsx +++ /dev/null @@ -1,44 +0,0 @@ -import { - addCleanup, - pluginHeaderItemAtom, -} from '@toeverything/infra/__internal__/plugin'; -import { useAtomValue } from 'jotai'; -import { startTransition, useCallback, useRef } from 'react'; - -import * as styles from './styles.css'; -export const PluginHeader = () => { - const headerItem = useAtomValue(pluginHeaderItemAtom); - const pluginsRef = useRef([]); - - return ( -
{ - if (root) { - Object.entries(headerItem).forEach(([pluginName, create]) => { - if (pluginsRef.current.includes(pluginName)) { - return; - } - pluginsRef.current.push(pluginName); - const div = document.createElement('div'); - div.setAttribute('plugin-id', pluginName); - startTransition(() => { - const cleanup = create(div); - root.append(div); - addCleanup(pluginName, () => { - pluginsRef.current = pluginsRef.current.filter( - name => name !== pluginName - ); - div.remove(); - cleanup(); - }); - }); - }); - } - }, - [headerItem] - )} - /> - ); -}; diff --git a/packages/frontend/core/src/components/pure/plugin-header/styles.css.ts b/packages/frontend/core/src/components/pure/plugin-header/styles.css.ts deleted file mode 100644 index 254ef6618d..0000000000 --- a/packages/frontend/core/src/components/pure/plugin-header/styles.css.ts +++ /dev/null @@ -1,8 +0,0 @@ -import { style } from '@vanilla-extract/css'; - -export const pluginHeaderItems = style({ - display: 'flex', - gap: '12px', - alignItems: 'center', - height: '100%', -}); diff --git a/packages/frontend/core/src/index.tsx b/packages/frontend/core/src/index.tsx index 57d68e38d1..1a1e95584b 100644 --- a/packages/frontend/core/src/index.tsx +++ b/packages/frontend/core/src/index.tsx @@ -1,14 +1,11 @@ -import 'ses'; import './polyfill/intl-segmenter'; import './polyfill/request-idle-callback'; import { assertExists } from '@blocksuite/global/utils'; -import { getCurrentStore } from '@toeverything/infra/atom'; import { StrictMode } from 'react'; import { createRoot } from 'react-dom/client'; import { App } from './app'; -import { bootstrapPluginSystem } from './bootstrap/register-plugins'; import { setup } from './bootstrap/setup'; import { performanceLogger } from './shared'; @@ -18,14 +15,9 @@ function main() { // skip bootstrap setup for desktop onboarding if (window.appInfo?.windowName !== 'onboarding') { - const rootStore = getCurrentStore(); performanceMainLogger.info('setup start'); setup(); performanceMainLogger.info('setup done'); - - bootstrapPluginSystem(rootStore).catch(err => { - console.error('Failed to bootstrap plugin system', err); - }); } mountApp(); 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 fb850561b1..d5ba576e7f 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 @@ -30,6 +30,7 @@ import { currentModeAtom, currentPageIdAtom } from '../../../atoms/mode'; import { AffineErrorBoundary } from '../../../components/affine/affine-error-boundary'; import { HubIsland } from '../../../components/affine/hub-island'; import { GlobalPageHistoryModal } from '../../../components/affine/page-history-modal'; +import { ImagePreviewModal } from '../../../components/image-preview'; import { PageDetailEditor } from '../../../components/page-detail-editor'; import { TrashPageFooter } from '../../../components/pure/trash-page-footer'; import { TopTip } from '../../../components/top-tip'; @@ -193,6 +194,10 @@ const DetailPageImpl = memo(function DetailPageImpl({ page }: { page: Page }) { ) : null } /> + ); diff --git a/packages/frontend/core/src/pages/workspace/trash-page.tsx b/packages/frontend/core/src/pages/workspace/trash-page.tsx index 637fda9215..4d6648f472 100644 --- a/packages/frontend/core/src/pages/workspace/trash-page.tsx +++ b/packages/frontend/core/src/pages/workspace/trash-page.tsx @@ -58,7 +58,6 @@ export const loader: LoaderFunction = async () => { export const TrashPage = () => { const currentWorkspace = useAtomValue(waitForCurrentWorkspaceAtom); - // todo(himself65): refactor to plugin const blockSuiteWorkspace = currentWorkspace.blockSuiteWorkspace; assertExists(blockSuiteWorkspace); diff --git a/packages/frontend/core/tsconfig.json b/packages/frontend/core/tsconfig.json index 36a7d8aba7..c250ef7c09 100644 --- a/packages/frontend/core/tsconfig.json +++ b/packages/frontend/core/tsconfig.json @@ -29,9 +29,6 @@ { "path": "../../common/env" }, - { - "path": "../../plugins/copilot" - }, { "path": "./tsconfig.node.json" }, diff --git a/packages/frontend/electron/package.json b/packages/frontend/electron/package.json index 6928300a75..59fa098bb9 100644 --- a/packages/frontend/electron/package.json +++ b/packages/frontend/electron/package.json @@ -23,14 +23,9 @@ "main": "./dist/main.js", "devDependencies": { "@affine-test/kit": "workspace:*", - "@affine/copilot-plugin": "workspace:*", "@affine/env": "workspace:*", - "@affine/hello-world-plugin": "workspace:*", - "@affine/image-preview-plugin": "workspace:*", "@affine/native": "workspace:*", - "@affine/sdk": "workspace:*", "@affine/templates": "workspace:*", - "@affine/vue-hello-world-plugin": "workspace:*", "@blocksuite/blocks": "0.11.0-nightly-202312220916-e3abcbb", "@blocksuite/lit": "0.11.0-nightly-202312220916-e3abcbb", "@blocksuite/presets": "0.11.0-nightly-202312220916-e3abcbb", diff --git a/packages/frontend/electron/project.json b/packages/frontend/electron/project.json index d2044e8ee7..7f87ea5387 100644 --- a/packages/frontend/electron/project.json +++ b/packages/frontend/electron/project.json @@ -7,14 +7,7 @@ "targets": { "build": { "executor": "nx:run-script", - "dependsOn": [ - { - "projects": ["tag:plugin"], - "target": "build", - "params": "ignore" - }, - "^build" - ], + "dependsOn": ["^build"], "options": { "script": "build" }, diff --git a/packages/frontend/electron/scripts/common.ts b/packages/frontend/electron/scripts/common.ts index bcb6d31ec2..ab2b6f41b0 100644 --- a/packages/frontend/electron/scripts/common.ts +++ b/packages/frontend/electron/scripts/common.ts @@ -28,14 +28,7 @@ export const config = (): BuildOptions => { bundle: true, target: `node${NODE_MAJOR_VERSION}`, platform: 'node', - external: [ - 'electron', - 'electron-updater', - '@toeverything/plugin-infra', - 'yjs', - 'semver', - 'tinykeys', - ], + external: ['electron', 'electron-updater', 'yjs', 'semver', 'tinykeys'], format: 'cjs', loader: { '.node': 'copy', diff --git a/packages/frontend/electron/scripts/generate-assets.ts b/packages/frontend/electron/scripts/generate-assets.ts index 3b7de92dda..7d0fdefb7b 100755 --- a/packages/frontend/electron/scripts/generate-assets.ts +++ b/packages/frontend/electron/scripts/generate-assets.ts @@ -43,14 +43,6 @@ const cwd = repoRootDir; const { SKIP_NX_CACHE } = process.env; const nxFlag = SKIP_NX_CACHE ? '--skip-nx-cache' : ''; -if (!process.env.SKIP_PLUGIN_BUILD) { - spawnSync('yarn', ['build:plugins'], { - stdio: 'inherit', - env: process.env, - cwd, - }); -} - // step 1: build web dist if (!process.env.SKIP_WEB_BUILD) { spawnSync('yarn', ['nx', 'build', '@affine/core', nxFlag], { diff --git a/packages/frontend/electron/tsconfig.json b/packages/frontend/electron/tsconfig.json index 7d62f4f91d..f207aca9fd 100644 --- a/packages/frontend/electron/tsconfig.json +++ b/packages/frontend/electron/tsconfig.json @@ -22,9 +22,6 @@ { "path": "../../common/infra" }, - { - "path": "../../common/sdk" - }, { "path": "../../common/env" }, diff --git a/packages/frontend/electron/tsconfig.node.json b/packages/frontend/electron/tsconfig.node.json index a8afe56bee..34fc8e1641 100644 --- a/packages/frontend/electron/tsconfig.node.json +++ b/packages/frontend/electron/tsconfig.node.json @@ -12,11 +12,7 @@ "types": ["node"], "allowJs": true }, - "include": [ - "./scripts", - "esbuild.main.config.ts", - "esbuild.plugin.config.ts" - ], + "include": ["./scripts"], "ts-node": { "esm": true, "experimentalSpecifierResolution": "node" diff --git a/packages/plugins/copilot/README.md b/packages/plugins/copilot/README.md deleted file mode 100644 index 578c09e87d..0000000000 --- a/packages/plugins/copilot/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# AFFiNE Copilot - -> AI Copilot Plugin for your writing diff --git a/packages/plugins/copilot/package.json b/packages/plugins/copilot/package.json deleted file mode 100644 index 9a17c79763..0000000000 --- a/packages/plugins/copilot/package.json +++ /dev/null @@ -1,41 +0,0 @@ -{ - "name": "@affine/copilot-plugin", - "type": "module", - "private": true, - "description": "Copilot plugin", - "affinePlugin": { - "release": false, - "entry": { - "core": "./src/index.ts" - } - }, - "scripts": { - "dev": "af dev", - "build": "af build" - }, - "dependencies": { - "@affine/component": "workspace:*", - "@affine/sdk": "workspace:*", - "@blocksuite/icons": "2.1.36", - "@vanilla-extract/css": "^1.13.0", - "clsx": "^2.0.0", - "idb": "^8.0.0", - "langchain": "^0.0.166", - "marked": "^11.0.0", - "marked-gfm-heading-id": "^3.1.0", - "marked-mangle": "^1.1.4", - "zod": "^3.22.4" - }, - "devDependencies": { - "@affine/plugin-cli": "workspace:*", - "@types/marked": "^6.0.0", - "jotai": "^2.5.1", - "react": "18.2.0", - "react-dom": "18.2.0" - }, - "peerDependencies": { - "react": "*", - "react-dom": "*" - }, - "version": "0.11.0" -} diff --git a/packages/plugins/copilot/project.json b/packages/plugins/copilot/project.json deleted file mode 100644 index f683b4b6a9..0000000000 --- a/packages/plugins/copilot/project.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "name": "@affine/copilot-plugin", - "$schema": "../../../node_modules/nx/schemas/project-schema.json", - "namedInputs": { - "default": [ - "{projectRoot}/**/*", - "{workspaceRoot}/tools/plugin-cli/src/**/*", - "sharedGlobals" - ] - }, - "targets": { - "build": { - "executor": "nx:run-script", - "options": { - "script": "build" - }, - "dependsOn": ["^build"], - "inputs": ["default"], - "outputs": [ - "{workspaceRoot}/packages/frontend/core/public/plugins/copilot", - "{workspaceRoot}/packages/frontend/electron/dist/plugins/copilot" - ] - } - }, - "tags": ["plugin"] -} diff --git a/packages/plugins/copilot/src/UI/debug-content.tsx b/packages/plugins/copilot/src/UI/debug-content.tsx deleted file mode 100644 index 5ccea36fb8..0000000000 --- a/packages/plugins/copilot/src/UI/debug-content.tsx +++ /dev/null @@ -1,37 +0,0 @@ -import { FlexWrapper, Input } from '@affine/component'; -import { Button } from '@affine/component/ui/button'; -import { useAtom } from 'jotai'; -import { type ReactElement, useCallback } from 'react'; - -import { openAIApiKeyAtom } from '../core/hooks'; -import { conversationHistoryDBName } from '../core/langchain/message-history'; - -export const DebugContent = (): ReactElement => { - const [key, setKey] = useAtom(openAIApiKeyAtom); - return ( -
- - { - setKey(newValue); - }, - [setKey] - )} - placeholder="Enter your API_KEY here" - /> - - -
- ); -}; diff --git a/packages/plugins/copilot/src/UI/detail-content.tsx b/packages/plugins/copilot/src/UI/detail-content.tsx deleted file mode 100644 index 78855ff672..0000000000 --- a/packages/plugins/copilot/src/UI/detail-content.tsx +++ /dev/null @@ -1,72 +0,0 @@ -import { IconButton } from '@affine/component/ui/button'; -import { SendIcon } from '@blocksuite/icons'; -import { useAtomValue, useSetAtom } from 'jotai'; -import type { ReactElement } from 'react'; -import { Suspense, useCallback, useState } from 'react'; - -import { ConversationList } from '../core/components/conversation-list'; -import { FollowingUp } from '../core/components/following-up'; -import { openAIApiKeyAtom, useChatAtoms } from '../core/hooks'; -import { - detailContentActionsStyle, - detailContentStyle, - sendButtonStyle, - textareaStyle, -} from './index.css'; - -const Actions = () => { - const { conversationAtom, followingUpAtoms } = useChatAtoms(); - const call = useSetAtom(conversationAtom); - const questions = useAtomValue(followingUpAtoms.questionsAtom); - const generateFollowingUp = useSetAtom(followingUpAtoms.generateChatAtom); - const [input, setInput] = useState(''); - return ( - <> - -
-