@types/quill
Advanced tools
Comparing version 0.0.31 to 1.3.0
@@ -1,158 +0,258 @@ | ||
// Type definitions for Quill | ||
// Type definitions for Quill 1.3 | ||
// Project: https://github.com/quilljs/quill/ | ||
// Definitions by: Sumit <https://github.com/sumitkm> | ||
// Guillaume <https://github.com/guillaume-ro-fr> | ||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped | ||
declare namespace Quill { | ||
/** | ||
* A stricter type definition would be: | ||
* | ||
* type DeltaOperation ({ insert: any } | { delete: number } | { retain: number }) & OptionalAttributes; | ||
* | ||
* But this would break a lot of existing code as it would require manual discrimination of the union types. | ||
*/ | ||
export type DeltaOperation = { insert?: any, delete?: number, retain?: number } & OptionalAttributes; | ||
export type Sources = "api" | "user" | "silent"; | ||
type Key = { key: string, shortKey?: boolean }; | ||
type Sources = "api" | "user" | "silent"; | ||
type StringMap = { [key: string]: any }; | ||
type OptionalAttributes = { attributes?: StringMap }; | ||
/** | ||
* A stricter type definition would be: | ||
* | ||
* type DeltaOperation ({ insert: any } | { delete: number } | { retain: number }) & OptionalAttributes; | ||
* | ||
* But this would break a lot of existing code as it would require manual discrimination of the union types. | ||
*/ | ||
type DeltaOperation = { insert?: any, delete?: number, retain?: number } & OptionalAttributes; | ||
export interface Key { | ||
key: string; | ||
shortKey?: boolean; | ||
} | ||
type TextChangeHandler = (delta: DeltaStatic, oldContents: DeltaStatic, source: Sources) => any; | ||
type SelectionChangeHandler = (range: RangeStatic, oldRange: RangeStatic, source: Sources) => any; | ||
type EditorChangeHandler = ((name: "text-change", delta: DeltaStatic, oldContents: DeltaStatic, source: Sources) => any) | ||
| ((name: "selection-change", range: RangeStatic, oldRange: RangeStatic, source: Sources) => any); | ||
export interface StringMap { | ||
[key: string]: any; | ||
} | ||
export interface KeyboardStatic { | ||
addBinding(key: Key, callback: (range: RangeStatic, context: any) => void): void; | ||
addBinding(key: Key, context: any, callback: (range: RangeStatic, context: any) => void) : void; | ||
} | ||
export interface OptionalAttributes { | ||
attributes?: StringMap; | ||
} | ||
export interface ClipboardStatic { | ||
addMatcher(selector: string, callback: (node: any, delta: DeltaStatic) => DeltaStatic) : void; | ||
addMatcher(nodeType: number, callback: (node: any, delta: DeltaStatic) => DeltaStatic) : void; | ||
dangerouslyPasteHTML(html: string, source?: Sources): void; | ||
dangerouslyPasteHTML(index: number, html: string, source?: Sources): void; | ||
} | ||
export type TextChangeHandler = (delta: DeltaStatic, oldContents: DeltaStatic, source: Sources) => any; | ||
export type SelectionChangeHandler = (range: RangeStatic, oldRange: RangeStatic, source: Sources) => any; | ||
export type EditorChangeHandler = ((name: "text-change", delta: DeltaStatic, oldContents: DeltaStatic, source: Sources) => any) | ||
| ((name: "selection-change", range: RangeStatic, oldRange: RangeStatic, source: Sources) => any); | ||
export interface QuillOptionsStatic { | ||
debug?: string, | ||
modules?: StringMap, | ||
placeholder?: string, | ||
readOnly?: boolean, | ||
theme?: string, | ||
formats?: string[], | ||
bounds?: HTMLElement | string | ||
} | ||
export interface KeyboardStatic { | ||
addBinding(key: Key, callback: (range: RangeStatic, context: any) => void): void; | ||
addBinding(key: Key, context: any, callback: (range: RangeStatic, context: any) => void): void; | ||
} | ||
export interface BoundsStatic { | ||
left: number, | ||
top: number, | ||
height: number, | ||
width: number | ||
} | ||
export interface ClipboardStatic { | ||
addMatcher(selectorOrNodeType: string|number, callback: (node: any, delta: DeltaStatic) => DeltaStatic): void; | ||
dangerouslyPasteHTML(html: string, source?: Sources): void; | ||
dangerouslyPasteHTML(index: number, html: string, source?: Sources): void; | ||
} | ||
export interface DeltaStatic { | ||
new (ops?: DeltaOperation[] | { ops: DeltaOperation[] }) : DeltaStatic; | ||
ops?: DeltaOperation[]; | ||
retain(length: number, attributes?: StringMap) : DeltaStatic; | ||
delete(length: number) : DeltaStatic; | ||
filter(predicate: (op: DeltaOperation) => boolean) : DeltaOperation[]; | ||
forEach(predicate: (op: DeltaOperation) => void) : void; | ||
insert(text: any, attributes?: StringMap): DeltaStatic; | ||
map<T>(predicate: (op: DeltaOperation) => T) : T[]; | ||
partition(predicate: (op: DeltaOperation) => boolean) : [DeltaOperation[], DeltaOperation[]]; | ||
reduce<T>(predicate: (acc: T, curr: DeltaOperation, idx: number, arr: DeltaOperation[]) => T, initial: T): T; | ||
chop() : DeltaStatic; | ||
length(): number; | ||
slice(start?: number, end?: number): DeltaStatic; | ||
compose(other: DeltaStatic): DeltaStatic; | ||
concat(other: DeltaStatic): DeltaStatic; | ||
diff(other: DeltaStatic, index?: number) : DeltaStatic; | ||
eachLine(predicate: (line: DeltaStatic, attributes: StringMap, idx: number) => any, newline?: string) : DeltaStatic; | ||
transform(index: number) : number; | ||
transform(other: DeltaStatic, priority: boolean) : DeltaStatic; | ||
transformPosition(index: number) : number; | ||
} | ||
export interface QuillOptionsStatic { | ||
debug?: string; | ||
modules?: StringMap; | ||
placeholder?: string; | ||
readOnly?: boolean; | ||
theme?: string; | ||
formats?: string[]; | ||
bounds?: HTMLElement | string; | ||
} | ||
export interface RangeStatic { | ||
new (): RangeStatic; | ||
index: number; | ||
length: number; | ||
} | ||
export interface BoundsStatic { | ||
left: number; | ||
top: number; | ||
height: number; | ||
width: number; | ||
} | ||
export interface EventEmitter { | ||
on(eventName: "text-change", handler: TextChangeHandler): EventEmitter; | ||
on(eventName: "selection-change", handler: SelectionChangeHandler): EventEmitter; | ||
on(eventName: "editor-change", handler: EditorChangeHandler): EventEmitter; | ||
once(eventName: "text-change", handler: TextChangeHandler): EventEmitter; | ||
once(eventName: "selection-change", handler: SelectionChangeHandler): EventEmitter; | ||
once(eventName: "editor-change", handler: EditorChangeHandler): EventEmitter; | ||
off(eventName: "text-change", handler: TextChangeHandler): EventEmitter; | ||
off(eventName: "selection-change", handler: SelectionChangeHandler): EventEmitter; | ||
off(eventName: "editor-change", handler: EditorChangeHandler): EventEmitter; | ||
} | ||
export interface DeltaStatic { | ||
ops?: DeltaOperation[]; | ||
retain(length: number, attributes?: StringMap): DeltaStatic; | ||
delete(length: number): DeltaStatic; | ||
filter(predicate: (op: DeltaOperation) => boolean): DeltaOperation[]; | ||
forEach(predicate: (op: DeltaOperation) => void): void; | ||
insert(text: any, attributes?: StringMap): DeltaStatic; | ||
map<T>(predicate: (op: DeltaOperation) => T): T[]; | ||
partition(predicate: (op: DeltaOperation) => boolean): [DeltaOperation[], DeltaOperation[]]; | ||
reduce<T>(predicate: (acc: T, curr: DeltaOperation, idx: number, arr: DeltaOperation[]) => T, initial: T): T; | ||
chop(): DeltaStatic; | ||
length(): number; | ||
slice(start?: number, end?: number): DeltaStatic; | ||
compose(other: DeltaStatic): DeltaStatic; | ||
concat(other: DeltaStatic): DeltaStatic; | ||
diff(other: DeltaStatic, index?: number): DeltaStatic; | ||
eachLine(predicate: (line: DeltaStatic, attributes: StringMap, idx: number) => any, newline?: string): DeltaStatic; | ||
transform(index: number): number; | ||
transform(other: DeltaStatic, priority: boolean): DeltaStatic; | ||
transformPosition(index: number): number; | ||
} | ||
export interface Quill extends EventEmitter { | ||
new (container: string | Element, options?: QuillOptionsStatic): Quill; | ||
deleteText(index: number, length: number, source?: Sources): void; | ||
disable(): void; | ||
enable(enabled?: boolean): void; | ||
getContents(index?: number, length?: number): DeltaStatic; | ||
getLength(): number; | ||
getText(index?: number, length?: number): string; | ||
insertEmbed(index: number, type: string, value: any, source?: Sources): void; | ||
insertText(index: number, text: string, source?: Sources): DeltaStatic; | ||
insertText(index: number, text: string, format: string, value: any, source?: Sources): DeltaStatic; | ||
insertText(index: number, text: string, formats: StringMap, source?: Sources): DeltaStatic; | ||
/** | ||
* @deprecated Use clipboard.dangerouslyPasteHTML(index: number, html: string, source: Sources) | ||
*/ | ||
pasteHTML(index: number, html: string, source?: Sources): string; | ||
/** | ||
* @deprecated Use dangerouslyPasteHTML(html: string, source: Sources): void; | ||
*/ | ||
pasteHTML(html: string, source?: Sources): string; | ||
setContents(delta: DeltaStatic, source?: Sources): DeltaStatic; | ||
setText(text: string, source?: Sources): DeltaStatic; | ||
update(source?: string): void; | ||
updateContents(delta: DeltaStatic, source?: Sources): DeltaStatic; | ||
export class Delta implements DeltaStatic { | ||
constructor(ops?: DeltaOperation[] | { ops: DeltaOperation[] }); | ||
ops?: DeltaOperation[]; | ||
retain(length: number, attributes?: StringMap): DeltaStatic; | ||
delete(length: number): DeltaStatic; | ||
filter(predicate: (op: DeltaOperation) => boolean): DeltaOperation[]; | ||
forEach(predicate: (op: DeltaOperation) => void): void; | ||
insert(text: any, attributes?: StringMap): DeltaStatic; | ||
map<T>(predicate: (op: DeltaOperation) => T): T[]; | ||
partition(predicate: (op: DeltaOperation) => boolean): [DeltaOperation[], DeltaOperation[]]; | ||
reduce<T>(predicate: (acc: T, curr: DeltaOperation, idx: number, arr: DeltaOperation[]) => T, initial: T): T; | ||
chop(): DeltaStatic; | ||
length(): number; | ||
slice(start?: number, end?: number): DeltaStatic; | ||
compose(other: DeltaStatic): DeltaStatic; | ||
concat(other: DeltaStatic): DeltaStatic; | ||
diff(other: DeltaStatic, index?: number): DeltaStatic; | ||
eachLine(predicate: (line: DeltaStatic, attributes: StringMap, idx: number) => any, newline?: string): DeltaStatic; | ||
transform(index: number): number; | ||
transform(other: DeltaStatic, priority: boolean): DeltaStatic; | ||
transformPosition(index: number): number; | ||
} | ||
format(name: string, value: any, source?: Sources): DeltaStatic; | ||
formatLine(index: number, length: number, source?: Sources): DeltaStatic; | ||
formatLine(index: number, length: number, format: string, value: any, source?: Sources): DeltaStatic; | ||
formatLine(index: number, length: number, formats: StringMap, source?: Sources): DeltaStatic; | ||
formatText(index: number, length: number, source?: Sources): DeltaStatic; | ||
formatText(index: number, length: number, format: string, value: any, source?: Sources): DeltaStatic; | ||
formatText(index: number, length: number, formats: StringMap, source?: Sources): DeltaStatic; | ||
getFormat(range?: RangeStatic): StringMap; | ||
getFormat(index: number, length?: number): StringMap; | ||
removeFormat(index: number, length: number, source?: Sources): void; | ||
export interface RangeStatic { | ||
index: number; | ||
length: number; | ||
} | ||
blur(): void; | ||
focus(): void; | ||
getBounds(index: number, length?: number): BoundsStatic; | ||
getSelection(focus?: boolean): RangeStatic; | ||
hasFocus(): boolean; | ||
setSelection(index: number, length: number, source?: Sources): void; | ||
setSelection(range: RangeStatic, source?: Sources): void; | ||
export class RangeStatic implements RangeStatic { | ||
constructor(); | ||
index: number; | ||
length: number; | ||
} | ||
debug(level: string): void; | ||
import(path: string): any; | ||
register(path: string, def: any, suppressWarning?: boolean): void; | ||
register(defs: StringMap, suppressWarning?: boolean): void; | ||
addContainer(className: string, refNode?: any): any; | ||
addContainer(domNode: any, refNode?: any): any; | ||
getModule(name: string): any | ||
export interface EventEmitter { | ||
on(eventName: "text-change", handler: TextChangeHandler): EventEmitter; | ||
on(eventName: "selection-change", handler: SelectionChangeHandler): EventEmitter; | ||
on(eventName: "editor-change", handler: EditorChangeHandler): EventEmitter; | ||
once(eventName: "text-change", handler: TextChangeHandler): EventEmitter; | ||
once(eventName: "selection-change", handler: SelectionChangeHandler): EventEmitter; | ||
once(eventName: "editor-change", handler: EditorChangeHandler): EventEmitter; | ||
off(eventName: "text-change", handler: TextChangeHandler): EventEmitter; | ||
off(eventName: "selection-change", handler: SelectionChangeHandler): EventEmitter; | ||
off(eventName: "editor-change", handler: EditorChangeHandler): EventEmitter; | ||
} | ||
clipboard: ClipboardStatic; | ||
} | ||
export interface Quill extends EventEmitter { | ||
/** | ||
* @private Internal API | ||
*/ | ||
root: HTMLDivElement; | ||
clipboard: ClipboardStatic; | ||
deleteText(index: number, length: number, source?: Sources): DeltaStatic; | ||
disable(): void; | ||
enable(enabled?: boolean): void; | ||
getContents(index?: number, length?: number): DeltaStatic; | ||
getLength(): number; | ||
getText(index?: number, length?: number): string; | ||
insertEmbed(index: number, type: string, value: any, source?: Sources): DeltaStatic; | ||
insertText(index: number, text: string, source?: Sources): DeltaStatic; | ||
insertText(index: number, text: string, format: string, value: any, source?: Sources): DeltaStatic; | ||
insertText(index: number, text: string, formats: StringMap, source?: Sources): DeltaStatic; | ||
/** | ||
* @deprecated Remove in 2.0. Use clipboard.dangerouslyPasteHTML(index: number, html: string, source: Sources) | ||
*/ | ||
pasteHTML(index: number, html: string, source?: Sources): string; | ||
/** | ||
* @deprecated Remove in 2.0. Use clipboard.dangerouslyPasteHTML(html: string, source: Sources): void; | ||
*/ | ||
pasteHTML(html: string, source?: Sources): string; | ||
setContents(delta: DeltaStatic, source?: Sources): DeltaStatic; | ||
setText(text: string, source?: Sources): DeltaStatic; | ||
update(source?: Sources): void; | ||
updateContents(delta: DeltaStatic, source?: Sources): DeltaStatic; | ||
format(name: string, value: any, source?: Sources): DeltaStatic; | ||
formatLine(index: number, length: number, source?: Sources): DeltaStatic; | ||
formatLine(index: number, length: number, format: string, value: any, source?: Sources): DeltaStatic; | ||
formatLine(index: number, length: number, formats: StringMap, source?: Sources): DeltaStatic; | ||
formatText(index: number, length: number, source?: Sources): DeltaStatic; | ||
formatText(index: number, length: number, format: string, value: any, source?: Sources): DeltaStatic; | ||
formatText(index: number, length: number, formats: StringMap, source?: Sources): DeltaStatic; | ||
getFormat(range?: RangeStatic): StringMap; | ||
getFormat(index: number, length?: number): StringMap; | ||
removeFormat(index: number, length: number, source?: Sources): DeltaStatic; | ||
blur(): void; | ||
focus(): void; | ||
getBounds(index: number, length?: number): BoundsStatic; | ||
getSelection(focus?: boolean): RangeStatic; | ||
hasFocus(): boolean; | ||
setSelection(index: number, length: number, source?: Sources): void; | ||
setSelection(range: RangeStatic, source?: Sources): void; | ||
debug(level: string|boolean): void; | ||
import(path: string): any; | ||
register(path: string, def: any, suppressWarning?: boolean): void; | ||
register(defs: StringMap, suppressWarning?: boolean): void; | ||
addContainer(classNameOrDomNode: string|Node, refNode?: Node): any; | ||
getModule(name: string): any; | ||
// Blot interface is not exported on Parchment | ||
find(domNode: Node, bubble?: boolean): Quill | any; | ||
getIndex(blot: any): number; | ||
getLeaf(index: number): any; | ||
getLine(index: number): [any, number]; | ||
getLines(index?: number, length?: number): any[]; | ||
getLines(range: RangeStatic): any[]; | ||
} | ||
declare var Quill: Quill.Quill; | ||
export class Quill implements Quill { | ||
/** | ||
* @private Internal API | ||
*/ | ||
root: HTMLDivElement; | ||
clipboard: ClipboardStatic; | ||
constructor(container: string | Element, options?: QuillOptionsStatic); | ||
deleteText(index: number, length: number, source?: Sources): DeltaStatic; | ||
disable(): void; | ||
enable(enabled?: boolean): void; | ||
getContents(index?: number, length?: number): DeltaStatic; | ||
getLength(): number; | ||
getText(index?: number, length?: number): string; | ||
insertEmbed(index: number, type: string, value: any, source?: Sources): DeltaStatic; | ||
insertText(index: number, text: string, source?: Sources): DeltaStatic; | ||
insertText(index: number, text: string, format: string, value: any, source?: Sources): DeltaStatic; | ||
insertText(index: number, text: string, formats: StringMap, source?: Sources): DeltaStatic; | ||
/** | ||
* @deprecated Remove in 2.0. Use clipboard.dangerouslyPasteHTML(index: number, html: string, source: Sources) | ||
*/ | ||
pasteHTML(index: number, html: string, source?: Sources): string; | ||
/** | ||
* @deprecated Remove in 2.0. Use clipboard.dangerouslyPasteHTML(html: string, source: Sources): void; | ||
*/ | ||
pasteHTML(html: string, source?: Sources): string; | ||
setContents(delta: DeltaStatic, source?: Sources): DeltaStatic; | ||
setText(text: string, source?: Sources): DeltaStatic; | ||
update(source?: Sources): void; | ||
updateContents(delta: DeltaStatic, source?: Sources): DeltaStatic; | ||
declare var Delta: Quill.DeltaStatic; | ||
format(name: string, value: any, source?: Sources): DeltaStatic; | ||
formatLine(index: number, length: number, source?: Sources): DeltaStatic; | ||
formatLine(index: number, length: number, format: string, value: any, source?: Sources): DeltaStatic; | ||
formatLine(index: number, length: number, formats: StringMap, source?: Sources): DeltaStatic; | ||
formatText(index: number, length: number, source?: Sources): DeltaStatic; | ||
formatText(index: number, length: number, format: string, value: any, source?: Sources): DeltaStatic; | ||
formatText(index: number, length: number, formats: StringMap, source?: Sources): DeltaStatic; | ||
getFormat(range?: RangeStatic): StringMap; | ||
getFormat(index: number, length?: number): StringMap; | ||
removeFormat(index: number, length: number, source?: Sources): DeltaStatic; | ||
declare module "quill" { | ||
export = Quill; | ||
blur(): void; | ||
focus(): void; | ||
getBounds(index: number, length?: number): BoundsStatic; | ||
getSelection(focus?: boolean): RangeStatic; | ||
hasFocus(): boolean; | ||
setSelection(index: number, length: number, source?: Sources): void; | ||
setSelection(range: RangeStatic, source?: Sources): void; | ||
debug(level: string|boolean): void; | ||
import(path: string): any; | ||
register(path: string, def: any, suppressWarning?: boolean): void; | ||
register(defs: StringMap, suppressWarning?: boolean): void; | ||
addContainer(classNameOrDomNode: string|Node, refNode?: Node): any; | ||
getModule(name: string): any; | ||
// Blot interface is not exported on Parchment | ||
find(domNode: Node, bubble?: boolean): Quill | any; | ||
getIndex(blot: any): number; | ||
getLeaf(index: number): any; | ||
getLine(index: number): [any, number]; | ||
getLines(index?: number, length?: number): any[]; | ||
getLines(range: RangeStatic): any[]; | ||
} |
{ | ||
"name": "@types/quill", | ||
"version": "0.0.31", | ||
"version": "1.3.0", | ||
"description": "TypeScript definitions for Quill", | ||
@@ -10,2 +10,6 @@ "license": "MIT", | ||
"url": "https://github.com/sumitkm" | ||
}, | ||
{ | ||
"name": "Guillaume", | ||
"url": "https://github.com/guillaume-ro-fr" | ||
} | ||
@@ -21,4 +25,4 @@ ], | ||
"peerDependencies": {}, | ||
"typesPublisherContentHash": "9bb87c8676433325def540b5781b7c301ae2faa7e2d761f2ca66886c4aa0dea0", | ||
"typesPublisherContentHash": "f0a9e0188d853c4856a141c8acfaa24773bcfdb82502f3fdda74fd4de1361ad2", | ||
"typeScriptVersion": "2.0" | ||
} |
@@ -11,7 +11,7 @@ # Installation | ||
Additional Details | ||
* Last updated: Fri, 30 Jun 2017 21:28:46 GMT | ||
* Last updated: Tue, 01 Aug 2017 21:20:06 GMT | ||
* Dependencies: none | ||
* Global values: Delta, Quill | ||
* Global values: none | ||
# Credits | ||
These definitions were written by Sumit <https://github.com/sumitkm>. | ||
These definitions were written by Sumit <https://github.com/sumitkm>, Guillaume <https://github.com/guillaume-ro-fr>. |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
14282
234
1
1