chore: merge blocksuite source code (#9213)

This commit is contained in:
Mirone
2024-12-20 15:38:06 +08:00
committed by GitHub
parent 2c9ef916f4
commit 30200ff86d
2031 changed files with 238888 additions and 229 deletions

View File

@@ -0,0 +1,55 @@
import type { ExtensionType } from '@blocksuite/block-std';
import { createIdentifier } from '@blocksuite/global/di';
import type { TemplateResult } from 'lit';
export interface NotificationService {
toast(
message: string,
options?: {
duration?: number;
portal?: HTMLElement;
}
): void;
confirm(options: {
title: string | TemplateResult;
message: string | TemplateResult;
confirmText?: string;
cancelText?: string;
abort?: AbortSignal;
}): Promise<boolean>;
prompt(options: {
title: string | TemplateResult;
message: string | TemplateResult;
autofill?: string;
placeholder?: string;
confirmText?: string;
cancelText?: string;
abort?: AbortSignal;
}): Promise<string | null>; // when cancel, return null
notify(options: {
title: string | TemplateResult;
message?: string | TemplateResult;
accent?: 'info' | 'success' | 'warning' | 'error';
duration?: number; // unit ms, give 0 to disable auto dismiss
abort?: AbortSignal;
action?: {
label: string | TemplateResult;
onClick: () => void;
};
onClose: () => void;
}): void;
}
export const NotificationProvider = createIdentifier<NotificationService>(
'AffineNotificationService'
);
export function NotificationExtension(
notificationService: NotificationService
): ExtensionType {
return {
setup: di => {
di.addImpl(NotificationProvider, notificationService);
},
};
}