Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(editor): add affine toolbar widget #9571

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions blocksuite/affine/widget-toolbar/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"name": "@blocksuite/affine-widget-toolbar",
"description": "Affine toolbar widget.",
"type": "module",
"scripts": {
"build": "tsc",
"test:unit": "nx vite:test --run --passWithNoTests",
"test:unit:coverage": "nx vite:test --run --coverage",
"test:e2e": "playwright test"
},
"sideEffects": false,
"keywords": [],
"author": "toeverything",
"license": "MIT",
"dependencies": {
"@blocksuite/affine-model": "workspace:*",
"@blocksuite/affine-shared": "workspace:*",
"@blocksuite/block-std": "workspace:*",
"@blocksuite/global": "workspace:*",
"@preact/signals-core": "^1.8.0",
"@toeverything/theme": "^1.1.12",
"lit": "^3.2.0"
},
"exports": {
".": "./src/index.ts",
"./effects": "./src/effects.ts"
},
"files": [
"src",
"dist",
"!src/__tests__",
"!dist/__tests__"
],
"version": "0.19.0"
}
11 changes: 11 additions & 0 deletions blocksuite/affine/widget-toolbar/src/effects.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { AFFINE_TOOLBAR_WIDGET, AffineToolbarWidget } from './toolbar';

export function effects() {
customElements.define(AFFINE_TOOLBAR_WIDGET, AffineToolbarWidget);
}

declare global {
interface HTMLElementTagNameMap {
[AFFINE_TOOLBAR_WIDGET]: AffineToolbarWidget;
}
}
1 change: 1 addition & 0 deletions blocksuite/affine/widget-toolbar/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './toolbar';
5 changes: 5 additions & 0 deletions blocksuite/affine/widget-toolbar/src/toolbar.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { WidgetComponent } from '@blocksuite/block-std';

export const AFFINE_TOOLBAR_WIDGET = 'affine-toolbar-widget';

