0
Fork 0
mirror of https://github.com/fastmail/Squire.git synced 2024-12-21 23:03:11 -05:00

Bundle types with build

This commit is contained in:
Callum Skeet 2023-07-31 12:47:02 +10:00
parent c9f10b297b
commit e9ffde9a65
46 changed files with 369 additions and 3 deletions

8
dist/types/Clean.d.ts vendored Normal file
View file

@ -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

1
dist/types/Clean.d.ts.map vendored Normal file
View file

@ -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"}

9
dist/types/Clipboard.d.ts vendored Normal file
View file

@ -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

1
dist/types/Clipboard.d.ts.map vendored Normal file
View file

@ -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"}

20
dist/types/Constants.d.ts vendored Normal file
View file

@ -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

1
dist/types/Constants.d.ts.map vendored Normal file
View file

@ -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"}

173
dist/types/Editor.d.ts vendored Normal file
View file

@ -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<string, string>;
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<string, Array<EventHandler>>;
_undoIndex: number;
_undoStack: Array<string>;
_undoStackLength: number;
_isInUndoState: boolean;
_ignoreChange: boolean;
_ignoreAllChanges: boolean;
_isShiftDown: boolean;
_keyHandlers: Record<string, KeyHandlerFunction>;
_mutation: MutationObserver;
constructor(root: HTMLElement, config?: Partial<SquireConfig>);
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<string>;
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<string, string>): 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<string, string | undefined>;
/**
* Looks for matching tag and attributes, so won't work if <strong>
* instead of <b> etc.
*/
hasFormat(tag: string, attributes?: Record<string, string> | null, range?: Range): boolean;
changeFormat(add: {
tag: string;
attributes?: Record<string, string>;
} | null, remove?: {
tag: string;
attributes?: Record<string, string>;
} | null, range?: Range, partial?: boolean): Squire;
_addFormat(tag: string, attributes: Record<string, string> | null, range: Range): Range;
_removeFormat(tag: string, attributes: Record<string, string>, 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<string, string>): 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<string, string>;
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

1
dist/types/Editor.d.ts.map vendored Normal file

File diff suppressed because one or more lines are too long

2
dist/types/Legacy.d.ts vendored Normal file
View file

@ -0,0 +1,2 @@
export {};
//# sourceMappingURL=Legacy.d.ts.map

1
dist/types/Legacy.d.ts.map vendored Normal file
View file

@ -0,0 +1 @@
{"version":3,"file":"Legacy.d.ts","sourceRoot":"","sources":["../../source/Legacy.ts"],"names":[],"mappings":""}

3
dist/types/Squire.d.ts vendored Normal file
View file

@ -0,0 +1,3 @@
import { Squire } from './Editor';
export default Squire;
//# sourceMappingURL=Squire.d.ts.map

1
dist/types/Squire.d.ts.map vendored Normal file
View file

@ -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"}

4
dist/types/keyboard/Backspace.d.ts vendored Normal file
View file

@ -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

View file

@ -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"}

4
dist/types/keyboard/Delete.d.ts vendored Normal file
View file

@ -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

1
dist/types/keyboard/Delete.d.ts.map vendored Normal file
View file

@ -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"}

4
dist/types/keyboard/Enter.d.ts vendored Normal file
View file

@ -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

1
dist/types/keyboard/Enter.d.ts.map vendored Normal file
View file

@ -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"}

6
dist/types/keyboard/KeyHandlers.d.ts vendored Normal file
View file

@ -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<string, KeyHandler>;
export { _onKey, keyHandlers };
//# sourceMappingURL=KeyHandlers.d.ts.map

View file

@ -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"}

6
dist/types/keyboard/KeyHelpers.d.ts vendored Normal file
View file

@ -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

View file

@ -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"}

4
dist/types/keyboard/Space.d.ts vendored Normal file
View file

@ -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

1
dist/types/keyboard/Space.d.ts.map vendored Normal file
View file

@ -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"}

5
dist/types/keyboard/Tab.d.ts vendored Normal file
View file

@ -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

1
dist/types/keyboard/Tab.d.ts.map vendored Normal file
View file

@ -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"}

