-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
20 changed files
with
440 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
packages/frontend/core/src/modules/peek-view/entities/peek-view.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import type { BlockElement } from '@blocksuite/block-std'; | ||
import type { AffineReference } from '@blocksuite/blocks'; | ||
import { Entity, LiveData } from '@toeverything/infra'; | ||
|
||
export type ActivePeekView = { | ||
target: BlockElement | AffineReference | HTMLAnchorElement; | ||
}; | ||
|
||
export class PeekViewEntity extends Entity { | ||
constructor() { | ||
super(); | ||
} | ||
|
||
private readonly _active$ = new LiveData<ActivePeekView | null>(null); | ||
|
||
active$ = this._active$.distinctUntilChanged(); | ||
show$ = this.active$.map(active => active !== null).distinctUntilChanged(); | ||
|
||
open(target: ActivePeekView['target']) { | ||
this._active$.next({ target }); | ||
} | ||
|
||
close() { | ||
if (this._active$.value === null) return; | ||
this._active$.next(null); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import type { Framework } from '@toeverything/infra'; | ||
|
||
import { PeekViewEntity } from './entities/peek-view'; | ||
import { PeekViewService } from './services/peek-view'; | ||
|
||
export function configurePeekViewModule(framework: Framework) { | ||
framework.service(PeekViewService).entity(PeekViewEntity); | ||
} | ||
|
||
export { PeekViewEntity, PeekViewService }; |
7 changes: 7 additions & 0 deletions
7
packages/frontend/core/src/modules/peek-view/services/peek-view.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import { Service } from '@toeverything/infra'; | ||
|
||
import { PeekViewEntity } from '../entities/peek-view'; | ||
|
||
export class PeekViewService extends Service { | ||
public readonly peekView = this.framework.createEntity(PeekViewEntity); | ||
} |
9 changes: 9 additions & 0 deletions
9
packages/frontend/core/src/modules/peek-view/view/doc-peek-view-modal.css.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import { style } from '@vanilla-extract/css'; | ||
|
||
export const editor = style({ | ||
vars: { | ||
'--affine-editor-width': '100%', | ||
'--affine-editor-side-padding': '160px', | ||
}, | ||
minHeight: '100%', | ||
}); |
Oops, something went wrong.