export class AffineToolbarWidget extends WidgetComponent {}
15 changes: 15 additions & 0 deletions blocksuite/affine/widget-toolbar/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"rootDir": "./src/",
"outDir": "./dist/",
"noEmit": false
},
"include": ["./src"],
"references": [
{ "path": "../model" },
{ "path": "../shared" },
{ "path": "../../framework/block-std" },
{ "path": "../../framework/global" }
]
}
1 change: 1 addition & 0 deletions blocksuite/blocks/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
"@blocksuite/affine-widget-frame-title": "workspace:*",
"@blocksuite/affine-widget-remote-selection": "workspace:*",
"@blocksuite/affine-widget-scroll-anchoring": "workspace:*",
"@blocksuite/affine-widget-toolbar": "workspace:*",
"@blocksuite/block-std": "workspace:*",
"@blocksuite/data-view": "workspace:*",
"@blocksuite/global": "workspace:*",
Expand Down
2 changes: 2 additions & 0 deletions blocksuite/blocks/src/effects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ import { effects as widgetEdgelessAutoConnectEffects } from '@blocksuite/affine-
import { effects as widgetFrameTitleEffects } from '@blocksuite/affine-widget-frame-title/effects';
import { effects as widgetRemoteSelectionEffects } from '@blocksuite/affine-widget-remote-selection/effects';
import { effects as widgetScrollAnchoringEffects } from '@blocksuite/affine-widget-scroll-anchoring/effects';
import { effects as widgetToolbarEffects } from '@blocksuite/affine-widget-toolbar/effects';
import { effects as stdEffects } from '@blocksuite/block-std/effects';
import { effects as dataViewEffects } from '@blocksuite/data-view/effects';
import { effects as inlineEffects } from '@blocksuite/inline/effects';
Expand Down Expand Up @@ -90,6 +91,7 @@ export function effects() {
widgetRemoteSelectionEffects();
widgetDragHandleEffects();
widgetEdgelessAutoConnectEffects();
widgetToolbarEffects();

fragmentFramePanelEffects();
fragmentOutlineEffects();
Expand Down
1 change: 1 addition & 0 deletions blocksuite/blocks/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
{ "path": "../affine/widget-frame-title" },
{ "path": "../affine/widget-remote-selection" },
{ "path": "../affine/widget-scroll-anchoring" },
{ "path": "../affine/widget-toolbar" },
{ "path": "../framework/block-std" },
{ "path": "../affine/data-view" },
{ "path": "../framework/global" },
Expand Down
2 changes: 1 addition & 1 deletion blocksuite/tests-legacy/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"@blocksuite/integration-test": "workspace:*",
"@blocksuite/store": "workspace:*",
"@playwright/test": "=1.50.1",
"@toeverything/theme": "^1.1.7"
"@toeverything/theme": "^1.1.12"
},
"bsImport": {
"@atlaskit/pragmatic-drag-and-drop/element/adapter": "@atlaskit/pragmatic-drag-and-drop/dist/cjs/entry-point/element/adapter.js",
Expand Down
12 changes: 12 additions & 0 deletions tools/utils/src/workspace.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -420,6 +420,16 @@ export const PackageList = [
'blocksuite/framework/global',
],
},
{
location: 'blocksuite/affine/widget-toolbar',
name: '@blocksuite/affine-widget-toolbar',
workspaceDependencies: [
'blocksuite/affine/model',
'blocksuite/affine/shared',
'blocksuite/framework/block-std',
'blocksuite/framework/global',
],
},
{
location: 'blocksuite/blocks',
name: '@blocksuite/blocks',
Expand Down Expand Up @@ -452,6 +462,7 @@ export const PackageList = [
'blocksuite/affine/widget-frame-title',
'blocksuite/affine/widget-remote-selection',
'blocksuite/affine/widget-scroll-anchoring',
'blocksuite/affine/widget-toolbar',
'blocksuite/framework/block-std',
'blocksuite/affine/data-view',
'blocksuite/framework/global',
Expand Down Expand Up @@ -843,6 +854,7 @@ export type PackageName =
| '@blocksuite/affine-widget-frame-title'
| '@blocksuite/affine-widget-remote-selection'
| '@blocksuite/affine-widget-scroll-anchoring'
| '@blocksuite/affine-widget-toolbar'
| '@blocksuite/blocks'
| '@blocksuite/block-std'
| '@blocksuite/global'
Expand Down
1 change: 1 addition & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@
{ "path": "./blocksuite/affine/widget-frame-title" },
{ "path": "./blocksuite/affine/widget-remote-selection" },
{ "path": "./blocksuite/affine/widget-scroll-anchoring" },
{ "path": "./blocksuite/affine/widget-toolbar" },
{ "path": "./blocksuite/blocks" },
{ "path": "./blocksuite/framework/block-std" },
{ "path": "./blocksuite/framework/global" },
Expand Down
19 changes: 17 additions & 2 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4033,6 +4033,20 @@ __metadata:
languageName: unknown
linkType: soft

"@blocksuite/affine-widget-toolbar@workspace:*, @blocksuite/affine-widget-toolbar@workspace:blocksuite/affine/widget-toolbar":
version: 0.0.0-use.local
resolution: "@blocksuite/affine-widget-toolbar@workspace:blocksuite/affine/widget-toolbar"
dependencies:
"@blocksuite/affine-model": "workspace:*"
"@blocksuite/affine-shared": "workspace:*"
"@blocksuite/block-std": "workspace:*"
"@blocksuite/global": "workspace:*"
"@preact/signals-core": "npm:^1.8.0"
"@toeverything/theme": "npm:^1.1.12"
lit: "npm:^3.2.0"
languageName: unknown
linkType: soft

"@blocksuite/affine@workspace:*, @blocksuite/affine@workspace:blocksuite/affine/all":
version: 0.0.0-use.local
resolution: "@blocksuite/affine@workspace:blocksuite/affine/all"
Expand Down Expand Up @@ -4105,6 +4119,7 @@ __metadata:
"@blocksuite/affine-widget-frame-title": "workspace:*"
"@blocksuite/affine-widget-remote-selection": "workspace:*"
"@blocksuite/affine-widget-scroll-anchoring": "workspace:*"
"@blocksuite/affine-widget-toolbar": "workspace:*"
"@blocksuite/block-std": "workspace:*"
"@blocksuite/data-view": "workspace:*"
"@blocksuite/global": "workspace:*"
Expand Down Expand Up @@ -4225,7 +4240,7 @@ __metadata:
"@blocksuite/integration-test": "workspace:*"
"@blocksuite/store": "workspace:*"
"@playwright/test": "npm:=1.50.1"
"@toeverything/theme": "npm:^1.1.7"
"@toeverything/theme": "npm:^1.1.12"
languageName: unknown
linkType: soft

Expand Down Expand Up @@ -14946,7 +14961,7 @@ __metadata:
languageName: node
linkType: hard

"@toeverything/theme@npm:^1.1.12, @toeverything/theme@npm:^1.1.7":
"@toeverything/theme@npm:^1.1.12":
version: 1.1.12
resolution: "@toeverything/theme@npm:1.1.12"
checksum: 10/32247cf7f7a819445fa7373a3afafaafc6a8527b95934e37e5f2c32181224b2184691b24bd8a400872cca7cd1336efe98bd5ad3366b98d149e48b3baee2609a7
Expand Down
Loading