Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@blocksuite/global

Package Overview
Dependencies
Maintainers
5
Versions
1152
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@blocksuite/global - npm Package Compare versions

Comparing version 0.5.0-20230306231625-c219ab3 to 0.5.0-20230307101545-7d5aefc

1

dist/config/icons.d.ts

@@ -38,2 +38,3 @@ export declare const TextIcon: import("lit-html").TemplateResult<1>;

export declare const CrossIcon: import("lit-html").TemplateResult<1>;
export declare const BlockHubIcon20: import("lit-html").TemplateResult<1>;
export declare const BlockHubIcon: import("lit-html").TemplateResult<1>;

@@ -40,0 +41,0 @@ export declare const SearchIcon: import("lit-html").TemplateResult<1>;

@@ -14,2 +14,5 @@ type DisposeCallback = () => void;

add(d: Disposable | DisposeCallback): void;
addFromEvent<N extends keyof WindowEventMap>(element: Window, eventName: N, handler: (e: WindowEventMap[N]) => void, options?: boolean | AddEventListenerOptions): void;
addFromEvent<N extends keyof DocumentEventMap>(element: Document, eventName: N, handler: (e: DocumentEventMap[N]) => void, eventOptions?: boolean | AddEventListenerOptions): void;
addFromEvent<N extends keyof HTMLElementEventMap>(element: HTMLElement, eventName: N, handler: (e: HTMLElementEventMap[N]) => void, eventOptions?: boolean | AddEventListenerOptions): void;
dispose(): void;

@@ -16,0 +19,0 @@ }

@@ -27,2 +27,10 @@ export class DisposableGroup {

}
addFromEvent(target, type, handler, eventOptions) {
this.add({
dispose: () => {
target.removeEventListener(type, handler, eventOptions);
},
});
target.addEventListener(type, handler, eventOptions);
}
dispose() {

@@ -29,0 +37,0 @@ disposeAll(this._disposables);

6

dist/utils/slot.d.ts

@@ -6,8 +6,2 @@ import { Disposable } from './disposable.js';

private _disposables;
/**
* Returns a disposable that will remove the listener
*/
static fromEvent<N extends keyof WindowEventMap>(element: Window, eventName: N, handler: (e: WindowEventMap[N]) => void, options?: boolean | AddEventListenerOptions): Disposable;
static fromEvent<N extends keyof DocumentEventMap>(element: Document, eventName: N, handler: (e: DocumentEventMap[N]) => void, eventOptions?: boolean | AddEventListenerOptions): Disposable;
static fromEvent<N extends keyof HTMLElementEventMap>(element: HTMLElement, eventName: N, handler: (e: HTMLElementEventMap[N]) => void, eventOptions?: boolean | AddEventListenerOptions): Disposable;
filter(testFun: (v: T) => boolean): Slot<T>;

@@ -14,0 +8,0 @@ on(callback: (v: T) => unknown): Disposable;

@@ -24,10 +24,2 @@ import { flattenDisposables } from './disposable.js';

}
static fromEvent(element, eventName, handler, eventOptions) {
element.addEventListener(eventName, handler, eventOptions);
return {
dispose: () => {
element.removeEventListener(eventName, handler, eventOptions);
},
};
}
filter(testFun) {

@@ -34,0 +26,0 @@ const result = new Slot();

{
"name": "@blocksuite/global",
"version": "0.5.0-20230306231625-c219ab3",
"version": "0.5.0-20230307101545-7d5aefc",
"types": "./index.d.ts",

@@ -5,0 +5,0 @@ "type": "module",

@@ -29,2 +29,34 @@ type DisposeCallback = () => void;

addFromEvent<N extends keyof WindowEventMap>(
element: Window,
eventName: N,
handler: (e: WindowEventMap[N]) => void,
options?: boolean | AddEventListenerOptions
): void;
addFromEvent<N extends keyof DocumentEventMap>(
element: Document,
eventName: N,
handler: (e: DocumentEventMap[N]) => void,
eventOptions?: boolean | AddEventListenerOptions
): void;
addFromEvent<N extends keyof HTMLElementEventMap>(
element: HTMLElement,
eventName: N,
handler: (e: HTMLElementEventMap[N]) => void,
eventOptions?: boolean | AddEventListenerOptions
): void;
addFromEvent(
target: HTMLElement | Window | Document,
type: string,
handler: (e: Event) => void,
eventOptions?: boolean | AddEventListenerOptions
) {
this.add({
dispose: () => {
target.removeEventListener(type, handler as () => void, eventOptions);
},
});
target.addEventListener(type, handler as () => void, eventOptions);
}
dispose() {

@@ -31,0 +63,0 @@ disposeAll(this._disposables);

@@ -10,37 +10,2 @@ import { Disposable, flattenDisposables } from './disposable.js';

/**
* Returns a disposable that will remove the listener
*/
static fromEvent<N extends keyof WindowEventMap>(
element: Window,
eventName: N,
handler: (e: WindowEventMap[N]) => void,
options?: boolean | AddEventListenerOptions
): Disposable;
static fromEvent<N extends keyof DocumentEventMap>(
element: Document,
eventName: N,
handler: (e: DocumentEventMap[N]) => void,
eventOptions?: boolean | AddEventListenerOptions
): Disposable;
static fromEvent<N extends keyof HTMLElementEventMap>(
element: HTMLElement,
eventName: N,
handler: (e: HTMLElementEventMap[N]) => void,
eventOptions?: boolean | AddEventListenerOptions
): Disposable;
static fromEvent(
element: HTMLElement | Window | Document,
eventName: string,
handler: (e: Event) => void,
eventOptions?: boolean | AddEventListenerOptions
): Disposable {
element.addEventListener(eventName, handler, eventOptions);
return {
dispose: () => {
element.removeEventListener(eventName, handler, eventOptions);
},
};
}
filter(testFun: (v: T) => boolean): Slot<T> {

@@ -47,0 +12,0 @@ const result = new Slot<T>();

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc