diff --git a/dist/types/Clean.d.ts b/dist/types/Clean.d.ts new file mode 100644 index 0000000..f79164e --- /dev/null +++ b/dist/types/Clean.d.ts @@ -0,0 +1,8 @@ +import { isLineBreak } from './node/Whitespace'; +import type { SquireConfig } from './Editor'; +declare const cleanTree: (node: Node, config: SquireConfig, preserveWS?: boolean) => Node; +declare const removeEmptyInlines: (node: Node) => void; +declare const cleanupBRs: (node: Element | DocumentFragment, root: Element, keepForBlankLine: boolean) => void; +declare const escapeHTML: (text: string) => string; +export { cleanTree, cleanupBRs, isLineBreak, removeEmptyInlines, escapeHTML }; +//# sourceMappingURL=Clean.d.ts.map \ No newline at end of file diff --git a/dist/types/Clean.d.ts.map b/dist/types/Clean.d.ts.map new file mode 100644 index 0000000..aaf426f --- /dev/null +++ b/dist/types/Clean.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"Clean.d.ts","sourceRoot":"","sources":["../../source/Clean.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAoN7C,QAAA,MAAM,SAAS,SACL,IAAI,UACF,YAAY,eACP,OAAO,KACrB,IA2FF,CAAC;AAIF,QAAA,MAAM,kBAAkB,SAAU,IAAI,KAAG,IAcxC,CAAC;AAUF,QAAA,MAAM,UAAU,SACN,OAAO,GAAG,gBAAgB,QAC1B,OAAO,oBACK,OAAO,KAC1B,IA8BF,CAAC;AAIF,QAAA,MAAM,UAAU,SAAU,MAAM,KAAG,MAUlC,CAAC;AAIF,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,WAAW,EAAE,kBAAkB,EAAE,UAAU,EAAE,CAAC"} \ No newline at end of file diff --git a/dist/types/Clipboard.d.ts b/dist/types/Clipboard.d.ts new file mode 100644 index 0000000..ded6080 --- /dev/null +++ b/dist/types/Clipboard.d.ts @@ -0,0 +1,9 @@ +import type { Squire } from './Editor'; +declare const extractRangeToClipboard: (event: ClipboardEvent, range: Range, root: HTMLElement, removeRangeFromDocument: boolean, toCleanHTML: ((html: string) => string) | null, toPlainText: ((html: string) => string) | null, plainTextOnly: boolean) => boolean; +declare const _onCut: (this: Squire, event: ClipboardEvent) => void; +declare const _onCopy: (this: Squire, event: ClipboardEvent) => void; +declare const _monitorShiftKey: (this: Squire, event: KeyboardEvent) => void; +declare const _onPaste: (this: Squire, event: ClipboardEvent) => void; +declare const _onDrop: (this: Squire, event: DragEvent) => void; +export { extractRangeToClipboard, _onCut, _onCopy, _monitorShiftKey, _onPaste, _onDrop, }; +//# sourceMappingURL=Clipboard.d.ts.map \ No newline at end of file diff --git a/dist/types/Clipboard.d.ts.map b/dist/types/Clipboard.d.ts.map new file mode 100644 index 0000000..99e7e87 --- /dev/null +++ b/dist/types/Clipboard.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"Clipboard.d.ts","sourceRoot":"","sources":["../../source/Clipboard.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAyEvC,QAAA,MAAM,uBAAuB,UAClB,cAAc,SACd,KAAK,QACN,WAAW,2BACQ,OAAO,uBACJ,MAAM,KAAK,MAAM,+BACjB,MAAM,KAAK,MAAM,yBAC9B,OAAO,KACvB,OAmDF,CAAC;AAIF,QAAA,MAAM,MAAM,SAAmB,MAAM,SAAS,cAAc,KAAG,IAkC9D,CAAC;AAEF,QAAA,MAAM,OAAO,SAAmB,MAAM,SAAS,cAAc,KAAG,IAU/D,CAAC;AAIF,QAAA,MAAM,gBAAgB,SAAmB,MAAM,SAAS,aAAa,KAAG,IAEvE,CAAC;AAEF,QAAA,MAAM,QAAQ,SAAmB,MAAM,SAAS,cAAc,KAAG,IAqLhE,CAAC;AAKF,QAAA,MAAM,OAAO,SAAmB,MAAM,SAAS,SAAS,KAAG,IAwB1D,CAAC;AAIF,OAAO,EACH,uBAAuB,EACvB,MAAM,EACN,OAAO,EACP,gBAAgB,EAChB,QAAQ,EACR,OAAO,GACV,CAAC"} \ No newline at end of file diff --git a/dist/types/Constants.d.ts b/dist/types/Constants.d.ts new file mode 100644 index 0000000..e9dbbaf --- /dev/null +++ b/dist/types/Constants.d.ts @@ -0,0 +1,20 @@ +declare const DOCUMENT_POSITION_PRECEDING = 2; +declare const ELEMENT_NODE = 1; +declare const TEXT_NODE = 3; +declare const DOCUMENT_NODE = 9; +declare const DOCUMENT_FRAGMENT_NODE = 11; +declare const ZWS = "\u200B"; +declare const ua: string; +declare const isMac: boolean; +declare const isWin: boolean; +declare const isIOS: boolean; +declare const isAndroid: boolean; +declare const isGecko: boolean; +declare const isLegacyEdge: boolean; +declare const isWebKit: boolean; +declare const ctrlKey: string; +declare const cantFocusEmptyTextNodes: boolean; +declare const supportsInputEvents: boolean; +declare const notWS: RegExp; +export { DOCUMENT_POSITION_PRECEDING, ELEMENT_NODE, TEXT_NODE, DOCUMENT_NODE, DOCUMENT_FRAGMENT_NODE, notWS, ZWS, ua, isMac, isWin, isIOS, isAndroid, isGecko, isLegacyEdge, isWebKit, ctrlKey, cantFocusEmptyTextNodes, supportsInputEvents, }; +//# sourceMappingURL=Constants.d.ts.map \ No newline at end of file diff --git a/dist/types/Constants.d.ts.map b/dist/types/Constants.d.ts.map new file mode 100644 index 0000000..f495e88 --- /dev/null +++ b/dist/types/Constants.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"Constants.d.ts","sourceRoot":"","sources":["../../source/Constants.ts"],"names":[],"mappings":"AAAA,QAAA,MAAM,2BAA2B,IAAI,CAAC;AACtC,QAAA,MAAM,YAAY,IAAI,CAAC;AACvB,QAAA,MAAM,SAAS,IAAI,CAAC;AACpB,QAAA,MAAM,aAAa,IAAI,CAAC;AACxB,QAAA,MAAM,sBAAsB,KAAK,CAAC;AAElC,QAAA,MAAM,GAAG,WAAW,CAAC;AAErB,QAAA,MAAM,EAAE,QAAsB,CAAC;AAE/B,QAAA,MAAM,KAAK,SAAsB,CAAC;AAClC,QAAA,MAAM,KAAK,SAAwB,CAAC;AACpC,QAAA,MAAM,KAAK,SAC6D,CAAC;AACzE,QAAA,MAAM,SAAS,SAAqB,CAAC;AAErC,QAAA,MAAM,OAAO,SAAqB,CAAC;AACnC,QAAA,MAAM,YAAY,SAAoB,CAAC;AACvC,QAAA,MAAM,QAAQ,SAAuC,CAAC;AAEtD,QAAA,MAAM,OAAO,QAAqC,CAAC;AAEnD,QAAA,MAAM,uBAAuB,SAAW,CAAC;AAEzC,QAAA,MAAM,mBAAmB,SACgD,CAAC;AAG1E,QAAA,MAAM,KAAK,QAAe,CAAC;AAI3B,OAAO,EACH,2BAA2B,EAC3B,YAAY,EACZ,SAAS,EACT,aAAa,EACb,sBAAsB,EACtB,KAAK,EACL,GAAG,EACH,EAAE,EACF,KAAK,EACL,KAAK,EACL,KAAK,EACL,SAAS,EACT,OAAO,EACP,YAAY,EACZ,QAAQ,EACR,OAAO,EACP,uBAAuB,EACvB,mBAAmB,GACtB,CAAC"} \ No newline at end of file diff --git a/dist/types/Editor.d.ts b/dist/types/Editor.d.ts new file mode 100644 index 0000000..144d27d --- /dev/null +++ b/dist/types/Editor.d.ts @@ -0,0 +1,173 @@ +type EventHandler = { + handleEvent: (e: Event) => void; +} | ((e: Event) => void); +type KeyHandlerFunction = (x: Squire, y: KeyboardEvent, z: Range) => void; +type TagAttributes = { + [key: string]: { + [key: string]: string; + }; +}; +interface SquireConfig { + blockTag: string; + blockAttributes: null | Record; + tagAttributes: TagAttributes; + classNames: { + color: string; + fontFamily: string; + fontSize: string; + highlight: string; + }; + undo: { + documentSizeThreshold: number; + undoLimit: number; + }; + addLinks: boolean; + willCutCopy: null | ((html: string) => string); + sanitizeToDOMFragment: (html: string, editor: Squire) => DocumentFragment; + didError: (x: any) => void; +} +declare class Squire { + _root: HTMLElement; + _config: SquireConfig; + _isFocused: boolean; + _lastSelection: Range; + _willRestoreSelection: boolean; + _mayHaveZWS: boolean; + _lastAnchorNode: Node | null; + _lastFocusNode: Node | null; + _path: string; + _events: Map>; + _undoIndex: number; + _undoStack: Array; + _undoStackLength: number; + _isInUndoState: boolean; + _ignoreChange: boolean; + _ignoreAllChanges: boolean; + _isShiftDown: boolean; + _keyHandlers: Record; + _mutation: MutationObserver; + constructor(root: HTMLElement, config?: Partial); + destroy(): void; + _makeConfig(userConfig?: object): SquireConfig; + setKeyHandler(key: number, fn: KeyHandlerFunction): this; + _beforeInput(event: InputEvent): void; + handleEvent(event: Event): void; + fireEvent(type: string, detail?: Event | object): Squire; + /** + * Subscribing to these events won't automatically add a listener to the + * document node, since these events are fired in a custom manner by the + * editor code. + */ + customEvents: Set; + addEventListener(type: string, fn: EventHandler): Squire; + removeEventListener(type: string, fn?: EventHandler): Squire; + focus(): Squire; + blur(): Squire; + _enableRestoreSelection(): void; + _disableRestoreSelection(): void; + _restoreSelection(): void; + _removeZWS(): void; + startSelectionId: string; + endSelectionId: string; + _saveRangeToBookmark(range: Range): void; + _getRangeAndRemoveBookmark(range?: Range): Range | null; + getSelection(): Range; + setSelection(range: Range): Squire; + _moveCursorTo(toStart: boolean): Squire; + moveCursorToStart(): Squire; + moveCursorToEnd(): Squire; + getCursorPosition(): DOMRect; + getPath(): string; + _updatePathOnEvent(): void; + _updatePath(range: Range, force?: boolean): void; + _getPath(node: Node): string; + modifyDocument(modificationFn: () => void): Squire; + _docWasChanged(): void; + /** + * Leaves bookmark. + */ + _recordUndoState(range: Range, replace?: boolean): Squire; + saveUndoState(range?: Range): Squire; + undo(): Squire; + redo(): Squire; + getRoot(): HTMLElement; + _getRawHTML(): string; + _setRawHTML(html: string): Squire; + getHTML(withBookmark?: boolean): string; + setHTML(html: string): Squire; + /** + * Insert HTML at the cursor location. If the selection is not collapsed + * insertTreeFragmentIntoRange will delete the selection so that it is + * replaced by the html being inserted. + */ + insertHTML(html: string, isPaste?: boolean): Squire; + insertElement(el: Element, range?: Range): Squire; + insertImage(src: string, attributes: Record): HTMLImageElement; + insertPlainText(plainText: string, isPaste: boolean): Squire; + getSelectedText(): string; + /** + * Extracts the font-family and font-size (if any) of the element + * holding the cursor. If there's a selection, returns an empty object. + */ + getFontInfo(range?: Range): Record; + /** + * Looks for matching tag and attributes, so won't work if + * instead of etc. + */ + hasFormat(tag: string, attributes?: Record | null, range?: Range): boolean; + changeFormat(add: { + tag: string; + attributes?: Record; + } | null, remove?: { + tag: string; + attributes?: Record; + } | null, range?: Range, partial?: boolean): Squire; + _addFormat(tag: string, attributes: Record | null, range: Range): Range; + _removeFormat(tag: string, attributes: Record, range: Range, partial?: boolean): Range; + bold(): Squire; + removeBold(): Squire; + italic(): Squire; + removeItalic(): Squire; + underline(): Squire; + removeUnderline(): Squire; + strikethrough(): Squire; + removeStrikethrough(): Squire; + subscript(): Squire; + removeSubscript(): Squire; + superscript(): Squire; + removeSuperscript(): Squire; + makeLink(url: string, attributes?: Record): Squire; + removeLink(): Squire; + linkRegExp: RegExp; + addDetectedLinks(searchInNode: DocumentFragment | Node, root?: DocumentFragment | HTMLElement): Squire; + setFontFace(name: string | null): Squire; + setFontSize(size: string | null): Squire; + setTextColor(color: string | null): Squire; + setHighlightColor(color: string | null): Squire; + _ensureBottomLine(): void; + createDefaultBlock(children?: Node[]): HTMLElement; + tagAfterSplit: Record; + splitBlock(lineBreakOnly: boolean, range?: Range): Squire; + forEachBlock(fn: (el: HTMLElement) => any, mutates: boolean, range?: Range): Squire; + modifyBlocks(modify: (x: DocumentFragment) => Node, range?: Range): Squire; + setTextAlignment(alignment: string): Squire; + setTextDirection(direction: string | null): Squire; + _getListSelection(range: Range, root: Element): [Node, Node | null, Node | null] | null; + increaseListLevel(range?: Range): Squire; + decreaseListLevel(range?: Range): Squire; + _makeList(frag: DocumentFragment, type: string): DocumentFragment; + makeUnorderedList(): Squire; + makeOrderedList(): Squire; + removeList(): Squire; + increaseQuoteLevel(range?: Range): Squire; + decreaseQuoteLevel(range?: Range): Squire; + removeQuote(range?: Range): Squire; + code(): Squire; + removeCode(): Squire; + toggleCode(): Squire; + _removeFormatting(root: DocumentFragment | Element, clean: DocumentFragment | Element): DocumentFragment | Element; + removeAllFormatting(range?: Range): Squire; +} +export { Squire }; +export type { SquireConfig }; +//# sourceMappingURL=Editor.d.ts.map \ No newline at end of file diff --git a/dist/types/Editor.d.ts.map b/dist/types/Editor.d.ts.map new file mode 100644 index 0000000..59d5544 --- /dev/null +++ b/dist/types/Editor.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"Editor.d.ts","sourceRoot":"","sources":["../../source/Editor.ts"],"names":[],"mappings":"AAiEA,KAAK,YAAY,GAAG;IAAE,WAAW,EAAE,CAAC,CAAC,EAAE,KAAK,KAAK,IAAI,CAAA;CAAE,GAAG,CAAC,CAAC,CAAC,EAAE,KAAK,KAAK,IAAI,CAAC,CAAC;AAE/E,KAAK,kBAAkB,GAAG,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,aAAa,EAAE,CAAC,EAAE,KAAK,KAAK,IAAI,CAAC;AAE1E,KAAK,aAAa,GAAG;IACjB,CAAC,GAAG,EAAE,MAAM,GAAG;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAAC;CAC5C,CAAC;AAEF,UAAU,YAAY;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,eAAe,EAAE,IAAI,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC/C,aAAa,EAAE,aAAa,CAAC;IAC7B,UAAU,EAAE;QACR,KAAK,EAAE,MAAM,CAAC;QACd,UAAU,EAAE,MAAM,CAAC;QACnB,QAAQ,EAAE,MAAM,CAAC;QACjB,SAAS,EAAE,MAAM,CAAC;KACrB,CAAC;IACF,IAAI,EAAE;QACF,qBAAqB,EAAE,MAAM,CAAC;QAC9B,SAAS,EAAE,MAAM,CAAC;KACrB,CAAC;IACF,QAAQ,EAAE,OAAO,CAAC;IAClB,WAAW,EAAE,IAAI,GAAG,CAAC,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,CAAC,CAAC;I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B,mBAAmB,CAAC,KAAK,CAAC,EAAE,KAAK,GAAG,MAAM;CAgF7C;AAID,OAAO,EAAE,MAAM,EAAE,CAAC;AAClB,YAAY,EAAE,YAAY,EAAE,CAAC"} \ No newline at end of file diff --git a/dist/types/Legacy.d.ts b/dist/types/Legacy.d.ts new file mode 100644 index 0000000..ed1f869 --- /dev/null +++ b/dist/types/Legacy.d.ts @@ -0,0 +1,2 @@ +export {}; +//# sourceMappingURL=Legacy.d.ts.map \ No newline at end of file diff --git a/dist/types/Legacy.d.ts.map b/dist/types/Legacy.d.ts.map new file mode 100644 index 0000000..a5b7c5e --- /dev/null +++ b/dist/types/Legacy.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"Legacy.d.ts","sourceRoot":"","sources":["../../source/Legacy.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/dist/types/Squire.d.ts b/dist/types/Squire.d.ts new file mode 100644 index 0000000..ad5a077 --- /dev/null +++ b/dist/types/Squire.d.ts @@ -0,0 +1,3 @@ +import { Squire } from './Editor'; +export default Squire; +//# sourceMappingURL=Squire.d.ts.map \ No newline at end of file diff --git a/dist/types/Squire.d.ts.map b/dist/types/Squire.d.ts.map new file mode 100644 index 0000000..c0b2f50 --- /dev/null +++ b/dist/types/Squire.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"Squire.d.ts","sourceRoot":"","sources":["../../source/Squire.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC,eAAe,MAAM,CAAC"} \ No newline at end of file diff --git a/dist/types/keyboard/Backspace.d.ts b/dist/types/keyboard/Backspace.d.ts new file mode 100644 index 0000000..c2f1450 --- /dev/null +++ b/dist/types/keyboard/Backspace.d.ts @@ -0,0 +1,4 @@ +import type { Squire } from '../Editor'; +declare const Backspace: (self: Squire, event: KeyboardEvent, range: Range) => void; +export { Backspace }; +//# sourceMappingURL=Backspace.d.ts.map \ No newline at end of file diff --git a/dist/types/keyboard/Backspace.d.ts.map b/dist/types/keyboard/Backspace.d.ts.map new file mode 100644 index 0000000..d2d9bba --- /dev/null +++ b/dist/types/keyboard/Backspace.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"Backspace.d.ts","sourceRoot":"","sources":["../../../source/keyboard/Backspace.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAkBxC,QAAA,MAAM,SAAS,SAAU,MAAM,SAAS,aAAa,SAAS,KAAK,KAAG,IAwFrE,CAAC;AAIF,OAAO,EAAE,SAAS,EAAE,CAAC"} \ No newline at end of file diff --git a/dist/types/keyboard/Delete.d.ts b/dist/types/keyboard/Delete.d.ts new file mode 100644 index 0000000..e14542e --- /dev/null +++ b/dist/types/keyboard/Delete.d.ts @@ -0,0 +1,4 @@ +import type { Squire } from '../Editor'; +declare const Delete: (self: Squire, event: KeyboardEvent, range: Range) => void; +export { Delete }; +//# sourceMappingURL=Delete.d.ts.map \ No newline at end of file diff --git a/dist/types/keyboard/Delete.d.ts.map b/dist/types/keyboard/Delete.d.ts.map new file mode 100644 index 0000000..3806841 --- /dev/null +++ b/dist/types/keyboard/Delete.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"Delete.d.ts","sourceRoot":"","sources":["../../../source/keyboard/Delete.ts"],"names":[],"mappings":"AAkBA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAIxC,QAAA,MAAM,MAAM,SAAU,MAAM,SAAS,aAAa,SAAS,KAAK,KAAG,IAyElE,CAAC;AAIF,OAAO,EAAE,MAAM,EAAE,CAAC"} \ No newline at end of file diff --git a/dist/types/keyboard/Enter.d.ts b/dist/types/keyboard/Enter.d.ts new file mode 100644 index 0000000..13d9146 --- /dev/null +++ b/dist/types/keyboard/Enter.d.ts @@ -0,0 +1,4 @@ +import type { Squire } from '../Editor'; +declare const Enter: (self: Squire, event: KeyboardEvent, range: Range) => void; +export { Enter }; +//# sourceMappingURL=Enter.d.ts.map \ No newline at end of file diff --git a/dist/types/keyboard/Enter.d.ts.map b/dist/types/keyboard/Enter.d.ts.map new file mode 100644 index 0000000..2fc70d2 --- /dev/null +++ b/dist/types/keyboard/Enter.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"Enter.d.ts","sourceRoot":"","sources":["../../../source/keyboard/Enter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAIxC,QAAA,MAAM,KAAK,SAAU,MAAM,SAAS,aAAa,SAAS,KAAK,KAAG,IAGjE,CAAC;AAIF,OAAO,EAAE,KAAK,EAAE,CAAC"} \ No newline at end of file diff --git a/dist/types/keyboard/KeyHandlers.d.ts b/dist/types/keyboard/KeyHandlers.d.ts new file mode 100644 index 0000000..72a8101 --- /dev/null +++ b/dist/types/keyboard/KeyHandlers.d.ts @@ -0,0 +1,6 @@ +import type { Squire } from '../Editor'; +declare const _onKey: (this: Squire, event: KeyboardEvent) => void; +type KeyHandler = (self: Squire, event: KeyboardEvent, range: Range) => void; +declare const keyHandlers: Record; +export { _onKey, keyHandlers }; +//# sourceMappingURL=KeyHandlers.d.ts.map \ No newline at end of file diff --git a/dist/types/keyboard/KeyHandlers.d.ts.map b/dist/types/keyboard/KeyHandlers.d.ts.map new file mode 100644 index 0000000..4bc527b --- /dev/null +++ b/dist/types/keyboard/KeyHandlers.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"KeyHandlers.d.ts","sourceRoot":"","sources":["../../../source/keyboard/KeyHandlers.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AA+BxC,QAAA,MAAM,MAAM,SAAmB,MAAM,SAAS,aAAa,KAAG,IAkE7D,CAAC;AAIF,KAAK,UAAU,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,aAAa,EAAE,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;AAE7E,QAAA,MAAM,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAoC3C,CAAC;AAyGF,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,CAAC"} \ No newline at end of file diff --git a/dist/types/keyboard/KeyHelpers.d.ts b/dist/types/keyboard/KeyHelpers.d.ts new file mode 100644 index 0000000..891495e --- /dev/null +++ b/dist/types/keyboard/KeyHelpers.d.ts @@ -0,0 +1,6 @@ +import type { Squire } from '../Editor'; +declare const afterDelete: (self: Squire, range?: Range) => void; +declare const detachUneditableNode: (node: Node, root: Element) => void; +declare const linkifyText: (self: Squire, textNode: Text, offset: number) => void; +export { afterDelete, detachUneditableNode, linkifyText }; +//# sourceMappingURL=KeyHelpers.d.ts.map \ No newline at end of file diff --git a/dist/types/keyboard/KeyHelpers.d.ts.map b/dist/types/keyboard/KeyHelpers.d.ts.map new file mode 100644 index 0000000..1db9441 --- /dev/null +++ b/dist/types/keyboard/KeyHelpers.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"KeyHelpers.d.ts","sourceRoot":"","sources":["../../../source/keyboard/KeyHelpers.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAQxC,QAAA,MAAM,WAAW,SAAU,MAAM,UAAU,KAAK,KAAG,IAsDlD,CAAC;AAEF,QAAA,MAAM,oBAAoB,SAAU,IAAI,QAAQ,OAAO,KAAG,IASzD,CAAC;AAIF,QAAA,MAAM,WAAW,SAAU,MAAM,YAAY,IAAI,UAAU,MAAM,KAAG,IAmDnE,CAAC;AAIF,OAAO,EAAE,WAAW,EAAE,oBAAoB,EAAE,WAAW,EAAE,CAAC"} \ No newline at end of file diff --git a/dist/types/keyboard/Space.d.ts b/dist/types/keyboard/Space.d.ts new file mode 100644 index 0000000..76e0adf --- /dev/null +++ b/dist/types/keyboard/Space.d.ts @@ -0,0 +1,4 @@ +import type { Squire } from '../Editor'; +declare const Space: (self: Squire, _: KeyboardEvent, range: Range) => void; +export { Space }; +//# sourceMappingURL=Space.d.ts.map \ No newline at end of file diff --git a/dist/types/keyboard/Space.d.ts.map b/dist/types/keyboard/Space.d.ts.map new file mode 100644 index 0000000..90b1574 --- /dev/null +++ b/dist/types/keyboard/Space.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"Space.d.ts","sourceRoot":"","sources":["../../../source/keyboard/Space.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAKxC,QAAA,MAAM,KAAK,SAAU,MAAM,KAAK,aAAa,SAAS,KAAK,KAAG,IA2C7D,CAAC;AAIF,OAAO,EAAE,KAAK,EAAE,CAAC"} \ No newline at end of file diff --git a/dist/types/keyboard/Tab.d.ts b/dist/types/keyboard/Tab.d.ts new file mode 100644 index 0000000..2269040 --- /dev/null +++ b/dist/types/keyboard/Tab.d.ts @@ -0,0 +1,5 @@ +import type { Squire } from '../Editor'; +declare const Tab: (self: Squire, event: KeyboardEvent, range: Range) => void; +declare const ShiftTab: (self: Squire, event: KeyboardEvent, range: Range) => void; +export { Tab, ShiftTab }; +//# sourceMappingURL=Tab.d.ts.map \ No newline at end of file diff --git a/dist/types/keyboard/Tab.d.ts.map b/dist/types/keyboard/Tab.d.ts.map new file mode 100644 index 0000000..810be7b --- /dev/null +++ b/dist/types/keyboard/Tab.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"Tab.d.ts","sourceRoot":"","sources":["../../../source/keyboard/Tab.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAIxC,QAAA,MAAM,GAAG,SAAU,MAAM,SAAS,aAAa,SAAS,KAAK,KAAG,IAmB/D,CAAC;AAEF,QAAA,MAAM,QAAQ,SAAU,MAAM,SAAS,aAAa,SAAS,KAAK,KAAG,IAYpE,CAAC;AAIF,OAAO,EAAE,GAAG,EAAE,QAAQ,EAAE,CAAC"} \ No newline at end of file diff --git a/dist/types/node/Block.d.ts b/dist/types/node/Block.d.ts new file mode 100644 index 0000000..897caa2 --- /dev/null +++ b/dist/types/node/Block.d.ts @@ -0,0 +1,7 @@ +import { TreeIterator } from './TreeIterator'; +declare const getBlockWalker: (node: Node, root: Element | DocumentFragment) => TreeIterator; +declare const getPreviousBlock: (node: Node, root: Element | DocumentFragment) => HTMLElement | null; +declare const getNextBlock: (node: Node, root: Element | DocumentFragment) => HTMLElement | null; +declare const isEmptyBlock: (block: Element) => boolean; +export { getBlockWalker, getPreviousBlock, getNextBlock, isEmptyBlock }; +//# sourceMappingURL=Block.d.ts.map \ No newline at end of file diff --git a/dist/types/node/Block.d.ts.map b/dist/types/node/Block.d.ts.map new file mode 100644 index 0000000..b1785bf --- /dev/null +++ b/dist/types/node/Block.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"Block.d.ts","sourceRoot":"","sources":["../../../source/node/Block.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAgB,MAAM,gBAAgB,CAAC;AAK5D,QAAA,MAAM,cAAc,SACV,IAAI,QACJ,OAAO,GAAG,gBAAgB,KACjC,aAAa,WAAW,CAI1B,CAAC;AAEF,QAAA,MAAM,gBAAgB,SACZ,IAAI,QACJ,OAAO,GAAG,gBAAgB,KACjC,WAAW,GAAG,IAGhB,CAAC;AAEF,QAAA,MAAM,YAAY,SACR,IAAI,QACJ,OAAO,GAAG,gBAAgB,KACjC,WAAW,GAAG,IAGhB,CAAC;AAEF,QAAA,MAAM,YAAY,UAAW,OAAO,KAAG,OAEtC,CAAC;AAIF,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,YAAY,EAAE,YAAY,EAAE,CAAC"} \ No newline at end of file diff --git a/dist/types/node/Category.d.ts b/dist/types/node/Category.d.ts new file mode 100644 index 0000000..32cb364 --- /dev/null +++ b/dist/types/node/Category.d.ts @@ -0,0 +1,9 @@ +declare const leafNodeNames: Set; +declare const resetNodeCategoryCache: () => void; +declare const isLeaf: (node: Node) => boolean; +declare const getNodeCategory: (node: Node) => number; +declare const isInline: (node: Node) => boolean; +declare const isBlock: (node: Node) => boolean; +declare const isContainer: (node: Node) => boolean; +export { getNodeCategory, isBlock, isContainer, isInline, isLeaf, leafNodeNames, resetNodeCategoryCache, }; +//# sourceMappingURL=Category.d.ts.map \ No newline at end of file diff --git a/dist/types/node/Category.d.ts.map b/dist/types/node/Category.d.ts.map new file mode 100644 index 0000000..1dc78b2 --- /dev/null +++ b/dist/types/node/Category.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"Category.d.ts","sourceRoot":"","sources":["../../../source/node/Category.ts"],"names":[],"mappings":"AAOA,QAAA,MAAM,aAAa,aAAkD,CAAC;AAWtE,QAAA,MAAM,sBAAsB,QAAO,IAElC,CAAC;AAIF,QAAA,MAAM,MAAM,SAAU,IAAI,KAAG,OAE5B,CAAC;AAEF,QAAA,MAAM,eAAe,SAAU,IAAI,KAAG,MA0BrC,CAAC;AAEF,QAAA,MAAM,QAAQ,SAAU,IAAI,KAAG,OAE9B,CAAC;AAEF,QAAA,MAAM,OAAO,SAAU,IAAI,KAAG,OAE7B,CAAC;AAEF,QAAA,MAAM,WAAW,SAAU,IAAI,KAAG,OAEjC,CAAC;AAIF,OAAO,EACH,eAAe,EACf,OAAO,EACP,WAAW,EACX,QAAQ,EACR,MAAM,EACN,aAAa,EACb,sBAAsB,GACzB,CAAC"} \ No newline at end of file diff --git a/dist/types/node/MergeSplit.d.ts b/dist/types/node/MergeSplit.d.ts new file mode 100644 index 0000000..c000cad --- /dev/null +++ b/dist/types/node/MergeSplit.d.ts @@ -0,0 +1,8 @@ +declare const fixCursor: (node: Node) => Node; +declare const fixContainer: (container: Node, root: Element | DocumentFragment) => Node; +declare const split: (node: Node, offset: number | Node | null, stopNode: Node, root: Element | DocumentFragment) => Node | null; +declare const mergeInlines: (node: Node, range: Range) => void; +declare const mergeWithBlock: (block: Node, next: Node, range: Range, root: Element) => void; +declare const mergeContainers: (node: Node, root: Element) => void; +export { fixContainer, fixCursor, mergeContainers, mergeInlines, mergeWithBlock, split, }; +//# sourceMappingURL=MergeSplit.d.ts.map \ No newline at end of file diff --git a/dist/types/node/MergeSplit.d.ts.map b/dist/types/node/MergeSplit.d.ts.map new file mode 100644 index 0000000..2e07f55 --- /dev/null +++ b/dist/types/node/MergeSplit.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"MergeSplit.d.ts","sourceRoot":"","sources":["../../../source/node/MergeSplit.ts"],"names":[],"mappings":"AAaA,QAAA,MAAM,SAAS,SAAU,IAAI,KAAG,IAyC/B,CAAC;AAGF,QAAA,MAAM,YAAY,cACH,IAAI,QACT,OAAO,GAAG,gBAAgB,KACjC,IA6BF,CAAC;AAEF,QAAA,MAAM,KAAK,SACD,IAAI,UACF,MAAM,GAAG,IAAI,GAAG,IAAI,YAClB,IAAI,QACR,OAAO,GAAG,gBAAgB,KACjC,IAAI,GAAG,IAoDT,CAAC;AA0DF,QAAA,MAAM,YAAY,SAAU,IAAI,SAAS,KAAK,KAAG,IAahD,CAAC;AAEF,QAAA,MAAM,cAAc,UACT,IAAI,QACL,IAAI,SACH,KAAK,QACN,OAAO,KACd,IA4BF,CAAC;AAEF,QAAA,MAAM,eAAe,SAAU,IAAI,QAAQ,OAAO,KAAG,IAkCpD,CAAC;AAIF,OAAO,EACH,YAAY,EACZ,SAAS,EACT,eAAe,EACf,YAAY,EACZ,cAAc,EACd,KAAK,GACR,CAAC"} \ No newline at end of file diff --git a/dist/types/node/Node.d.ts b/dist/types/node/Node.d.ts new file mode 100644 index 0000000..e0b8ee6 --- /dev/null +++ b/dist/types/node/Node.d.ts @@ -0,0 +1,12 @@ +declare const createElement: (tag: string, props?: Record | null, children?: Node[]) => HTMLElement; +declare const areAlike: (node: HTMLElement | Node, node2: HTMLElement | Node) => boolean; +declare const hasTagAttributes: (node: Node | Element, tag: string, attributes?: Record | null) => boolean; +declare const getNearest: (node: Node | null, root: Element | DocumentFragment, tag: string, attributes?: Record | null) => Node | null; +declare const getNodeBeforeOffset: (node: Node, offset: number) => Node; +declare const getNodeAfterOffset: (node: Node, offset: number) => Node | null; +declare const getLength: (node: Node) => number; +declare const empty: (node: Node) => DocumentFragment; +declare const detach: (node: Node) => Node; +declare const replaceWith: (node: Node, node2: Node) => void; +export { areAlike, createElement, detach, empty, getLength, getNearest, getNodeAfterOffset, getNodeBeforeOffset, hasTagAttributes, replaceWith, }; +//# sourceMappingURL=Node.d.ts.map \ No newline at end of file diff --git a/dist/types/node/Node.d.ts.map b/dist/types/node/Node.d.ts.map new file mode 100644 index 0000000..1dff536 --- /dev/null +++ b/dist/types/node/Node.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"Node.d.ts","sourceRoot":"","sources":["../../../source/node/Node.ts"],"names":[],"mappings":"AAIA,QAAA,MAAM,aAAa,QACV,MAAM,UACH,OAAO,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI,aAC1B,IAAI,EAAE,KAClB,WAkBF,CAAC;AAIF,QAAA,MAAM,QAAQ,SACJ,WAAW,GAAG,IAAI,SACjB,WAAW,GAAG,IAAI,KAC1B,OAeF,CAAC;AAEF,QAAA,MAAM,gBAAgB,SACZ,IAAI,GAAG,OAAO,OACf,MAAM,eACE,OAAO,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI,KAC3C,OAaF,CAAC;AAIF,QAAA,MAAM,UAAU,SACN,IAAI,GAAG,IAAI,QACX,OAAO,GAAG,gBAAgB,OAC3B,MAAM,eACE,OAAO,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI,KAC3C,IAAI,GAAG,IAQT,CAAC;AAEF,QAAA,MAAM,mBAAmB,SAAU,IAAI,UAAU,MAAM,KAAG,IAQzD,CAAC;AAEF,QAAA,MAAM,kBAAkB,SAAU,IAAI,UAAU,MAAM,KAAG,IAAI,GAAG,IAgB/D,CAAC;AAEF,QAAA,MAAM,SAAS,SAAU,IAAI,KAAG,MAM/B,CAAC;AAIF,QAAA,MAAM,KAAK,SAAU,IAAI,KAAG,gBAQ3B,CAAC;AAEF,QAAA,MAAM,MAAM,SAAU,IAAI,KAAG,IAM5B,CAAC;AAEF,QAAA,MAAM,WAAW,SAAU,IAAI,SAAS,IAAI,KAAG,IAK9C,CAAC;AAIF,OAAO,EACH,QAAQ,EACR,aAAa,EACb,MAAM,EACN,KAAK,EACL,SAAS,EACT,UAAU,EACV,kBAAkB,EAClB,mBAAmB,EACnB,gBAAgB,EAChB,WAAW,GACd,CAAC"} \ No newline at end of file diff --git a/dist/types/node/TreeIterator.d.ts b/dist/types/node/TreeIterator.d.ts new file mode 100644 index 0000000..6520bc1 --- /dev/null +++ b/dist/types/node/TreeIterator.d.ts @@ -0,0 +1,17 @@ +type NODE_TYPE = 1 | 4 | 5; +declare const SHOW_ELEMENT = 1; +declare const SHOW_TEXT = 4; +declare const SHOW_ELEMENT_OR_TEXT = 5; +declare class TreeIterator { + root: Node; + currentNode: Node; + nodeType: NODE_TYPE; + filter: (n: T) => boolean; + constructor(root: Node, nodeType: NODE_TYPE, filter?: (n: T) => boolean); + isAcceptableNode(node: Node): boolean; + nextNode(): T | null; + previousNode(): T | null; + previousPONode(): T | null; +} +export { TreeIterator, SHOW_ELEMENT, SHOW_TEXT, SHOW_ELEMENT_OR_TEXT }; +//# sourceMappingURL=TreeIterator.d.ts.map \ No newline at end of file diff --git a/dist/types/node/TreeIterator.d.ts.map b/dist/types/node/TreeIterator.d.ts.map new file mode 100644 index 0000000..4166933 --- /dev/null +++ b/dist/types/node/TreeIterator.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"TreeIterator.d.ts","sourceRoot":"","sources":["../../../source/node/TreeIterator.ts"],"names":[],"mappings":"AAAA,KAAK,SAAS,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AAC3B,QAAA,MAAM,YAAY,IAAI,CAAC;AACvB,QAAA,MAAM,SAAS,IAAI,CAAC;AACpB,QAAA,MAAM,oBAAoB,IAAI,CAAC;AAI/B,cAAM,YAAY,CAAC,CAAC,SAAS,IAAI;IAC7B,IAAI,EAAE,IAAI,CAAC;IACX,WAAW,EAAE,IAAI,CAAC;IAClB,QAAQ,EAAE,SAAS,CAAC;IACpB,MAAM,EAAE,CAAC,CAAC,EAAE,CAAC,KAAK,OAAO,CAAC;gBAEd,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,KAAK,OAAO;IAOvE,gBAAgB,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO;IAWrC,QAAQ,IAAI,CAAC,GAAG,IAAI;IA2BpB,YAAY,IAAI,CAAC,GAAG,IAAI;IA4BxB,cAAc,IAAI,CAAC,GAAG,IAAI;CAyB7B;AAID,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,SAAS,EAAE,oBAAoB,EAAE,CAAC"} \ No newline at end of file diff --git a/dist/types/node/Whitespace.d.ts b/dist/types/node/Whitespace.d.ts new file mode 100644 index 0000000..0adb8ed --- /dev/null +++ b/dist/types/node/Whitespace.d.ts @@ -0,0 +1,4 @@ +declare const isLineBreak: (br: Element, isLBIfEmptyBlock: boolean) => boolean; +declare const removeZWS: (root: Node, keepNode?: Node) => void; +export { isLineBreak, removeZWS }; +//# sourceMappingURL=Whitespace.d.ts.map \ No newline at end of file diff --git a/dist/types/node/Whitespace.d.ts.map b/dist/types/node/Whitespace.d.ts.map new file mode 100644 index 0000000..78c663a --- /dev/null +++ b/dist/types/node/Whitespace.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"Whitespace.d.ts","sourceRoot":"","sources":["../../../source/node/Whitespace.ts"],"names":[],"mappings":"AAcA,QAAA,MAAM,WAAW,OAAQ,OAAO,oBAAoB,OAAO,KAAG,OAY7D,CAAC;AAUF,QAAA,MAAM,SAAS,SAAU,IAAI,aAAa,IAAI,KAAG,IA4BhD,CAAC;AAIF,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,CAAC"} \ No newline at end of file diff --git a/dist/types/range/Block.d.ts b/dist/types/range/Block.d.ts new file mode 100644 index 0000000..e929fac --- /dev/null +++ b/dist/types/range/Block.d.ts @@ -0,0 +1,7 @@ +declare const getStartBlockOfRange: (range: Range, root: Element | DocumentFragment) => HTMLElement | null; +declare const getEndBlockOfRange: (range: Range, root: Element | DocumentFragment) => HTMLElement | null; +declare const rangeDoesStartAtBlockBoundary: (range: Range, root: Element) => boolean; +declare const rangeDoesEndAtBlockBoundary: (range: Range, root: Element) => boolean; +declare const expandRangeToBlockBoundaries: (range: Range, root: Element) => void; +export { getStartBlockOfRange, getEndBlockOfRange, rangeDoesStartAtBlockBoundary, rangeDoesEndAtBlockBoundary, expandRangeToBlockBoundaries, }; +//# sourceMappingURL=Block.d.ts.map \ No newline at end of file diff --git a/dist/types/range/Block.d.ts.map b/dist/types/range/Block.d.ts.map new file mode 100644 index 0000000..1b03f9c --- /dev/null +++ b/dist/types/range/Block.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"Block.d.ts","sourceRoot":"","sources":["../../../source/range/Block.ts"],"names":[],"mappings":"AAWA,QAAA,MAAM,oBAAoB,UACf,KAAK,QACN,OAAO,GAAG,gBAAgB,KACjC,WAAW,GAAG,IAmBhB,CAAC;AAIF,QAAA,MAAM,kBAAkB,UACb,KAAK,QACN,OAAO,GAAG,gBAAgB,KACjC,WAAW,GAAG,IA0BhB,CAAC;AAQF,QAAA,MAAM,6BAA6B,UACxB,KAAK,QACN,OAAO,KACd,OAsCF,CAAC;AAEF,QAAA,MAAM,2BAA2B,UAAW,KAAK,QAAQ,OAAO,KAAG,OA6BlE,CAAC;AAEF,QAAA,MAAM,4BAA4B,UAAW,KAAK,QAAQ,OAAO,KAAG,IAWnE,CAAC;AAIF,OAAO,EACH,oBAAoB,EACpB,kBAAkB,EAClB,6BAA6B,EAC7B,2BAA2B,EAC3B,4BAA4B,GAC/B,CAAC"} \ No newline at end of file diff --git a/dist/types/range/Boundaries.d.ts b/dist/types/range/Boundaries.d.ts new file mode 100644 index 0000000..8e2942c --- /dev/null +++ b/dist/types/range/Boundaries.d.ts @@ -0,0 +1,10 @@ +declare const isNodeContainedInRange: (range: Range, node: Node, partial: boolean) => boolean; +/** + * Moves the range to an equivalent position with the start/end as deep in + * the tree as possible. + */ +declare const moveRangeBoundariesDownTree: (range: Range) => void; +declare const moveRangeBoundariesUpTree: (range: Range, startMax: Node, endMax: Node, root: Node) => void; +declare const moveRangeBoundaryOutOf: (range: Range, tag: string, root: Element) => Range; +export { isNodeContainedInRange, moveRangeBoundariesDownTree, moveRangeBoundariesUpTree, moveRangeBoundaryOutOf, }; +//# sourceMappingURL=Boundaries.d.ts.map \ No newline at end of file diff --git a/dist/types/range/Boundaries.d.ts.map b/dist/types/range/Boundaries.d.ts.map new file mode 100644 index 0000000..bf3c364 --- /dev/null +++ b/dist/types/range/Boundaries.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"Boundaries.d.ts","sourceRoot":"","sources":["../../../source/range/Boundaries.ts"],"names":[],"mappings":"AAYA,QAAA,MAAM,sBAAsB,UACjB,KAAK,QACN,IAAI,WACD,OAAO,KACjB,OAoBF,CAAC;AAEF;;;GAGG;AACH,QAAA,MAAM,2BAA2B,UAAW,KAAK,KAAG,IA6DnD,CAAC;AAEF,QAAA,MAAM,yBAAyB,UACpB,KAAK,YACF,IAAI,UACN,IAAI,QACN,IAAI,KACX,IAkDF,CAAC;AAEF,QAAA,MAAM,sBAAsB,UACjB,KAAK,OACP,MAAM,QACL,OAAO,KACd,KAWF,CAAC;AAIF,OAAO,EACH,sBAAsB,EACtB,2BAA2B,EAC3B,yBAAyB,EACzB,sBAAsB,GACzB,CAAC"} \ No newline at end of file diff --git a/dist/types/range/InsertDelete.d.ts b/dist/types/range/InsertDelete.d.ts new file mode 100644 index 0000000..0e0d2b3 --- /dev/null +++ b/dist/types/range/InsertDelete.d.ts @@ -0,0 +1,14 @@ +declare function createRange(startContainer: Node, startOffset: number): Range; +declare function createRange(startContainer: Node, startOffset: number, endContainer: Node, endOffset: number): Range; +declare const insertNodeInRange: (range: Range, node: Node) => void; +/** + * Removes the contents of the range and returns it as a DocumentFragment. + * The range at the end will be at the same position, with the edges just + * before/after the split. If the start/end have the same parents, it will + * be collapsed. + */ +declare const extractContentsOfRange: (range: Range, common: Node | null, root: Element) => DocumentFragment; +declare const deleteContentsOfRange: (range: Range, root: Element) => DocumentFragment; +declare const insertTreeFragmentIntoRange: (range: Range, frag: DocumentFragment, root: Element) => void; +export { createRange, deleteContentsOfRange, extractContentsOfRange, insertNodeInRange, insertTreeFragmentIntoRange, }; +//# sourceMappingURL=InsertDelete.d.ts.map \ No newline at end of file diff --git a/dist/types/range/InsertDelete.d.ts.map b/dist/types/range/InsertDelete.d.ts.map new file mode 100644 index 0000000..9e1eda1 --- /dev/null +++ b/dist/types/range/InsertDelete.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"InsertDelete.d.ts","sourceRoot":"","sources":["../../../source/range/InsertDelete.ts"],"names":[],"mappings":"AAyBA,iBAAS,WAAW,CAAC,cAAc,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,GAAG,KAAK,CAAC;AACvE,iBAAS,WAAW,CAChB,cAAc,EAAE,IAAI,EACpB,WAAW,EAAE,MAAM,EACnB,YAAY,EAAE,IAAI,EAClB,SAAS,EAAE,MAAM,GAClB,KAAK,CAAC;AAiBT,QAAA,MAAM,iBAAiB,UAAW,KAAK,QAAQ,IAAI,KAAG,IAiDrD,CAAC;AAEF;;;;;GAKG;AACH,QAAA,MAAM,sBAAsB,UACjB,KAAK,UACJ,IAAI,GAAG,IAAI,QACb,OAAO,KACd,gBA6CF,CAAC;AAuBF,QAAA,MAAM,qBAAqB,UAChB,KAAK,QACN,OAAO,KACd,gBA8GF,CAAC;AAIF,QAAA,MAAM,2BAA2B,UACtB,KAAK,QACN,gBAAgB,QAChB,OAAO,KACd,IAqIF,CAAC;AAIF,OAAO,EACH,WAAW,EACX,qBAAqB,EACrB,sBAAsB,EACtB,iBAAiB,EACjB,2BAA2B,GAC9B,CAAC"} \ No newline at end of file diff --git a/package.json b/package.json index fd5e7fa..155c315 100644 --- a/package.json +++ b/package.json @@ -3,10 +3,11 @@ "version": "2.0.3", "description": "Squire is an HTML5 rich text editor, which provides powerful cross-browser normalisation, whilst being supremely lightweight and flexible.", "main": "dist/squire.mjs", + "types": "dist/types/Squire.d.ts", "type": "module", "scripts": { "test": "jest", - "build": "./build.js", + "build": "./build.js && tsc", "lint": "eslint source", "fix": "eslint --fix source && prettier --write source" }, diff --git a/tsconfig.json b/tsconfig.json index 201e26e..f50863d 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -5,7 +5,6 @@ "strict": true, "esModuleInterop": true, "forceConsistentCasingInFileNames": true, - "outDir": "./dist", "allowUnreachableCode": false, "allowUnusedLabels": false, "noImplicitAny": true, @@ -15,7 +14,15 @@ // "noUncheckedIndexedAccess": true "noUnusedLocals": true, "noUnusedParameters": true, - "skipLibCheck": true + "skipLibCheck": true, + "declaration": true, + "declarationMap": true, + "emitDeclarationOnly": true, + "baseUrl": ".", + "outDir": "dist/types", + "paths": { + "squire-rte": ["source"] + } }, "include": ["./source"] }