chore: bump bs (#8204)

This commit is contained in:
Saul-Mirone
2024-09-11 12:04:25 +00:00
parent b74dd1c92e
commit ba81b1a9ca
16 changed files with 431 additions and 430 deletions

View File

@@ -8,7 +8,9 @@ import {
type DocMode,
DocModeProvider,
type EdgelessRootService,
EditPropsStore,
type ImageSelection,
NotificationProvider,
type PageRootService,
TelemetryProvider,
} from '@blocksuite/blocks';
@@ -114,7 +116,7 @@ function getViewportCenter(
) {
const center = { x: 400, y: 50 };
if (mode === 'page') {
const viewport = rootService.editPropsStore.getStorage('viewport');
const viewport = rootService.std.get(EditPropsStore).getStorage('viewport');
if (viewport) {
if ('xywh' in viewport) {
const bound = Bound.deserialize(viewport.xywh);
@@ -178,7 +180,7 @@ function addAIChatBlock(
}
export function promptDocTitle(host: EditorHost, autofill?: string) {
const notification = host.std.getService('affine:page')?.notificationService;
const notification = host.std.getOptional(NotificationProvider);
if (!notification) return Promise.resolve(undefined);
return notification.prompt({
@@ -302,7 +304,7 @@ const SAVE_CHAT_TO_BLOCK_ACTION: ChatAction = {
const surfaceService = host.std.getService('affine:surface');
if (!rootService || !surfaceService) return false;
const { notificationService } = rootService;
const notificationService = host.std.getOptional(NotificationProvider);
const docModeService = host.std.get(DocModeProvider);
const { layer } = surfaceService;
const curMode = docModeService.getEditorMode() || 'page';

View File

@@ -3,7 +3,7 @@ import type {
EditorHost,
TextSelection,
} from '@blocksuite/block-std';
import type { ImageSelection } from '@blocksuite/blocks';
import { type ImageSelection, NotificationProvider } from '@blocksuite/blocks';
import { css, html, LitElement, nothing } from 'lit';
import { customElement, property } from 'lit/decorators.js';
import { classMap } from 'lit/directives/class-map.js';
@@ -59,10 +59,6 @@ export class ChatActionList extends LitElement {
return this.host.selection.value;
}
private get _rootService() {
return this.host.std.getService('affine:page');
}
private get _currentTextSelection(): TextSelection | undefined {
return this._selectionValue.find(v => v.type === 'text') as TextSelection;
}
@@ -148,7 +144,7 @@ export class ChatActionList extends LitElement {
messageId
);
if (success) {
this._rootService?.notificationService?.notify({
this.host.std.getOptional(NotificationProvider)?.notify({
title: action.toast,
accent: 'success',
onClose: function (): void {},

View File

@@ -4,7 +4,11 @@ import type {
TextSelection,
} from '@blocksuite/block-std';
import { WithDisposable } from '@blocksuite/block-std';
import { createButtonPopper, Tooltip } from '@blocksuite/blocks';
import {
createButtonPopper,
NotificationProvider,
Tooltip,
} from '@blocksuite/blocks';
import { noop } from '@blocksuite/global/utils';
import { css, html, LitElement, nothing, type PropertyValues } from 'lit';
import { customElement, property, query, state } from 'lit/decorators.js';
@@ -129,7 +133,7 @@ export class ChatCopyMore extends WithDisposable(LitElement) {
private readonly _notifySuccess = (title: string) => {
if (!this._rootService) return;
const { notificationService } = this._rootService;
const notificationService = this.host.std.getOptional(NotificationProvider);
notificationService?.notify({
title: title,
accent: 'success',

View File

@@ -3,6 +3,7 @@ import './chat-panel-messages';
import type { EditorHost } from '@blocksuite/block-std';
import { ShadowlessElement, WithDisposable } from '@blocksuite/block-std';
import { NotificationProvider } from '@blocksuite/blocks';
import { debounce } from '@blocksuite/global/utils';
import type { Doc } from '@blocksuite/store';
import { css, html, type PropertyValues } from 'lit';
@@ -159,8 +160,7 @@ export class ChatPanel extends WithDisposable(ShadowlessElement) {
};
private readonly _cleanupHistories = async () => {
const notification =
this.host.std.getService('affine:page')?.notificationService;
const notification = this.host.std.getOptional(NotificationProvider);
if (!notification) return;
if (

View File

@@ -12,6 +12,7 @@ import {
type EdgelessRootService,
TelemetryProvider,
} from '@blocksuite/blocks';
import { NotificationProvider } from '@blocksuite/blocks';
import {
type AIChatBlockModel,
type ChatMessage,
@@ -255,7 +256,7 @@ export class AIChatBlockPeekView extends LitElement {
*/
cleanCurrentChatHistories = async () => {
if (!this._rootService) return;
const { notificationService } = this._rootService;
const notificationService = this.host.std.getOptional(NotificationProvider);
if (!notificationService) return;
const { currentChatBlockId, currentSessionId } = this.chatContext;