7
dist/types/node/Block.d.ts vendored Normal file
View file

@ -0,0 +1,7 @@
import { TreeIterator } from './TreeIterator';
declare const getBlockWalker: (node: Node, root: Element | DocumentFragment) => TreeIterator<HTMLElement>;
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

1
dist/types/node/Block.d.ts.map vendored Normal file
View file

@ -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"}

9
dist/types/node/Category.d.ts vendored Normal file
View file

@ -0,0 +1,9 @@
declare const leafNodeNames: Set<string>;
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

1
dist/types/node/Category.d.ts.map vendored Normal file
View file

@ -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"}

8
dist/types/node/MergeSplit.d.ts vendored Normal file
View file

@ -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

1
dist/types/node/MergeSplit.d.ts.map vendored Normal file
View file

@ -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"}

12
dist/types/node/Node.d.ts vendored Normal file
View file

@ -0,0 +1,12 @@
declare const createElement: (tag: string, props?: Record<string, string> | null, children?: Node[]) => HTMLElement;
declare const areAlike: (node: HTMLElement | Node, node2: HTMLElement | Node) => boolean;
declare const hasTagAttributes: (node: Node | Element, tag: string, attributes?: Record<string, string> | null) => boolean;
declare const getNearest: (node: Node | null, root: Element | DocumentFragment, tag: string, attributes?: Record<string, string> | 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

1
dist/types/node/Node.d.ts.map vendored Normal file
View file

@ -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"}

17
dist/types/node/TreeIterator.d.ts vendored Normal file
View file

@ -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<T extends Node> {
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

1
dist/types/node/TreeIterator.d.ts.map vendored Normal file
View file

@ -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"}

4
dist/types/node/Whitespace.d.ts vendored Normal file
View file

@ -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

1
dist/types/node/Whitespace.d.ts.map vendored Normal file
View file

@ -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"}

7
dist/types/range/Block.d.ts vendored Normal file
View file

@ -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

1
dist/types/range/Block.d.ts.map vendored Normal file
View file

@ -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"}

10
dist/types/range/Boundaries.d.ts vendored Normal file
View file

@ -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

1
dist/types/range/Boundaries.d.ts.map vendored Normal file
View file

@ -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"}

14
dist/types/range/InsertDelete.d.ts vendored Normal file
View file

@ -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

View file

@ -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"}

View file

@ -3,10 +3,11 @@
"version": "2.0.3", "version": "2.0.3",
"description": "Squire is an HTML5 rich text editor, which provides powerful cross-browser normalisation, whilst being supremely lightweight and flexible.", "description": "Squire is an HTML5 rich text editor, which provides powerful cross-browser normalisation, whilst being supremely lightweight and flexible.",
"main": "dist/squire.mjs", "main": "dist/squire.mjs",
"types": "dist/types/Squire.d.ts",
"type": "module", "type": "module",
"scripts": { "scripts": {
"test": "jest", "test": "jest",
"build": "./build.js", "build": "./build.js && tsc",
"lint": "eslint source", "lint": "eslint source",
"fix": "eslint --fix source && prettier --write source" "fix": "eslint --fix source && prettier --write source"
}, },

View file

@ -5,7 +5,6 @@
"strict": true, "strict": true,
"esModuleInterop": true, "esModuleInterop": true,
"forceConsistentCasingInFileNames": true, "forceConsistentCasingInFileNames": true,
"outDir": "./dist",
"allowUnreachableCode": false, "allowUnreachableCode": false,
"allowUnusedLabels": false, "allowUnusedLabels": false,
"noImplicitAny": true, "noImplicitAny": true,
@ -15,7 +14,15 @@
// "noUncheckedIndexedAccess": true // "noUncheckedIndexedAccess": true
"noUnusedLocals": true, "noUnusedLocals": true,
"noUnusedParameters": true, "noUnusedParameters": true,
"skipLibCheck": true "skipLibCheck": true,
"declaration": true,
"declarationMap": true,
"emitDeclarationOnly": true,
"baseUrl": ".",
"outDir": "dist/types",
"paths": {
"squire-rte": ["source"]
}
}, },
"include": ["./source"] "include": ["./source"]
} }