diff --git a/base.ts b/base.ts index b78698a..7a0b51f 100644 --- a/base.ts +++ b/base.ts @@ -14,11 +14,11 @@ export interface Page { /** the thumbnail URL of a page if exists * * set to `null` if not exists - */ + */ image: string | null; /** the thumbnail text of a page. - * the maximum number of lines is 5. - * */ descriptions: string[]; + * the maximum number of lines is 5. + */ descriptions: string[]; /** ページの最終更新日時 */ updated: number; /** Date last visitedに使われる最終アクセス日時 */ accessed: number; } diff --git a/deps/events.ts b/deps/events.ts index 94f12cc..23acfb2 100644 --- a/deps/events.ts +++ b/deps/events.ts @@ -1 +1 @@ -export type { EventEmitter } from "https://deno.land/std@0.131.0/node/events.ts"; +export type { EventEmitter } from "https://deno.land/std@0.131.0/node/_events.d.ts"; diff --git a/deps/react.ts b/deps/react.ts index 06095b7..4994920 100644 --- a/deps/react.ts +++ b/deps/react.ts @@ -1 +1,72 @@ -export type { default as React } from "https://esm.sh/react@17.0.2"; +/// +/// +/// + +// cut and modified from https://cdn.esm.sh/v73/@types/react@17.0.42/index.d.ts + +type NativeMouseEvent = MouseEvent; + +// deno-lint-ignore no-namespace +export namespace React { + /** + * currentTarget - a reference to the element on which the event listener is registered. + * + * target - a reference to the element from which the event was originally dispatched. + * This might be a child element to the element on which the event listener is registered. + * If you thought this should be `EventTarget & T`, see https://github.com/DefinitelyTyped/DefinitelyTyped/issues/11508#issuecomment-256045682 + */ + export interface SyntheticEvent< + T extends Element = Element, + E extends Event = Event, + > { + nativeEvent: E; + currentTarget: T & EventTarget; + target: EventTarget; + bubbles: boolean; + cancelable: boolean; + defaultPrevented: boolean; + eventPhase: number; + isTrusted: boolean; + preventDefault(): void; + isDefaultPrevented(): boolean; + stopPropagation(): void; + isPropagationStopped(): boolean; + persist(): void; + timeStamp: number; + type: string; + } + export interface AbstractView { + styleMedia: StyleMedia; + document: Document; + } + + export interface UIEvent + extends SyntheticEvent { + detail: number; + view: AbstractView; + } + export interface MouseEvent< + T extends Element = Element, + E extends Event = NativeMouseEvent, + > extends UIEvent { + altKey: boolean; + button: number; + buttons: number; + clientX: number; + clientY: number; + ctrlKey: boolean; + /** + * See [DOM Level 3 Events spec](https://www.w3.org/TR/uievents-key/#keys-modifier). for a list of valid (case-sensitive) arguments to this method. + */ + getModifierState(key: string): boolean; + metaKey: boolean; + movementX: number; + movementY: number; + pageX: number; + pageY: number; + relatedTarget: EventTarget | null; + screenX: number; + screenY: number; + shiftKey: boolean; + } +} diff --git a/userscript.ts b/userscript.ts index 2519832..ecbf4a0 100644 --- a/userscript.ts +++ b/userscript.ts @@ -1,3 +1,8 @@ +/// +/// +/// +/// + import { ParsedLine } from "./userscript/blocks.ts"; import { StringLc } from "./base.ts"; import type { Layout, PartialLayout } from "./layout.ts";