setBackgroundImage支持数组传入,修复部分类型提示问题
This commit is contained in:
parent
a6edd9aebe
commit
b9878c184b
|
@ -0,0 +1,21 @@
|
||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) Microsoft Corporation.
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE
|
|
@ -0,0 +1,15 @@
|
||||||
|
# Installation
|
||||||
|
> `npm install --save @types/codemirror`
|
||||||
|
|
||||||
|
# Summary
|
||||||
|
This package contains type definitions for codemirror (https://github.com/codemirror/CodeMirror).
|
||||||
|
|
||||||
|
# Details
|
||||||
|
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/codemirror.
|
||||||
|
|
||||||
|
### Additional Details
|
||||||
|
* Last updated: Wed, 22 Nov 2023 00:24:48 GMT
|
||||||
|
* Dependencies: [@types/tern](https://npmjs.com/package/@types/tern)
|
||||||
|
|
||||||
|
# Credits
|
||||||
|
These definitions were written by [mihailik](https://github.com/mihailik), [nrbernard](https://github.com/nrbernard), [Pr1st0n](https://github.com/Pr1st0n), [rileymiller](https://github.com/rileymiller), [toddself](https://github.com/toddself), [ysulyma](https://github.com/ysulyma), [azoson](https://github.com/azoson), [kylesferrazza](https://github.com/kylesferrazza), [fityocsaba96](https://github.com/fityocsaba96), [koddsson](https://github.com/koddsson), and [ficristo](https://github.com/ficristo).
|
|
@ -0,0 +1,37 @@
|
||||||
|
import "../../";
|
||||||
|
|
||||||
|
declare module "../../" {
|
||||||
|
interface Editor {
|
||||||
|
/** Tries to uncomment the current selection, and if that fails, line-comments it. */
|
||||||
|
toggleComment(options?: CommentOptions): void;
|
||||||
|
/** Set the lines in the given range to be line comments. Will fall back to `blockComment` when no line comment style is defined for the mode. */
|
||||||
|
lineComment(from: Position, to: Position, options?: CommentOptions): void;
|
||||||
|
/** Wrap the code in the given range in a block comment. Will fall back to `lineComment` when no block comment style is defined for the mode. */
|
||||||
|
blockComment(from: Position, to: Position, options?: CommentOptions): void;
|
||||||
|
/** Try to uncomment the given range. Returns `true` if a comment range was found and removed, `false` otherwise. */
|
||||||
|
uncomment(from: Position, to: Position, options?: CommentOptions): boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface CommentOptions {
|
||||||
|
/** Override the [comment string properties](https://codemirror.net/doc/manual.html#mode_comment) of the mode with custom comment strings. */
|
||||||
|
blockCommentStart?: string | undefined;
|
||||||
|
/** Override the [comment string properties](https://codemirror.net/doc/manual.html#mode_comment) of the mode with custom comment strings. */
|
||||||
|
blockCommentEnd?: string | undefined;
|
||||||
|
/** Override the [comment string properties](https://codemirror.net/doc/manual.html#mode_comment) of the mode with custom comment strings. */
|
||||||
|
blockCommentLead?: string | undefined;
|
||||||
|
/** Override the [comment string properties](https://codemirror.net/doc/manual.html#mode_comment) of the mode with custom comment strings. */
|
||||||
|
lineComment?: string | undefined;
|
||||||
|
/** A string that will be inserted after opening and leading markers, and before closing comment markers. Defaults to a single space. */
|
||||||
|
padding?: string | null | undefined;
|
||||||
|
/** Whether, when adding line comments, to also comment lines that contain only whitespace. */
|
||||||
|
commentBlankLines?: boolean | undefined;
|
||||||
|
/** When adding line comments and this is turned on, it will align the comment block to the current indentation of the first line of the block. */
|
||||||
|
indent?: boolean | undefined;
|
||||||
|
/** When block commenting, this controls whether the whole lines are indented, or only the precise range that is given. Defaults to `true`. */
|
||||||
|
fullLines?: boolean | undefined;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface CommandActions {
|
||||||
|
toggleComment(cm: Editor): void;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,12 @@
|
||||||
|
import "../../";
|
||||||
|
|
||||||
|
declare module "../../" {
|
||||||
|
interface EditorConfiguration {
|
||||||
|
/**
|
||||||
|
* if true, the editor will make the next line continue a comment when
|
||||||
|
* pressing the Enter key. If set to a string, it will continue comments
|
||||||
|
* using a custom shortcut.
|
||||||
|
*/
|
||||||
|
continueComments?: boolean | string | { key: string; continueLineComment?: boolean | undefined } | undefined;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,43 @@
|
||||||
|
import "../../";
|
||||||
|
|
||||||
|
export type DialogCloseFunction = () => void;
|
||||||
|
|
||||||
|
export interface DialogOptions {
|
||||||
|
bottom?: boolean | undefined;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface OpenDialogOptions extends DialogOptions {
|
||||||
|
/** If true, the dialog will be closed when the user presses enter in the input. Defaults to true. */
|
||||||
|
closeOnEnter?: boolean | undefined;
|
||||||
|
/** Determines whether the dialog is closed when it loses focus. Defaults to true. */
|
||||||
|
closeOnBlur?: boolean | undefined;
|
||||||
|
/** An event handler that will be called whenever keydown fires in the dialog's input. If the callback returns true, the dialog will not do any further processing of the event. */
|
||||||
|
onKeyDown?(event: KeyboardEvent, value: string, close: DialogCloseFunction): boolean | undefined;
|
||||||
|
/** An event handler that will be called whenever keyup fires in the dialog's input. If the callback returns true, the dialog will not do any further processing of the event. */
|
||||||
|
onKeyUp?(event: KeyboardEvent, value: string, close: DialogCloseFunction): boolean | undefined;
|
||||||
|
/** An event handler that will be called whenever input fires in the dialog's input. If the callback returns true, the dialog will not do any further processing of the event. */
|
||||||
|
onInput?(event: KeyboardEvent, value: string, close: DialogCloseFunction): boolean | undefined;
|
||||||
|
/** A callback that will be called after the dialog has been closed and removed from the DOM. */
|
||||||
|
onClose?(instance: HTMLElement): void;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface OpenNotificationOptions extends DialogOptions {
|
||||||
|
duration?: number | undefined;
|
||||||
|
}
|
||||||
|
|
||||||
|
declare module "../../" {
|
||||||
|
interface Editor {
|
||||||
|
/** Provides a very simple way to query users for text input. */
|
||||||
|
openDialog(
|
||||||
|
template: string | Node,
|
||||||
|
callback: (value: string, e: Event) => void,
|
||||||
|
options?: OpenDialogOptions,
|
||||||
|
): DialogCloseFunction;
|
||||||
|
openNotification(template: string | Node, options?: OpenNotificationOptions): DialogCloseFunction;
|
||||||
|
openConfirm(
|
||||||
|
template: string | Node,
|
||||||
|
callbacks: ReadonlyArray<(editor: Editor) => void>,
|
||||||
|
options?: DialogOptions,
|
||||||
|
): DialogCloseFunction;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,9 @@
|
||||||
|
import "../../";
|
||||||
|
|
||||||
|
declare module "../../" {
|
||||||
|
interface EditorConfiguration {
|
||||||
|
// if true, it will be refreshed the first time the editor becomes visible.
|
||||||
|
// you can pass delay (msec) time as polling duration
|
||||||
|
autoRefresh?: boolean | { delay: number } | undefined;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,13 @@
|
||||||
|
import "../../";
|
||||||
|
|
||||||
|
declare module "../../" {
|
||||||
|
interface EditorConfiguration {
|
||||||
|
/**
|
||||||
|
* When set to true, will make the editor full-screen (as in, taking up the whole browser window).
|
||||||
|
* Depends on fullscreen.css
|
||||||
|
* @see {@link https://codemirror.net/doc/manual.html#addon_fullscreen}
|
||||||
|
* @default false
|
||||||
|
*/
|
||||||
|
fullScreen?: boolean | undefined;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,41 @@
|
||||||
|
import "../../";
|
||||||
|
|
||||||
|
declare module "../../" {
|
||||||
|
interface Panel {
|
||||||
|
/** Removes the panel from the editor */
|
||||||
|
clear(): void;
|
||||||
|
/** Notifies panel that height of DOM node has changed */
|
||||||
|
changed(height?: number): void;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface ShowPanelOptions {
|
||||||
|
/**
|
||||||
|
* Controls the position of the newly added panel. The following values are recognized:
|
||||||
|
* `top` (default): Adds the panel at the very top.
|
||||||
|
* `after-top`: Adds the panel at the bottom of the top panels.
|
||||||
|
* `bottom`: Adds the panel at the very bottom.
|
||||||
|
* `before-bottom`: Adds the panel at the top of the bottom panels.
|
||||||
|
*/
|
||||||
|
position?: "top" | "after-top" | "bottom" | "before-bottom" | undefined;
|
||||||
|
/** The new panel will be added before the given panel. */
|
||||||
|
before?: Panel | undefined;
|
||||||
|
/** The new panel will be added after the given panel. */
|
||||||
|
after?: Panel | undefined;
|
||||||
|
/** The new panel will replace the given panel. */
|
||||||
|
replace?: Panel | undefined;
|
||||||
|
/** Whether to scroll the editor to keep the text's vertical position stable, when adding a panel above it. Defaults to false. */
|
||||||
|
stable?: boolean | undefined;
|
||||||
|
/** The initial height of the panel. Defaults to the offsetHeight of the node. */
|
||||||
|
height?: number | undefined;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface Editor {
|
||||||
|
/**
|
||||||
|
* Places a DOM node above or below an editor and shrinks the editor to make room for the node.
|
||||||
|
* When using the `after`, `before` or `replace` options, if the panel doesn't exists or has been removed, the value of the `position` option will be used as a fallback.
|
||||||
|
* @param node the DOM node
|
||||||
|
* @param options optional options object
|
||||||
|
*/
|
||||||
|
addPanel(node: HTMLElement, options?: ShowPanelOptions): Panel;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,11 @@
|
||||||
|
import "../../";
|
||||||
|
|
||||||
|
declare module "../../" {
|
||||||
|
interface EditorConfiguration {
|
||||||
|
/**
|
||||||
|
* Adds a placeholder option that can be used to make content appear in the editor when it is empty and not focused.
|
||||||
|
* It can hold either a string or a DOM node. Also gives the editor a CodeMirror-empty CSS class whenever it doesn't contain any text.
|
||||||
|
*/
|
||||||
|
placeholder?: string | Node | undefined;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,16 @@
|
||||||
|
import "../../";
|
||||||
|
|
||||||
|
export interface Ruler {
|
||||||
|
column: number;
|
||||||
|
className?: string | undefined;
|
||||||
|
color?: string | undefined;
|
||||||
|
lineStyle?: string | undefined;
|
||||||
|
width?: string | undefined;
|
||||||
|
}
|
||||||
|
|
||||||
|
declare module "../../" {
|
||||||
|
interface EditorConfiguration {
|
||||||
|
/** show one or more vertical rulers in the editor. */
|
||||||
|
rulers?: false | ReadonlyArray<number | Ruler> | undefined;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,40 @@
|
||||||
|
import "../../";
|
||||||
|
|
||||||
|
declare module "../../" {
|
||||||
|
interface AutoCloseBrackets {
|
||||||
|
/**
|
||||||
|
* String containing pairs of matching characters.
|
||||||
|
*/
|
||||||
|
pairs?: string | undefined;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* If the next character is in the string, opening a bracket should be auto-closed.
|
||||||
|
*/
|
||||||
|
closeBefore?: string | undefined;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* String containing chars that could do a triple quote.
|
||||||
|
*/
|
||||||
|
triples?: string | undefined;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* explode should be a similar string that gives the pairs of characters that, when enter is pressed between them, should have the second character also moved to its own line.
|
||||||
|
*/
|
||||||
|
explode?: string | undefined;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* By default, if the active mode has a closeBrackets property, that overrides the configuration given in the option.
|
||||||
|
* But you can add an override property with a truthy value to override mode-specific configuration.
|
||||||
|
*/
|
||||||
|
override?: boolean | undefined;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface EditorConfiguration {
|
||||||
|
/**
|
||||||
|
* Will auto-close brackets and quotes when typed.
|
||||||
|
* By default, it'll auto-close ()[]{}''"", but you can pass it a string similar to that (containing pairs of matching characters),
|
||||||
|
* or an object with pairs and optionally explode properties to customize it.
|
||||||
|
*/
|
||||||
|
autoCloseBrackets?: AutoCloseBrackets | boolean | string | undefined;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,44 @@
|
||||||
|
import "../../";
|
||||||
|
|
||||||
|
declare module "../../" {
|
||||||
|
interface CommandActions {
|
||||||
|
closeTag(cm: Editor): void;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface AutoCloseTags {
|
||||||
|
/**
|
||||||
|
* Whether to autoclose when the '/' of a closing tag is typed. (default true)
|
||||||
|
*/
|
||||||
|
whenClosing?: boolean | undefined;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Whether to autoclose the tag when the final '>' of an opening tag is typed. (default true)
|
||||||
|
*/
|
||||||
|
whenOpening?: boolean | undefined;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An array of tag names that should not be autoclosed. (default is empty tags for HTML, none for XML)
|
||||||
|
*/
|
||||||
|
dontCloseTags?: readonly string[] | undefined;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An array of tag names that should, when opened, cause a
|
||||||
|
* blank line to be added inside the tag, and the blank line and
|
||||||
|
* closing line to be indented. (default is block tags for HTML, none for XML)
|
||||||
|
*/
|
||||||
|
indentTags?: readonly string[] | undefined;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An array of XML tag names that should be autoclosed with '/>'. (default is none)
|
||||||
|
*/
|
||||||
|
emptyTags: readonly string[];
|
||||||
|
}
|
||||||
|
|
||||||
|
interface EditorConfiguration {
|
||||||
|
/**
|
||||||
|
* Will auto-close XML tags when '>' or '/' is typed.
|
||||||
|
* Depends on the fold/xml-fold.js addon.
|
||||||
|
*/
|
||||||
|
autoCloseTags?: AutoCloseTags | boolean | undefined;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,7 @@
|
||||||
|
import "../../";
|
||||||
|
|
||||||
|
declare module "../../" {
|
||||||
|
interface CommandActions {
|
||||||
|
newlineAndIndentContinueMarkdownList(cm: Editor): void | typeof Pass;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,35 @@
|
||||||
|
import "../../";
|
||||||
|
|
||||||
|
declare module "../../" {
|
||||||
|
interface MatchBrackets {
|
||||||
|
/**
|
||||||
|
* Only use the character after the start position, never the one before it.
|
||||||
|
*/
|
||||||
|
afterCursor?: boolean | undefined;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Causes only matches where both brackets are at the same side of the start position to be considered.
|
||||||
|
*/
|
||||||
|
strict?: boolean | undefined;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Stop after scanning this amount of lines without a successful match. Defaults to 1000.
|
||||||
|
*/
|
||||||
|
maxScanLines?: number | undefined;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Ignore lines longer than this. Defaults to 10000.
|
||||||
|
*/
|
||||||
|
maxScanLineLength?: number | undefined;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Don't highlight a bracket in a line longer than this. Defaults to 1000.
|
||||||
|
*/
|
||||||
|
maxHighlightLineLength?: number | undefined;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface EditorConfiguration {
|
||||||
|
// When set to true or an options object, causes matching brackets to be highlighted whenever the cursor is next to them.
|
||||||
|
matchBrackets?: MatchBrackets | boolean | undefined;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,25 @@
|
||||||
|
import "../../";
|
||||||
|
|
||||||
|
declare module "../../" {
|
||||||
|
interface CommandActions {
|
||||||
|
/**
|
||||||
|
* You can bind a key to in order to jump to the tag matching the one under the cursor.
|
||||||
|
*/
|
||||||
|
toMatchingTag(cm: Editor): void;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface MatchTags {
|
||||||
|
/**
|
||||||
|
* Highlight both matching tags.
|
||||||
|
*/
|
||||||
|
bothTags?: boolean | undefined;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface EditorConfiguration {
|
||||||
|
/**
|
||||||
|
* When enabled will cause the tags around the cursor to be highlighted (using the CodeMirror-matchingtag class).
|
||||||
|
* Depends on the addon/fold/xml-fold.js addon.
|
||||||
|
*/
|
||||||
|
matchTags?: MatchTags | boolean | undefined;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,8 @@
|
||||||
|
import "../../";
|
||||||
|
|
||||||
|
declare module "../../" {
|
||||||
|
interface EditorConfiguration {
|
||||||
|
/** when enabled, adds the CSS class cm-trailingspace to stretches of whitespace at the end of lines. */
|
||||||
|
showTrailingSpace?: boolean | undefined;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,9 @@
|
||||||
|
import "./foldcode";
|
||||||
|
|
||||||
|
declare module "./foldcode" {
|
||||||
|
interface FoldHelpers {
|
||||||
|
brace: FoldRangeFinder;
|
||||||
|
import: FoldRangeFinder;
|
||||||
|
include: FoldRangeFinder;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,7 @@
|
||||||
|
import "./foldcode";
|
||||||
|
|
||||||
|
declare module "./foldcode" {
|
||||||
|
interface FoldHelpers {
|
||||||
|
comment: FoldRangeFinder;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,77 @@
|
||||||
|
// See docs https://codemirror.net/doc/manual.html#addon_foldcode
|
||||||
|
|
||||||
|
import * as CodeMirror from "../../";
|
||||||
|
|
||||||
|
export type FoldRangeFinder = (cm: CodeMirror.Editor, pos: CodeMirror.Position) => CodeMirror.FoldRange | undefined;
|
||||||
|
|
||||||
|
export interface FoldHelpers {
|
||||||
|
combine: (...finders: FoldRangeFinder[]) => FoldRangeFinder;
|
||||||
|
auto: FoldRangeFinder;
|
||||||
|
}
|
||||||
|
|
||||||
|
declare module "../../" {
|
||||||
|
interface Editor {
|
||||||
|
/**
|
||||||
|
* Helps with code folding. Adds a foldCode method to editor instances, which will try to do a code fold starting at the given line,
|
||||||
|
* or unfold the fold that is already present.
|
||||||
|
* The method takes as first argument the position that should be folded (may be a line number or a Pos), and as second optional argument either a
|
||||||
|
* range-finder function, or an options object.
|
||||||
|
*/
|
||||||
|
foldCode: (
|
||||||
|
lineOrPos: number | Position,
|
||||||
|
rangeFindeOrFoldOptions?: FoldRangeFinder | FoldOptions,
|
||||||
|
force?: "fold" | "unfold",
|
||||||
|
) => void;
|
||||||
|
isFolded(pos: Position): boolean | undefined;
|
||||||
|
foldOption<K extends keyof FoldOptions>(option: K): FoldOptions[K];
|
||||||
|
}
|
||||||
|
|
||||||
|
interface EditorConfiguration {
|
||||||
|
foldOptions?: FoldOptions | undefined;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface FoldOptions {
|
||||||
|
/**
|
||||||
|
* The function that is used to find foldable ranges. If this is not directly passed, it will default to CodeMirror.fold.auto,
|
||||||
|
* which uses getHelpers with a "fold" type to find folding functions appropriate for the local mode.
|
||||||
|
* There are files in the addon/fold/ directory providing CodeMirror.fold.brace, which finds blocks in brace languages (JavaScript, C, Java, etc),
|
||||||
|
* CodeMirror.fold.indent, for languages where indentation determines block structure (Python, Haskell), and CodeMirror.fold.xml, for XML-style languages,
|
||||||
|
* and CodeMirror.fold.comment, for folding comment blocks.
|
||||||
|
*/
|
||||||
|
rangeFinder?: FoldRangeFinder | undefined;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The widget to show for folded ranges. Can be either a string, in which case it'll become a span with class CodeMirror-foldmarker, or a DOM node.
|
||||||
|
* To dynamically generate the widget, this can be a function that returns a string or DOM node, which will then render as described.
|
||||||
|
* The function will be invoked with parameters identifying the range to be folded.
|
||||||
|
*/
|
||||||
|
widget?: string | Element | ((from: Position, to: Position) => string | Element) | undefined;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* When true (default is false), the addon will try to find foldable ranges on the lines above the current one if there isn't an eligible one on the given line.
|
||||||
|
*/
|
||||||
|
scanUp?: boolean | undefined;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The minimum amount of lines that a fold should span to be accepted. Defaults to 0, which also allows single-line folds.
|
||||||
|
*/
|
||||||
|
minFoldSize?: number | undefined;
|
||||||
|
|
||||||
|
clearOnEnter?: boolean | undefined;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface FoldRange {
|
||||||
|
from: Position;
|
||||||
|
to: Position;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface CommandActions {
|
||||||
|
toggleFold(cm: Editor): void;
|
||||||
|
fold(cm: Editor): void;
|
||||||
|
unfold(cm: Editor): void;
|
||||||
|
foldAll(cm: Editor): void;
|
||||||
|
unfoldAll(cm: Editor): void;
|
||||||
|
}
|
||||||
|
|
||||||
|
const fold: FoldHelpers;
|
||||||
|
}
|
|
@ -0,0 +1,40 @@
|
||||||
|
// See docs https://codemirror.net/doc/manual.html#addon_foldgutter
|
||||||
|
|
||||||
|
import "../../";
|
||||||
|
|
||||||
|
declare module "../../" {
|
||||||
|
interface EditorConfiguration {
|
||||||
|
/**
|
||||||
|
* Provides an option foldGutter, which can be used to create a gutter with markers indicating the blocks that can be folded.
|
||||||
|
*/
|
||||||
|
foldGutter?: boolean | FoldGutterOptions | undefined;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface FoldRange {
|
||||||
|
from: Position;
|
||||||
|
to: Position;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface FoldGutterOptions {
|
||||||
|
/**
|
||||||
|
* The CSS class of the gutter. Defaults to "CodeMirror-foldgutter". You will have to style this yourself to give it a width (and possibly a background).
|
||||||
|
*/
|
||||||
|
gutter?: string | undefined;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A CSS class or DOM element to be used as the marker for open, foldable blocks. Defaults to "CodeMirror-foldgutter-open".
|
||||||
|
*/
|
||||||
|
indicatorOpen?: string | Element | undefined;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A CSS class or DOM element to be used as the marker for folded blocks. Defaults to "CodeMirror-foldgutter-folded".
|
||||||
|
*/
|
||||||
|
indicatorFolded?: string | Element | undefined;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The range-finder function to use when determining whether something can be folded.
|
||||||
|
* When not given, CodeMirror.fold.auto will be used as default.
|
||||||
|
*/
|
||||||
|
rangeFinder?: (cm: Editor, pos: Position) => FoldRange | undefined;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,7 @@
|
||||||
|
import "./foldcode";
|
||||||
|
|
||||||
|
declare module "./foldcode" {
|
||||||
|
interface FoldHelpers {
|
||||||
|
indent: FoldRangeFinder;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,7 @@
|
||||||
|
import "./foldcode";
|
||||||
|
|
||||||
|
declare module "./foldcode" {
|
||||||
|
interface FoldHelpers {
|
||||||
|
markdown: FoldRangeFinder;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,31 @@
|
||||||
|
import * as CodeMirror from "../../";
|
||||||
|
import "./foldcode";
|
||||||
|
|
||||||
|
export interface XmlTag {
|
||||||
|
from: CodeMirror.Position;
|
||||||
|
to: CodeMirror.Position;
|
||||||
|
tag: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
declare module "./foldcode" {
|
||||||
|
interface FoldHelpers {
|
||||||
|
xml: FoldRangeFinder;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
declare module "../../" {
|
||||||
|
function findMatchingTag(
|
||||||
|
cm: Editor,
|
||||||
|
pos: Position,
|
||||||
|
range: Range,
|
||||||
|
): { open: XmlTag; close: XmlTag | null | undefined; at: "open" | "close" } | undefined;
|
||||||
|
|
||||||
|
function findEnclosingTag(
|
||||||
|
cm: Editor,
|
||||||
|
pos: Position,
|
||||||
|
range: Range,
|
||||||
|
tag: string,
|
||||||
|
): { open: XmlTag; close: XmlTag } | undefined;
|
||||||
|
|
||||||
|
function scanForClosingTag(cm: Editor, pos: Position, name: string, end?: Position): XmlTag | null | undefined;
|
||||||
|
}
|
|
@ -0,0 +1,12 @@
|
||||||
|
import "./show-hint";
|
||||||
|
|
||||||
|
declare module "../../" {
|
||||||
|
interface HintHelpers {
|
||||||
|
anyword: HintFunction;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface ShowHintOptions {
|
||||||
|
word?: RegExp | undefined;
|
||||||
|
range?: number | undefined;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,7 @@
|
||||||
|
import "./show-hint";
|
||||||
|
|
||||||
|
declare module "../../" {
|
||||||
|
interface HintHelpers {
|
||||||
|
css: HintFunction;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,9 @@
|
||||||
|
import "./xml-hint";
|
||||||
|
|
||||||
|
declare module "../../" {
|
||||||
|
interface HintHelpers {
|
||||||
|
html: HintFunction;
|
||||||
|
}
|
||||||
|
|
||||||
|
const htmlSchema: any;
|
||||||
|
}
|
|
@ -0,0 +1,8 @@
|
||||||
|
import "./show-hint";
|
||||||
|
|
||||||
|
declare module "../../" {
|
||||||
|
interface HintHelpers {
|
||||||
|
javascript: HintFunction;
|
||||||
|
coffeescript: HintFunction;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,121 @@
|
||||||
|
import "../../";
|
||||||
|
|
||||||
|
declare module "../../" {
|
||||||
|
/**
|
||||||
|
* Provides a framework for showing autocompletion hints. Defines editor.showHint, which takes an optional
|
||||||
|
* options object, and pops up a widget that allows the user to select a completion. Finding hints is done with
|
||||||
|
* a hinting functions (the hint option), which is a function that take an editor instance and options object,
|
||||||
|
* and return a {list, from, to} object, where list is an array of strings or objects (the completions), and
|
||||||
|
* from and to give the start and end of the token that is being completed as {line, ch} objects. An optional
|
||||||
|
* selectedHint property (an integer) can be added to the completion object to control the initially selected hint.
|
||||||
|
*/
|
||||||
|
function showHint(cm: Editor, hinter?: HintFunction, options?: ShowHintOptions): void;
|
||||||
|
|
||||||
|
function on<T extends keyof CompletionEventMap>(hints: Hints, eventName: T, handler: CompletionEventMap[T]): void;
|
||||||
|
function off<T extends keyof CompletionEventMap>(hints: Hints, eventName: T, handler: CompletionEventMap[T]): void;
|
||||||
|
function signal<T extends keyof CompletionEventMap>(
|
||||||
|
hints: Hints,
|
||||||
|
eventName: T,
|
||||||
|
...args: Parameters<CompletionEventMap[T]>
|
||||||
|
): void;
|
||||||
|
|
||||||
|
interface CompletionEventMap {
|
||||||
|
shown: () => void;
|
||||||
|
select: (completion: Hint | string, element: Element) => void;
|
||||||
|
pick: (completion: Hint | string) => void;
|
||||||
|
close: () => void;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface Hints {
|
||||||
|
from: Position;
|
||||||
|
to: Position;
|
||||||
|
list: Array<Hint | string>;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Interface used by showHint.js Codemirror add-on
|
||||||
|
* When completions aren't simple strings, they should be objects with the following properties:
|
||||||
|
*/
|
||||||
|
interface Hint {
|
||||||
|
text: string;
|
||||||
|
className?: string | undefined;
|
||||||
|
displayText?: string | undefined;
|
||||||
|
from?: Position | undefined;
|
||||||
|
/** Called if a completion is picked. If provided *you* are responsible for applying the completion */
|
||||||
|
hint?: ((cm: Editor, data: Hints, cur: Hint) => void) | undefined;
|
||||||
|
render?: ((element: HTMLLIElement, data: Hints, cur: Hint) => void) | undefined;
|
||||||
|
to?: Position | undefined;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface EditorEventMap {
|
||||||
|
startCompletion: (instance: Editor) => void;
|
||||||
|
endCompletion: (instance: Editor) => void;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface Editor {
|
||||||
|
showHint(options?: ShowHintOptions): void;
|
||||||
|
closeHint(): void;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface CommandActions {
|
||||||
|
/* An extension of the existing CodeMirror typings for the autocomplete command */
|
||||||
|
autocomplete: typeof showHint;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface HintFunction {
|
||||||
|
(cm: Editor, options: ShowHintOptions): Hints | null | undefined | PromiseLike<Hints | null | undefined>;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface AsyncHintFunction {
|
||||||
|
(cm: Editor, callback: (hints: Hints | null | undefined) => void, options: ShowHintOptions): void;
|
||||||
|
async: true;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface HintFunctionResolver {
|
||||||
|
resolve(cm: Editor, post: Position): HintFunction | AsyncHintFunction;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface ShowHintOptions {
|
||||||
|
completeSingle?: boolean | undefined;
|
||||||
|
hint?: HintFunction | AsyncHintFunction | HintFunctionResolver | undefined;
|
||||||
|
alignWithWord?: boolean | undefined;
|
||||||
|
closeCharacters?: RegExp | undefined;
|
||||||
|
closeOnPick?: boolean | undefined;
|
||||||
|
closeOnUnfocus?: boolean | undefined;
|
||||||
|
updateOnCursorActivity?: boolean | undefined;
|
||||||
|
completeOnSingleClick?: boolean | undefined;
|
||||||
|
container?: HTMLElement | null | undefined;
|
||||||
|
customKeys?:
|
||||||
|
| { [key: string]: ((editor: Editor, handle: CompletionHandle) => void) | string }
|
||||||
|
| null
|
||||||
|
| undefined;
|
||||||
|
extraKeys?: { [key: string]: ((editor: Editor, handle: CompletionHandle) => void) | string } | null | undefined;
|
||||||
|
scrollMargin?: number | undefined;
|
||||||
|
paddingForScrollbar?: boolean | undefined;
|
||||||
|
moveOnOverlap?: boolean | undefined;
|
||||||
|
words?: readonly string[] | undefined; // used by fromList
|
||||||
|
}
|
||||||
|
|
||||||
|
/** The Handle used to interact with the autocomplete dialog box. */
|
||||||
|
interface CompletionHandle {
|
||||||
|
moveFocus(n: number, avoidWrap: boolean): void;
|
||||||
|
setFocus(n: number): void;
|
||||||
|
menuSize(): number;
|
||||||
|
length: number;
|
||||||
|
close(): void;
|
||||||
|
pick(): void;
|
||||||
|
data: any;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface EditorConfiguration {
|
||||||
|
showHint?: boolean | undefined;
|
||||||
|
hintOptions?: ShowHintOptions | undefined;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface HintHelpers {
|
||||||
|
auto: HintFunctionResolver;
|
||||||
|
fromList: HintFunction;
|
||||||
|
}
|
||||||
|
|
||||||
|
const hint: HintHelpers;
|
||||||
|
}
|
|
@ -0,0 +1,20 @@
|
||||||
|
import "./show-hint";
|
||||||
|
|
||||||
|
declare module "../../" {
|
||||||
|
interface HintHelpers {
|
||||||
|
sql: HintFunction;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface SqlHintTable {
|
||||||
|
columns: string[];
|
||||||
|
}
|
||||||
|
|
||||||
|
interface ShowHintOptions {
|
||||||
|
tables?:
|
||||||
|
| ReadonlyArray<string | { text: string; columns: string[] }>
|
||||||
|
| Record<string, string[] | { columns: string[] }>
|
||||||
|
| undefined;
|
||||||
|
defaultTable?: string | undefined;
|
||||||
|
disableKeywords?: boolean | undefined;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,13 @@
|
||||||
|
import "./show-hint";
|
||||||
|
|
||||||
|
declare module "../../" {
|
||||||
|
interface HintHelpers {
|
||||||
|
xml: HintFunction;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface ShowHintOptions {
|
||||||
|
schemaInfo?: any;
|
||||||
|
quoteChar?: string | undefined;
|
||||||
|
matchInMiddle?: boolean | undefined;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,7 @@
|
||||||
|
import { Linter } from "./lint";
|
||||||
|
|
||||||
|
declare module "../../" {
|
||||||
|
namespace lint {
|
||||||
|
const coffeescript: Linter<{}>;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,7 @@
|
||||||
|
import { Linter } from "./lint";
|
||||||
|
|
||||||
|
declare module "../../" {
|
||||||
|
namespace lint {
|
||||||
|
const css: Linter<any>;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,7 @@
|
||||||
|
import { Linter } from "./lint";
|
||||||
|
|
||||||
|
declare module "../../" {
|
||||||
|
namespace lint {
|
||||||
|
const html: Linter<any>;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,7 @@
|
||||||
|
import { Linter } from "./lint";
|
||||||
|
|
||||||
|
declare module "../../" {
|
||||||
|
namespace lint {
|
||||||
|
const javascript: Linter<any>;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,7 @@
|
||||||
|
import { Linter } from "./lint";
|
||||||
|
|
||||||
|
declare module "../../" {
|
||||||
|
namespace lint {
|
||||||
|
const json: Linter<{}>;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,96 @@
|
||||||
|
import * as CodeMirror from "../../";
|
||||||
|
|
||||||
|
export interface BaseLintStateOptions<T> {
|
||||||
|
/** debounce delay before linting onChange */
|
||||||
|
delay?: number | undefined;
|
||||||
|
|
||||||
|
/** callback to modify an annotation before display */
|
||||||
|
formatAnnotation?: ((annotation: Annotation) => Annotation) | undefined;
|
||||||
|
|
||||||
|
/** whether to lint onChange event */
|
||||||
|
lintOnChange?: boolean | undefined;
|
||||||
|
|
||||||
|
selfContain?: boolean | undefined;
|
||||||
|
|
||||||
|
/** callback after linter completes */
|
||||||
|
onUpdateLinting?(
|
||||||
|
annotationsNotSorted: Annotation[],
|
||||||
|
annotations: Annotation[],
|
||||||
|
codeMirror: CodeMirror.Editor,
|
||||||
|
): void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Passing rules in `options` property prevents JSHint (and other linters) from complaining
|
||||||
|
* about unrecognized rules like `onUpdateLinting`, `delay`, `lintOnChange`, etc.
|
||||||
|
*/
|
||||||
|
options?: T | undefined;
|
||||||
|
|
||||||
|
/** controls display of lint tooltips */
|
||||||
|
tooltips?: boolean | "gutter" | undefined;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface SyncLintStateOptions<T> extends BaseLintStateOptions<T> {
|
||||||
|
async?: false | undefined;
|
||||||
|
getAnnotations?: Linter<T> | undefined;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface AsyncLintStateOptions<T> extends BaseLintStateOptions<T> {
|
||||||
|
/** specifies that the lint process runs asynchronously */
|
||||||
|
async: true;
|
||||||
|
getAnnotations?: AsyncLinter<T> | undefined;
|
||||||
|
}
|
||||||
|
|
||||||
|
export type LintStateOptions<T> = SyncLintStateOptions<T> | AsyncLintStateOptions<T>;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A function that return errors found during the linting process.
|
||||||
|
*/
|
||||||
|
export interface Linter<T> {
|
||||||
|
(content: string, options: T, codeMirror: CodeMirror.Editor):
|
||||||
|
| Annotation[]
|
||||||
|
| PromiseLike<Annotation[]>;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A function that calls the updateLintingCallback with any errors found during the linting process.
|
||||||
|
*/
|
||||||
|
export interface AsyncLinter<T> {
|
||||||
|
(
|
||||||
|
content: string,
|
||||||
|
updateLintingCallback: UpdateLintingCallback,
|
||||||
|
options: T,
|
||||||
|
codeMirror: CodeMirror.Editor,
|
||||||
|
): void;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A function that, given an array of annotations, updates the CodeMirror linting GUI with those annotations
|
||||||
|
*/
|
||||||
|
export interface UpdateLintingCallback {
|
||||||
|
(annotations: Annotation[]): void;
|
||||||
|
(codeMirror: CodeMirror.Editor, annotations: Annotation[]): void;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An annotation contains a description of a lint error, detailing the location of the error within the code, the severity of the error,
|
||||||
|
* and an explaination as to why the error was thrown.
|
||||||
|
*/
|
||||||
|
export interface Annotation {
|
||||||
|
from: CodeMirror.Position;
|
||||||
|
message?: string | undefined;
|
||||||
|
severity?: string | undefined;
|
||||||
|
to?: CodeMirror.Position | undefined;
|
||||||
|
}
|
||||||
|
|
||||||
|
declare module "../../" {
|
||||||
|
interface Editor {
|
||||||
|
performLint: () => void;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface EditorConfiguration {
|
||||||
|
/** Optional lint configuration to be used in conjunction with CodeMirror's linter addon. */
|
||||||
|
lint?: boolean | LintStateOptions<any> | Linter<any> | undefined;
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace lint {}
|
||||||
|
}
|
|
@ -0,0 +1,7 @@
|
||||||
|
import { Linter } from "./lint";
|
||||||
|
|
||||||
|
declare module "../../" {
|
||||||
|
namespace lint {
|
||||||
|
const yaml: Linter<{}>;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,137 @@
|
||||||
|
import * as CodeMirror from "../../";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tracks changes in chunks from original to new.
|
||||||
|
*/
|
||||||
|
export interface MergeViewDiffChunk {
|
||||||
|
editFrom: number;
|
||||||
|
editTo: number;
|
||||||
|
origFrom: number;
|
||||||
|
origTo: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface DiffView {
|
||||||
|
/**
|
||||||
|
* Forces the view to reload.
|
||||||
|
*/
|
||||||
|
forceUpdate(): (mode: string) => void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets whether or not the merge view should show the differences between the editor views.
|
||||||
|
*/
|
||||||
|
setShowDifferences(showDifferences: boolean): void;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface MergeView {
|
||||||
|
/**
|
||||||
|
* Returns the editor instance.
|
||||||
|
*/
|
||||||
|
editor(): CodeMirror.Editor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Left side of the merge view.
|
||||||
|
*/
|
||||||
|
left?: DiffView | undefined;
|
||||||
|
leftChunks(): MergeViewDiffChunk[] | undefined;
|
||||||
|
leftOriginal(): CodeMirror.Editor | undefined;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Right side of the merge view.
|
||||||
|
*/
|
||||||
|
right?: DiffView | undefined;
|
||||||
|
rightChunks(): MergeViewDiffChunk[] | undefined;
|
||||||
|
rightOriginal(): CodeMirror.Editor | undefined;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets whether or not the merge view should show the differences between the editor views.
|
||||||
|
*/
|
||||||
|
setShowDifferences(showDifferences: boolean): void;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface MergeViewConstructor {
|
||||||
|
new(element: HTMLElement, options?: MergeViewConfiguration): MergeView;
|
||||||
|
(element: HTMLElement, options?: MergeViewConfiguration): MergeView;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Options available to MergeView.
|
||||||
|
*/
|
||||||
|
export interface MergeViewConfiguration extends CodeMirror.EditorConfiguration {
|
||||||
|
/**
|
||||||
|
* Determines whether the original editor allows editing. Defaults to false.
|
||||||
|
*/
|
||||||
|
allowEditingOriginals?: boolean | undefined;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* When true stretches of unchanged text will be collapsed. When a number is given, this indicates the amount
|
||||||
|
* of lines to leave visible around such stretches (which defaults to 2). Defaults to false.
|
||||||
|
*/
|
||||||
|
collapseIdentical?: boolean | number | undefined;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the style used to connect changed chunks of code. By default, connectors are drawn. When this is set to "align",
|
||||||
|
* the smaller chunk is padded to align with the bigger chunk instead.
|
||||||
|
*/
|
||||||
|
connect?: string | undefined;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Callback for when stretches of unchanged text are collapsed.
|
||||||
|
*/
|
||||||
|
onCollapse?(
|
||||||
|
mergeView: MergeView,
|
||||||
|
line: number,
|
||||||
|
size: number,
|
||||||
|
mark: CodeMirror.TextMarker<CodeMirror.MarkerRange>,
|
||||||
|
): void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Provides original version of the document to be shown on the right of the editor.
|
||||||
|
*/
|
||||||
|
orig?: string | undefined;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Provides original version of the document to be shown on the left of the editor.
|
||||||
|
* To create a 2-way (as opposed to 3-way) merge view, provide only one of origLeft and origRight.
|
||||||
|
*/
|
||||||
|
origLeft?: string | undefined;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Provides original version of document to be shown on the right of the editor.
|
||||||
|
* To create a 2-way (as opposed to 3-way) merge view, provide only one of origLeft and origRight.
|
||||||
|
*/
|
||||||
|
origRight?: string | undefined;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determines whether buttons that allow the user to revert changes are shown. Defaults to true.
|
||||||
|
*/
|
||||||
|
revertButtons?: boolean | undefined;
|
||||||
|
|
||||||
|
revertChunk?:
|
||||||
|
| ((
|
||||||
|
mv: MergeView,
|
||||||
|
from: CodeMirror.Editor,
|
||||||
|
fromStart: CodeMirror.Position,
|
||||||
|
fromEnd: CodeMirror.Position,
|
||||||
|
to: CodeMirror.Editor,
|
||||||
|
toStart: CodeMirror.Position,
|
||||||
|
toEnd: CodeMirror.Position,
|
||||||
|
) => void)
|
||||||
|
| undefined;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* When true, changed pieces of text are highlighted. Defaults to true.
|
||||||
|
*/
|
||||||
|
showDifferences?: boolean | undefined;
|
||||||
|
}
|
||||||
|
|
||||||
|
declare module "../../" {
|
||||||
|
const MergeView: MergeViewConstructor;
|
||||||
|
|
||||||
|
interface CommandActions {
|
||||||
|
/** Move cursor to the next diff */
|
||||||
|
goNextDiff(cm: Editor): void;
|
||||||
|
|
||||||
|
/** Move cursor to the previous diff */
|
||||||
|
goPrevDiff(cm: Editor): void;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,14 @@
|
||||||
|
import "../../";
|
||||||
|
|
||||||
|
export interface RequireModeOptions {
|
||||||
|
path?(mode: string): string;
|
||||||
|
loadMode?(file: string, callback: () => void): void;
|
||||||
|
}
|
||||||
|
|
||||||
|
declare module "../../" {
|
||||||
|
let modeURL: string;
|
||||||
|
|
||||||
|
function requireMode(mode: string | { name: string }, callback: () => void, options?: RequireModeOptions): void;
|
||||||
|
|
||||||
|
function autoLoadMode(instance: Editor, mode: string, options?: RequireModeOptions): void;
|
||||||
|
}
|
|
@ -0,0 +1,29 @@
|
||||||
|
import * as CodeMirror from "../../";
|
||||||
|
|
||||||
|
export interface MultiplexedInnerMode {
|
||||||
|
open: string;
|
||||||
|
close: string;
|
||||||
|
mode: CodeMirror.Mode<any>;
|
||||||
|
parseDelimiters?: boolean | undefined;
|
||||||
|
delimStyle?: string | undefined;
|
||||||
|
innerStyle?: string | undefined;
|
||||||
|
}
|
||||||
|
|
||||||
|
declare module "../../" {
|
||||||
|
/**
|
||||||
|
* Mode combinator that can be used to easily 'multiplex' between several modes.
|
||||||
|
* When given as first argument a mode object, and as other arguments any number of
|
||||||
|
* {open, close, mode [, delimStyle, innerStyle, parseDelimiters]} objects, it will return a mode object that starts parsing
|
||||||
|
* using the mode passed as first argument, but will switch to another mode as soon as it encounters a string that occurs in
|
||||||
|
* one of the open fields of the passed objects. When in a sub-mode, it will go back to the top mode again when the close
|
||||||
|
* string is encountered. Pass "\n" for open or close if you want to switch on a blank line.
|
||||||
|
*
|
||||||
|
* When delimStyle is specified, it will be the token style returned for the delimiter tokens (as well as [delimStyle]-open on
|
||||||
|
* the opening token and [delimStyle]-close on the closing token).
|
||||||
|
* When innerStyle is specified, it will be the token style added for each inner mode token.
|
||||||
|
* When parseDelimiters is true, the content of the delimiters will also be passed to the inner mode. (And delimStyle is ignored.)
|
||||||
|
*
|
||||||
|
* The outer mode will not see the content between the delimiters.
|
||||||
|
*/
|
||||||
|
function multiplexingMode(outer: Mode<any>, ...others: MultiplexedInnerMode[]): Mode<any>;
|
||||||
|
}
|
|
@ -0,0 +1,9 @@
|
||||||
|
import "../../";
|
||||||
|
|
||||||
|
declare module "../../" {
|
||||||
|
/**
|
||||||
|
* Mode combinator that can be used to extend a mode with an 'overlay' — a secondary mode is run over the stream,
|
||||||
|
* along with the base mode, and can color specific pieces of text without interfering with the base mode.
|
||||||
|
*/
|
||||||
|
function overlayMode(base: Mode<any>, overlay: Mode<any>, combine?: boolean): Mode<any>;
|
||||||
|
}
|
|
@ -0,0 +1,27 @@
|
||||||
|
import "../../";
|
||||||
|
|
||||||
|
declare module "../../" {
|
||||||
|
// Based on https://codemirror.net/demo/simplemode.html
|
||||||
|
interface Rule {
|
||||||
|
regex?: string | RegExp | undefined;
|
||||||
|
token?: string | string[] | null | undefined;
|
||||||
|
sol?: boolean | undefined;
|
||||||
|
next?: string | undefined;
|
||||||
|
push?: string | undefined;
|
||||||
|
pop?: boolean | undefined;
|
||||||
|
mode?: {
|
||||||
|
spec: string | ModeSpec<any>;
|
||||||
|
end?: RegExp | undefined;
|
||||||
|
persistent?: boolean | undefined;
|
||||||
|
} | undefined;
|
||||||
|
indent?: boolean | undefined;
|
||||||
|
dedent?: boolean | undefined;
|
||||||
|
dedentIfLineStart?: boolean | undefined;
|
||||||
|
}
|
||||||
|
|
||||||
|
function defineSimpleMode<K extends string>(
|
||||||
|
name: string,
|
||||||
|
// eslint-disable-next-line @definitelytyped/no-unnecessary-generics
|
||||||
|
mode: { [P in K]: P extends "meta" ? Record<string, any> : Rule[] } & { start: Rule[] },
|
||||||
|
): void;
|
||||||
|
}
|
|
@ -0,0 +1,12 @@
|
||||||
|
import "../../";
|
||||||
|
|
||||||
|
declare module "../../" {
|
||||||
|
/**
|
||||||
|
* Provides a convenient way to syntax-highlight code snippets in a webpage. Depends on the runmode addon (or its standalone variant).
|
||||||
|
* Can be called with an array (or other array-ish collection) of DOM nodes that represent the code snippets. By default, it'll get all pre tags.
|
||||||
|
* Will read the data-lang attribute of these nodes to figure out their language, and syntax-color their content using the relevant CodeMirror
|
||||||
|
* mode (you'll have to load the scripts for the relevant modes yourself).
|
||||||
|
* A second argument may be provided to give a default mode, used when no language attribute is found for a node.
|
||||||
|
*/
|
||||||
|
function colorize(collection?: ArrayLike<Element>, defaultMode?: string): void;
|
||||||
|
}
|
|
@ -0,0 +1,23 @@
|
||||||
|
import "../../";
|
||||||
|
|
||||||
|
declare module "../../" {
|
||||||
|
/**
|
||||||
|
* Runs a CodeMirror mode over text without opening an editor instance.
|
||||||
|
*
|
||||||
|
* @param text The document to run through the highlighter.
|
||||||
|
* @param mode The mode to use (must be loaded as normal).
|
||||||
|
* @param callback If this is a function, it will be called for each token with
|
||||||
|
* five arguments, the token's text, the token's style class (may be null for unstyled tokens),
|
||||||
|
* the number of row of the token, the column position of token and the state of mode.
|
||||||
|
* If it is a DOM node, the tokens will be converted to span elements as in an editor,
|
||||||
|
* and inserted into the node (through innerHTML).
|
||||||
|
*/
|
||||||
|
function runMode(
|
||||||
|
text: string,
|
||||||
|
mode: string | ModeSpec<unknown>,
|
||||||
|
callback:
|
||||||
|
| HTMLElement
|
||||||
|
| ((text: string, style?: string | null, row?: number, column?: number, state?: any) => void),
|
||||||
|
options?: { tabSize?: number | undefined; state?: any },
|
||||||
|
): void;
|
||||||
|
}
|
26
node_modules/@types/codemirror/addon/scroll/annotatescrollbar.d.ts
generated
vendored
Normal file
26
node_modules/@types/codemirror/addon/scroll/annotatescrollbar.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
import * as CodeMirror from "../..";
|
||||||
|
import "./searchcursor";
|
||||||
|
|
||||||
|
export interface Annotation {
|
||||||
|
clear(): void;
|
||||||
|
/**
|
||||||
|
* Updates the ranges to be highlighted. The array must be sorted.
|
||||||
|
*/
|
||||||
|
update(annotations: Array<{ from: CodeMirror.Position; to: CodeMirror.Position }>): void;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface AnnotateScrollbarOptions {
|
||||||
|
className: string;
|
||||||
|
scrollButtonHeight?: number | undefined;
|
||||||
|
listenForChanges?: boolean | undefined;
|
||||||
|
}
|
||||||
|
|
||||||
|
declare module "../../" {
|
||||||
|
interface Editor {
|
||||||
|
annotateScrollbar(options: string | AnnotateScrollbarOptions): Annotation;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface EditorConfiguration {
|
||||||
|
scrollButtonHeight?: number | undefined;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,10 @@
|
||||||
|
import "../../";
|
||||||
|
|
||||||
|
declare module "../../" {
|
||||||
|
interface EditorConfiguration {
|
||||||
|
/**
|
||||||
|
* When the end of the file is reached it allows you to keep scrolling so that your last few lines of code are not stuck at the bottom of the editor.
|
||||||
|
*/
|
||||||
|
scrollPastEnd?: boolean | undefined;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,8 @@
|
||||||
|
import "../../";
|
||||||
|
|
||||||
|
declare module "../../" {
|
||||||
|
interface ScrollbarModels {
|
||||||
|
simple: ScrollbarModelConstructor;
|
||||||
|
overlay: ScrollbarModelConstructor;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,14 @@
|
||||||
|
import "../..";
|
||||||
|
import "../dialog/dialog";
|
||||||
|
|
||||||
|
declare module "../../" {
|
||||||
|
interface CommandActions {
|
||||||
|
jumpToLine(cm: Editor): void;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface EditorConfiguration {
|
||||||
|
search?: {
|
||||||
|
bottom: boolean;
|
||||||
|
} | undefined;
|
||||||
|
}
|
||||||
|
}
|
50
node_modules/@types/codemirror/addon/search/match-highlighter.d.ts
generated
vendored
Normal file
50
node_modules/@types/codemirror/addon/search/match-highlighter.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,50 @@
|
||||||
|
// See docs https://codemirror.net/doc/manual.html#addon_match-highlighter
|
||||||
|
|
||||||
|
import "../../";
|
||||||
|
|
||||||
|
declare module "../../" {
|
||||||
|
interface HighlightSelectionMatches {
|
||||||
|
/**
|
||||||
|
* Minimum amount of selected characters that triggers a highlight (default 2).
|
||||||
|
*/
|
||||||
|
minChars?: number | undefined;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The style to be used to highlight the matches (default "matchhighlight", which will correspond to CSS class cm-matchhighlight).
|
||||||
|
*/
|
||||||
|
style?: string | undefined;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Controls whether whitespace is trimmed from the selection.
|
||||||
|
*/
|
||||||
|
trim?: boolean | undefined;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Can be set to true or to a regexp matching the characters that make up a word.
|
||||||
|
*/
|
||||||
|
showToken?: boolean | RegExp | undefined;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Used to specify how much time to wait, in milliseconds, before highlighting the matches (default is 100).
|
||||||
|
*/
|
||||||
|
delay?: number | undefined;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* If wordsOnly is enabled, the matches will be highlighted only if the selected text is a word.
|
||||||
|
*/
|
||||||
|
wordsOnly?: boolean | undefined;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* If annotateScrollbar is enabled, the occurences will be highlighted on the scrollbar via the matchesonscrollbar addon.
|
||||||
|
*/
|
||||||
|
annotateScrollbar?: boolean | undefined;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface EditorConfiguration {
|
||||||
|
/**
|
||||||
|
* Adds a highlightSelectionMatches option that can be enabled to highlight all instances of a currently selected word.
|
||||||
|
* When enabled, it causes the current word to be highlighted when nothing is selected (defaults to off).
|
||||||
|
*/
|
||||||
|
highlightSelectionMatches?: HighlightSelectionMatches | boolean | undefined;
|
||||||
|
}
|
||||||
|
}
|
12
node_modules/@types/codemirror/addon/search/matchesonscrollbar.d.ts
generated
vendored
Normal file
12
node_modules/@types/codemirror/addon/search/matchesonscrollbar.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
import "../..";
|
||||||
|
import "./searchcursor";
|
||||||
|
|
||||||
|
export interface SearchAnnotation {
|
||||||
|
clear(): void;
|
||||||
|
}
|
||||||
|
|
||||||
|
declare module "../../" {
|
||||||
|
interface Editor {
|
||||||
|
showMatchesOnScrollbar(query: string | RegExp, caseFold?: boolean, className?: string): SearchAnnotation;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,23 @@
|
||||||
|
import "../../";
|
||||||
|
import "./searchcursor";
|
||||||
|
import "../dialog/dialog";
|
||||||
|
|
||||||
|
declare module "../../" {
|
||||||
|
interface CommandActions {
|
||||||
|
find(cm: Editor): void;
|
||||||
|
findPersistent(cm: Editor): void;
|
||||||
|
findPersistentNext(cm: Editor): void;
|
||||||
|
findPersistentPrev(cm: Editor): void;
|
||||||
|
findNext(cm: Editor): void;
|
||||||
|
findPrev(cm: Editor): void;
|
||||||
|
clearSearch(cm: Editor): void;
|
||||||
|
replace(cm: Editor): void;
|
||||||
|
replaceAll(cm: Editor): void;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface EditorConfiguration {
|
||||||
|
search?: {
|
||||||
|
bottom: boolean;
|
||||||
|
} | undefined;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,53 @@
|
||||||
|
import "../../";
|
||||||
|
|
||||||
|
declare module "../../" {
|
||||||
|
interface DocOrEditor {
|
||||||
|
/**
|
||||||
|
* This method can be used to implement search/replace functionality.
|
||||||
|
* `query`: This can be a regular * expression or a string (only strings will match across lines -
|
||||||
|
* if they contain newlines).
|
||||||
|
* `start`: This provides the starting position of the search. It can be a `{line, ch} object,
|
||||||
|
* or can be left off to default to the start of the document
|
||||||
|
* `caseFold`: This is only relevant when matching a string. IT will cause the search to be case-insenstive
|
||||||
|
*/
|
||||||
|
getSearchCursor(query: string | RegExp, start?: Position, caseFold?: boolean): SearchCursor;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface SearchCursor {
|
||||||
|
/**
|
||||||
|
* Searches forward or backward from the current position. The return value indicates whether a match was
|
||||||
|
* found. If matching a regular expression, the return value will be the array returned by the match method, in case
|
||||||
|
* you want to extract matched groups
|
||||||
|
*/
|
||||||
|
find(reverse: boolean): boolean | RegExpMatchArray;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Searches forward from the current position. The return value indicates whether a match was
|
||||||
|
* found. If matching a regular expression, the return value will be the array returned by the match method, in case
|
||||||
|
* you want to extract matched groups
|
||||||
|
*/
|
||||||
|
findNext(): boolean | RegExpMatchArray;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Searches backward from the current position. The return value indicates whether a match was
|
||||||
|
* found. If matching a regular expression, the return value will be the array returned by the match method, in case
|
||||||
|
* you want to extract matched groups
|
||||||
|
*/
|
||||||
|
findPrevious(): boolean | RegExpMatchArray;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Only valid when the last call to find, findNext, or findPrevious did not return false. Returns {line, ch}
|
||||||
|
* objects pointing the start of the match.
|
||||||
|
*/
|
||||||
|
from(): Position;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Only valid when the last call to find, findNext, or findPrevious did not return false. Returns {line, ch}
|
||||||
|
* objects pointing the end of the match.
|
||||||
|
*/
|
||||||
|
to(): Position;
|
||||||
|
|
||||||
|
/** Replaces the currently found match with the given text and adjusts the cursor position to reflect the deplacement. */
|
||||||
|
replace(text: string, origin?: string): void;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,18 @@
|
||||||
|
import "../../";
|
||||||
|
|
||||||
|
declare module "../../" {
|
||||||
|
interface StyleActiveLine {
|
||||||
|
/**
|
||||||
|
* Controls whether single-line selections, or just cursor selections, are styled. Defaults to false (only cursor selections).
|
||||||
|
*/
|
||||||
|
nonEmpty: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface EditorConfiguration {
|
||||||
|
/**
|
||||||
|
* When enabled gives the wrapper of the line that contains the cursor the class CodeMirror-activeline,
|
||||||
|
* adds a background with the class CodeMirror-activeline-background, and adds the class CodeMirror-activeline-gutter to the line's gutter space is enabled.
|
||||||
|
*/
|
||||||
|
styleActiveLine?: StyleActiveLine | boolean | undefined;
|
||||||
|
}
|
||||||
|
}
|
11
node_modules/@types/codemirror/addon/selection/mark-selection.d.ts
generated
vendored
Normal file
11
node_modules/@types/codemirror/addon/selection/mark-selection.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
import "../../";
|
||||||
|
|
||||||
|
declare module "../../" {
|
||||||
|
interface EditorConfiguration {
|
||||||
|
/**
|
||||||
|
* Causes the selected text to be marked with the CSS class CodeMirror-selectedtext or a custom class when the styleSelectedText option is enabled.
|
||||||
|
* Useful to change the colour of the selection (in addition to the background).
|
||||||
|
*/
|
||||||
|
styleSelectedText?: boolean | string | undefined;
|
||||||
|
}
|
||||||
|
}
|
11
node_modules/@types/codemirror/addon/selection/selection-pointer.d.ts
generated
vendored
Normal file
11
node_modules/@types/codemirror/addon/selection/selection-pointer.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
import "../../";
|
||||||
|
|
||||||
|
declare module "../../" {
|
||||||
|
interface EditorConfiguration {
|
||||||
|
/**
|
||||||
|
* Controls the mouse cursor appearance when hovering over the selection. It can be set to a string, like "pointer", or to true,
|
||||||
|
* in which case the "default" (arrow) cursor will be used.
|
||||||
|
*/
|
||||||
|
selectionPointer?: boolean | string | undefined;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,105 @@
|
||||||
|
// See docs https://codemirror.net/doc/manual.html#addon_tern and https://codemirror.net/addon/tern/tern.js (comments in the beginning of the file)
|
||||||
|
// Docs for tern itself might also be helpful: http://ternjs.net/doc/manual.html
|
||||||
|
|
||||||
|
import * as Tern from "tern";
|
||||||
|
import "../../";
|
||||||
|
|
||||||
|
declare module "../../" {
|
||||||
|
class TernServer {
|
||||||
|
constructor(options?: TernOptions);
|
||||||
|
|
||||||
|
readonly options: TernOptions;
|
||||||
|
readonly docs: {
|
||||||
|
readonly [key: string]: {
|
||||||
|
doc: Doc;
|
||||||
|
name: string;
|
||||||
|
changed: {
|
||||||
|
from: number;
|
||||||
|
to: number;
|
||||||
|
} | null;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
readonly server: Tern.Server;
|
||||||
|
addDoc(
|
||||||
|
name: string,
|
||||||
|
doc: Doc,
|
||||||
|
): { doc: Doc; name: string; changed: { from: number; to: number } | null };
|
||||||
|
delDoc(id: string | Editor | Doc): void;
|
||||||
|
hideDoc(id: string | Editor | Doc): void;
|
||||||
|
complete(cm: Editor): void;
|
||||||
|
showType(cm: Editor, pos?: Position, callback?: () => void): void;
|
||||||
|
showDocs(cm: Editor, pos?: Position, callback?: () => void): void;
|
||||||
|
updateArgHints(cm: Editor): void;
|
||||||
|
jumpToDef(cm: Editor): void;
|
||||||
|
jumpBack(cm: Editor): void;
|
||||||
|
rename(cm: Editor): void;
|
||||||
|
selectName(cm: Editor): void;
|
||||||
|
request<Q extends Tern.Query>(
|
||||||
|
cm: Doc,
|
||||||
|
query: Q,
|
||||||
|
callback: (error?: Error, data?: Tern.QueryResult<Q>) => void,
|
||||||
|
pos?: Position,
|
||||||
|
): void;
|
||||||
|
request<Q extends Tern.Query["type"]>(
|
||||||
|
cm: Doc,
|
||||||
|
query: Q,
|
||||||
|
callback: (error?: Error, data?: Tern.QueryRegistry[Q]["result"]) => void,
|
||||||
|
pos?: Position,
|
||||||
|
): void;
|
||||||
|
destroy(): void;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface TernOptions {
|
||||||
|
/** An object mapping plugin names to configuration options. */
|
||||||
|
plugins?: Tern.ConstructorOptions["plugins"] | undefined;
|
||||||
|
/** An array of JSON definition data structures. */
|
||||||
|
defs?: Tern.Def[] | undefined;
|
||||||
|
/**
|
||||||
|
* Can be used to access files in
|
||||||
|
* the project that haven't been loaded yet. Simply do callback(null) to
|
||||||
|
* indicate that a file is not available.
|
||||||
|
*/
|
||||||
|
getFile?(name: string, callback: (docValue: string | null) => any): any;
|
||||||
|
/**
|
||||||
|
* This function will be applied
|
||||||
|
* to documents before passing them on to Tern.
|
||||||
|
*/
|
||||||
|
fileFilter?(value: string, docName: string, doc: Doc): string;
|
||||||
|
/** This function should, when providing a multi-file view, switch the view or focus to the named file. */
|
||||||
|
switchToDoc?(name: string, doc: Doc): void;
|
||||||
|
/** Can be used to override the way errors are displayed. */
|
||||||
|
showError?(editor: Editor, message: Error | string): void;
|
||||||
|
/**
|
||||||
|
* Customize the content in tooltips for completions.
|
||||||
|
* Is passed a single argument — the completion's data as returned by
|
||||||
|
* Tern — and may return a string, DOM node, or null to indicate that
|
||||||
|
* no tip should be shown. By default the docstring is shown.
|
||||||
|
*/
|
||||||
|
completionTip?(data: Tern.CompletionsQueryResult): string | HTMLElement | null;
|
||||||
|
/** Like completionTip, but for the tooltips shown for type queries. */
|
||||||
|
typeTip?(data: Tern.TypeQueryResult): string | HTMLElement | null;
|
||||||
|
/** This function will be applied to the Tern responses before treating them */
|
||||||
|
responseFilter?<Q extends Tern.Query>(
|
||||||
|
doc: Doc,
|
||||||
|
query: Q,
|
||||||
|
request: Tern.Document,
|
||||||
|
error: Error | undefined,
|
||||||
|
data: Tern.QueryResult<Q> | undefined,
|
||||||
|
): Tern.QueryResult<Q> | undefined;
|
||||||
|
/**
|
||||||
|
* Set to true to enable web worker mode. You'll probably
|
||||||
|
* want to feature detect the actual value you use here, for example
|
||||||
|
* !!window.Worker.
|
||||||
|
*/
|
||||||
|
useWorker?: boolean | undefined;
|
||||||
|
/** The main script of the worker. Point this to wherever you are hosting worker.js from this directory. */
|
||||||
|
workerScript?: string | undefined;
|
||||||
|
/**
|
||||||
|
* An array of paths pointing (relative to workerScript)
|
||||||
|
* to the Acorn and Tern libraries and any Tern plugins you want to
|
||||||
|
* load. Or, if you minified those into a single script and included
|
||||||
|
* them in the workerScript, simply leave this undefined.
|
||||||
|
*/
|
||||||
|
workerDeps?: string[] | undefined;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,25 @@
|
||||||
|
import "../../";
|
||||||
|
|
||||||
|
export interface HardwrapOptions {
|
||||||
|
column?: number | undefined;
|
||||||
|
paragraphStart?: RegExp | undefined;
|
||||||
|
paragraphEnd?: RegExp | undefined;
|
||||||
|
wrapOn?: RegExp | undefined;
|
||||||
|
killTrailingSpace?: boolean | undefined;
|
||||||
|
forceBreak?: boolean | undefined;
|
||||||
|
}
|
||||||
|
|
||||||
|
declare module "../../" {
|
||||||
|
interface CommandActions {
|
||||||
|
wrapLines(cm: Editor): void;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface Editor {
|
||||||
|
/** Wraps the paragraph at the given position. If pos is not given, it defaults to the cursor position. */
|
||||||
|
wrapParagraph(pos?: Position, options?: HardwrapOptions): void;
|
||||||
|
/** Wraps the given range as one big paragraph. */
|
||||||
|
wrapRange(from: Position, to: Position, options?: HardwrapOptions): void;
|
||||||
|
/** Wraps the paragraphs in (and overlapping with) the given range individually. */
|
||||||
|
wrapParagraphsInRange(from: Position, to: Position, options?: HardwrapOptions): void;
|
||||||
|
}
|
||||||
|
}
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,19 @@
|
||||||
|
import "../";
|
||||||
|
|
||||||
|
export interface ModeInfo {
|
||||||
|
name: string;
|
||||||
|
mime?: string | undefined;
|
||||||
|
mimes?: string[] | undefined;
|
||||||
|
mode: string;
|
||||||
|
file?: RegExp | undefined;
|
||||||
|
ext?: string[] | undefined;
|
||||||
|
alias?: string[] | undefined;
|
||||||
|
}
|
||||||
|
|
||||||
|
declare module "../" {
|
||||||
|
const modeInfo: ModeInfo[];
|
||||||
|
function findModeByMIME(mime: string): ModeInfo | undefined;
|
||||||
|
function findModeByExtension(ext: string): ModeInfo | undefined;
|
||||||
|
function findModeByFileName(filename: string): ModeInfo | undefined;
|
||||||
|
function findModeByName(name: string): ModeInfo | undefined;
|
||||||
|
}
|
|
@ -0,0 +1,77 @@
|
||||||
|
{
|
||||||
|
"name": "@types/codemirror",
|
||||||
|
"version": "5.60.15",
|
||||||
|
"description": "TypeScript definitions for codemirror",
|
||||||
|
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/codemirror",
|
||||||
|
"license": "MIT",
|
||||||
|
"contributors": [
|
||||||
|
{
|
||||||
|
"name": "mihailik",
|
||||||
|
"githubUsername": "mihailik",
|
||||||
|
"url": "https://github.com/mihailik"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "nrbernard",
|
||||||
|
"githubUsername": "nrbernard",
|
||||||
|
"url": "https://github.com/nrbernard"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Pr1st0n",
|
||||||
|
"githubUsername": "Pr1st0n",
|
||||||
|
"url": "https://github.com/Pr1st0n"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "rileymiller",
|
||||||
|
"githubUsername": "rileymiller",
|
||||||
|
"url": "https://github.com/rileymiller"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "toddself",
|
||||||
|
"githubUsername": "toddself",
|
||||||
|
"url": "https://github.com/toddself"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "ysulyma",
|
||||||
|
"githubUsername": "ysulyma",
|
||||||
|
"url": "https://github.com/ysulyma"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "azoson",
|
||||||
|
"githubUsername": "azoson",
|
||||||
|
"url": "https://github.com/azoson"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "kylesferrazza",
|
||||||
|
"githubUsername": "kylesferrazza",
|
||||||
|
"url": "https://github.com/kylesferrazza"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "fityocsaba96",
|
||||||
|
"githubUsername": "fityocsaba96",
|
||||||
|
"url": "https://github.com/fityocsaba96"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "koddsson",
|
||||||
|
"githubUsername": "koddsson",
|
||||||
|
"url": "https://github.com/koddsson"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "ficristo",
|
||||||
|
"githubUsername": "ficristo",
|
||||||
|
"url": "https://github.com/ficristo"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"main": "",
|
||||||
|
"types": "index.d.ts",
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git",
|
||||||
|
"directory": "types/codemirror"
|
||||||
|
},
|
||||||
|
"scripts": {},
|
||||||
|
"dependencies": {
|
||||||
|
"@types/tern": "*"
|
||||||
|
},
|
||||||
|
"typesPublisherContentHash": "54e0c0ddc3a9697697700c91f38c2b02a1b34c09f84a5c7e8795d9f5b92618c2",
|
||||||
|
"typeScriptVersion": "5.0"
|
||||||
|
}
|
|
@ -0,0 +1,21 @@
|
||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) Microsoft Corporation.
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE
|
|
@ -0,0 +1,15 @@
|
||||||
|
# Installation
|
||||||
|
> `npm install --save @types/estree`
|
||||||
|
|
||||||
|
# Summary
|
||||||
|
This package contains type definitions for estree (https://github.com/estree/estree).
|
||||||
|
|
||||||
|
# Details
|
||||||
|
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/estree.
|
||||||
|
|
||||||
|
### Additional Details
|
||||||
|
* Last updated: Mon, 06 Nov 2023 22:41:05 GMT
|
||||||
|
* Dependencies: none
|
||||||
|
|
||||||
|
# Credits
|
||||||
|
These definitions were written by [RReverser](https://github.com/RReverser).
|
|
@ -0,0 +1,167 @@
|
||||||
|
declare namespace ESTree {
|
||||||
|
interface FlowTypeAnnotation extends Node {}
|
||||||
|
|
||||||
|
interface FlowBaseTypeAnnotation extends FlowTypeAnnotation {}
|
||||||
|
|
||||||
|
interface FlowLiteralTypeAnnotation extends FlowTypeAnnotation, Literal {}
|
||||||
|
|
||||||
|
interface FlowDeclaration extends Declaration {}
|
||||||
|
|
||||||
|
interface AnyTypeAnnotation extends FlowBaseTypeAnnotation {}
|
||||||
|
|
||||||
|
interface ArrayTypeAnnotation extends FlowTypeAnnotation {
|
||||||
|
elementType: FlowTypeAnnotation;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface BooleanLiteralTypeAnnotation extends FlowLiteralTypeAnnotation {}
|
||||||
|
|
||||||
|
interface BooleanTypeAnnotation extends FlowBaseTypeAnnotation {}
|
||||||
|
|
||||||
|
interface ClassImplements extends Node {
|
||||||
|
id: Identifier;
|
||||||
|
typeParameters?: TypeParameterInstantiation | null;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface ClassProperty {
|
||||||
|
key: Expression;
|
||||||
|
value?: Expression | null;
|
||||||
|
typeAnnotation?: TypeAnnotation | null;
|
||||||
|
computed: boolean;
|
||||||
|
static: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface DeclareClass extends FlowDeclaration {
|
||||||
|
id: Identifier;
|
||||||
|
typeParameters?: TypeParameterDeclaration | null;
|
||||||
|
body: ObjectTypeAnnotation;
|
||||||
|
extends: InterfaceExtends[];
|
||||||
|
}
|
||||||
|
|
||||||
|
interface DeclareFunction extends FlowDeclaration {
|
||||||
|
id: Identifier;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface DeclareModule extends FlowDeclaration {
|
||||||
|
id: Literal | Identifier;
|
||||||
|
body: BlockStatement;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface DeclareVariable extends FlowDeclaration {
|
||||||
|
id: Identifier;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface FunctionTypeAnnotation extends FlowTypeAnnotation {
|
||||||
|
params: FunctionTypeParam[];
|
||||||
|
returnType: FlowTypeAnnotation;
|
||||||
|
rest?: FunctionTypeParam | null;
|
||||||
|
typeParameters?: TypeParameterDeclaration | null;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface FunctionTypeParam {
|
||||||
|
name: Identifier;
|
||||||
|
typeAnnotation: FlowTypeAnnotation;
|
||||||
|
optional: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface GenericTypeAnnotation extends FlowTypeAnnotation {
|
||||||
|
id: Identifier | QualifiedTypeIdentifier;
|
||||||
|
typeParameters?: TypeParameterInstantiation | null;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface InterfaceExtends extends Node {
|
||||||
|
id: Identifier | QualifiedTypeIdentifier;
|
||||||
|
typeParameters?: TypeParameterInstantiation | null;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface InterfaceDeclaration extends FlowDeclaration {
|
||||||
|
id: Identifier;
|
||||||
|
typeParameters?: TypeParameterDeclaration | null;
|
||||||
|
extends: InterfaceExtends[];
|
||||||
|
body: ObjectTypeAnnotation;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface IntersectionTypeAnnotation extends FlowTypeAnnotation {
|
||||||
|
types: FlowTypeAnnotation[];
|
||||||
|
}
|
||||||
|
|
||||||
|
interface MixedTypeAnnotation extends FlowBaseTypeAnnotation {}
|
||||||
|
|
||||||
|
interface NullableTypeAnnotation extends FlowTypeAnnotation {
|
||||||
|
typeAnnotation: TypeAnnotation;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface NumberLiteralTypeAnnotation extends FlowLiteralTypeAnnotation {}
|
||||||
|
|
||||||
|
interface NumberTypeAnnotation extends FlowBaseTypeAnnotation {}
|
||||||
|
|
||||||
|
interface StringLiteralTypeAnnotation extends FlowLiteralTypeAnnotation {}
|
||||||
|
|
||||||
|
interface StringTypeAnnotation extends FlowBaseTypeAnnotation {}
|
||||||
|
|
||||||
|
interface TupleTypeAnnotation extends FlowTypeAnnotation {
|
||||||
|
types: FlowTypeAnnotation[];
|
||||||
|
}
|
||||||
|
|
||||||
|
interface TypeofTypeAnnotation extends FlowTypeAnnotation {
|
||||||
|
argument: FlowTypeAnnotation;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface TypeAlias extends FlowDeclaration {
|
||||||
|
id: Identifier;
|
||||||
|
typeParameters?: TypeParameterDeclaration | null;
|
||||||
|
right: FlowTypeAnnotation;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface TypeAnnotation extends Node {
|
||||||
|
typeAnnotation: FlowTypeAnnotation;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface TypeCastExpression extends Expression {
|
||||||
|
expression: Expression;
|
||||||
|
typeAnnotation: TypeAnnotation;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface TypeParameterDeclaration extends Node {
|
||||||
|
params: Identifier[];
|
||||||
|
}
|
||||||
|
|
||||||
|
interface TypeParameterInstantiation extends Node {
|
||||||
|
params: FlowTypeAnnotation[];
|
||||||
|
}
|
||||||
|
|
||||||
|
interface ObjectTypeAnnotation extends FlowTypeAnnotation {
|
||||||
|
properties: ObjectTypeProperty[];
|
||||||
|
indexers: ObjectTypeIndexer[];
|
||||||
|
callProperties: ObjectTypeCallProperty[];
|
||||||
|
}
|
||||||
|
|
||||||
|
interface ObjectTypeCallProperty extends Node {
|
||||||
|
value: FunctionTypeAnnotation;
|
||||||
|
static: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface ObjectTypeIndexer extends Node {
|
||||||
|
id: Identifier;
|
||||||
|
key: FlowTypeAnnotation;
|
||||||
|
value: FlowTypeAnnotation;
|
||||||
|
static: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface ObjectTypeProperty extends Node {
|
||||||
|
key: Expression;
|
||||||
|
value: FlowTypeAnnotation;
|
||||||
|
optional: boolean;
|
||||||
|
static: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface QualifiedTypeIdentifier extends Node {
|
||||||
|
qualification: Identifier | QualifiedTypeIdentifier;
|
||||||
|
id: Identifier;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface UnionTypeAnnotation extends FlowTypeAnnotation {
|
||||||
|
types: FlowTypeAnnotation[];
|
||||||
|
}
|
||||||
|
|
||||||
|
interface VoidTypeAnnotation extends FlowBaseTypeAnnotation {}
|
||||||
|
}
|
|
@ -0,0 +1,683 @@
|
||||||
|
// This definition file follows a somewhat unusual format. ESTree allows
|
||||||
|
// runtime type checks based on the `type` parameter. In order to explain this
|
||||||
|
// to typescript we want to use discriminated union types:
|
||||||
|
// https://github.com/Microsoft/TypeScript/pull/9163
|
||||||
|
//
|
||||||
|
// For ESTree this is a bit tricky because the high level interfaces like
|
||||||
|
// Node or Function are pulling double duty. We want to pass common fields down
|
||||||
|
// to the interfaces that extend them (like Identifier or
|
||||||
|
// ArrowFunctionExpression), but you can't extend a type union or enforce
|
||||||
|
// common fields on them. So we've split the high level interfaces into two
|
||||||
|
// types, a base type which passes down inherited fields, and a type union of
|
||||||
|
// all types which extend the base type. Only the type union is exported, and
|
||||||
|
// the union is how other types refer to the collection of inheriting types.
|
||||||
|
//
|
||||||
|
// This makes the definitions file here somewhat more difficult to maintain,
|
||||||
|
// but it has the notable advantage of making ESTree much easier to use as
|
||||||
|
// an end user.
|
||||||
|
|
||||||
|
export interface BaseNodeWithoutComments {
|
||||||
|
// Every leaf interface that extends BaseNode must specify a type property.
|
||||||
|
// The type property should be a string literal. For example, Identifier
|
||||||
|
// has: `type: "Identifier"`
|
||||||
|
type: string;
|
||||||
|
loc?: SourceLocation | null | undefined;
|
||||||
|
range?: [number, number] | undefined;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface BaseNode extends BaseNodeWithoutComments {
|
||||||
|
leadingComments?: Comment[] | undefined;
|
||||||
|
trailingComments?: Comment[] | undefined;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface NodeMap {
|
||||||
|
AssignmentProperty: AssignmentProperty;
|
||||||
|
CatchClause: CatchClause;
|
||||||
|
Class: Class;
|
||||||
|
ClassBody: ClassBody;
|
||||||
|
Expression: Expression;
|
||||||
|
Function: Function;
|
||||||
|
Identifier: Identifier;
|
||||||
|
Literal: Literal;
|
||||||
|
MethodDefinition: MethodDefinition;
|
||||||
|
ModuleDeclaration: ModuleDeclaration;
|
||||||
|
ModuleSpecifier: ModuleSpecifier;
|
||||||
|
Pattern: Pattern;
|
||||||
|
PrivateIdentifier: PrivateIdentifier;
|
||||||
|
Program: Program;
|
||||||
|
Property: Property;
|
||||||
|
PropertyDefinition: PropertyDefinition;
|
||||||
|
SpreadElement: SpreadElement;
|
||||||
|
Statement: Statement;
|
||||||
|
Super: Super;
|
||||||
|
SwitchCase: SwitchCase;
|
||||||
|
TemplateElement: TemplateElement;
|
||||||
|
VariableDeclarator: VariableDeclarator;
|
||||||
|
}
|
||||||
|
|
||||||
|
export type Node = NodeMap[keyof NodeMap];
|
||||||
|
|
||||||
|
export interface Comment extends BaseNodeWithoutComments {
|
||||||
|
type: "Line" | "Block";
|
||||||
|
value: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface SourceLocation {
|
||||||
|
source?: string | null | undefined;
|
||||||
|
start: Position;
|
||||||
|
end: Position;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface Position {
|
||||||
|
/** >= 1 */
|
||||||
|
line: number;
|
||||||
|
/** >= 0 */
|
||||||
|
column: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface Program extends BaseNode {
|
||||||
|
type: "Program";
|
||||||
|
sourceType: "script" | "module";
|
||||||
|
body: Array<Directive | Statement | ModuleDeclaration>;
|
||||||
|
comments?: Comment[] | undefined;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface Directive extends BaseNode {
|
||||||
|
type: "ExpressionStatement";
|
||||||
|
expression: Literal;
|
||||||
|
directive: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface BaseFunction extends BaseNode {
|
||||||
|
params: Pattern[];
|
||||||
|
generator?: boolean | undefined;
|
||||||
|
async?: boolean | undefined;
|
||||||
|
// The body is either BlockStatement or Expression because arrow functions
|
||||||
|
// can have a body that's either. FunctionDeclarations and
|
||||||
|
// FunctionExpressions have only BlockStatement bodies.
|
||||||
|
body: BlockStatement | Expression;
|
||||||
|
}
|
||||||
|
|
||||||
|
export type Function = FunctionDeclaration | FunctionExpression | ArrowFunctionExpression;
|
||||||
|
|
||||||
|
export type Statement =
|
||||||
|
| ExpressionStatement
|
||||||
|
| BlockStatement
|
||||||
|
| StaticBlock
|
||||||
|
| EmptyStatement
|
||||||
|
| DebuggerStatement
|
||||||
|
| WithStatement
|
||||||
|
| ReturnStatement
|
||||||
|
| LabeledStatement
|
||||||
|
| BreakStatement
|
||||||
|
| ContinueStatement
|
||||||
|
| IfStatement
|
||||||
|
| SwitchStatement
|
||||||
|
| ThrowStatement
|
||||||
|
| TryStatement
|
||||||
|
| WhileStatement
|
||||||
|
| DoWhileStatement
|
||||||
|
| ForStatement
|
||||||
|
| ForInStatement
|
||||||
|
| ForOfStatement
|
||||||
|
| Declaration;
|
||||||
|
|
||||||
|
export interface BaseStatement extends BaseNode {}
|
||||||
|
|
||||||
|
export interface EmptyStatement extends BaseStatement {
|
||||||
|
type: "EmptyStatement";
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface BlockStatement extends BaseStatement {
|
||||||
|
type: "BlockStatement";
|
||||||
|
body: Statement[];
|
||||||
|
innerComments?: Comment[] | undefined;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface StaticBlock extends Omit<BlockStatement, "type"> {
|
||||||
|
type: "StaticBlock";
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ExpressionStatement extends BaseStatement {
|
||||||
|
type: "ExpressionStatement";
|
||||||
|
expression: Expression;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface IfStatement extends BaseStatement {
|
||||||
|
type: "IfStatement";
|
||||||
|
test: Expression;
|
||||||
|
consequent: Statement;
|
||||||
|
alternate?: Statement | null | undefined;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface LabeledStatement extends BaseStatement {
|
||||||
|
type: "LabeledStatement";
|
||||||
|
label: Identifier;
|
||||||
|
body: Statement;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface BreakStatement extends BaseStatement {
|
||||||
|
type: "BreakStatement";
|
||||||
|
label?: Identifier | null | undefined;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ContinueStatement extends BaseStatement {
|
||||||
|
type: "ContinueStatement";
|
||||||
|
label?: Identifier | null | undefined;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface WithStatement extends BaseStatement {
|
||||||
|
type: "WithStatement";
|
||||||
|
object: Expression;
|
||||||
|
body: Statement;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface SwitchStatement extends BaseStatement {
|
||||||
|
type: "SwitchStatement";
|
||||||
|
discriminant: Expression;
|
||||||
|
cases: SwitchCase[];
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ReturnStatement extends BaseStatement {
|
||||||
|
type: "ReturnStatement";
|
||||||
|
argument?: Expression | null | undefined;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ThrowStatement extends BaseStatement {
|
||||||
|
type: "ThrowStatement";
|
||||||
|
argument: Expression;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface TryStatement extends BaseStatement {
|
||||||
|
type: "TryStatement";
|
||||||
|
block: BlockStatement;
|
||||||
|
handler?: CatchClause | null | undefined;
|
||||||
|
finalizer?: BlockStatement | null | undefined;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface WhileStatement extends BaseStatement {
|
||||||
|
type: "WhileStatement";
|
||||||
|
test: Expression;
|
||||||
|
body: Statement;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface DoWhileStatement extends BaseStatement {
|
||||||
|
type: "DoWhileStatement";
|
||||||
|
body: Statement;
|
||||||
|
test: Expression;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ForStatement extends BaseStatement {
|
||||||
|
type: "ForStatement";
|
||||||
|
init?: VariableDeclaration | Expression | null | undefined;
|
||||||
|
test?: Expression | null | undefined;
|
||||||
|
update?: Expression | null | undefined;
|
||||||
|
body: Statement;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface BaseForXStatement extends BaseStatement {
|
||||||
|
left: VariableDeclaration | Pattern;
|
||||||
|
right: Expression;
|
||||||
|
body: Statement;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ForInStatement extends BaseForXStatement {
|
||||||
|
type: "ForInStatement";
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface DebuggerStatement extends BaseStatement {
|
||||||
|
type: "DebuggerStatement";
|
||||||
|
}
|
||||||
|
|
||||||
|
export type Declaration = FunctionDeclaration | VariableDeclaration | ClassDeclaration;
|
||||||
|
|
||||||
|
export interface BaseDeclaration extends BaseStatement {}
|
||||||
|
|
||||||
|
export interface MaybeNamedFunctionDeclaration extends BaseFunction, BaseDeclaration {
|
||||||
|
type: "FunctionDeclaration";
|
||||||
|
/** It is null when a function declaration is a part of the `export default function` statement */
|
||||||
|
id: Identifier | null;
|
||||||
|
body: BlockStatement;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface FunctionDeclaration extends MaybeNamedFunctionDeclaration {
|
||||||
|
id: Identifier;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface VariableDeclaration extends BaseDeclaration {
|
||||||
|
type: "VariableDeclaration";
|
||||||
|
declarations: VariableDeclarator[];
|
||||||
|
kind: "var" | "let" | "const";
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface VariableDeclarator extends BaseNode {
|
||||||
|
type: "VariableDeclarator";
|
||||||
|
id: Pattern;
|
||||||
|
init?: Expression | null | undefined;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ExpressionMap {
|
||||||
|
ArrayExpression: ArrayExpression;
|
||||||
|
ArrowFunctionExpression: ArrowFunctionExpression;
|
||||||
|
AssignmentExpression: AssignmentExpression;
|
||||||
|
AwaitExpression: AwaitExpression;
|
||||||
|
BinaryExpression: BinaryExpression;
|
||||||
|
CallExpression: CallExpression;
|
||||||
|
ChainExpression: ChainExpression;
|
||||||
|
ClassExpression: ClassExpression;
|
||||||
|
ConditionalExpression: ConditionalExpression;
|
||||||
|
FunctionExpression: FunctionExpression;
|
||||||
|
Identifier: Identifier;
|
||||||
|
ImportExpression: ImportExpression;
|
||||||
|
Literal: Literal;
|
||||||
|
LogicalExpression: LogicalExpression;
|
||||||
|
MemberExpression: MemberExpression;
|
||||||
|
MetaProperty: MetaProperty;
|
||||||
|
NewExpression: NewExpression;
|
||||||
|
ObjectExpression: ObjectExpression;
|
||||||
|
SequenceExpression: SequenceExpression;
|
||||||
|
TaggedTemplateExpression: TaggedTemplateExpression;
|
||||||
|
TemplateLiteral: TemplateLiteral;
|
||||||
|
ThisExpression: ThisExpression;
|
||||||
|
UnaryExpression: UnaryExpression;
|
||||||
|
UpdateExpression: UpdateExpression;
|
||||||
|
YieldExpression: YieldExpression;
|
||||||
|
}
|
||||||
|
|
||||||
|
export type Expression = ExpressionMap[keyof ExpressionMap];
|
||||||
|
|
||||||
|
export interface BaseExpression extends BaseNode {}
|
||||||
|
|
||||||
|
export type ChainElement = SimpleCallExpression | MemberExpression;
|
||||||
|
|
||||||
|
export interface ChainExpression extends BaseExpression {
|
||||||
|
type: "ChainExpression";
|
||||||
|
expression: ChainElement;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ThisExpression extends BaseExpression {
|
||||||
|
type: "ThisExpression";
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ArrayExpression extends BaseExpression {
|
||||||
|
type: "ArrayExpression";
|
||||||
|
elements: Array<Expression | SpreadElement | null>;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ObjectExpression extends BaseExpression {
|
||||||
|
type: "ObjectExpression";
|
||||||
|
properties: Array<Property | SpreadElement>;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface PrivateIdentifier extends BaseNode {
|
||||||
|
type: "PrivateIdentifier";
|
||||||
|
name: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface Property extends BaseNode {
|
||||||
|
type: "Property";
|
||||||
|
key: Expression | PrivateIdentifier;
|
||||||
|
value: Expression | Pattern; // Could be an AssignmentProperty
|
||||||
|
kind: "init" | "get" | "set";
|
||||||
|
method: boolean;
|
||||||
|
shorthand: boolean;
|
||||||
|
computed: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface PropertyDefinition extends BaseNode {
|
||||||
|
type: "PropertyDefinition";
|
||||||
|
key: Expression | PrivateIdentifier;
|
||||||
|
value?: Expression | null | undefined;
|
||||||
|
computed: boolean;
|
||||||
|
static: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface FunctionExpression extends BaseFunction, BaseExpression {
|
||||||
|
id?: Identifier | null | undefined;
|
||||||
|
type: "FunctionExpression";
|
||||||
|
body: BlockStatement;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface SequenceExpression extends BaseExpression {
|
||||||
|
type: "SequenceExpression";
|
||||||
|
expressions: Expression[];
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface UnaryExpression extends BaseExpression {
|
||||||
|
type: "UnaryExpression";
|
||||||
|
operator: UnaryOperator;
|
||||||
|
prefix: true;
|
||||||
|
argument: Expression;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface BinaryExpression extends BaseExpression {
|
||||||
|
type: "BinaryExpression";
|
||||||
|
operator: BinaryOperator;
|
||||||
|
left: Expression;
|
||||||
|
right: Expression;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface AssignmentExpression extends BaseExpression {
|
||||||
|
type: "AssignmentExpression";
|
||||||
|
operator: AssignmentOperator;
|
||||||
|
left: Pattern | MemberExpression;
|
||||||
|
right: Expression;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface UpdateExpression extends BaseExpression {
|
||||||
|
type: "UpdateExpression";
|
||||||
|
operator: UpdateOperator;
|
||||||
|
argument: Expression;
|
||||||
|
prefix: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface LogicalExpression extends BaseExpression {
|
||||||
|
type: "LogicalExpression";
|
||||||
|
operator: LogicalOperator;
|
||||||
|
left: Expression;
|
||||||
|
right: Expression;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ConditionalExpression extends BaseExpression {
|
||||||
|
type: "ConditionalExpression";
|
||||||
|
test: Expression;
|
||||||
|
alternate: Expression;
|
||||||
|
consequent: Expression;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface BaseCallExpression extends BaseExpression {
|
||||||
|
callee: Expression | Super;
|
||||||
|
arguments: Array<Expression | SpreadElement>;
|
||||||
|
}
|
||||||
|
export type CallExpression = SimpleCallExpression | NewExpression;
|
||||||
|
|
||||||
|
export interface SimpleCallExpression extends BaseCallExpression {
|
||||||
|
type: "CallExpression";
|
||||||
|
optional: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface NewExpression extends BaseCallExpression {
|
||||||
|
type: "NewExpression";
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface MemberExpression extends BaseExpression, BasePattern {
|
||||||
|
type: "MemberExpression";
|
||||||
|
object: Expression | Super;
|
||||||
|
property: Expression | PrivateIdentifier;
|
||||||
|
computed: boolean;
|
||||||
|
optional: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
export type Pattern = Identifier | ObjectPattern | ArrayPattern | RestElement | AssignmentPattern | MemberExpression;
|
||||||
|
|
||||||
|
export interface BasePattern extends BaseNode {}
|
||||||
|
|
||||||
|
export interface SwitchCase extends BaseNode {
|
||||||
|
type: "SwitchCase";
|
||||||
|
test?: Expression | null | undefined;
|
||||||
|
consequent: Statement[];
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface CatchClause extends BaseNode {
|
||||||
|
type: "CatchClause";
|
||||||
|
param: Pattern | null;
|
||||||
|
body: BlockStatement;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface Identifier extends BaseNode, BaseExpression, BasePattern {
|
||||||
|
type: "Identifier";
|
||||||
|
name: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export type Literal = SimpleLiteral | RegExpLiteral | BigIntLiteral;
|
||||||
|
|
||||||
|
export interface SimpleLiteral extends BaseNode, BaseExpression {
|
||||||
|
type: "Literal";
|
||||||
|
value: string | boolean | number | null;
|
||||||
|
raw?: string | undefined;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface RegExpLiteral extends BaseNode, BaseExpression {
|
||||||
|
type: "Literal";
|
||||||
|
value?: RegExp | null | undefined;
|
||||||
|
regex: {
|
||||||
|
pattern: string;
|
||||||
|
flags: string;
|
||||||
|
};
|
||||||
|
raw?: string | undefined;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface BigIntLiteral extends BaseNode, BaseExpression {
|
||||||
|
type: "Literal";
|
||||||
|
value?: bigint | null | undefined;
|
||||||
|
bigint: string;
|
||||||
|
raw?: string | undefined;
|
||||||
|
}
|
||||||
|
|
||||||
|
export type UnaryOperator = "-" | "+" | "!" | "~" | "typeof" | "void" | "delete";
|
||||||
|
|
||||||
|
export type BinaryOperator =
|
||||||
|
| "=="
|
||||||
|
| "!="
|
||||||
|
| "==="
|
||||||
|
| "!=="
|
||||||
|
| "<"
|
||||||
|
| "<="
|
||||||
|
| ">"
|
||||||
|
| ">="
|
||||||
|
| "<<"
|
||||||
|
| ">>"
|
||||||
|
| ">>>"
|
||||||
|
| "+"
|
||||||
|
| "-"
|
||||||
|
| "*"
|
||||||
|
| "/"
|
||||||
|
| "%"
|
||||||
|
| "**"
|
||||||
|
| "|"
|
||||||
|
| "^"
|
||||||
|
| "&"
|
||||||
|
| "in"
|
||||||
|
| "instanceof";
|
||||||
|
|
||||||
|
export type LogicalOperator = "||" | "&&" | "??";
|
||||||
|
|
||||||
|
export type AssignmentOperator =
|
||||||
|
| "="
|
||||||
|
| "+="
|
||||||
|
| "-="
|
||||||
|
| "*="
|
||||||
|
| "/="
|
||||||
|
| "%="
|
||||||
|
| "**="
|
||||||
|
| "<<="
|
||||||
|
| ">>="
|
||||||
|
| ">>>="
|
||||||
|
| "|="
|
||||||
|
| "^="
|
||||||
|
| "&="
|
||||||
|
| "||="
|
||||||
|
| "&&="
|
||||||
|
| "??=";
|
||||||
|
|
||||||
|
export type UpdateOperator = "++" | "--";
|
||||||
|
|
||||||
|
export interface ForOfStatement extends BaseForXStatement {
|
||||||
|
type: "ForOfStatement";
|
||||||
|
await: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface Super extends BaseNode {
|
||||||
|
type: "Super";
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface SpreadElement extends BaseNode {
|
||||||
|
type: "SpreadElement";
|
||||||
|
argument: Expression;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ArrowFunctionExpression extends BaseExpression, BaseFunction {
|
||||||
|
type: "ArrowFunctionExpression";
|
||||||
|
expression: boolean;
|
||||||
|
body: BlockStatement | Expression;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface YieldExpression extends BaseExpression {
|
||||||
|
type: "YieldExpression";
|
||||||
|
argument?: Expression | null | undefined;
|
||||||
|
delegate: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface TemplateLiteral extends BaseExpression {
|
||||||
|
type: "TemplateLiteral";
|
||||||
|
quasis: TemplateElement[];
|
||||||
|
expressions: Expression[];
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface TaggedTemplateExpression extends BaseExpression {
|
||||||
|
type: "TaggedTemplateExpression";
|
||||||
|
tag: Expression;
|
||||||
|
quasi: TemplateLiteral;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface TemplateElement extends BaseNode {
|
||||||
|
type: "TemplateElement";
|
||||||
|
tail: boolean;
|
||||||
|
value: {
|
||||||
|
/** It is null when the template literal is tagged and the text has an invalid escape (e.g. - tag`\unicode and \u{55}`) */
|
||||||
|
cooked?: string | null | undefined;
|
||||||
|
raw: string;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface AssignmentProperty extends Property {
|
||||||
|
value: Pattern;
|
||||||
|
kind: "init";
|
||||||
|
method: boolean; // false
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ObjectPattern extends BasePattern {
|
||||||
|
type: "ObjectPattern";
|
||||||
|
properties: Array<AssignmentProperty | RestElement>;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ArrayPattern extends BasePattern {
|
||||||
|
type: "ArrayPattern";
|
||||||
|
elements: Array<Pattern | null>;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface RestElement extends BasePattern {
|
||||||
|
type: "RestElement";
|
||||||
|
argument: Pattern;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface AssignmentPattern extends BasePattern {
|
||||||
|
type: "AssignmentPattern";
|
||||||
|
left: Pattern;
|
||||||
|
right: Expression;
|
||||||
|
}
|
||||||
|
|
||||||
|
export type Class = ClassDeclaration | ClassExpression;
|
||||||
|
export interface BaseClass extends BaseNode {
|
||||||
|
superClass?: Expression | null | undefined;
|
||||||
|
body: ClassBody;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ClassBody extends BaseNode {
|
||||||
|
type: "ClassBody";
|
||||||
|
body: Array<MethodDefinition | PropertyDefinition | StaticBlock>;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface MethodDefinition extends BaseNode {
|
||||||
|
type: "MethodDefinition";
|
||||||
|
key: Expression | PrivateIdentifier;
|
||||||
|
value: FunctionExpression;
|
||||||
|
kind: "constructor" | "method" | "get" | "set";
|
||||||
|
computed: boolean;
|
||||||
|
static: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface MaybeNamedClassDeclaration extends BaseClass, BaseDeclaration {
|
||||||
|
type: "ClassDeclaration";
|
||||||
|
/** It is null when a class declaration is a part of the `export default class` statement */
|
||||||
|
id: Identifier | null;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ClassDeclaration extends MaybeNamedClassDeclaration {
|
||||||
|
id: Identifier;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ClassExpression extends BaseClass, BaseExpression {
|
||||||
|
type: "ClassExpression";
|
||||||
|
id?: Identifier | null | undefined;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface MetaProperty extends BaseExpression {
|
||||||
|
type: "MetaProperty";
|
||||||
|
meta: Identifier;
|
||||||
|
property: Identifier;
|
||||||
|
}
|
||||||
|
|
||||||
|
export type ModuleDeclaration =
|
||||||
|
| ImportDeclaration
|
||||||
|
| ExportNamedDeclaration
|
||||||
|
| ExportDefaultDeclaration
|
||||||
|
| ExportAllDeclaration;
|
||||||
|
export interface BaseModuleDeclaration extends BaseNode {}
|
||||||
|
|
||||||
|
export type ModuleSpecifier = ImportSpecifier | ImportDefaultSpecifier | ImportNamespaceSpecifier | ExportSpecifier;
|
||||||
|
export interface BaseModuleSpecifier extends BaseNode {
|
||||||
|
local: Identifier;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ImportDeclaration extends BaseModuleDeclaration {
|
||||||
|
type: "ImportDeclaration";
|
||||||
|
specifiers: Array<ImportSpecifier | ImportDefaultSpecifier | ImportNamespaceSpecifier>;
|
||||||
|
source: Literal;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ImportSpecifier extends BaseModuleSpecifier {
|
||||||
|
type: "ImportSpecifier";
|
||||||
|
imported: Identifier;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ImportExpression extends BaseExpression {
|
||||||
|
type: "ImportExpression";
|
||||||
|
source: Expression;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ImportDefaultSpecifier extends BaseModuleSpecifier {
|
||||||
|
type: "ImportDefaultSpecifier";
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ImportNamespaceSpecifier extends BaseModuleSpecifier {
|
||||||
|
type: "ImportNamespaceSpecifier";
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ExportNamedDeclaration extends BaseModuleDeclaration {
|
||||||
|
type: "ExportNamedDeclaration";
|
||||||
|
declaration?: Declaration | null | undefined;
|
||||||
|
specifiers: ExportSpecifier[];
|
||||||
|
source?: Literal | null | undefined;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ExportSpecifier extends BaseModuleSpecifier {
|
||||||
|
type: "ExportSpecifier";
|
||||||
|
exported: Identifier;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ExportDefaultDeclaration extends BaseModuleDeclaration {
|
||||||
|
type: "ExportDefaultDeclaration";
|
||||||
|
declaration: MaybeNamedFunctionDeclaration | MaybeNamedClassDeclaration | Expression;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ExportAllDeclaration extends BaseModuleDeclaration {
|
||||||
|
type: "ExportAllDeclaration";
|
||||||
|
exported: Identifier | null;
|
||||||
|
source: Literal;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface AwaitExpression extends BaseExpression {
|
||||||
|
type: "AwaitExpression";
|
||||||
|
argument: Expression;
|
||||||
|
}
|
|
@ -0,0 +1,26 @@
|
||||||
|
{
|
||||||
|
"name": "@types/estree",
|
||||||
|
"version": "1.0.5",
|
||||||
|
"description": "TypeScript definitions for estree",
|
||||||
|
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/estree",
|
||||||
|
"license": "MIT",
|
||||||
|
"contributors": [
|
||||||
|
{
|
||||||
|
"name": "RReverser",
|
||||||
|
"githubUsername": "RReverser",
|
||||||
|
"url": "https://github.com/RReverser"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"main": "",
|
||||||
|
"types": "index.d.ts",
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git",
|
||||||
|
"directory": "types/estree"
|
||||||
|
},
|
||||||
|
"scripts": {},
|
||||||
|
"dependencies": {},
|
||||||
|
"typesPublisherContentHash": "6f0eeaffe488ce594e73f8df619c677d752a279b51edbc744e4aebb20db4b3a7",
|
||||||
|
"typeScriptVersion": "4.5",
|
||||||
|
"nonNpm": true
|
||||||
|
}
|
|
@ -0,0 +1,21 @@
|
||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) Microsoft Corporation. All rights reserved.
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE
|
|
@ -0,0 +1,16 @@
|
||||||
|
# Installation
|
||||||
|
> `npm install --save @types/jszip`
|
||||||
|
|
||||||
|
# Summary
|
||||||
|
This package contains type definitions for JSZip (http://stuk.github.com/jszip/).
|
||||||
|
|
||||||
|
# Details
|
||||||
|
Files were exported from https://www.github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/jszip
|
||||||
|
|
||||||
|
Additional Details
|
||||||
|
* Last updated: Wed, 31 May 2017 23:34:31 GMT
|
||||||
|
* Dependencies: none
|
||||||
|
* Global values: JSZip
|
||||||
|
|
||||||
|
# Credits
|
||||||
|
These definitions were written by mzeiher <https://github.com/mzeiher>.
|
|
@ -0,0 +1,232 @@
|
||||||
|
// Type definitions for JSZip
|
||||||
|
// Project: http://stuk.github.com/jszip/
|
||||||
|
// Definitions by: mzeiher <https://github.com/mzeiher>
|
||||||
|
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||||
|
|
||||||
|
interface JSZip {
|
||||||
|
files: {[key: string]: JSZipObject};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get a file from the archive
|
||||||
|
*
|
||||||
|
* @param Path relative path to file
|
||||||
|
* @return File matching path, null if no file found
|
||||||
|
*/
|
||||||
|
file(path: string): JSZipObject;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get files matching a RegExp from archive
|
||||||
|
*
|
||||||
|
* @param path RegExp to match
|
||||||
|
* @return Return all matching files or an empty array
|
||||||
|
*/
|
||||||
|
file(path: RegExp): JSZipObject[];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add a file to the archive
|
||||||
|
*
|
||||||
|
* @param path Relative path to file
|
||||||
|
* @param content Content of the file
|
||||||
|
* @param options Optional information about the file
|
||||||
|
* @return JSZip object
|
||||||
|
*/
|
||||||
|
file(path: string, data: any, options?: JSZipFileOptions): JSZip;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return an new JSZip instance with the given folder as root
|
||||||
|
*
|
||||||
|
* @param name Name of the folder
|
||||||
|
* @return New JSZip object with the given folder as root or null
|
||||||
|
*/
|
||||||
|
folder(name: string): JSZip;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns new JSZip instances with the matching folders as root
|
||||||
|
*
|
||||||
|
* @param name RegExp to match
|
||||||
|
* @return New array of JSZipFile objects which match the RegExp
|
||||||
|
*/
|
||||||
|
folder(name: RegExp): JSZipObject[];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Call a callback function for each entry at this folder level.
|
||||||
|
*
|
||||||
|
* @param callback function
|
||||||
|
*/
|
||||||
|
forEach(callback: (relativePath: string, file: JSZipObject) => void): void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get all files wchich match the given filter function
|
||||||
|
*
|
||||||
|
* @param predicate Filter function
|
||||||
|
* @return Array of matched elements
|
||||||
|
*/
|
||||||
|
filter(predicate: (relativePath: string, file: JSZipObject) => boolean): JSZipObject[];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Removes the file or folder from the archive
|
||||||
|
*
|
||||||
|
* @param path Relative path of file or folder
|
||||||
|
* @return Returns the JSZip instance
|
||||||
|
*/
|
||||||
|
remove(path: string): JSZip;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated since version 3.0
|
||||||
|
* @see {@link generateAsync}
|
||||||
|
* http://stuk.github.io/jszip/documentation/upgrade_guide.html
|
||||||
|
*/
|
||||||
|
generate(options?: JSZipGeneratorOptions): any;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generates a new archive asynchronously
|
||||||
|
*
|
||||||
|
* @param options Optional options for the generator
|
||||||
|
* @return The serialized archive
|
||||||
|
*/
|
||||||
|
generateAsync(options?: JSZipGeneratorOptions, onUpdate?: Function): Promise<any>;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated since version 3.0
|
||||||
|
* @see {@link loadAsync}
|
||||||
|
* http://stuk.github.io/jszip/documentation/upgrade_guide.html
|
||||||
|
*/
|
||||||
|
load(): void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Deserialize zip file asynchronously
|
||||||
|
*
|
||||||
|
* @param data Serialized zip file
|
||||||
|
* @param options Options for deserializing
|
||||||
|
* @return Returns promise
|
||||||
|
*/
|
||||||
|
loadAsync(data: any, options?: JSZipLoadOptions): Promise<JSZip>;
|
||||||
|
}
|
||||||
|
|
||||||
|
type Serialization = ("string" | "text" | "base64" | "binarystring" | "uint8array" |
|
||||||
|
"arraybuffer" | "blob" | "nodebuffer");
|
||||||
|
|
||||||
|
interface JSZipObject {
|
||||||
|
name: string;
|
||||||
|
dir: boolean;
|
||||||
|
date: Date;
|
||||||
|
comment: string;
|
||||||
|
options: JSZipObjectOptions;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Prepare the content in the asked type.
|
||||||
|
* @param {String} type the type of the result.
|
||||||
|
* @param {Function} onUpdate a function to call on each internal update.
|
||||||
|
* @return Promise the promise of the result.
|
||||||
|
*/
|
||||||
|
async(type: Serialization, onUpdate?: Function): Promise<any>;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated since version 3.0
|
||||||
|
*/
|
||||||
|
asText(): void;
|
||||||
|
/**
|
||||||
|
* @deprecated since version 3.0
|
||||||
|
*/
|
||||||
|
asBinary(): void;
|
||||||
|
/**
|
||||||
|
* @deprecated since version 3.0
|
||||||
|
*/
|
||||||
|
asArrayBuffer(): void;
|
||||||
|
/**
|
||||||
|
* @deprecated since version 3.0
|
||||||
|
*/
|
||||||
|
asUint8Array(): void;
|
||||||
|
//asNodeBuffer(): void;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface JSZipFileOptions {
|
||||||
|
base64?: boolean;
|
||||||
|
binary?: boolean;
|
||||||
|
date?: Date;
|
||||||
|
compression?: string;
|
||||||
|
comment?: string;
|
||||||
|
optimizedBinaryString?: boolean;
|
||||||
|
createFolders?: boolean;
|
||||||
|
dir?: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface JSZipObjectOptions {
|
||||||
|
/** deprecated */
|
||||||
|
base64: boolean;
|
||||||
|
/** deprecated */
|
||||||
|
binary: boolean;
|
||||||
|
/** deprecated */
|
||||||
|
dir: boolean;
|
||||||
|
/** deprecated */
|
||||||
|
date: Date;
|
||||||
|
compression: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface JSZipGeneratorOptions {
|
||||||
|
/** deprecated */
|
||||||
|
base64?: boolean;
|
||||||
|
/** DEFLATE or STORE */
|
||||||
|
compression?: string;
|
||||||
|
/** base64 (default), string, uint8array, arraybuffer, blob */
|
||||||
|
type?: string;
|
||||||
|
comment?: string;
|
||||||
|
/**
|
||||||
|
* mime-type for the generated file.
|
||||||
|
* Useful when you need to generate a file with a different extension, ie: “.ods”.
|
||||||
|
*/
|
||||||
|
mimeType?: string;
|
||||||
|
/** streaming uses less memory */
|
||||||
|
streamFiles?: boolean;
|
||||||
|
/** DOS (default) or UNIX */
|
||||||
|
platform?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface JSZipLoadOptions {
|
||||||
|
base64?: boolean;
|
||||||
|
checkCRC32?: boolean;
|
||||||
|
optimizedBinaryString?: boolean;
|
||||||
|
createFolders?: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface JSZipSupport {
|
||||||
|
arraybuffer: boolean;
|
||||||
|
uint8array: boolean;
|
||||||
|
blob: boolean;
|
||||||
|
nodebuffer: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
declare var JSZip: {
|
||||||
|
/**
|
||||||
|
* Create JSZip instance
|
||||||
|
*/
|
||||||
|
(): JSZip;
|
||||||
|
/**
|
||||||
|
* Create JSZip instance
|
||||||
|
* If no parameters given an empty zip archive will be created
|
||||||
|
*
|
||||||
|
* @param data Serialized zip archive
|
||||||
|
* @param options Description of the serialized zip archive
|
||||||
|
*/
|
||||||
|
(data: any, options?: JSZipLoadOptions): JSZip;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create JSZip instance
|
||||||
|
*/
|
||||||
|
new (): JSZip;
|
||||||
|
/**
|
||||||
|
* Create JSZip instance
|
||||||
|
* If no parameters given an empty zip archive will be created
|
||||||
|
*
|
||||||
|
* @param data Serialized zip archive
|
||||||
|
* @param options Description of the serialized zip archive
|
||||||
|
*/
|
||||||
|
new (data: any, options?: JSZipLoadOptions): JSZip;
|
||||||
|
|
||||||
|
prototype: JSZip;
|
||||||
|
support: JSZipSupport;
|
||||||
|
}
|
||||||
|
|
||||||
|
declare module "jszip" {
|
||||||
|
export = JSZip;
|
||||||
|
}
|
|
@ -0,0 +1,22 @@
|
||||||
|
{
|
||||||
|
"name": "@types/jszip",
|
||||||
|
"version": "0.0.33",
|
||||||
|
"description": "TypeScript definitions for JSZip",
|
||||||
|
"license": "MIT",
|
||||||
|
"contributors": [
|
||||||
|
{
|
||||||
|
"name": "mzeiher",
|
||||||
|
"url": "https://github.com/mzeiher"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"main": "",
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://www.github.com/DefinitelyTyped/DefinitelyTyped.git"
|
||||||
|
},
|
||||||
|
"scripts": {},
|
||||||
|
"dependencies": {},
|
||||||
|
"peerDependencies": {},
|
||||||
|
"typesPublisherContentHash": "1662aabea3b5b6b613519eb02c48d0886dac452a2d0ae1a8be95f18c326748fc",
|
||||||
|
"typeScriptVersion": "2.0"
|
||||||
|
}
|
20
node_modules/@types/noname-typings/.github/workflows/release-package.yml
generated
vendored
Normal file
20
node_modules/@types/noname-typings/.github/workflows/release-package.yml
generated
vendored
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
name: Node.js Package
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
tags:
|
||||||
|
- "v*"
|
||||||
|
jobs:
|
||||||
|
Publish:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
permissions:
|
||||||
|
packages: write
|
||||||
|
contents: read
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
- uses: actions/setup-node@v3
|
||||||
|
with:
|
||||||
|
node-version: latest
|
||||||
|
registry-url: https://registry.npmjs.org
|
||||||
|
- run: npm publish
|
||||||
|
env:
|
||||||
|
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
|
|
@ -0,0 +1,112 @@
|
||||||
|
// noname内扩展的一些array方法:
|
||||||
|
declare interface Array<T> {
|
||||||
|
/**
|
||||||
|
* @deprecated 已废弃,请使用includes
|
||||||
|
*/
|
||||||
|
contains(item: T): boolean;
|
||||||
|
containsSome(...item: T): boolean;
|
||||||
|
containsAll(...item: T): boolean;
|
||||||
|
/**
|
||||||
|
* 添加任意元素进数组中
|
||||||
|
* @param args
|
||||||
|
* @returns
|
||||||
|
* 1. 当添加成功时,返回此数组
|
||||||
|
* 2. 添加失败(已有此元素)时返回false,若传入多个参数,且添加失败时,后面的元素不再进行添加操作
|
||||||
|
*/
|
||||||
|
add(...args: T[]): this | false;
|
||||||
|
/**
|
||||||
|
* 添加一个数组的所有元素到该数组中(循环执行this.add),此时参数arr中若有一个数组元素可能会出现bug
|
||||||
|
* @param arr
|
||||||
|
*/
|
||||||
|
addArray(arr: T[]): this;
|
||||||
|
/**
|
||||||
|
* 移除一个元素出该数组(该元素不能是数组)
|
||||||
|
* @param item
|
||||||
|
* @returns
|
||||||
|
* 1. 当移除成功时,返回此数组
|
||||||
|
* 2. 移除失败(没有此元素)时返回false
|
||||||
|
* 3. 传入参数为一个数组时,返回undefined
|
||||||
|
*/
|
||||||
|
remove(item: T): this | false;
|
||||||
|
|
||||||
|
remove(item: T[]): void;
|
||||||
|
/**
|
||||||
|
* 将一个数组的所有元素移除出该数组(循环执行this.remove),此时参数arr中若有一个数组元素可能会出现bug
|
||||||
|
* @param arr
|
||||||
|
*/
|
||||||
|
removeArray(...arr: T[]): this;
|
||||||
|
/**
|
||||||
|
* 随机获得该数组的一个元素
|
||||||
|
* @param args 设置需要排除掉的部分元素;
|
||||||
|
*/
|
||||||
|
randomGet(...args: T[]): T;
|
||||||
|
/**
|
||||||
|
* 随机移除数组的一个/多个元素
|
||||||
|
* @param num 若num为数字的情况下,则移除num个元素,否则移除一个
|
||||||
|
* @returns
|
||||||
|
* 1. 移除一个元素,只返回被移除的元素
|
||||||
|
* 2. 移除多个元素,返回一个被移除元素组成的数组
|
||||||
|
* 3. 数组无元素返回undefined
|
||||||
|
*/
|
||||||
|
randomRemove(num?: number): T | T[];
|
||||||
|
randomRemove(num?: T): T | undefined;
|
||||||
|
/**
|
||||||
|
* 随机重新排序数组(数组乱序)
|
||||||
|
*/
|
||||||
|
randomSort(): this;
|
||||||
|
/**
|
||||||
|
* 随机获取数组的元素
|
||||||
|
*
|
||||||
|
* 返回的是一个重新整合的数组
|
||||||
|
* @param num 获取的数量, 不传参视为0
|
||||||
|
*/
|
||||||
|
randomGets(num?: number): this;
|
||||||
|
/**
|
||||||
|
* 对所有玩家进行排序
|
||||||
|
*
|
||||||
|
* 其排序,使用的是lib.sort.seat方法,按座位排序
|
||||||
|
* @param target 目标玩家
|
||||||
|
*/
|
||||||
|
sortBySeat(target?: Player): Player[];
|
||||||
|
/**
|
||||||
|
* 将一个Array中所有位于处理区的卡牌过滤出来
|
||||||
|
*
|
||||||
|
* 例:设一list为[c1,c2,c3,c4],其中c1和c3是位于处理区的卡牌
|
||||||
|
* 那么list.filterInD()得到的结果即为[c1,c3]
|
||||||
|
*
|
||||||
|
* 在1.9.97.8.1或更高的版本中:
|
||||||
|
* 可通过直接在括号中填写一个区域 来判断处于特定区域的卡牌
|
||||||
|
* 例:list.filterInD('h') 即判断数组中所有位于手牌区的卡牌
|
||||||
|
* @param poiston 指定的区域,默认是 'o'
|
||||||
|
*/
|
||||||
|
filterInD(poiston?: "e" | "j" | "x" | "s" | "h" | "c" | "d" | "o"): Card[];
|
||||||
|
someInD(poiston?: "e" | "j" | "x" | "s" | "h" | "c" | "d" | "o"): boolean;
|
||||||
|
everyInD(poiston?: "e" | "j" | "x" | "s" | "h" | "c" | "d" | "o"): boolean;
|
||||||
|
|
||||||
|
//关于处理区:
|
||||||
|
/*
|
||||||
|
不知道处理区是什么的同学们 请自行查阅凌天翼规则集相关内容太长了我懒得贴
|
||||||
|
处理区在无名杀的代码为ui.ordering
|
||||||
|
为方便兼容旧扩展 使用get.position(card)方法读取处理区的卡牌 默认得到的仍然是弃牌堆('d')
|
||||||
|
使用get.position(card,true) 才会得到处理区('o')的结果
|
||||||
|
|
||||||
|
处理区:(不清楚无名杀对其的实验是否满足这些要求)
|
||||||
|
一个最常被用到,但是尚未命名的区域。
|
||||||
|
当你使用一张牌等待结算或处于结算中,
|
||||||
|
当你和另一名角色拼点的两张牌失去时,
|
||||||
|
当你和另一名角色交换的牌失去时,
|
||||||
|
当你的牌被张辽或张郃搞的失去时……
|
||||||
|
总之,当一张牌不在任何角色的手牌、装备区或判定区里,
|
||||||
|
也不在牌堆或弃牌堆里,也没有被移出游戏,那么它就是在这个尚未命名的区域里。
|
||||||
|
为了便于行文,在本规则与FAQ集中暂且称之为‘处理区’。
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取 item 在数组中出现的次数
|
||||||
|
*/
|
||||||
|
numOf(item: T): number;
|
||||||
|
unique(): this;
|
||||||
|
toUniqued(): T[];
|
||||||
|
maxBy(sortBy?: Function, filter?: typeof Array['prototype']['filter']): T;
|
||||||
|
minBy(sortBy?: Function, filter?: typeof Array['prototype']['filter']): T;
|
||||||
|
}
|
|
@ -0,0 +1,23 @@
|
||||||
|
declare type CardBaseUIData = {
|
||||||
|
name?: string;
|
||||||
|
suit?: string;
|
||||||
|
number?: number;
|
||||||
|
nature?: string | null;
|
||||||
|
|
||||||
|
//用于某些方法,用于过滤卡牌的额外结构
|
||||||
|
type?: string | string[];
|
||||||
|
subtype?: string;
|
||||||
|
color?: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否时视为牌
|
||||||
|
*
|
||||||
|
* 是本来的卡牌,则为true,作为视为牌则为false/undefined
|
||||||
|
* 在useCard使用时,作为视为牌,会把next.cards,设置为card.cards;
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
isCard?: boolean;
|
||||||
|
|
||||||
|
/** 真实使用的卡牌 */
|
||||||
|
cards?: Card[];
|
||||||
|
}
|
|
@ -0,0 +1,5 @@
|
||||||
|
// 一些额外需要增加的一些小提示提示
|
||||||
|
interface Date {
|
||||||
|
/** 格式化 */
|
||||||
|
format(format: string): string;
|
||||||
|
}
|
|
@ -0,0 +1,85 @@
|
||||||
|
//noname内扩展的一些HTMLDivElement方法:
|
||||||
|
interface HTMLDivElement {
|
||||||
|
_link: any;
|
||||||
|
timeout?: number;
|
||||||
|
destiny?: HTMLDivElement;
|
||||||
|
_listeningEnd?: boolean;
|
||||||
|
_transitionEnded?: boolean;
|
||||||
|
_onEndDelete?: boolean;
|
||||||
|
_selfDestroyed?: boolean;
|
||||||
|
/**
|
||||||
|
* 增加一个动画(增加className动画标记)
|
||||||
|
*
|
||||||
|
* @param name className
|
||||||
|
* @param time 该动画多长时间自动销毁
|
||||||
|
*/
|
||||||
|
addTempClass(name: string, time?: number): this;
|
||||||
|
/**
|
||||||
|
* 隐藏
|
||||||
|
*/
|
||||||
|
hide(): this;
|
||||||
|
unfocus(): this;
|
||||||
|
refocus(): this;
|
||||||
|
show(): this;
|
||||||
|
/**
|
||||||
|
* 删除该节点div
|
||||||
|
* @param time 调用后删除的时间(延时删除)
|
||||||
|
* @param callback 删除后的回调
|
||||||
|
*/
|
||||||
|
delete(time?: number, callback?: () => void): this;
|
||||||
|
/**
|
||||||
|
* 将该节点div移除,并添加到目标处
|
||||||
|
*
|
||||||
|
* 会为card设置将position到destiny,在get.position中,获得得位置为将要设置得position目标处;
|
||||||
|
* @param position 目标处
|
||||||
|
* @param time 延迟执行的时间
|
||||||
|
*/
|
||||||
|
goto(position: HTMLDivElement, time?: number): this;
|
||||||
|
/**
|
||||||
|
* 立即移除
|
||||||
|
*/
|
||||||
|
fix(): this;
|
||||||
|
/**
|
||||||
|
* 设置背景(卡面)/设置图片
|
||||||
|
* @param name 自定义格式名: xxx:xxxxxxxx:xx(应该有各种命名格式,到时详细探讨)
|
||||||
|
* @param type 设置的卡面的类型
|
||||||
|
* @param ext 文件类型后缀名(例:.jpg),填noskin,或者不填,默认为".jpg"
|
||||||
|
* @param subfolder 子文件夹路径(基本都是按规定文件夹放置,命名),不填走默认路径
|
||||||
|
*/
|
||||||
|
setBackground(name: string, type?: string, ext?: string, subfolder?: string): this;
|
||||||
|
/**
|
||||||
|
* 设置游戏背景,并且缓存该设置
|
||||||
|
* @param img
|
||||||
|
*/
|
||||||
|
setBackgroundDB(img: string): Promise<this>;
|
||||||
|
/**
|
||||||
|
* 设置背景
|
||||||
|
* @param img
|
||||||
|
*/
|
||||||
|
setBackgroundImage(img: string | string[]): this;
|
||||||
|
/**
|
||||||
|
* 设置触摸/点击监听
|
||||||
|
* @param func
|
||||||
|
*/
|
||||||
|
listen(func: (this: HTMLDivElement, event: Event) => void): this;
|
||||||
|
/**
|
||||||
|
* 设置转换结束(webkitTransitionEnd)监听
|
||||||
|
* @param func
|
||||||
|
* @param time
|
||||||
|
*/
|
||||||
|
listenTransition(func: () => void, time: number): number;
|
||||||
|
/**
|
||||||
|
* 设置位置
|
||||||
|
* @param args
|
||||||
|
*/
|
||||||
|
setPosition(...args: number[]): this;
|
||||||
|
/**
|
||||||
|
* 添加css样式
|
||||||
|
* @param style
|
||||||
|
*/
|
||||||
|
css<T extends keyof CSSStyleDeclaration>(style: {
|
||||||
|
[key in T]?: string;
|
||||||
|
} & {
|
||||||
|
innerHTML?: string;
|
||||||
|
}): this;
|
||||||
|
}
|
|
@ -0,0 +1,8 @@
|
||||||
|
interface HTMLTableElement {
|
||||||
|
/**
|
||||||
|
* 获取该div下表结构row行,col列的元素
|
||||||
|
* @param row
|
||||||
|
* @param col
|
||||||
|
*/
|
||||||
|
get(row: number, col: number): HTMLElement | void;
|
||||||
|
}
|
|
@ -0,0 +1,674 @@
|
||||||
|
GNU GENERAL PUBLIC LICENSE
|
||||||
|
Version 3, 29 June 2007
|
||||||
|
|
||||||
|
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
||||||
|
Everyone is permitted to copy and distribute verbatim copies
|
||||||
|
of this license document, but changing it is not allowed.
|
||||||
|
|
||||||
|
Preamble
|
||||||
|
|
||||||
|
The GNU General Public License is a free, copyleft license for
|
||||||
|
software and other kinds of works.
|
||||||
|
|
||||||
|
The licenses for most software and other practical works are designed
|
||||||
|
to take away your freedom to share and change the works. By contrast,
|
||||||
|
the GNU General Public License is intended to guarantee your freedom to
|
||||||
|
share and change all versions of a program--to make sure it remains free
|
||||||
|
software for all its users. We, the Free Software Foundation, use the
|
||||||
|
GNU General Public License for most of our software; it applies also to
|
||||||
|
any other work released this way by its authors. You can apply it to
|
||||||
|
your programs, too.
|
||||||
|
|
||||||
|
When we speak of free software, we are referring to freedom, not
|
||||||
|
price. Our General Public Licenses are designed to make sure that you
|
||||||
|
have the freedom to distribute copies of free software (and charge for
|
||||||
|
them if you wish), that you receive source code or can get it if you
|
||||||
|
want it, that you can change the software or use pieces of it in new
|
||||||
|
free programs, and that you know you can do these things.
|
||||||
|
|
||||||
|
To protect your rights, we need to prevent others from denying you
|
||||||
|
these rights or asking you to surrender the rights. Therefore, you have
|
||||||
|
certain responsibilities if you distribute copies of the software, or if
|
||||||
|
you modify it: responsibilities to respect the freedom of others.
|
||||||
|
|
||||||
|
For example, if you distribute copies of such a program, whether
|
||||||
|
gratis or for a fee, you must pass on to the recipients the same
|
||||||
|
freedoms that you received. You must make sure that they, too, receive
|
||||||
|
or can get the source code. And you must show them these terms so they
|
||||||
|
know their rights.
|
||||||
|
|
||||||
|
Developers that use the GNU GPL protect your rights with two steps:
|
||||||
|
(1) assert copyright on the software, and (2) offer you this License
|
||||||
|
giving you legal permission to copy, distribute and/or modify it.
|
||||||
|
|
||||||
|
For the developers' and authors' protection, the GPL clearly explains
|
||||||
|
that there is no warranty for this free software. For both users' and
|
||||||
|
authors' sake, the GPL requires that modified versions be marked as
|
||||||
|
changed, so that their problems will not be attributed erroneously to
|
||||||
|
authors of previous versions.
|
||||||
|
|
||||||
|
Some devices are designed to deny users access to install or run
|
||||||
|
modified versions of the software inside them, although the manufacturer
|
||||||
|
can do so. This is fundamentally incompatible with the aim of
|
||||||
|
protecting users' freedom to change the software. The systematic
|
||||||
|
pattern of such abuse occurs in the area of products for individuals to
|
||||||
|
use, which is precisely where it is most unacceptable. Therefore, we
|
||||||
|
have designed this version of the GPL to prohibit the practice for those
|
||||||
|
products. If such problems arise substantially in other domains, we
|
||||||
|
stand ready to extend this provision to those domains in future versions
|
||||||
|
of the GPL, as needed to protect the freedom of users.
|
||||||
|
|
||||||
|
Finally, every program is threatened constantly by software patents.
|
||||||
|
States should not allow patents to restrict development and use of
|
||||||
|
software on general-purpose computers, but in those that do, we wish to
|
||||||
|
avoid the special danger that patents applied to a free program could
|
||||||
|
make it effectively proprietary. To prevent this, the GPL assures that
|
||||||
|
patents cannot be used to render the program non-free.
|
||||||
|
|
||||||
|
The precise terms and conditions for copying, distribution and
|
||||||
|
modification follow.
|
||||||
|
|
||||||
|
TERMS AND CONDITIONS
|
||||||
|
|
||||||
|
0. Definitions.
|
||||||
|
|
||||||
|
"This License" refers to version 3 of the GNU General Public License.
|
||||||
|
|
||||||
|
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||||
|
works, such as semiconductor masks.
|
||||||
|
|
||||||
|
"The Program" refers to any copyrightable work licensed under this
|
||||||
|
License. Each licensee is addressed as "you". "Licensees" and
|
||||||
|
"recipients" may be individuals or organizations.
|
||||||
|
|
||||||
|
To "modify" a work means to copy from or adapt all or part of the work
|
||||||
|
in a fashion requiring copyright permission, other than the making of an
|
||||||
|
exact copy. The resulting work is called a "modified version" of the
|
||||||
|
earlier work or a work "based on" the earlier work.
|
||||||
|
|
||||||
|
A "covered work" means either the unmodified Program or a work based
|
||||||
|
on the Program.
|
||||||
|
|
||||||
|
To "propagate" a work means to do anything with it that, without
|
||||||
|
permission, would make you directly or secondarily liable for
|
||||||
|
infringement under applicable copyright law, except executing it on a
|
||||||
|
computer or modifying a private copy. Propagation includes copying,
|
||||||
|
distribution (with or without modification), making available to the
|
||||||
|
public, and in some countries other activities as well.
|
||||||
|
|
||||||
|
To "convey" a work means any kind of propagation that enables other
|
||||||
|
parties to make or receive copies. Mere interaction with a user through
|
||||||
|
a computer network, with no transfer of a copy, is not conveying.
|
||||||
|
|
||||||
|
An interactive user interface displays "Appropriate Legal Notices"
|
||||||
|
to the extent that it includes a convenient and prominently visible
|
||||||
|
feature that (1) displays an appropriate copyright notice, and (2)
|
||||||
|
tells the user that there is no warranty for the work (except to the
|
||||||
|
extent that warranties are provided), that licensees may convey the
|
||||||
|
work under this License, and how to view a copy of this License. If
|
||||||
|
the interface presents a list of user commands or options, such as a
|
||||||
|
menu, a prominent item in the list meets this criterion.
|
||||||
|
|
||||||
|
1. Source Code.
|
||||||
|
|
||||||
|
The "source code" for a work means the preferred form of the work
|
||||||
|
for making modifications to it. "Object code" means any non-source
|
||||||
|
form of a work.
|
||||||
|
|
||||||
|
A "Standard Interface" means an interface that either is an official
|
||||||
|
standard defined by a recognized standards body, or, in the case of
|
||||||
|
interfaces specified for a particular programming language, one that
|
||||||
|
is widely used among developers working in that language.
|
||||||
|
|
||||||
|
The "System Libraries" of an executable work include anything, other
|
||||||
|
than the work as a whole, that (a) is included in the normal form of
|
||||||
|
packaging a Major Component, but which is not part of that Major
|
||||||
|
Component, and (b) serves only to enable use of the work with that
|
||||||
|
Major Component, or to implement a Standard Interface for which an
|
||||||
|
implementation is available to the public in source code form. A
|
||||||
|
"Major Component", in this context, means a major essential component
|
||||||
|
(kernel, window system, and so on) of the specific operating system
|
||||||
|
(if any) on which the executable work runs, or a compiler used to
|
||||||
|
produce the work, or an object code interpreter used to run it.
|
||||||
|
|
||||||
|
The "Corresponding Source" for a work in object code form means all
|
||||||
|
the source code needed to generate, install, and (for an executable
|
||||||
|
work) run the object code and to modify the work, including scripts to
|
||||||
|
control those activities. However, it does not include the work's
|
||||||
|
System Libraries, or general-purpose tools or generally available free
|
||||||
|
programs which are used unmodified in performing those activities but
|
||||||
|
which are not part of the work. For example, Corresponding Source
|
||||||
|
includes interface definition files associated with source files for
|
||||||
|
the work, and the source code for shared libraries and dynamically
|
||||||
|
linked subprograms that the work is specifically designed to require,
|
||||||
|
such as by intimate data communication or control flow between those
|
||||||
|
subprograms and other parts of the work.
|
||||||
|
|
||||||
|
The Corresponding Source need not include anything that users
|
||||||
|
can regenerate automatically from other parts of the Corresponding
|
||||||
|
Source.
|
||||||
|
|
||||||
|
The Corresponding Source for a work in source code form is that
|
||||||
|
same work.
|
||||||
|
|
||||||
|
2. Basic Permissions.
|
||||||
|
|
||||||
|
All rights granted under this License are granted for the term of
|
||||||
|
copyright on the Program, and are irrevocable provided the stated
|
||||||
|
conditions are met. This License explicitly affirms your unlimited
|
||||||
|
permission to run the unmodified Program. The output from running a
|
||||||
|
covered work is covered by this License only if the output, given its
|
||||||
|
content, constitutes a covered work. This License acknowledges your
|
||||||
|
rights of fair use or other equivalent, as provided by copyright law.
|
||||||
|
|
||||||
|
You may make, run and propagate covered works that you do not
|
||||||
|
convey, without conditions so long as your license otherwise remains
|
||||||
|
in force. You may convey covered works to others for the sole purpose
|
||||||
|
of having them make modifications exclusively for you, or provide you
|
||||||
|
with facilities for running those works, provided that you comply with
|
||||||
|
the terms of this License in conveying all material for which you do
|
||||||
|
not control copyright. Those thus making or running the covered works
|
||||||
|
for you must do so exclusively on your behalf, under your direction
|
||||||
|
and control, on terms that prohibit them from making any copies of
|
||||||
|
your copyrighted material outside their relationship with you.
|
||||||
|
|
||||||
|
Conveying under any other circumstances is permitted solely under
|
||||||
|
the conditions stated below. Sublicensing is not allowed; section 10
|
||||||
|
makes it unnecessary.
|
||||||
|
|
||||||
|
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||||
|
|
||||||
|
No covered work shall be deemed part of an effective technological
|
||||||
|
measure under any applicable law fulfilling obligations under article
|
||||||
|
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||||
|
similar laws prohibiting or restricting circumvention of such
|
||||||
|
measures.
|
||||||
|
|
||||||
|
When you convey a covered work, you waive any legal power to forbid
|
||||||
|
circumvention of technological measures to the extent such circumvention
|
||||||
|
is effected by exercising rights under this License with respect to
|
||||||
|
the covered work, and you disclaim any intention to limit operation or
|
||||||
|
modification of the work as a means of enforcing, against the work's
|
||||||
|
users, your or third parties' legal rights to forbid circumvention of
|
||||||
|
technological measures.
|
||||||
|
|
||||||
|
4. Conveying Verbatim Copies.
|
||||||
|
|
||||||
|
You may convey verbatim copies of the Program's source code as you
|
||||||
|
receive it, in any medium, provided that you conspicuously and
|
||||||
|
appropriately publish on each copy an appropriate copyright notice;
|
||||||
|
keep intact all notices stating that this License and any
|
||||||
|
non-permissive terms added in accord with section 7 apply to the code;
|
||||||
|
keep intact all notices of the absence of any warranty; and give all
|
||||||
|
recipients a copy of this License along with the Program.
|
||||||
|
|
||||||
|
You may charge any price or no price for each copy that you convey,
|
||||||
|
and you may offer support or warranty protection for a fee.
|
||||||
|
|
||||||
|
5. Conveying Modified Source Versions.
|
||||||
|
|
||||||
|
You may convey a work based on the Program, or the modifications to
|
||||||
|
produce it from the Program, in the form of source code under the
|
||||||
|
terms of section 4, provided that you also meet all of these conditions:
|
||||||
|
|
||||||
|
a) The work must carry prominent notices stating that you modified
|
||||||
|
it, and giving a relevant date.
|
||||||
|
|
||||||
|
b) The work must carry prominent notices stating that it is
|
||||||
|
released under this License and any conditions added under section
|
||||||
|
7. This requirement modifies the requirement in section 4 to
|
||||||
|
"keep intact all notices".
|
||||||
|
|
||||||
|
c) You must license the entire work, as a whole, under this
|
||||||
|
License to anyone who comes into possession of a copy. This
|
||||||
|
License will therefore apply, along with any applicable section 7
|
||||||
|
additional terms, to the whole of the work, and all its parts,
|
||||||
|
regardless of how they are packaged. This License gives no
|
||||||
|
permission to license the work in any other way, but it does not
|
||||||
|
invalidate such permission if you have separately received it.
|
||||||
|
|
||||||
|
d) If the work has interactive user interfaces, each must display
|
||||||
|
Appropriate Legal Notices; however, if the Program has interactive
|
||||||
|
interfaces that do not display Appropriate Legal Notices, your
|
||||||
|
work need not make them do so.
|
||||||
|
|
||||||
|
A compilation of a covered work with other separate and independent
|
||||||
|
works, which are not by their nature extensions of the covered work,
|
||||||
|
and which are not combined with it such as to form a larger program,
|
||||||
|
in or on a volume of a storage or distribution medium, is called an
|
||||||
|
"aggregate" if the compilation and its resulting copyright are not
|
||||||
|
used to limit the access or legal rights of the compilation's users
|
||||||
|
beyond what the individual works permit. Inclusion of a covered work
|
||||||
|
in an aggregate does not cause this License to apply to the other
|
||||||
|
parts of the aggregate.
|
||||||
|
|
||||||
|
6. Conveying Non-Source Forms.
|
||||||
|
|
||||||
|
You may convey a covered work in object code form under the terms
|
||||||
|
of sections 4 and 5, provided that you also convey the
|
||||||
|
machine-readable Corresponding Source under the terms of this License,
|
||||||
|
in one of these ways:
|
||||||
|
|
||||||
|
a) Convey the object code in, or embodied in, a physical product
|
||||||
|
(including a physical distribution medium), accompanied by the
|
||||||
|
Corresponding Source fixed on a durable physical medium
|
||||||
|
customarily used for software interchange.
|
||||||
|
|
||||||
|
b) Convey the object code in, or embodied in, a physical product
|
||||||
|
(including a physical distribution medium), accompanied by a
|
||||||
|
written offer, valid for at least three years and valid for as
|
||||||
|
long as you offer spare parts or customer support for that product
|
||||||
|
model, to give anyone who possesses the object code either (1) a
|
||||||
|
copy of the Corresponding Source for all the software in the
|
||||||
|
product that is covered by this License, on a durable physical
|
||||||
|
medium customarily used for software interchange, for a price no
|
||||||
|
more than your reasonable cost of physically performing this
|
||||||
|
conveying of source, or (2) access to copy the
|
||||||
|
Corresponding Source from a network server at no charge.
|
||||||
|
|
||||||
|
c) Convey individual copies of the object code with a copy of the
|
||||||
|
written offer to provide the Corresponding Source. This
|
||||||
|
alternative is allowed only occasionally and noncommercially, and
|
||||||
|
only if you received the object code with such an offer, in accord
|
||||||
|
with subsection 6b.
|
||||||
|
|
||||||
|
d) Convey the object code by offering access from a designated
|
||||||
|
place (gratis or for a charge), and offer equivalent access to the
|
||||||
|
Corresponding Source in the same way through the same place at no
|
||||||
|
further charge. You need not require recipients to copy the
|
||||||
|
Corresponding Source along with the object code. If the place to
|
||||||
|
copy the object code is a network server, the Corresponding Source
|
||||||
|
may be on a different server (operated by you or a third party)
|
||||||
|
that supports equivalent copying facilities, provided you maintain
|
||||||
|
clear directions next to the object code saying where to find the
|
||||||
|
Corresponding Source. Regardless of what server hosts the
|
||||||
|
Corresponding Source, you remain obligated to ensure that it is
|
||||||
|
available for as long as needed to satisfy these requirements.
|
||||||
|
|
||||||
|
e) Convey the object code using peer-to-peer transmission, provided
|
||||||
|
you inform other peers where the object code and Corresponding
|
||||||
|
Source of the work are being offered to the general public at no
|
||||||
|
charge under subsection 6d.
|
||||||
|
|
||||||
|
A separable portion of the object code, whose source code is excluded
|
||||||
|
from the Corresponding Source as a System Library, need not be
|
||||||
|
included in conveying the object code work.
|
||||||
|
|
||||||
|
A "User Product" is either (1) a "consumer product", which means any
|
||||||
|
tangible personal property which is normally used for personal, family,
|
||||||
|
or household purposes, or (2) anything designed or sold for incorporation
|
||||||
|
into a dwelling. In determining whether a product is a consumer product,
|
||||||
|
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||||
|
product received by a particular user, "normally used" refers to a
|
||||||
|
typical or common use of that class of product, regardless of the status
|
||||||
|
of the particular user or of the way in which the particular user
|
||||||
|
actually uses, or expects or is expected to use, the product. A product
|
||||||
|
is a consumer product regardless of whether the product has substantial
|
||||||
|
commercial, industrial or non-consumer uses, unless such uses represent
|
||||||
|
the only significant mode of use of the product.
|
||||||
|
|
||||||
|
"Installation Information" for a User Product means any methods,
|
||||||
|
procedures, authorization keys, or other information required to install
|
||||||
|
and execute modified versions of a covered work in that User Product from
|
||||||
|
a modified version of its Corresponding Source. The information must
|
||||||
|
suffice to ensure that the continued functioning of the modified object
|
||||||
|
code is in no case prevented or interfered with solely because
|
||||||
|
modification has been made.
|
||||||
|
|
||||||
|
If you convey an object code work under this section in, or with, or
|
||||||
|
specifically for use in, a User Product, and the conveying occurs as
|
||||||
|
part of a transaction in which the right of possession and use of the
|
||||||
|
User Product is transferred to the recipient in perpetuity or for a
|
||||||
|
fixed term (regardless of how the transaction is characterized), the
|
||||||
|
Corresponding Source conveyed under this section must be accompanied
|
||||||
|
by the Installation Information. But this requirement does not apply
|
||||||
|
if neither you nor any third party retains the ability to install
|
||||||
|
modified object code on the User Product (for example, the work has
|
||||||
|
been installed in ROM).
|
||||||
|
|
||||||
|
The requirement to provide Installation Information does not include a
|
||||||
|
requirement to continue to provide support service, warranty, or updates
|
||||||
|
for a work that has been modified or installed by the recipient, or for
|
||||||
|
the User Product in which it has been modified or installed. Access to a
|
||||||
|
network may be denied when the modification itself materially and
|
||||||
|
adversely affects the operation of the network or violates the rules and
|
||||||
|
protocols for communication across the network.
|
||||||
|
|
||||||
|
Corresponding Source conveyed, and Installation Information provided,
|
||||||
|
in accord with this section must be in a format that is publicly
|
||||||
|
documented (and with an implementation available to the public in
|
||||||
|
source code form), and must require no special password or key for
|
||||||
|
unpacking, reading or copying.
|
||||||
|
|
||||||
|
7. Additional Terms.
|
||||||
|
|
||||||
|
"Additional permissions" are terms that supplement the terms of this
|
||||||
|
License by making exceptions from one or more of its conditions.
|
||||||
|
Additional permissions that are applicable to the entire Program shall
|
||||||
|
be treated as though they were included in this License, to the extent
|
||||||
|
that they are valid under applicable law. If additional permissions
|
||||||
|
apply only to part of the Program, that part may be used separately
|
||||||
|
under those permissions, but the entire Program remains governed by
|
||||||
|
this License without regard to the additional permissions.
|
||||||
|
|
||||||
|
When you convey a copy of a covered work, you may at your option
|
||||||
|
remove any additional permissions from that copy, or from any part of
|
||||||
|
it. (Additional permissions may be written to require their own
|
||||||
|
removal in certain cases when you modify the work.) You may place
|
||||||
|
additional permissions on material, added by you to a covered work,
|
||||||
|
for which you have or can give appropriate copyright permission.
|
||||||
|
|
||||||
|
Notwithstanding any other provision of this License, for material you
|
||||||
|
add to a covered work, you may (if authorized by the copyright holders of
|
||||||
|
that material) supplement the terms of this License with terms:
|
||||||
|
|
||||||
|
a) Disclaiming warranty or limiting liability differently from the
|
||||||
|
terms of sections 15 and 16 of this License; or
|
||||||
|
|
||||||
|
b) Requiring preservation of specified reasonable legal notices or
|
||||||
|
author attributions in that material or in the Appropriate Legal
|
||||||
|
Notices displayed by works containing it; or
|
||||||
|
|
||||||
|
c) Prohibiting misrepresentation of the origin of that material, or
|
||||||
|
requiring that modified versions of such material be marked in
|
||||||
|
reasonable ways as different from the original version; or
|
||||||
|
|
||||||
|
d) Limiting the use for publicity purposes of names of licensors or
|
||||||
|
authors of the material; or
|
||||||
|
|
||||||
|
e) Declining to grant rights under trademark law for use of some
|
||||||
|
trade names, trademarks, or service marks; or
|
||||||
|
|
||||||
|
f) Requiring indemnification of licensors and authors of that
|
||||||
|
material by anyone who conveys the material (or modified versions of
|
||||||
|
it) with contractual assumptions of liability to the recipient, for
|
||||||
|
any liability that these contractual assumptions directly impose on
|
||||||
|
those licensors and authors.
|
||||||
|
|
||||||
|
All other non-permissive additional terms are considered "further
|
||||||
|
restrictions" within the meaning of section 10. If the Program as you
|
||||||
|
received it, or any part of it, contains a notice stating that it is
|
||||||
|
governed by this License along with a term that is a further
|
||||||
|
restriction, you may remove that term. If a license document contains
|
||||||
|
a further restriction but permits relicensing or conveying under this
|
||||||
|
License, you may add to a covered work material governed by the terms
|
||||||
|
of that license document, provided that the further restriction does
|
||||||
|
not survive such relicensing or conveying.
|
||||||
|
|
||||||
|
If you add terms to a covered work in accord with this section, you
|
||||||
|
must place, in the relevant source files, a statement of the
|
||||||
|
additional terms that apply to those files, or a notice indicating
|
||||||
|
where to find the applicable terms.
|
||||||
|
|
||||||
|
Additional terms, permissive or non-permissive, may be stated in the
|
||||||
|
form of a separately written license, or stated as exceptions;
|
||||||
|
the above requirements apply either way.
|
||||||
|
|
||||||
|
8. Termination.
|
||||||
|
|
||||||
|
You may not propagate or modify a covered work except as expressly
|
||||||
|
provided under this License. Any attempt otherwise to propagate or
|
||||||
|
modify it is void, and will automatically terminate your rights under
|
||||||
|
this License (including any patent licenses granted under the third
|
||||||
|
paragraph of section 11).
|
||||||
|
|
||||||
|
However, if you cease all violation of this License, then your
|
||||||
|
license from a particular copyright holder is reinstated (a)
|
||||||
|
provisionally, unless and until the copyright holder explicitly and
|
||||||
|
finally terminates your license, and (b) permanently, if the copyright
|
||||||
|
holder fails to notify you of the violation by some reasonable means
|
||||||
|
prior to 60 days after the cessation.
|
||||||
|
|
||||||
|
Moreover, your license from a particular copyright holder is
|
||||||
|
reinstated permanently if the copyright holder notifies you of the
|
||||||
|
violation by some reasonable means, this is the first time you have
|
||||||
|
received notice of violation of this License (for any work) from that
|
||||||
|
copyright holder, and you cure the violation prior to 30 days after
|
||||||
|
your receipt of the notice.
|
||||||
|
|
||||||
|
Termination of your rights under this section does not terminate the
|
||||||
|
licenses of parties who have received copies or rights from you under
|
||||||
|
this License. If your rights have been terminated and not permanently
|
||||||
|
reinstated, you do not qualify to receive new licenses for the same
|
||||||
|
material under section 10.
|
||||||
|
|
||||||
|
9. Acceptance Not Required for Having Copies.
|
||||||
|
|
||||||
|
You are not required to accept this License in order to receive or
|
||||||
|
run a copy of the Program. Ancillary propagation of a covered work
|
||||||
|
occurring solely as a consequence of using peer-to-peer transmission
|
||||||
|
to receive a copy likewise does not require acceptance. However,
|
||||||
|
nothing other than this License grants you permission to propagate or
|
||||||
|
modify any covered work. These actions infringe copyright if you do
|
||||||
|
not accept this License. Therefore, by modifying or propagating a
|
||||||
|
covered work, you indicate your acceptance of this License to do so.
|
||||||
|
|
||||||
|
10. Automatic Licensing of Downstream Recipients.
|
||||||
|
|
||||||
|
Each time you convey a covered work, the recipient automatically
|
||||||
|
receives a license from the original licensors, to run, modify and
|
||||||
|
propagate that work, subject to this License. You are not responsible
|
||||||
|
for enforcing compliance by third parties with this License.
|
||||||
|
|
||||||
|
An "entity transaction" is a transaction transferring control of an
|
||||||
|
organization, or substantially all assets of one, or subdividing an
|
||||||
|
organization, or merging organizations. If propagation of a covered
|
||||||
|
work results from an entity transaction, each party to that
|
||||||
|
transaction who receives a copy of the work also receives whatever
|
||||||
|
licenses to the work the party's predecessor in interest had or could
|
||||||
|
give under the previous paragraph, plus a right to possession of the
|
||||||
|
Corresponding Source of the work from the predecessor in interest, if
|
||||||
|
the predecessor has it or can get it with reasonable efforts.
|
||||||
|
|
||||||
|
You may not impose any further restrictions on the exercise of the
|
||||||
|
rights granted or affirmed under this License. For example, you may
|
||||||
|
not impose a license fee, royalty, or other charge for exercise of
|
||||||
|
rights granted under this License, and you may not initiate litigation
|
||||||
|
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||||
|
any patent claim is infringed by making, using, selling, offering for
|
||||||
|
sale, or importing the Program or any portion of it.
|
||||||
|
|
||||||
|
11. Patents.
|
||||||
|
|
||||||
|
A "contributor" is a copyright holder who authorizes use under this
|
||||||
|
License of the Program or a work on which the Program is based. The
|
||||||
|
work thus licensed is called the contributor's "contributor version".
|
||||||
|
|
||||||
|
A contributor's "essential patent claims" are all patent claims
|
||||||
|
owned or controlled by the contributor, whether already acquired or
|
||||||
|
hereafter acquired, that would be infringed by some manner, permitted
|
||||||
|
by this License, of making, using, or selling its contributor version,
|
||||||
|
but do not include claims that would be infringed only as a
|
||||||
|
consequence of further modification of the contributor version. For
|
||||||
|
purposes of this definition, "control" includes the right to grant
|
||||||
|
patent sublicenses in a manner consistent with the requirements of
|
||||||
|
this License.
|
||||||
|
|
||||||
|
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||||
|
patent license under the contributor's essential patent claims, to
|
||||||
|
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||||
|
propagate the contents of its contributor version.
|
||||||
|
|
||||||
|
In the following three paragraphs, a "patent license" is any express
|
||||||
|
agreement or commitment, however denominated, not to enforce a patent
|
||||||
|
(such as an express permission to practice a patent or covenant not to
|
||||||
|
sue for patent infringement). To "grant" such a patent license to a
|
||||||
|
party means to make such an agreement or commitment not to enforce a
|
||||||
|
patent against the party.
|
||||||
|
|
||||||
|
If you convey a covered work, knowingly relying on a patent license,
|
||||||
|
and the Corresponding Source of the work is not available for anyone
|
||||||
|
to copy, free of charge and under the terms of this License, through a
|
||||||
|
publicly available network server or other readily accessible means,
|
||||||
|
then you must either (1) cause the Corresponding Source to be so
|
||||||
|
available, or (2) arrange to deprive yourself of the benefit of the
|
||||||
|
patent license for this particular work, or (3) arrange, in a manner
|
||||||
|
consistent with the requirements of this License, to extend the patent
|
||||||
|
license to downstream recipients. "Knowingly relying" means you have
|
||||||
|
actual knowledge that, but for the patent license, your conveying the
|
||||||
|
covered work in a country, or your recipient's use of the covered work
|
||||||
|
in a country, would infringe one or more identifiable patents in that
|
||||||
|
country that you have reason to believe are valid.
|
||||||
|
|
||||||
|
If, pursuant to or in connection with a single transaction or
|
||||||
|
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||||
|
covered work, and grant a patent license to some of the parties
|
||||||
|
receiving the covered work authorizing them to use, propagate, modify
|
||||||
|
or convey a specific copy of the covered work, then the patent license
|
||||||
|
you grant is automatically extended to all recipients of the covered
|
||||||
|
work and works based on it.
|
||||||
|
|
||||||
|
A patent license is "discriminatory" if it does not include within
|
||||||
|
the scope of its coverage, prohibits the exercise of, or is
|
||||||
|
conditioned on the non-exercise of one or more of the rights that are
|
||||||
|
specifically granted under this License. You may not convey a covered
|
||||||
|
work if you are a party to an arrangement with a third party that is
|
||||||
|
in the business of distributing software, under which you make payment
|
||||||
|
to the third party based on the extent of your activity of conveying
|
||||||
|
the work, and under which the third party grants, to any of the
|
||||||
|
parties who would receive the covered work from you, a discriminatory
|
||||||
|
patent license (a) in connection with copies of the covered work
|
||||||
|
conveyed by you (or copies made from those copies), or (b) primarily
|
||||||
|
for and in connection with specific products or compilations that
|
||||||
|
contain the covered work, unless you entered into that arrangement,
|
||||||
|
or that patent license was granted, prior to 28 March 2007.
|
||||||
|
|
||||||
|
Nothing in this License shall be construed as excluding or limiting
|
||||||
|
any implied license or other defenses to infringement that may
|
||||||
|
otherwise be available to you under applicable patent law.
|
||||||
|
|
||||||
|
12. No Surrender of Others' Freedom.
|
||||||
|
|
||||||
|
If conditions are imposed on you (whether by court order, agreement or
|
||||||
|
otherwise) that contradict the conditions of this License, they do not
|
||||||
|
excuse you from the conditions of this License. If you cannot convey a
|
||||||
|
covered work so as to satisfy simultaneously your obligations under this
|
||||||
|
License and any other pertinent obligations, then as a consequence you may
|
||||||
|
not convey it at all. For example, if you agree to terms that obligate you
|
||||||
|
to collect a royalty for further conveying from those to whom you convey
|
||||||
|
the Program, the only way you could satisfy both those terms and this
|
||||||
|
License would be to refrain entirely from conveying the Program.
|
||||||
|
|
||||||
|
13. Use with the GNU Affero General Public License.
|
||||||
|
|
||||||
|
Notwithstanding any other provision of this License, you have
|
||||||
|
permission to link or combine any covered work with a work licensed
|
||||||
|
under version 3 of the GNU Affero General Public License into a single
|
||||||
|
combined work, and to convey the resulting work. The terms of this
|
||||||
|
License will continue to apply to the part which is the covered work,
|
||||||
|
but the special requirements of the GNU Affero General Public License,
|
||||||
|
section 13, concerning interaction through a network will apply to the
|
||||||
|
combination as such.
|
||||||
|
|
||||||
|
14. Revised Versions of this License.
|
||||||
|
|
||||||
|
The Free Software Foundation may publish revised and/or new versions of
|
||||||
|
the GNU General Public License from time to time. Such new versions will
|
||||||
|
be similar in spirit to the present version, but may differ in detail to
|
||||||
|
address new problems or concerns.
|
||||||
|
|
||||||
|
Each version is given a distinguishing version number. If the
|
||||||
|
Program specifies that a certain numbered version of the GNU General
|
||||||
|
Public License "or any later version" applies to it, you have the
|
||||||
|
option of following the terms and conditions either of that numbered
|
||||||
|
version or of any later version published by the Free Software
|
||||||
|
Foundation. If the Program does not specify a version number of the
|
||||||
|
GNU General Public License, you may choose any version ever published
|
||||||
|
by the Free Software Foundation.
|
||||||
|
|
||||||
|
If the Program specifies that a proxy can decide which future
|
||||||
|
versions of the GNU General Public License can be used, that proxy's
|
||||||
|
public statement of acceptance of a version permanently authorizes you
|
||||||
|
to choose that version for the Program.
|
||||||
|
|
||||||
|
Later license versions may give you additional or different
|
||||||
|
permissions. However, no additional obligations are imposed on any
|
||||||
|
author or copyright holder as a result of your choosing to follow a
|
||||||
|
later version.
|
||||||
|
|
||||||
|
15. Disclaimer of Warranty.
|
||||||
|
|
||||||
|
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||||
|
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||||
|
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
||||||
|
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||||
|
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||||
|
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||||
|
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||||
|
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||||
|
|
||||||
|
16. Limitation of Liability.
|
||||||
|
|
||||||
|
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||||
|
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||||
|
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||||
|
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
||||||
|
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||||
|
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
||||||
|
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||||
|
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||||
|
SUCH DAMAGES.
|
||||||
|
|
||||||
|
17. Interpretation of Sections 15 and 16.
|
||||||
|
|
||||||
|
If the disclaimer of warranty and limitation of liability provided
|
||||||
|
above cannot be given local legal effect according to their terms,
|
||||||
|
reviewing courts shall apply local law that most closely approximates
|
||||||
|
an absolute waiver of all civil liability in connection with the
|
||||||
|
Program, unless a warranty or assumption of liability accompanies a
|
||||||
|
copy of the Program in return for a fee.
|
||||||
|
|
||||||
|
END OF TERMS AND CONDITIONS
|
||||||
|
|
||||||
|
How to Apply These Terms to Your New Programs
|
||||||
|
|
||||||
|
If you develop a new program, and you want it to be of the greatest
|
||||||
|
possible use to the public, the best way to achieve this is to make it
|
||||||
|
free software which everyone can redistribute and change under these terms.
|
||||||
|
|
||||||
|
To do so, attach the following notices to the program. It is safest
|
||||||
|
to attach them to the start of each source file to most effectively
|
||||||
|
state the exclusion of warranty; and each file should have at least
|
||||||
|
the "copyright" line and a pointer to where the full notice is found.
|
||||||
|
|
||||||
|
<one line to give the program's name and a brief idea of what it does.>
|
||||||
|
Copyright (C) <year> <name of author>
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Also add information on how to contact you by electronic and paper mail.
|
||||||
|
|
||||||
|
If the program does terminal interaction, make it output a short
|
||||||
|
notice like this when it starts in an interactive mode:
|
||||||
|
|
||||||
|
<program> Copyright (C) <year> <name of author>
|
||||||
|
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||||
|
This is free software, and you are welcome to redistribute it
|
||||||
|
under certain conditions; type `show c' for details.
|
||||||
|
|
||||||
|
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||||
|
parts of the General Public License. Of course, your program's commands
|
||||||
|
might be different; for a GUI interface, you would use an "about box".
|
||||||
|
|
||||||
|
You should also get your employer (if you work as a programmer) or school,
|
||||||
|
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||||
|
For more information on this, and how to apply and follow the GNU GPL, see
|
||||||
|
<http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
The GNU General Public License does not permit incorporating your program
|
||||||
|
into proprietary programs. If your program is a subroutine library, you
|
||||||
|
may consider it more useful to permit linking proprietary applications with
|
||||||
|
the library. If this is what you want to do, use the GNU Lesser General
|
||||||
|
Public License instead of this License. But first, please read
|
||||||
|
<http://www.gnu.org/philosophy/why-not-lgpl.html>.
|
|
@ -0,0 +1,27 @@
|
||||||
|
declare interface Map<K, V> {
|
||||||
|
/**
|
||||||
|
* @deprecated 为了兼容array改为map而创建的方法,请使用has
|
||||||
|
*/
|
||||||
|
contains(item: K): boolean;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated 为了兼容array改为map而创建的方法,请使用has
|
||||||
|
*/
|
||||||
|
inculdes(item: K): boolean;
|
||||||
|
/**
|
||||||
|
* @deprecated 为了兼容array改为map而创建的方法,请使用set
|
||||||
|
*/
|
||||||
|
add(item: K): this;
|
||||||
|
/**
|
||||||
|
* @deprecated 为了兼容array改为map而创建的方法,请使用set
|
||||||
|
*/
|
||||||
|
push(item: K): this;
|
||||||
|
/**
|
||||||
|
* @deprecated 为了兼容array改为map而创建的方法
|
||||||
|
*/
|
||||||
|
addArray(arr: Array<K>): this;
|
||||||
|
/**
|
||||||
|
* @deprecated 为了兼容array改为map而创建的方法,请使用delete
|
||||||
|
*/
|
||||||
|
remove(item: K): this;
|
||||||
|
}
|
|
@ -0,0 +1,43 @@
|
||||||
|
declare interface Result {
|
||||||
|
/**
|
||||||
|
* 最终结果
|
||||||
|
*
|
||||||
|
* 大多代表该事件到达这一步骤过程中的结果;
|
||||||
|
* 一般用来标记当前事件是否按预定执行的,即执行成功
|
||||||
|
*
|
||||||
|
* 大部分事件间接接触game.check,一般最终结果不变,大多数是这种
|
||||||
|
*
|
||||||
|
* 其实主要是ok方法会有直接的bool,主要涉及game.check;
|
||||||
|
*/
|
||||||
|
bool?: boolean;
|
||||||
|
|
||||||
|
//choose系
|
||||||
|
/** 记录返回当前事件操作过程中的卡牌 */
|
||||||
|
cards: Card[];
|
||||||
|
/** 记录返回当前事件操作过程中的目标 */
|
||||||
|
targets: Player[];
|
||||||
|
/** 记录返回当前事件操作过程中的按钮 */
|
||||||
|
buttons: Button[];
|
||||||
|
/** 记录buttons内所有button.link(即该按钮的类型,link的类型很多,参考按钮的item) */
|
||||||
|
links: any[];
|
||||||
|
|
||||||
|
//control系(直接control系列没有result.bool)
|
||||||
|
/** control操作面板的选中结果,即该按钮的link,即名字 */
|
||||||
|
control: string;
|
||||||
|
/** 既control的下标 */
|
||||||
|
index: number;
|
||||||
|
|
||||||
|
//ok系
|
||||||
|
/** 记录返回当前事件操作过程中,面板按钮的确定ok取消cancel */
|
||||||
|
confirm: string;
|
||||||
|
/** 一般为触发的“视为”技能 */
|
||||||
|
skill: string;
|
||||||
|
/**
|
||||||
|
* 当前事件操作的“视为”牌,
|
||||||
|
* 当前有“视为”操作,该card参数特供给视为牌,不需要cards[0]获取视为牌 ;
|
||||||
|
* 判断是否为视为牌:card.isCard,false为视为牌
|
||||||
|
*/
|
||||||
|
card: Card;
|
||||||
|
|
||||||
|
[key: string]: any;
|
||||||
|
}
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,69 @@
|
||||||
|
// Type definitions for Apache Cordova Dialogs plugin
|
||||||
|
// Project: https://github.com/apache/cordova-plugin-dialogs
|
||||||
|
// Definitions by: Microsoft Open Technologies Inc <http://msopentech.com>
|
||||||
|
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||||
|
//
|
||||||
|
// Copyright (c) Microsoft Open Technologies Inc
|
||||||
|
// Licensed under the MIT license.
|
||||||
|
|
||||||
|
interface Navigator {
|
||||||
|
/** This plugin provides access to some native dialog UI elements. */
|
||||||
|
notification: Notification
|
||||||
|
}
|
||||||
|
|
||||||
|
/** This plugin provides access to some native dialog UI elements. */
|
||||||
|
interface Notification {
|
||||||
|
/**
|
||||||
|
* Shows a custom alert or dialog box. Most Cordova implementations use a native dialog box for this feature,
|
||||||
|
* but some platforms use the browser's alert function, which is typically less customizable.
|
||||||
|
* @param message Dialog message.
|
||||||
|
* @param alertCallback Callback to invoke when alert dialog is dismissed.
|
||||||
|
* @param title Dialog title, defaults to 'Alert'.
|
||||||
|
* @param buttonName Button name, defaults to OK.
|
||||||
|
*/
|
||||||
|
alert(message: string,
|
||||||
|
alertCallback: () => void,
|
||||||
|
title?: string,
|
||||||
|
buttonName?: string): void;
|
||||||
|
/**
|
||||||
|
* The device plays a beep sound.
|
||||||
|
* @param times The number of times to repeat the beep.
|
||||||
|
*/
|
||||||
|
beep(times: number): void;
|
||||||
|
/**
|
||||||
|
* Displays a customizable confirmation dialog box.
|
||||||
|
* @param message Dialog message.
|
||||||
|
* @param confirmCallback Callback to invoke with index of button pressed (1, 2, or 3)
|
||||||
|
* or when the dialog is dismissed without a button press (0).
|
||||||
|
* @param title Dialog title, defaults to Confirm.
|
||||||
|
* @param buttonLabels Array of strings specifying button labels, defaults to [OK,Cancel].
|
||||||
|
*/
|
||||||
|
confirm(message: string,
|
||||||
|
confirmCallback: (choice: number) => void,
|
||||||
|
title?: string,
|
||||||
|
buttonLabels?: string[]): void;
|
||||||
|
/**
|
||||||
|
* Displays a native dialog box that is more customizable than the browser's prompt function.
|
||||||
|
* @param message Dialog message.
|
||||||
|
* @param promptCallback Callback to invoke when a button is pressed.
|
||||||
|
* @param title Dialog title, defaults to "Prompt".
|
||||||
|
* @param buttonLabels Array of strings specifying button labels, defaults to ["OK","Cancel"].
|
||||||
|
* @param defaultText Default textbox input value, default: "".
|
||||||
|
*/
|
||||||
|
prompt(message: string,
|
||||||
|
promptCallback: (result: NotificationPromptResult) => void,
|
||||||
|
title?: string,
|
||||||
|
buttonLabels?: string[],
|
||||||
|
defaultText?: string): void;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Object, passed to promptCallback */
|
||||||
|
interface NotificationPromptResult {
|
||||||
|
/**
|
||||||
|
* The index of the pressed button. Note that the index uses one-based indexing, so the value is 1, 2, 3, etc.
|
||||||
|
* 0 is the result when the dialog is dismissed without a button press.
|
||||||
|
*/
|
||||||
|
buttonIndex: number;
|
||||||
|
/** The text entered in the prompt dialog box. */
|
||||||
|
input1: string;
|
||||||
|
}
|
136
node_modules/@types/noname-typings/cordova-plugin-file-transfer.d.ts
generated
vendored
Normal file
136
node_modules/@types/noname-typings/cordova-plugin-file-transfer.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,136 @@
|
||||||
|
// Type definitions for Apache Cordova FileTransfer plugin
|
||||||
|
// Project: https://github.com/apache/cordova-plugin-file-transfer
|
||||||
|
// Definitions by: Microsoft Open Technologies Inc. <http://msopentech.com>
|
||||||
|
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||||
|
//
|
||||||
|
// Copyright (c) Microsoft Open Technologies Inc
|
||||||
|
// Licensed under the MIT license
|
||||||
|
|
||||||
|
/// <reference path="./cordova-plugin-file.d.ts" />
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The FileTransfer object provides a way to upload files using an HTTP multi-part POST request,
|
||||||
|
* and to download files as well.
|
||||||
|
*/
|
||||||
|
interface FileTransfer {
|
||||||
|
/** Called with a ProgressEvent whenever a new chunk of data is transferred. */
|
||||||
|
onprogress: (event: ProgressEvent) => void;
|
||||||
|
/**
|
||||||
|
* Sends a file to a server.
|
||||||
|
* @param fileURL Filesystem URL representing the file on the device. For backwards compatibility,
|
||||||
|
* this can also be the full path of the file on the device.
|
||||||
|
* @param server URL of the server to receive the file, as encoded by encodeURI().
|
||||||
|
* @param successCallback A callback that is passed a FileUploadResult object.
|
||||||
|
* @param errorCallback A callback that executes if an error occurs retrieving the FileUploadResult.
|
||||||
|
* Invoked with a FileTransferError object.
|
||||||
|
* @param options Optional parameters.
|
||||||
|
* @param trustAllHosts Optional parameter, defaults to false. If set to true, it accepts all security certificates.
|
||||||
|
* This is useful since Android rejects self-signed security certificates.
|
||||||
|
* Not recommended for production use. Supported on Android and iOS.
|
||||||
|
*/
|
||||||
|
upload(
|
||||||
|
fileURL: string,
|
||||||
|
server: string,
|
||||||
|
successCallback: (result: FileUploadResult) => void,
|
||||||
|
errorCallback: (error: FileTransferError) => void,
|
||||||
|
options?: FileUploadOptions,
|
||||||
|
trustAllHosts?: boolean): void;
|
||||||
|
/**
|
||||||
|
* downloads a file from server.
|
||||||
|
* @param source URL of the server to download the file, as encoded by encodeURI().
|
||||||
|
* @param target Filesystem url representing the file on the device. For backwards compatibility,
|
||||||
|
* this can also be the full path of the file on the device.
|
||||||
|
* @param successCallback A callback that is passed a FileEntry object. (Function)
|
||||||
|
* @param errorCallback A callback that executes if an error occurs when retrieving the fileEntry.
|
||||||
|
* Invoked with a FileTransferError object.
|
||||||
|
* @param options Optional parameters.
|
||||||
|
* @param trustAllHosts Optional parameter, defaults to false. If set to true, it accepts all security certificates.
|
||||||
|
* This is useful since Android rejects self-signed security certificates.
|
||||||
|
* Not recommended for production use. Supported on Android and iOS.
|
||||||
|
*/
|
||||||
|
download(
|
||||||
|
source: string,
|
||||||
|
target: string,
|
||||||
|
successCallback: (fileEntry: FileEntry) => void,
|
||||||
|
errorCallback: (error: FileTransferError) => void,
|
||||||
|
trustAllHosts?: boolean,
|
||||||
|
options?: FileDownloadOptions): void;
|
||||||
|
/**
|
||||||
|
* Aborts an in-progress transfer. The onerror callback is passed a FileTransferError object
|
||||||
|
* which has an error code of FileTransferError.ABORT_ERR.
|
||||||
|
*/
|
||||||
|
abort(): void;
|
||||||
|
}
|
||||||
|
|
||||||
|
declare var FileTransfer: {
|
||||||
|
new(): FileTransfer;
|
||||||
|
};
|
||||||
|
|
||||||
|
/** A FileUploadResult object is passed to the success callback of the FileTransfer object's upload() method. */
|
||||||
|
interface FileUploadResult {
|
||||||
|
/** The number of bytes sent to the server as part of the upload. */
|
||||||
|
bytesSent: number;
|
||||||
|
/** The HTTP response code returned by the server. */
|
||||||
|
responseCode: number;
|
||||||
|
/** The HTTP response returned by the server. */
|
||||||
|
response: string;
|
||||||
|
/** The HTTP response headers by the server. Currently supported on iOS only.*/
|
||||||
|
headers: any;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Optional parameters for upload method. */
|
||||||
|
interface FileUploadOptions {
|
||||||
|
/** The name of the form element. Defaults to file. */
|
||||||
|
fileKey?: string;
|
||||||
|
/** The file name to use when saving the file on the server. Defaults to image.jpg. */
|
||||||
|
fileName?: string;
|
||||||
|
/** The HTTP method to use - either `PUT` or `POST`. Defaults to `POST`. */
|
||||||
|
httpMethod?: string;
|
||||||
|
/** The mime type of the data to upload. Defaults to image/jpeg. */
|
||||||
|
mimeType?: string;
|
||||||
|
/** A set of optional key/value pairs to pass in the HTTP request. */
|
||||||
|
params?: Object;
|
||||||
|
/** Whether to upload the data in chunked streaming mode. Defaults to true. */
|
||||||
|
chunkedMode?: boolean;
|
||||||
|
/** A map of header name/header values. Use an array to specify more than one value. */
|
||||||
|
headers?: Object;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Optional parameters for download method. */
|
||||||
|
interface FileDownloadOptions {
|
||||||
|
/** A map of header name/header values. */
|
||||||
|
headers?: {};
|
||||||
|
}
|
||||||
|
|
||||||
|
/** A FileTransferError object is passed to an error callback when an error occurs. */
|
||||||
|
interface FileTransferError {
|
||||||
|
/**
|
||||||
|
* One of the predefined error codes listed below.
|
||||||
|
* FileTransferError.FILE_NOT_FOUND_ERR
|
||||||
|
* FileTransferError.INVALID_URL_ERR
|
||||||
|
* FileTransferError.CONNECTION_ERR
|
||||||
|
* FileTransferError.ABORT_ERR
|
||||||
|
* FileTransferError.NOT_MODIFIED_ERR
|
||||||
|
*/
|
||||||
|
code: number;
|
||||||
|
/** URL to the source. */
|
||||||
|
source: string;
|
||||||
|
/** URL to the target. */
|
||||||
|
target: string;
|
||||||
|
/** HTTP status code. This attribute is only available when a response code is received from the HTTP connection. */
|
||||||
|
http_status: number;
|
||||||
|
/* Response body. This attribute is only available when a response is received from the HTTP connection. */
|
||||||
|
body: string;
|
||||||
|
/* Exception that is thrown by native code */
|
||||||
|
exception: any;
|
||||||
|
}
|
||||||
|
|
||||||
|
declare var FileTransferError: {
|
||||||
|
/** Constructor for FileTransferError object */
|
||||||
|
new(code?: number, source?: string, target?: string, status?: number, body?: any, exception?: any): FileTransferError;
|
||||||
|
FILE_NOT_FOUND_ERR: number;
|
||||||
|
INVALID_URL_ERR: number;
|
||||||
|
CONNECTION_ERR: number;
|
||||||
|
ABORT_ERR: number;
|
||||||
|
NOT_MODIFIED_ERR: number;
|
||||||
|
}
|
|
@ -0,0 +1,374 @@
|
||||||
|
// Type definitions for Apache Cordova File System plugin
|
||||||
|
// Project: https://github.com/apache/cordova-plugin-file
|
||||||
|
// Definitions by: Microsoft Open Technologies Inc <http://msopentech.com>
|
||||||
|
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||||
|
//
|
||||||
|
// Copyright (c) Microsoft Open Technologies, Inc.
|
||||||
|
// Licensed under the MIT license.
|
||||||
|
|
||||||
|
interface Window {
|
||||||
|
/**
|
||||||
|
* Requests a filesystem in which to store application data.
|
||||||
|
* @param type Whether the filesystem requested should be persistent, as defined above. Use one of TEMPORARY or PERSISTENT.
|
||||||
|
* @param size This is an indicator of how much storage space, in bytes, the application expects to need.
|
||||||
|
* @param successCallback The callback that is called when the user agent provides a filesystem.
|
||||||
|
* @param errorCallback A callback that is called when errors happen, or when the request to obtain the filesystem is denied.
|
||||||
|
*/
|
||||||
|
requestFileSystem(
|
||||||
|
type: LocalFileSystem,
|
||||||
|
size: number,
|
||||||
|
successCallback: (fileSystem: FileSystem) => void,
|
||||||
|
errorCallback?: (fileError: FileError) => void): void;
|
||||||
|
/**
|
||||||
|
* Look up file system Entry referred to by local URL.
|
||||||
|
* @param string url URL referring to a local file or directory
|
||||||
|
* @param successCallback invoked with Entry object corresponding to URL
|
||||||
|
* @param errorCallback invoked if error occurs retrieving file system entry
|
||||||
|
*/
|
||||||
|
resolveLocalFileSystemURL(url: string,
|
||||||
|
successCallback: (entry: Entry) => void,
|
||||||
|
errorCallback?: (error: FileError) => void): void;
|
||||||
|
|
||||||
|
resolveLocalFileSystemURL(url: string,
|
||||||
|
successCallback: (entry: DirectoryEntry) => void,
|
||||||
|
errorCallback?: (error: FileError) => void): void;
|
||||||
|
/**
|
||||||
|
* Look up file system Entry referred to by local URI.
|
||||||
|
* @param string uri URI referring to a local file or directory
|
||||||
|
* @param successCallback invoked with Entry object corresponding to URI
|
||||||
|
* @param errorCallback invoked if error occurs retrieving file system entry
|
||||||
|
*/
|
||||||
|
resolveLocalFileSystemURI(uri: string,
|
||||||
|
successCallback: (entry: Entry) => void,
|
||||||
|
errorCallback?: (error: FileError) => void): void;
|
||||||
|
TEMPORARY: number;
|
||||||
|
PERSISTENT: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An abstract interface representing entries in a file system,
|
||||||
|
* each of which may be a File or DirectoryEntry.
|
||||||
|
*/
|
||||||
|
interface Entry {
|
||||||
|
/** Entry is a file. */
|
||||||
|
isFile: boolean;
|
||||||
|
/** Entry is a directory. */
|
||||||
|
isDirectory: boolean;
|
||||||
|
/** The name of the entry, excluding the path leading to it. */
|
||||||
|
name: string;
|
||||||
|
/** The full absolute path from the root to the entry. */
|
||||||
|
fullPath: string;
|
||||||
|
/** The file system on which the entry resides. */
|
||||||
|
filesystem: FileSystem;
|
||||||
|
nativeURL: string;
|
||||||
|
/**
|
||||||
|
* Look up metadata about this entry.
|
||||||
|
* @param successCallback A callback that is called with the time of the last modification.
|
||||||
|
* @param errorCallback A callback that is called when errors happen.
|
||||||
|
*/
|
||||||
|
getMetadata(
|
||||||
|
successCallback: (metadata: Metadata) => void,
|
||||||
|
errorCallback?: (error: FileError) => void): void;
|
||||||
|
/**
|
||||||
|
* Move an entry to a different location on the file system. It is an error to try to:
|
||||||
|
* move a directory inside itself or to any child at any depth;move an entry into its parent if a name different from its current one isn't provided;
|
||||||
|
* move a file to a path occupied by a directory;
|
||||||
|
* move a directory to a path occupied by a file;
|
||||||
|
* move any element to a path occupied by a directory which is not empty.
|
||||||
|
* A move of a file on top of an existing file must attempt to delete and replace that file.
|
||||||
|
* A move of a directory on top of an existing empty directory must attempt to delete and replace that directory.
|
||||||
|
* @param parent The directory to which to move the entry.
|
||||||
|
* @param newName The new name of the entry. Defaults to the Entry's current name if unspecified.
|
||||||
|
* @param successCallback A callback that is called with the Entry for the new location.
|
||||||
|
* @param errorCallback A callback that is called when errors happen.
|
||||||
|
*/
|
||||||
|
moveTo(parent: DirectoryEntry,
|
||||||
|
newName?: string,
|
||||||
|
successCallback?: (entry: Entry) => void,
|
||||||
|
errorCallback?: (error: FileError) => void): void;
|
||||||
|
/**
|
||||||
|
* Copy an entry to a different location on the file system. It is an error to try to:
|
||||||
|
* copy a directory inside itself or to any child at any depth;
|
||||||
|
* copy an entry into its parent if a name different from its current one isn't provided;
|
||||||
|
* copy a file to a path occupied by a directory;
|
||||||
|
* copy a directory to a path occupied by a file;
|
||||||
|
* copy any element to a path occupied by a directory which is not empty.
|
||||||
|
* A copy of a file on top of an existing file must attempt to delete and replace that file.
|
||||||
|
* A copy of a directory on top of an existing empty directory must attempt to delete and replace that directory.
|
||||||
|
* Directory copies are always recursive--that is, they copy all contents of the directory.
|
||||||
|
* @param parent The directory to which to move the entry.
|
||||||
|
* @param newName The new name of the entry. Defaults to the Entry's current name if unspecified.
|
||||||
|
* @param successCallback A callback that is called with the Entry for the new object.
|
||||||
|
* @param errorCallback A callback that is called when errors happen.
|
||||||
|
*/
|
||||||
|
copyTo(parent: DirectoryEntry,
|
||||||
|
newName?: string,
|
||||||
|
successCallback?: (entry: Entry) => void,
|
||||||
|
errorCallback?: (error: FileError) => void): void;
|
||||||
|
/**
|
||||||
|
* Returns a URL that can be used as the src attribute of a <video> or <audio> tag.
|
||||||
|
* If that is not possible, construct a cdvfile:// URL.
|
||||||
|
* @return string URL
|
||||||
|
*/
|
||||||
|
toURL(): string;
|
||||||
|
/**
|
||||||
|
* Return a URL that can be passed across the bridge to identify this entry.
|
||||||
|
* @return string URL that can be passed across the bridge to identify this entry
|
||||||
|
*/
|
||||||
|
toInternalURL(): string;
|
||||||
|
/**
|
||||||
|
* Deletes a file or directory. It is an error to attempt to delete a directory that is not empty. It is an error to attempt to delete the root directory of a filesystem.
|
||||||
|
* @param successCallback A callback that is called on success.
|
||||||
|
* @param errorCallback A callback that is called when errors happen.
|
||||||
|
*/
|
||||||
|
remove(successCallback: () => void,
|
||||||
|
errorCallback?: (error: FileError) => void): void;
|
||||||
|
/**
|
||||||
|
* Look up the parent DirectoryEntry containing this Entry. If this Entry is the root of its filesystem, its parent is itself.
|
||||||
|
* @param successCallback A callback that is called with the time of the last modification.
|
||||||
|
* @param errorCallback A callback that is called when errors happen.
|
||||||
|
*/
|
||||||
|
getParent(successCallback: (entry: Entry) => void,
|
||||||
|
errorCallback?: (error: FileError) => void): void;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** This interface supplies information about the state of a file or directory. */
|
||||||
|
interface Metadata {
|
||||||
|
/** This is the time at which the file or directory was last modified. */
|
||||||
|
modificationTime: Date;
|
||||||
|
/** The size of the file, in bytes. This must return 0 for directories. */
|
||||||
|
size: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** This interface represents a directory on a file system. */
|
||||||
|
interface DirectoryEntry extends Entry {
|
||||||
|
/**
|
||||||
|
* Creates a new DirectoryReader to read Entries from this Directory.
|
||||||
|
*/
|
||||||
|
createReader(): DirectoryReader;
|
||||||
|
/**
|
||||||
|
* Creates or looks up a file.
|
||||||
|
* @param path Either an absolute path or a relative path from this DirectoryEntry
|
||||||
|
* to the file to be looked up or created.
|
||||||
|
* It is an error to attempt to create a file whose immediate parent does not yet exist.
|
||||||
|
* @param options If create and exclusive are both true, and the path already exists, getFile must fail.
|
||||||
|
* If create is true, the path doesn't exist, and no other error occurs, getFile must create it as a zero-length file and return a corresponding FileEntry.
|
||||||
|
* If create is not true and the path doesn't exist, getFile must fail.
|
||||||
|
* If create is not true and the path exists, but is a directory, getFile must fail.
|
||||||
|
* Otherwise, if no other error occurs, getFile must return a FileEntry corresponding to path.
|
||||||
|
* @param successCallback A callback that is called to return the File selected or created.
|
||||||
|
* @param errorCallback A callback that is called when errors happen.
|
||||||
|
*/
|
||||||
|
getFile(path: string, options?: Flags,
|
||||||
|
successCallback?: (entry: FileEntry) => void,
|
||||||
|
errorCallback?: (error: FileError) => void): void;
|
||||||
|
/**
|
||||||
|
* Creates or looks up a directory.
|
||||||
|
* @param path Either an absolute path or a relative path from this DirectoryEntry
|
||||||
|
* to the directory to be looked up or created.
|
||||||
|
* It is an error to attempt to create a directory whose immediate parent does not yet exist.
|
||||||
|
* @param options If create and exclusive are both true and the path already exists, getDirectory must fail.
|
||||||
|
* If create is true, the path doesn't exist, and no other error occurs, getDirectory must create and return a corresponding DirectoryEntry.
|
||||||
|
* If create is not true and the path doesn't exist, getDirectory must fail.
|
||||||
|
* If create is not true and the path exists, but is a file, getDirectory must fail.
|
||||||
|
* Otherwise, if no other error occurs, getDirectory must return a DirectoryEntry corresponding to path.
|
||||||
|
* @param successCallback A callback that is called to return the Directory selected or created.
|
||||||
|
* @param errorCallback A callback that is called when errors happen.
|
||||||
|
*/
|
||||||
|
getDirectory(path: string, options?: Flags,
|
||||||
|
successCallback?: (entry: DirectoryEntry) => void,
|
||||||
|
errorCallback?: (error: FileError) => void): void;
|
||||||
|
/**
|
||||||
|
* Deletes a directory and all of its contents, if any. In the event of an error (e.g. trying
|
||||||
|
* to delete a directory that contains a file that cannot be removed), some of the contents
|
||||||
|
* of the directory may be deleted. It is an error to attempt to delete the root directory of a filesystem.
|
||||||
|
* @param successCallback A callback that is called on success.
|
||||||
|
* @param errorCallback A callback that is called when errors happen.
|
||||||
|
*/
|
||||||
|
removeRecursively(successCallback: () => void,
|
||||||
|
errorCallback?: (error: FileError) => void): void;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This dictionary is used to supply arguments to methods
|
||||||
|
* that look up or create files or directories.
|
||||||
|
*/
|
||||||
|
interface Flags {
|
||||||
|
/** Used to indicate that the user wants to create a file or directory if it was not previously there. */
|
||||||
|
create?: boolean;
|
||||||
|
/** By itself, exclusive must have no effect. Used with create, it must cause getFile and getDirectory to fail if the target path already exists. */
|
||||||
|
exclusive?: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This interface lets a user list files and directories in a directory. If there are
|
||||||
|
* no additions to or deletions from a directory between the first and last call to
|
||||||
|
* readEntries, and no errors occur, then:
|
||||||
|
* A series of calls to readEntries must return each entry in the directory exactly once.
|
||||||
|
* Once all entries have been returned, the next call to readEntries must produce an empty array.
|
||||||
|
* If not all entries have been returned, the array produced by readEntries must not be empty.
|
||||||
|
* The entries produced by readEntries must not include the directory itself ["."] or its parent [".."].
|
||||||
|
*/
|
||||||
|
interface DirectoryReader {
|
||||||
|
/**
|
||||||
|
* Read the next block of entries from this directory.
|
||||||
|
* @param successCallback Called once per successful call to readEntries to deliver the next
|
||||||
|
* previously-unreported set of Entries in the associated Directory.
|
||||||
|
* If all Entries have already been returned from previous invocations
|
||||||
|
* of readEntries, successCallback must be called with a zero-length array as an argument.
|
||||||
|
* @param errorCallback A callback indicating that there was an error reading from the Directory.
|
||||||
|
*/
|
||||||
|
readEntries(
|
||||||
|
successCallback: (entries: Entry[]) => void,
|
||||||
|
errorCallback?: (error: FileError) => void): void;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** This interface represents a file on a file system. */
|
||||||
|
interface FileEntry extends Entry {
|
||||||
|
/**
|
||||||
|
* Creates a new FileWriter associated with the file that this FileEntry represents.
|
||||||
|
* @param successCallback A callback that is called with the new FileWriter.
|
||||||
|
* @param errorCallback A callback that is called when errors happen.
|
||||||
|
*/
|
||||||
|
createWriter(successCallback: (
|
||||||
|
writer: FileWriter) => void,
|
||||||
|
errorCallback?: (error: FileError) => void): void;
|
||||||
|
/**
|
||||||
|
* Returns a File that represents the current state of the file that this FileEntry represents.
|
||||||
|
* @param successCallback A callback that is called with the File.
|
||||||
|
* @param errorCallback A callback that is called when errors happen.
|
||||||
|
*/
|
||||||
|
file(successCallback: (file: File) => void,
|
||||||
|
errorCallback?: (error: FileError) => void): void;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This interface provides methods to monitor the asynchronous writing of blobs
|
||||||
|
* to disk using progress events and event handler attributes.
|
||||||
|
*/
|
||||||
|
interface FileSaver extends EventTarget {
|
||||||
|
/** Terminate file operation */
|
||||||
|
abort(): void;
|
||||||
|
/**
|
||||||
|
* The FileSaver object can be in one of 3 states. The readyState attribute, on getting,
|
||||||
|
* must return the current state, which must be one of the following values:
|
||||||
|
* INIT
|
||||||
|
* WRITING
|
||||||
|
* DONE
|
||||||
|
*/
|
||||||
|
readyState: number;
|
||||||
|
/** Handler for writestart events. */
|
||||||
|
onwritestart: (event: ProgressEvent) => void;
|
||||||
|
/** Handler for progress events. */
|
||||||
|
onprogress: (event: ProgressEvent) => void;
|
||||||
|
/** Handler for write events. */
|
||||||
|
onwrite: (event: ProgressEvent) => void;
|
||||||
|
/** Handler for abort events. */
|
||||||
|
onabort: (event: ProgressEvent) => void;
|
||||||
|
/** Handler for error events. */
|
||||||
|
onerror: (event: ProgressEvent) => void;
|
||||||
|
/** Handler for writeend events. */
|
||||||
|
onwriteend: (event: ProgressEvent) => void;
|
||||||
|
/** The last error that occurred on the FileSaver. */
|
||||||
|
error: Error;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This interface expands on the FileSaver interface to allow for multiple write
|
||||||
|
* actions, rather than just saving a single Blob.
|
||||||
|
*/
|
||||||
|
interface FileWriter extends FileSaver {
|
||||||
|
/**
|
||||||
|
* The byte offset at which the next write to the file will occur. This always less or equal than length.
|
||||||
|
* A newly-created FileWriter will have position set to 0.
|
||||||
|
*/
|
||||||
|
position: number;
|
||||||
|
/**
|
||||||
|
* The length of the file. If the user does not have read access to the file,
|
||||||
|
* this will be the highest byte offset at which the user has written.
|
||||||
|
*/
|
||||||
|
length: number;
|
||||||
|
/**
|
||||||
|
* Write the supplied data to the file at position.
|
||||||
|
* @param {Blob|string|ArrayBuffer} data The blob to write.
|
||||||
|
*/
|
||||||
|
write(data: Blob | string | ArrayBuffer): void;
|
||||||
|
/**
|
||||||
|
* The file position at which the next write will occur.
|
||||||
|
* @param offset If nonnegative, an absolute byte offset into the file.
|
||||||
|
* If negative, an offset back from the end of the file.
|
||||||
|
*/
|
||||||
|
seek(offset: number): void;
|
||||||
|
/**
|
||||||
|
* Changes the length of the file to that specified. If shortening the file, data beyond the new length
|
||||||
|
* will be discarded. If extending the file, the existing data will be zero-padded up to the new length.
|
||||||
|
* @param size The size to which the length of the file is to be adjusted, measured in bytes.
|
||||||
|
*/
|
||||||
|
truncate(size: number): void;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* FileWriter states */
|
||||||
|
declare var FileWriter: {
|
||||||
|
INIT: number;
|
||||||
|
WRITING: number;
|
||||||
|
DONE: number
|
||||||
|
};
|
||||||
|
|
||||||
|
interface FileError {
|
||||||
|
/** Error code */
|
||||||
|
code: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
declare var FileError: {
|
||||||
|
new (code: number): FileError;
|
||||||
|
NOT_FOUND_ERR: number;
|
||||||
|
SECURITY_ERR: number;
|
||||||
|
ABORT_ERR: number;
|
||||||
|
NOT_READABLE_ERR: number;
|
||||||
|
ENCODING_ERR: number;
|
||||||
|
NO_MODIFICATION_ALLOWED_ERR: number;
|
||||||
|
INVALID_STATE_ERR: number;
|
||||||
|
SYNTAX_ERR: number;
|
||||||
|
INVALID_MODIFICATION_ERR: number;
|
||||||
|
QUOTA_EXCEEDED_ERR: number;
|
||||||
|
TYPE_MISMATCH_ERR: number;
|
||||||
|
PATH_EXISTS_ERR: number;
|
||||||
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Constants defined in fileSystemPaths
|
||||||
|
*/
|
||||||
|
interface Cordova {
|
||||||
|
file: {
|
||||||
|
/* Read-only directory where the application is installed. */
|
||||||
|
applicationDirectory: string;
|
||||||
|
/* Root of app's private writable storage */
|
||||||
|
applicationStorageDirectory: string;
|
||||||
|
/* Where to put app-specific data files. */
|
||||||
|
dataDirectory: string;
|
||||||
|
/* Cached files that should survive app restarts. Apps should not rely on the OS to delete files in here. */
|
||||||
|
cacheDirectory: string;
|
||||||
|
/* Android: the application space on external storage. */
|
||||||
|
externalApplicationStorageDirectory: string;
|
||||||
|
/* Android: Where to put app-specific data files on external storage. */
|
||||||
|
externalDataDirectory: string;
|
||||||
|
/* Android: the application cache on external storage. */
|
||||||
|
externalCacheDirectory: string;
|
||||||
|
/* Android: the external storage (SD card) root. */
|
||||||
|
externalRootDirectory: string;
|
||||||
|
/* iOS: Temp directory that the OS can clear at will. */
|
||||||
|
tempDirectory: string;
|
||||||
|
/* iOS: Holds app-specific files that should be synced (e.g. to iCloud). */
|
||||||
|
syncedDataDirectory: string;
|
||||||
|
/* iOS: Files private to the app, but that are meaningful to other applciations (e.g. Office files) */
|
||||||
|
documentsDirectory: string;
|
||||||
|
/* BlackBerry10: Files globally available to all apps */
|
||||||
|
sharedDirectory: string
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
declare enum LocalFileSystem {
|
||||||
|
PERSISTENT=1,
|
||||||
|
TEMPORARY=0
|
||||||
|
}
|
390
node_modules/@types/noname-typings/cordova-plugin-local-notifications.d.ts
generated
vendored
Normal file
390
node_modules/@types/noname-typings/cordova-plugin-local-notifications.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,390 @@
|
||||||
|
interface CordovaPlugins {
|
||||||
|
notification: {
|
||||||
|
badge: Object;
|
||||||
|
local: LocalNotification;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
type Callback = (bool: boolean) => void;
|
||||||
|
|
||||||
|
interface LocalNotification {
|
||||||
|
/**
|
||||||
|
* Check permission to show notifications.
|
||||||
|
*
|
||||||
|
* @param callback The function to be exec as the callback.
|
||||||
|
* @param scope The callback function's scope.
|
||||||
|
*/
|
||||||
|
hasPermission: (callback?: Callback, scope?: any) => void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Request permission to show notifications.
|
||||||
|
*
|
||||||
|
* @param callback The function to be exec as the callback.
|
||||||
|
* @param scope The callback function's scope.
|
||||||
|
*/
|
||||||
|
requestPermission: (callback?: Callback, scope?: any) => void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Schedule notifications.
|
||||||
|
*
|
||||||
|
* @param msgs The notifications to schedule.
|
||||||
|
* @param callback The function to be exec as the callback.
|
||||||
|
* @param scope The callback function's scope.
|
||||||
|
* @param args Optional flags how to schedule.
|
||||||
|
*/
|
||||||
|
schedule: (msgs: Object | Object[], callback?: Callback, scope?: any, args?: Object) => void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Schedule notifications.
|
||||||
|
*
|
||||||
|
* @param notifications The notifications to schedule.
|
||||||
|
* @param callback The function to be exec as the callback.
|
||||||
|
* @param scope The callback function's scope.
|
||||||
|
* @param args Optional flags how to schedule.
|
||||||
|
*/
|
||||||
|
update: (msgs: Object | Object[], callback?: Callback, scope?: any, args?: Object) => void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Clear the specified notifications by id.
|
||||||
|
*
|
||||||
|
* @param ids The IDs of the notifications.
|
||||||
|
* @param callback The function to be exec as the callback.
|
||||||
|
* @param scope The callback function's scope.
|
||||||
|
*/
|
||||||
|
clear: (ids: number | number[], callback?: Callback, scope?: any) => void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Clear all triggered notifications.
|
||||||
|
*
|
||||||
|
* @param callback The function to be exec as the callback.
|
||||||
|
* @param scope The callback function's scope.
|
||||||
|
*/
|
||||||
|
clearAll: (callback?: Callback, scope?: any) => void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Clear the specified notifications by id.
|
||||||
|
*
|
||||||
|
* @param ids The IDs of the notifications.
|
||||||
|
* @param callback The function to be exec as the callback.
|
||||||
|
* @param scope The callback function's scope.
|
||||||
|
*/
|
||||||
|
cancel: (ids: number | number[], callback?: Callback, scope?: any) => void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Cancel all scheduled notifications.
|
||||||
|
*
|
||||||
|
* @param callback The function to be exec as the callback.
|
||||||
|
* @param scope The callback function's scope.
|
||||||
|
*/
|
||||||
|
cancelAll: (callback?: Callback, scope?: any) => void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if a notification is present.
|
||||||
|
*
|
||||||
|
* @param id The ID of the notification.
|
||||||
|
* @param callback The function to be exec as the callback.
|
||||||
|
* @param scope The callback function's scope.
|
||||||
|
*/
|
||||||
|
isPresent: (id: number, callback?: Callback, scope?: any) => void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if a notification is scheduled.
|
||||||
|
*
|
||||||
|
* @param id The ID of the notification.
|
||||||
|
* @param callback The function to be exec as the callback.
|
||||||
|
* @param scope The callback function's scope.
|
||||||
|
*/
|
||||||
|
isScheduled: (id: number, callback?: Callback, scope?: any) => void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if a notification was triggered.
|
||||||
|
*
|
||||||
|
* @param id The ID of the notification.
|
||||||
|
* @param callback The function to be exec as the callback.
|
||||||
|
* @param scope The callback function's scope.
|
||||||
|
*/
|
||||||
|
isTriggered: (id: number, callback?: Callback, scope?: any) => void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if a notification has a given type.
|
||||||
|
*
|
||||||
|
* @param id The ID of the notification.
|
||||||
|
* @param type The type of the notification.
|
||||||
|
* @param callback The function to be exec as the callback.
|
||||||
|
* @param scope The callback function's scope.
|
||||||
|
*/
|
||||||
|
hasType: (id: number, type: string, callback?: Callback, scope?: any) => void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the type (triggered, scheduled) for the notification.
|
||||||
|
*
|
||||||
|
* @param id The ID of the notification.
|
||||||
|
* @param callback The function to be exec as the callback.
|
||||||
|
* @param scope The callback function's scope.
|
||||||
|
*/
|
||||||
|
getType: (id: number, callback?: Callback, scope?: any) => void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* List of all notification ids.
|
||||||
|
*
|
||||||
|
* @param callback The function to be exec as the callback.
|
||||||
|
* @param scope The callback function's scope.
|
||||||
|
*/
|
||||||
|
getIds: (callback: (ids: number[]) => void, scope?: any) => void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* List of all scheduled notification IDs.
|
||||||
|
*
|
||||||
|
* @param callback The function to be exec as the callback.
|
||||||
|
* @param scope The callback function's scope.
|
||||||
|
*/
|
||||||
|
getScheduledIds: (callback: (ids: number[]) => void, scope?: any) => void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* List of all triggered notification IDs.
|
||||||
|
*
|
||||||
|
* @param callback The function to be exec as the callback.
|
||||||
|
* @param scope The callback function's scope.
|
||||||
|
*/
|
||||||
|
getTriggeredIds: (callback: (ids: number[]) => void, scope?: any) => void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* List of local notifications specified by id.
|
||||||
|
* If called without IDs, all notification will be returned.
|
||||||
|
*
|
||||||
|
* @param ids The IDs of the notifications.
|
||||||
|
* @param callback The function to be exec as the callback.
|
||||||
|
* @param scope The callback function's scope.
|
||||||
|
*/
|
||||||
|
|
||||||
|
get(ids: number[], callback: (notifications: Object[]) => void, scope?: any): void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* List of local notifications specified by id.
|
||||||
|
* If called without IDs, all notification will be returned.
|
||||||
|
*/
|
||||||
|
get(callback: (notifications: Object[]) => void, scope?: any): void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* List for all notifications.
|
||||||
|
*
|
||||||
|
* @param callback The function to be exec as the callback.
|
||||||
|
* @param scope The callback function's scope.
|
||||||
|
*/
|
||||||
|
getAll: (callback: (notifications: Object[]) => void, scope?: any) => void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* List of all scheduled notifications.
|
||||||
|
*
|
||||||
|
* @param callback The function to be exec as the callback.
|
||||||
|
* @param scope The callback function's scope.
|
||||||
|
*/
|
||||||
|
getScheduled: (callback: (notifications: Object[]) => void, scope?: any) => void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* List of all triggered notifications.
|
||||||
|
*
|
||||||
|
* @param callback The function to be exec as the callback.
|
||||||
|
* @param scope The callback function's scope.
|
||||||
|
*/
|
||||||
|
getTriggered: (callback: (notifications: Object[]) => void, scope?: any) => void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add an group of actions by id.
|
||||||
|
*
|
||||||
|
* @param id The Id of the group.
|
||||||
|
* @param actions The action config settings.
|
||||||
|
* @param callback The function to be exec as the callback.
|
||||||
|
* @param scope The callback function's scope.
|
||||||
|
*/
|
||||||
|
addActions: (id: string, actions: any[], callback?: Function, scope?: any) => void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove an group of actions by id.
|
||||||
|
*
|
||||||
|
* @param id The Id of the group.
|
||||||
|
* @param callback The function to be exec as the callback.
|
||||||
|
* @param scope The callback function's scope.
|
||||||
|
*/
|
||||||
|
removeActions: (id: string, callback?: Function, scope?: any) => void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if a group of actions is defined.
|
||||||
|
*
|
||||||
|
* @param id The Id of the group.
|
||||||
|
* @param callback The function to be exec as the callback.
|
||||||
|
* @param scope The callback function's scope.
|
||||||
|
*/
|
||||||
|
hasActions: (id: string, callback?: Function, scope?: any) => void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The (platform specific) default settings.
|
||||||
|
*/
|
||||||
|
getDefaults: () => ({
|
||||||
|
actions: any[],
|
||||||
|
attachments: any[],
|
||||||
|
autoClear: boolean,
|
||||||
|
badge: any, // null
|
||||||
|
channel: any, // null
|
||||||
|
clock: boolean,
|
||||||
|
color: any, // null
|
||||||
|
data: any, // null
|
||||||
|
defaults: number,
|
||||||
|
foreground: any, // null
|
||||||
|
group: any, // null
|
||||||
|
groupSummary: boolean,
|
||||||
|
icon: any, // null,
|
||||||
|
iconType: any, // null,
|
||||||
|
id: number,
|
||||||
|
launch: boolean,
|
||||||
|
led: boolean,
|
||||||
|
lockscreen: boolean,
|
||||||
|
mediaSession: any, // null
|
||||||
|
number: number,
|
||||||
|
priority: number,
|
||||||
|
progressBar: boolean,
|
||||||
|
silent: boolean,
|
||||||
|
smallIcon: string,
|
||||||
|
sound: boolean,
|
||||||
|
sticky: boolean,
|
||||||
|
summary: any, // null,
|
||||||
|
text: string,
|
||||||
|
timeoutAfter: boolean,
|
||||||
|
title: string,
|
||||||
|
trigger: Object,
|
||||||
|
vibrate: boolean,
|
||||||
|
wakeup: boolean
|
||||||
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Overwrite default settings.
|
||||||
|
*
|
||||||
|
* @param newDefaults New default values.
|
||||||
|
*/
|
||||||
|
setDefaults: (newDefaults: object) => void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Register callback for given event.
|
||||||
|
*
|
||||||
|
* @param event The name of the event.
|
||||||
|
* @param callback The function to be exec as callback.
|
||||||
|
* @param scope The callback function's scope.
|
||||||
|
*/
|
||||||
|
on: (event: string, callback: Function, scope?: any) => void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Unregister callback for given event.
|
||||||
|
*
|
||||||
|
* @param event The name of the event.
|
||||||
|
* @param callback The function to be exec as callback.
|
||||||
|
*/
|
||||||
|
un: (event: string, callback: Function) => void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fire the event with given arguments.
|
||||||
|
*
|
||||||
|
* @param event The event's name.
|
||||||
|
* @param args The callback's arguments.
|
||||||
|
*/
|
||||||
|
fireEvent: (event: string, ...args: any[]) => void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fire queued events once the device is ready and all listeners are registered.
|
||||||
|
*/
|
||||||
|
fireQueuedEvents: VoidFunction;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface privateFunction {
|
||||||
|
/**
|
||||||
|
* Merge custom properties with the default values.
|
||||||
|
*
|
||||||
|
* @param options Set of custom values.
|
||||||
|
*/
|
||||||
|
_mergeWithDefaults: (options: object) => object;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Convert the passed values to their required type.
|
||||||
|
*
|
||||||
|
* @param options Properties to convert for.
|
||||||
|
*/
|
||||||
|
_convertProperties: (options: object) => object;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Convert the passed values for the priority to their required type.
|
||||||
|
*
|
||||||
|
* @param options Set of custom values.
|
||||||
|
*
|
||||||
|
* @return Interaction object with trigger spec.
|
||||||
|
*/
|
||||||
|
_convertPriority: (options: object) => object;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Convert the passed values to their required type, modifying them
|
||||||
|
* directly for Android and passing the converted list back for iOS.
|
||||||
|
*
|
||||||
|
* @param options Set of custom values.
|
||||||
|
*
|
||||||
|
* @return Interaction object with category & actions.
|
||||||
|
*/
|
||||||
|
_convertActions: (options: object) => object;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Convert the passed values for the trigger to their required type.
|
||||||
|
*
|
||||||
|
* @param options Set of custom values.
|
||||||
|
*
|
||||||
|
* @return Interaction object with trigger spec.
|
||||||
|
*/
|
||||||
|
_convertTrigger: (options: object) => object;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a callback function to get executed within a specific scope.
|
||||||
|
*
|
||||||
|
* @param [ Function ] fn The function to be exec as the callback.
|
||||||
|
* @param [ Object ] scope The callback function's scope.
|
||||||
|
*
|
||||||
|
* @return [ Function ]
|
||||||
|
*/
|
||||||
|
_createCallbackFn: (fn: Function, scope?: any) => (...args: any[]) => void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Convert the IDs to numbers.
|
||||||
|
*
|
||||||
|
* @param ids
|
||||||
|
*/
|
||||||
|
_convertIds: (ids: (number | string)[]) => number[];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* First found value for the given keys.
|
||||||
|
*
|
||||||
|
* @param options Object with key-value properties.
|
||||||
|
* @param keys List of keys.
|
||||||
|
*/
|
||||||
|
_getValueFor: (options: object, ...keys: any[]) => object | null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Convert a value to an array.
|
||||||
|
*
|
||||||
|
* @param obj Any kind of object.
|
||||||
|
*
|
||||||
|
* @return An array with the object as first item.
|
||||||
|
*/
|
||||||
|
_toArray: (obj: any) => any[];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Execute the native counterpart.
|
||||||
|
*
|
||||||
|
* @param action The name of the action.
|
||||||
|
* @param args Array of arguments.
|
||||||
|
* @param callback The callback function.
|
||||||
|
* @param scope The scope for the function.
|
||||||
|
*/
|
||||||
|
_exec: (action: string, args: any[], callback: Function, scope?: any) => void;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the launch details if the app was launched by clicking on a toast.
|
||||||
|
*/
|
||||||
|
_setLaunchDetails: VoidFunction;
|
||||||
|
|
||||||
|
}
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,20 @@
|
||||||
|
/// <reference path="./ArrayEx.d.ts" />
|
||||||
|
/// <reference path="./Card.d.ts" />
|
||||||
|
/// <reference path="./DateEx.d.ts" />
|
||||||
|
/// <reference path="./HTMLDivElementEx.d.ts" />
|
||||||
|
/// <reference path="./HTMLTableELementEx.d.ts" />
|
||||||
|
/// <reference path="./windowEx.d.ts" />
|
||||||
|
/// <reference path="./Result.d.ts" />
|
||||||
|
/// <reference path="./Skill.d.ts" />
|
||||||
|
/// <reference path="./type.d.ts" />
|
||||||
|
/// <reference path="./MapEx.d.ts" />
|
||||||
|
/// <reference types="@types/cordova" />
|
||||||
|
/// <reference path="./cordova-plugin-dialogs.d.ts" />
|
||||||
|
/// <reference path="./cordova-plugin-file.d.ts" />
|
||||||
|
/// <reference path="./cordova-plugin-file-transfer.d.ts" />
|
||||||
|
/// <reference path="./cordova-plugin-local-notifications.d.ts" />
|
||||||
|
/// <reference path="./electron.d.ts" />
|
||||||
|
/// <reference path="./nonameModules/noname.d.ts" />
|
||||||
|
declare module "noname-typings" {
|
||||||
|
|
||||||
|
}
|
2
node_modules/@types/noname-typings/nonameModules/game/codemirror.d.ts
generated
vendored
Normal file
2
node_modules/@types/noname-typings/nonameModules/game/codemirror.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
import codemirror from 'codemirror/index';
|
||||||
|
export = codemirror;
|
|
@ -0,0 +1,2 @@
|
||||||
|
import * as jszip from 'jszip'
|
||||||
|
export = jszip;
|
|
@ -0,0 +1,8 @@
|
||||||
|
export { GNC as gnc } from "./noname/gnc/index.js";
|
||||||
|
export { AI as ai } from "./noname/ai/index.js";
|
||||||
|
export { Game as game } from "./noname/game/index.js";
|
||||||
|
export { Get as get } from "./noname/get/index.js";
|
||||||
|
export { Library as lib } from "./noname/library/index.js";
|
||||||
|
export { status as _status } from "./noname/status/index.js";
|
||||||
|
export { UI as ui } from "./noname/ui/index.js";
|
||||||
|
export { boot } from "./noname/init/index.js";
|
25
node_modules/@types/noname-typings/nonameModules/noname/ai/basic.d.ts
generated
vendored
Normal file
25
node_modules/@types/noname-typings/nonameModules/noname/ai/basic.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
export class Basic extends Uninstantable {
|
||||||
|
/**
|
||||||
|
* @param { (
|
||||||
|
* button: Button,
|
||||||
|
* buttons?: Button[]
|
||||||
|
* ) => number } check
|
||||||
|
*/
|
||||||
|
static chooseButton(check: (button: Button, buttons?: Button[]) => number): boolean;
|
||||||
|
/**
|
||||||
|
* @param { (
|
||||||
|
* card?: Card,
|
||||||
|
* cards?: Card[]
|
||||||
|
* ) => number } check
|
||||||
|
* @returns { boolean | undefined }
|
||||||
|
*/
|
||||||
|
static chooseCard(check: (card?: Card, cards?: Card[]) => number): boolean | undefined;
|
||||||
|
/**
|
||||||
|
* @param { (
|
||||||
|
* target?: Player,
|
||||||
|
* targets?: Player[]
|
||||||
|
* ) => number } check
|
||||||
|
*/
|
||||||
|
static chooseTarget(check: (target?: Player, targets?: Player[]) => number): boolean;
|
||||||
|
}
|
||||||
|
import { Uninstantable } from "../util/index.js";
|
9
node_modules/@types/noname-typings/nonameModules/noname/ai/index.d.ts
generated
vendored
Normal file
9
node_modules/@types/noname-typings/nonameModules/noname/ai/index.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
export class AI extends Uninstantable {
|
||||||
|
static basic: typeof Basic;
|
||||||
|
static get: typeof get;
|
||||||
|
}
|
||||||
|
export const ai: typeof AI;
|
||||||
|
export { Basic };
|
||||||
|
import { Uninstantable } from "../util/index.js";
|
||||||
|
import { Basic } from './basic.js';
|
||||||
|
import { Get as get } from '../get/index.js';
|
117
node_modules/@types/noname-typings/nonameModules/noname/game/dynamic-style/index.d.ts
generated
vendored
Normal file
117
node_modules/@types/noname-typings/nonameModules/noname/game/dynamic-style/index.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,117 @@
|
||||||
|
export class DynamicStyle {
|
||||||
|
/**
|
||||||
|
* Turn the Object Style to string format.
|
||||||
|
* 将给定的对象样式转换成字符串的形式
|
||||||
|
*
|
||||||
|
* @param {StyleObject} style 给定的对象样式
|
||||||
|
* @returns {string} 样式的字符串形式
|
||||||
|
*/
|
||||||
|
translate(style: {
|
||||||
|
[x: string]: string | number;
|
||||||
|
}): string;
|
||||||
|
/**
|
||||||
|
* Generate the common css selector.
|
||||||
|
* 生成标准的CSS样式
|
||||||
|
*
|
||||||
|
* @param {string} name 选择器
|
||||||
|
* @param {StyleObject} style 对象样式
|
||||||
|
* @returns {string} 标准的CSS样式
|
||||||
|
*/
|
||||||
|
generate(name: string, style: {
|
||||||
|
[x: string]: string | number;
|
||||||
|
}): string;
|
||||||
|
/**
|
||||||
|
* Determine the selector is in rules.
|
||||||
|
* 检查是否存在对应选择器的规则
|
||||||
|
*
|
||||||
|
* @param {string} name 选择器
|
||||||
|
* @returns {boolean}
|
||||||
|
*/
|
||||||
|
has(name: string): boolean;
|
||||||
|
/**
|
||||||
|
* Get the style of given selector, or return null.
|
||||||
|
* 获得对应选择器的样式对象,若不存在,则返回`null`
|
||||||
|
*
|
||||||
|
* @param {string} name 选择器
|
||||||
|
* @returns {?StyleObject}
|
||||||
|
*/
|
||||||
|
get(name: string): {
|
||||||
|
[x: string]: string | number;
|
||||||
|
};
|
||||||
|
/**
|
||||||
|
* Callback of `DynamicStyle#find`, getting the rule wanted.
|
||||||
|
* `DynamicStyle#find`的回调函数,用于获取符合要求的规则
|
||||||
|
*
|
||||||
|
* @callback FindCallback
|
||||||
|
* @param {Rule} rule 样式规则
|
||||||
|
* @param {number} index 样式编号
|
||||||
|
* @param {Rule[]} rules 规则集
|
||||||
|
* @returns {boolean}
|
||||||
|
*/
|
||||||
|
/**
|
||||||
|
* Get the rule wanted by given function.
|
||||||
|
* 通过给定的函数,获取符合要求的规则
|
||||||
|
*
|
||||||
|
* @param {FindCallback} fn 用于检查的函数
|
||||||
|
* @returns {Rule}
|
||||||
|
*/
|
||||||
|
find(fn: (rule: [string, {
|
||||||
|
[x: string]: string | number;
|
||||||
|
}], index: number, rules: [string, {
|
||||||
|
[x: string]: string | number;
|
||||||
|
}][]) => boolean): [string, {
|
||||||
|
[x: string]: string | number;
|
||||||
|
}];
|
||||||
|
/**
|
||||||
|
* Length of rules.
|
||||||
|
* 规则集的长度
|
||||||
|
*
|
||||||
|
* @returns {number}
|
||||||
|
*/
|
||||||
|
size(): number;
|
||||||
|
/**
|
||||||
|
* Get the index of given selector, or return `-1`.
|
||||||
|
* 获得对应选择器的位置,若不存在,则返回`-1`
|
||||||
|
*
|
||||||
|
* @param {string} name 选择器
|
||||||
|
* @returns {number}
|
||||||
|
*/
|
||||||
|
indexOf(name: string): number;
|
||||||
|
/**
|
||||||
|
* @param {string} name 选择器
|
||||||
|
* @param {StyleObject} style 要添加的样式对象
|
||||||
|
* @returns {boolean} 添加的结果,为`true`则添加成功,为`false`则添加失败
|
||||||
|
*/
|
||||||
|
add(name: string, style: {
|
||||||
|
[x: string]: string | number;
|
||||||
|
}): boolean;
|
||||||
|
/**
|
||||||
|
* @param {Record<string, StyleObject>} object 以`name: style`存储的映射
|
||||||
|
* @returns {boolean[]} 添加的结果,为`true`则添加成功,为`false`则添加失败
|
||||||
|
*/
|
||||||
|
addObject(object: Record<string, {
|
||||||
|
[x: string]: string | number;
|
||||||
|
}>): boolean[];
|
||||||
|
/**
|
||||||
|
* @param {string} name 要移除规则的选择器
|
||||||
|
* @returns {boolean} 移除的结果,为`true`则移除成功,为`false`则移除失败
|
||||||
|
*/
|
||||||
|
remove(name: string): boolean;
|
||||||
|
/**
|
||||||
|
* @param {string} name 要移除规则的选择器
|
||||||
|
* @param {string[]} styles 要移除的样式
|
||||||
|
* @returns {boolean} 移除的结果,为`true`则移除成功,为`false`则移除失败
|
||||||
|
*/
|
||||||
|
removeStyles(name: string, styles: string[]): boolean;
|
||||||
|
/**
|
||||||
|
* 添加或修改一个规则所对应的样式
|
||||||
|
*
|
||||||
|
* @param {string} name 要变更规则的选择器
|
||||||
|
* @param {StyleObject} style 变更规则的样式
|
||||||
|
* @returns {boolean} 更新的结果,为`true`则更新成功,为`false`则更新失败
|
||||||
|
*/
|
||||||
|
update(name: string, style: {
|
||||||
|
[x: string]: string | number;
|
||||||
|
}): boolean;
|
||||||
|
#private;
|
||||||
|
}
|
1409
node_modules/@types/noname-typings/nonameModules/noname/game/index.d.ts
generated
vendored
Normal file
1409
node_modules/@types/noname-typings/nonameModules/noname/game/index.d.ts
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
46
node_modules/@types/noname-typings/nonameModules/noname/game/promises.d.ts
generated
vendored
Normal file
46
node_modules/@types/noname-typings/nonameModules/noname/game/promises.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,46 @@
|
||||||
|
export class GamePromises extends Uninstantable {
|
||||||
|
/**
|
||||||
|
* 模仿h5的prompt,用于显示可提示用户进行输入的对话框
|
||||||
|
*
|
||||||
|
* 注: 由于参数列表是随意的,在这里我准备限制一下这个函数的参数顺序
|
||||||
|
*
|
||||||
|
* @type {{
|
||||||
|
* (title: string): Promise<string | false>;
|
||||||
|
* (title: string, forced: true): Promise<string>;
|
||||||
|
* (alertOption: 'alert', title: string): Promise<true>;
|
||||||
|
* }}
|
||||||
|
*
|
||||||
|
* @param { string } [title] 设置prompt标题与input内容
|
||||||
|
* @param { boolean } [forced] 为true的话将没有"取消按钮"
|
||||||
|
* @param { string } alertOption 设置prompt是否模拟alert
|
||||||
|
* @example
|
||||||
|
* ```js
|
||||||
|
* // 只设置标题(但是input的初始值就变成了undefined)
|
||||||
|
* game.promises.prompt('###prompt标题').then(value => console.log(value));
|
||||||
|
* // 设置标题和input初始内容
|
||||||
|
* game.promises.prompt('###prompt标题###input初始内容').then(value => console.log(value));
|
||||||
|
* ```
|
||||||
|
* @returns { Promise<string> }
|
||||||
|
*/
|
||||||
|
static prompt(alertOption: string, title?: string, forced?: boolean): Promise<string>;
|
||||||
|
/**
|
||||||
|
* 模仿h5的alert,用于显示信息的对话框
|
||||||
|
*
|
||||||
|
* @param { string } title
|
||||||
|
* @example
|
||||||
|
* ```js
|
||||||
|
* await game.promises.alert('弹窗内容');
|
||||||
|
* ```
|
||||||
|
* @returns { Promise<true> }
|
||||||
|
*/
|
||||||
|
static alert(title: string): Promise<true>;
|
||||||
|
static download(url: any, folder: any, dev: any, onprogress: any): Promise<any>;
|
||||||
|
static readFile(filename: any): Promise<any>;
|
||||||
|
static readFileAsText(filename: any): Promise<any>;
|
||||||
|
static writeFile(data: any, path: any, name: any): Promise<any>;
|
||||||
|
static ensureDirectory(list: any, callback: any, file: any): Promise<any>;
|
||||||
|
static createDir(directory: any): Promise<any>;
|
||||||
|
static removeFile(filename: any): Promise<void>;
|
||||||
|
static removeDir(directory: any): Promise<void>;
|
||||||
|
}
|
||||||
|
import { Uninstantable } from "../util/index.js";
|
492
node_modules/@types/noname-typings/nonameModules/noname/get/index.d.ts
generated
vendored
Normal file
492
node_modules/@types/noname-typings/nonameModules/noname/get/index.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,492 @@
|
||||||
|
export class Get extends Uninstantable {
|
||||||
|
static is: typeof Is;
|
||||||
|
/**
|
||||||
|
* 获取当前内核版本信息
|
||||||
|
*
|
||||||
|
* 目前仅考虑`chrome`, `firefox`和`safari`三种浏览器的信息,其余均归于其他范畴
|
||||||
|
*
|
||||||
|
* > 其他后续或许会增加,但`IE`永无可能
|
||||||
|
*
|
||||||
|
* @returns {["firefox" | "chrome" | "safari" | "other", number, number, number]}
|
||||||
|
*/
|
||||||
|
static coreInfo(): ["firefox" | "chrome" | "safari" | "other", number, number, number];
|
||||||
|
/**
|
||||||
|
* 返回 VCard[] 形式的所有牌,用于印卡将遍历
|
||||||
|
* @param {Function} filter
|
||||||
|
* @returns {string[][]}
|
||||||
|
*/
|
||||||
|
static inpileVCardList(filter: Function): string[][];
|
||||||
|
/**
|
||||||
|
* 根据(Player的)座次数n(从1开始)获取对应的“n号位”翻译
|
||||||
|
* @param {number | Player} seat
|
||||||
|
*/
|
||||||
|
static seatTranslation(seat: number | Player): string;
|
||||||
|
/**
|
||||||
|
* @param {number} numberOfPlayers
|
||||||
|
* @returns {string[]}
|
||||||
|
*/
|
||||||
|
static identityList(numberOfPlayers: number): string[];
|
||||||
|
/**
|
||||||
|
* Generate an object URL from the Base64-encoded octet stream
|
||||||
|
*
|
||||||
|
* 从Base64编码的八位字节流生成对象URL
|
||||||
|
*/
|
||||||
|
static objectURL(octetStream: any): any;
|
||||||
|
/**
|
||||||
|
* Get the card name length
|
||||||
|
*
|
||||||
|
* 获取此牌的字数
|
||||||
|
*/
|
||||||
|
static cardNameLength(card: any, player: any): number;
|
||||||
|
/**
|
||||||
|
* Get the Yingbian conditions (of the card)
|
||||||
|
*
|
||||||
|
* 获取(此牌的)应变条件
|
||||||
|
*/
|
||||||
|
static yingbianConditions(card: any): string[];
|
||||||
|
static complexYingbianConditions(card: any): string[];
|
||||||
|
static simpleYingbianConditions(card: any): string[];
|
||||||
|
/**
|
||||||
|
* Get the Yingbian effects (of the card)
|
||||||
|
*
|
||||||
|
* 获取(此牌的)应变效果
|
||||||
|
*/
|
||||||
|
static yingbianEffects(card: any): string[];
|
||||||
|
/**
|
||||||
|
* Get the default Yingbian effect of the card
|
||||||
|
*
|
||||||
|
* 获取此牌的默认应变效果
|
||||||
|
*/
|
||||||
|
static defaultYingbianEffect(card: any): any;
|
||||||
|
/**
|
||||||
|
* 优先度判断
|
||||||
|
*/
|
||||||
|
static priority(skill: any): any;
|
||||||
|
/**
|
||||||
|
* 新装备栏相关
|
||||||
|
*
|
||||||
|
* 获取一张装备牌实际占用的装备栏(君曹操六龙)
|
||||||
|
*
|
||||||
|
* 用法同{@link subtype},返回数组
|
||||||
|
*
|
||||||
|
* @param { string | Card | VCard | CardBaseUIData } obj
|
||||||
|
* @param { false | Player } [player]
|
||||||
|
* @returns { string[] }
|
||||||
|
*/
|
||||||
|
static subtypes(obj: string | Card | VCard | CardBaseUIData, player?: false | Player): string[];
|
||||||
|
/**
|
||||||
|
* @returns { string[] }
|
||||||
|
*/
|
||||||
|
static pinyin(chinese: any, withTone: any): string[];
|
||||||
|
static yunmu(str: any): any;
|
||||||
|
/**
|
||||||
|
* 用于将参数转换为字符串,作为缓存的key。
|
||||||
|
*/
|
||||||
|
static paramToCacheKey(...args: any[]): string;
|
||||||
|
static yunjiao(str: any): string;
|
||||||
|
/**
|
||||||
|
* @param { string } skill
|
||||||
|
* @param { Player } player
|
||||||
|
* @returns { string[] }
|
||||||
|
*/
|
||||||
|
static skillCategoriesOf(skill: string, player: Player): string[];
|
||||||
|
static numOf(obj: any, item: any): any;
|
||||||
|
static connectNickname(): any;
|
||||||
|
static zhinangs(filter: any): any;
|
||||||
|
static sourceCharacter(str: any): any;
|
||||||
|
static isLuckyStar(player: any): boolean;
|
||||||
|
static infoHp(hp: any): number;
|
||||||
|
static infoMaxHp(hp: any): number;
|
||||||
|
static infoHujia(hp: any): number;
|
||||||
|
static bottomCards(num: any, putBack: any): any;
|
||||||
|
static discarded(): any;
|
||||||
|
static cardOffset(): number;
|
||||||
|
static colorspan(str: any): any;
|
||||||
|
static evtprompt(next: any, str: any): void;
|
||||||
|
static autoViewAs(card: any, cards: any): import("../library/element/vcard.js").VCard;
|
||||||
|
/**
|
||||||
|
* @deprecated
|
||||||
|
*/
|
||||||
|
static _autoViewAs(card: any, cards: any): any;
|
||||||
|
static max(list: any, func: any, type: any): any;
|
||||||
|
static min(list: any, func: any, type: any): any;
|
||||||
|
/**
|
||||||
|
* @overload
|
||||||
|
* @param { string } name
|
||||||
|
* @returns { Character }
|
||||||
|
*/
|
||||||
|
static character(name: string): Character;
|
||||||
|
/**
|
||||||
|
* @template { 0 | 1 | 2 | 3 | 4 } T
|
||||||
|
* @overload
|
||||||
|
* @param { string } name
|
||||||
|
* @param { T } num
|
||||||
|
* @returns { Character[T] }
|
||||||
|
*/
|
||||||
|
static character<T extends 0 | 1 | 2 | 3 | 4>(name: string, num: T): Character[T];
|
||||||
|
static characterInitFilter(name: any): string[];
|
||||||
|
static characterIntro(name: any): any;
|
||||||
|
static bordergroup(info: any, raw: any): any;
|
||||||
|
static groupnature(group: any, method: any): any;
|
||||||
|
static sgn(num: any): 0 | 1 | -1;
|
||||||
|
static rand(num: any, num2: any): any;
|
||||||
|
static sort(arr: any, method: any, arg: any): any;
|
||||||
|
static sortSeat(arr: any, target: any): any;
|
||||||
|
static zip(callback: any): void;
|
||||||
|
static delayx(num: any, max: any): number;
|
||||||
|
static prompt(skill: any, target: any, player: any): string;
|
||||||
|
static prompt2(skill: any, target: any, player: any, ...args: any[]): any;
|
||||||
|
static url(master: any): string;
|
||||||
|
static round(num: any, f: any): number;
|
||||||
|
static playerNumber(): number;
|
||||||
|
static benchmark(func1: any, func2: any, iteration: any, arg: any): number;
|
||||||
|
static stringify(obj: any, level: any): any;
|
||||||
|
/**
|
||||||
|
* 深拷贝函数(虽然只处理了部分情况)
|
||||||
|
*
|
||||||
|
* 除了普通的Object和NullObject,均不考虑自行赋值的数据,但会原样将Symbol复制过去
|
||||||
|
*
|
||||||
|
* @template T
|
||||||
|
* @param {T} obj - 要复制的对象,若不是对象则直接返回原值
|
||||||
|
* @param {boolean} [copyKeyDeep = false] - 是否深复制`Map`的`key`
|
||||||
|
* @param {WeakMap<object, unknown>} [map] - 拷贝用的临时存储,用于处理循环引用(请勿自行赋值)
|
||||||
|
* @returns {T} - 深拷贝后的对象,若传入值不是对象则为传入值
|
||||||
|
*/
|
||||||
|
static copy<T_1>(obj: T_1, copyKeyDeep?: boolean, map?: WeakMap<object, unknown>): T_1;
|
||||||
|
static inpilefull(type: any): {
|
||||||
|
name: any;
|
||||||
|
suit: any;
|
||||||
|
number: any;
|
||||||
|
nature: any;
|
||||||
|
}[];
|
||||||
|
static inpile(type: any, filter: any): any[];
|
||||||
|
static inpile2(type: any): any[];
|
||||||
|
static typeCard(type: any, filter: any): string[];
|
||||||
|
static libCard(filter: any): string[];
|
||||||
|
static ip(): string;
|
||||||
|
static modetrans(config: any, server: any): string;
|
||||||
|
static charactersOL(func: any): number[];
|
||||||
|
static trimip(str: any): any;
|
||||||
|
static mode(): any;
|
||||||
|
static idDialog(id: any): import("../library/element/dialog.js").Dialog;
|
||||||
|
static arenaState(): {
|
||||||
|
number: string;
|
||||||
|
players: {};
|
||||||
|
mode: any;
|
||||||
|
dying: any[];
|
||||||
|
servermode: any;
|
||||||
|
roomId: any;
|
||||||
|
over: boolean;
|
||||||
|
inpile: any[];
|
||||||
|
inpile_nature: any[];
|
||||||
|
renku: any[];
|
||||||
|
};
|
||||||
|
static skillState(player: any): {
|
||||||
|
global: string[];
|
||||||
|
};
|
||||||
|
static id(): string;
|
||||||
|
static zhu(player: any, skill: any, group: any): any;
|
||||||
|
static config(item: any, mode: any): any;
|
||||||
|
static coinCoeff(list: any): number;
|
||||||
|
static rank(name: any, num: any): number | "x" | "s" | "b" | "c" | "d" | "a" | "ap" | "am" | "bp" | "bm" | "sp";
|
||||||
|
static skillRank(skill: any, type: any, grouped: any): number;
|
||||||
|
static targetsInfo(targets: any): any[];
|
||||||
|
static infoTargets(infos: any): import("../library/element/player.js").Player[];
|
||||||
|
static cardInfo(card: any): any[];
|
||||||
|
static cardsInfo(cards?: any[]): any[][];
|
||||||
|
static infoCard(info: any): import("../library/element/card.js").Card;
|
||||||
|
static infoCards(infos: any): import("../library/element/card.js").Card[];
|
||||||
|
static cardInfoOL(card: any): string;
|
||||||
|
static infoCardOL(info: any): any;
|
||||||
|
static cardsInfoOL(cards: any): string[];
|
||||||
|
static infoCardsOL(infos: any): any[];
|
||||||
|
static playerInfoOL(player: any): string;
|
||||||
|
static infoPlayerOL(info: any): any;
|
||||||
|
static playersInfoOL(players: any): string[];
|
||||||
|
static infoPlayersOL(infos: any): any[];
|
||||||
|
static funcInfoOL(func: any): any;
|
||||||
|
static infoFuncOL(info: any): any;
|
||||||
|
static eventInfoOL(item: any, level: any, noMore: any): string;
|
||||||
|
/**
|
||||||
|
* @param {string} item
|
||||||
|
*/
|
||||||
|
static infoEventOL(item: string): string | import("../library/element/gameEvent.js").GameEvent;
|
||||||
|
static stringifiedResult(item: any, level: any, nomore: any): any;
|
||||||
|
static parsedResult(item: any): any;
|
||||||
|
static verticalStr(str: any, sp: any): string;
|
||||||
|
static numStr(num: any, method: any): any;
|
||||||
|
static rawName(str: any): any;
|
||||||
|
/**
|
||||||
|
* 作用修改:只读前缀 不读_ab
|
||||||
|
*/
|
||||||
|
static rawName2(str: any): any;
|
||||||
|
static slimNameHorizontal(str: any): any;
|
||||||
|
/**
|
||||||
|
* @param {string} prefix
|
||||||
|
* @param {string} name
|
||||||
|
* @returns {string}
|
||||||
|
*/
|
||||||
|
static prefixSpan(prefix: string, name: string): string;
|
||||||
|
static slimName(str: any): string;
|
||||||
|
static time(): number;
|
||||||
|
static utc(): number;
|
||||||
|
static evtDistance(e1: any, e2: any): number;
|
||||||
|
static xyDistance(from: any, to: any): number;
|
||||||
|
/**
|
||||||
|
* @overload
|
||||||
|
* @returns { void }
|
||||||
|
*/
|
||||||
|
static itemtype(): void;
|
||||||
|
/**
|
||||||
|
* @overload
|
||||||
|
* @param { string } obj
|
||||||
|
* @returns { 'position' | 'natures' | 'nature' }
|
||||||
|
*/
|
||||||
|
static itemtype(obj: string): 'position' | 'natures' | 'nature';
|
||||||
|
/**
|
||||||
|
* @overload
|
||||||
|
* @param { Player[] } obj
|
||||||
|
* @returns { 'players' }
|
||||||
|
*/
|
||||||
|
static itemtype(obj: Player[]): 'players';
|
||||||
|
/**
|
||||||
|
* @overload
|
||||||
|
* @param { Card[] } obj
|
||||||
|
* @returns { 'cards' }
|
||||||
|
*/
|
||||||
|
static itemtype(obj: Card[]): 'cards';
|
||||||
|
/**
|
||||||
|
* @overload
|
||||||
|
* @param { [number, number] } obj
|
||||||
|
* @returns { 'select' }
|
||||||
|
*/
|
||||||
|
static itemtype(obj: [number, number]): 'select';
|
||||||
|
/**
|
||||||
|
* @overload
|
||||||
|
* @param { [number, number, number, number] } obj
|
||||||
|
* @returns { 'divposition' }
|
||||||
|
*/
|
||||||
|
static itemtype(obj: [number, number, number, number]): 'divposition';
|
||||||
|
/**
|
||||||
|
* @overload
|
||||||
|
* @param { Button } obj
|
||||||
|
* @returns { 'button' }
|
||||||
|
*/
|
||||||
|
static itemtype(obj: Button): 'button';
|
||||||
|
/**
|
||||||
|
* @overload
|
||||||
|
* @param { Card } obj
|
||||||
|
* @returns { 'card' }
|
||||||
|
*/
|
||||||
|
static itemtype(obj: Card): 'card';
|
||||||
|
/**
|
||||||
|
* @overload
|
||||||
|
* @param { Player } obj
|
||||||
|
* @returns { 'player' }
|
||||||
|
*/
|
||||||
|
static itemtype(obj: Player): 'player';
|
||||||
|
/**
|
||||||
|
* @overload
|
||||||
|
* @param { Dialog } obj
|
||||||
|
* @returns { 'dialog' }
|
||||||
|
*/
|
||||||
|
static itemtype(obj: Dialog): 'dialog';
|
||||||
|
/**
|
||||||
|
* @overload
|
||||||
|
* @param { GameEvent | GameEventPromise } obj
|
||||||
|
* @returns { 'event' }
|
||||||
|
*/
|
||||||
|
static itemtype(obj: GameEvent | GameEventPromise): 'event';
|
||||||
|
static equipNum(card: any): number;
|
||||||
|
static objtype(obj: any): "object" | "div" | "array" | "table" | "tr" | "td" | "fragment";
|
||||||
|
static type(obj: any, method: any, player: any): any;
|
||||||
|
static type2(card: any, player: any): any;
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param { string | Card | VCard | CardBaseUIData } obj
|
||||||
|
* @param { false | Player } [player]
|
||||||
|
* @returns { string }
|
||||||
|
*/
|
||||||
|
static subtype(obj: string | Card | VCard | CardBaseUIData, player?: false | Player): string;
|
||||||
|
static equiptype(card: any, player: any): number;
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param { Card | VCard | CardBaseUIData } card
|
||||||
|
* @param { false | Player } [player]
|
||||||
|
* @returns { string }
|
||||||
|
*/
|
||||||
|
static name(card: Card | VCard | CardBaseUIData, player?: false | Player): string;
|
||||||
|
/**
|
||||||
|
* @param {Card | VCard | Card[] | VCard[]} card
|
||||||
|
* @param {false | Player} [player]
|
||||||
|
* @returns {string}
|
||||||
|
*/
|
||||||
|
static suit(card: Card | VCard | Card[] | VCard[], player?: false | Player): string;
|
||||||
|
/**
|
||||||
|
* @param {Card | VCard | Card[] | VCard[]} card
|
||||||
|
* @param {false | Player} [player]
|
||||||
|
* @returns {string}
|
||||||
|
*/
|
||||||
|
static color(card: Card | VCard | Card[] | VCard[], player?: false | Player): string;
|
||||||
|
/**
|
||||||
|
* @param {Card | VCard} card
|
||||||
|
* @param {false | Player} [player]
|
||||||
|
* @returns {number}
|
||||||
|
*/
|
||||||
|
static number(card: Card | VCard, player?: false | Player): number;
|
||||||
|
/**
|
||||||
|
* 返回一张杀的属性。如有多种属性则用`lib.natureSeparator`分割开来。例:火雷【杀】的返回值为`fire|thunder`
|
||||||
|
* @param {string | string[] | Card | VCard} card
|
||||||
|
* @param {false | Player} [player]
|
||||||
|
* @returns {string}
|
||||||
|
*/
|
||||||
|
static nature(card: string | string[] | Card | VCard, player?: false | Player): string;
|
||||||
|
/**
|
||||||
|
* 返回包含所有属性的数组
|
||||||
|
* @param {string[] | string} card
|
||||||
|
* @param {false | Player} [player]
|
||||||
|
* @returns {string[]}
|
||||||
|
*/
|
||||||
|
static natureList(card: string[] | string, player?: false | Player): string[];
|
||||||
|
static cards(num: any, putBack: any): any;
|
||||||
|
static judge(card: any): any;
|
||||||
|
static judge2(card: any): any;
|
||||||
|
static distance(from: any, to: any, method: any): number;
|
||||||
|
/**
|
||||||
|
* @overload
|
||||||
|
* @param { string } item
|
||||||
|
* @returns { Skill }
|
||||||
|
*/
|
||||||
|
static info(item: string): Skill;
|
||||||
|
/**
|
||||||
|
* @overload
|
||||||
|
* @param { Card | VCard | CardBaseUIData } item
|
||||||
|
* @param { Player | false } [player]
|
||||||
|
* @returns { any }
|
||||||
|
*/
|
||||||
|
static info(item: Card | VCard | CardBaseUIData, player?: Player | false): any;
|
||||||
|
/**
|
||||||
|
* @param { number | Select | (()=>Select) } [select]
|
||||||
|
* @returns { Select }
|
||||||
|
*/
|
||||||
|
static select(select?: number | Select | (() => Select)): Select;
|
||||||
|
static card(original: any): any;
|
||||||
|
/**
|
||||||
|
* @overload
|
||||||
|
* @returns {GameEvent}
|
||||||
|
*/
|
||||||
|
static event(): GameEvent;
|
||||||
|
/**
|
||||||
|
* @template { keyof GameEvent } T
|
||||||
|
* @overload
|
||||||
|
* @param {T} key
|
||||||
|
* @returns {GameEvent[T]}
|
||||||
|
*/
|
||||||
|
static event<T_2 extends keyof import("../library/element/gameEvent.js").GameEvent>(key: T_2): import("../library/element/gameEvent.js").GameEvent[T_2];
|
||||||
|
static player(): import("../library/element/player.js").Player;
|
||||||
|
static players(sort: any, dead: any, out: any): import("../library/element/player.js").Player[];
|
||||||
|
static position(card: any, ordering: any): number | "x" | "s" | "e" | "j" | "h" | "c" | "d" | "o";
|
||||||
|
static skillTranslation(str: any, player: any): string;
|
||||||
|
static skillInfoTranslation(name: any, player: any): any;
|
||||||
|
/**
|
||||||
|
* @returns {string}
|
||||||
|
*/
|
||||||
|
static translation(str: any, arg: any): string;
|
||||||
|
static menuZoom(): any;
|
||||||
|
static strNumber(num: any): any;
|
||||||
|
static cnNumber(num: any, ordinal: any): any;
|
||||||
|
/**
|
||||||
|
* 遍历子元素
|
||||||
|
* @param {HTMLElement} node
|
||||||
|
* @returns {Iterable<HTMLElement>} 迭代器
|
||||||
|
*/
|
||||||
|
static iterableChildNodes(node: HTMLElement, ...args: any[]): Iterable<HTMLElement>;
|
||||||
|
/**
|
||||||
|
* @param {((a: Button, b: Button) => number)} [sort] 排序函数
|
||||||
|
* @returns { Button[] }
|
||||||
|
*/
|
||||||
|
static selectableButtons(sort?: (a: Button, b: Button) => number): Button[];
|
||||||
|
/**
|
||||||
|
* @param {((a: Card, b: Card) => number)} [sort] 排序函数
|
||||||
|
* @returns { Card[] }
|
||||||
|
*/
|
||||||
|
static selectableCards(sort?: (a: Card, b: Card) => number): Card[];
|
||||||
|
/**
|
||||||
|
* @returns { string[] } 技能名数组
|
||||||
|
*/
|
||||||
|
static skills(): string[];
|
||||||
|
static gainableSkills(func: any, player: any): any[];
|
||||||
|
static gainableSkillsName(name: any, func: any): any[];
|
||||||
|
static gainableCharacters(func: any): string[];
|
||||||
|
/**
|
||||||
|
* @param {((a: Player, b: Player) => number)} [sort] 排序函数
|
||||||
|
* @returns { Player[] }
|
||||||
|
*/
|
||||||
|
static selectableTargets(sort?: (a: Player, b: Player) => number): Player[];
|
||||||
|
static filter(filter: any, i: any): any;
|
||||||
|
static cardCount(card: any, player: any): any;
|
||||||
|
static skillCount(skill: any, player: any): any;
|
||||||
|
static owner(card: any, method: any): import("../library/element/player.js").Player;
|
||||||
|
static noSelected(): boolean;
|
||||||
|
static population(identity: any): number;
|
||||||
|
static totalPopulation(identity: any): number;
|
||||||
|
/**
|
||||||
|
* @param { Card | VCard } item
|
||||||
|
*/
|
||||||
|
static cardtag(item: Card | VCard, tag: any): any;
|
||||||
|
static tag(item: any, tag: any, item2: any, bool: any): any;
|
||||||
|
static sortCard(sort: any): (card: any) => any;
|
||||||
|
static difficulty(): 2 | 1 | 3;
|
||||||
|
static cardPile(name: any, create: any): any;
|
||||||
|
static cardPile2(name: any): any;
|
||||||
|
static discardPile(name: any): any;
|
||||||
|
static aiStrategy(): 2 | 1 | 3 | 4 | 5 | 6;
|
||||||
|
static skillintro(name: any, learn: any, learn2: any): string;
|
||||||
|
static intro(name: any): string;
|
||||||
|
static storageintro(type: any, content: any, player: any, dialog: any, skill: any): any;
|
||||||
|
static nodeintro(node: any, simple: any, evt: any): import("../library/element/dialog.js").Dialog;
|
||||||
|
static linkintro(dialog: any, content: any, player: any): void;
|
||||||
|
static groups(): string[];
|
||||||
|
static types(): any[];
|
||||||
|
static links(buttons: any): any[];
|
||||||
|
static threaten(target: any, player: any, hp: any): number;
|
||||||
|
static condition(player: any): any;
|
||||||
|
static attitude(from: any, to: any, ...args: any[]): any;
|
||||||
|
static sgnAttitude(...args: any[]): 0 | 1 | -1;
|
||||||
|
static useful_raw(card: any, player: any): any;
|
||||||
|
static useful(card: any, player: any): any;
|
||||||
|
static unuseful(card: any): number;
|
||||||
|
static unuseful2(card: any): number;
|
||||||
|
static unuseful3(card: any): number;
|
||||||
|
static value(card: any, player: any, method: any): any;
|
||||||
|
static equipResult(player: any, target: any, name: any): number;
|
||||||
|
static equipValue(card: any, player: any): number;
|
||||||
|
static equipValueNumber(card: any): number;
|
||||||
|
static disvalue(card: any, player: any): number;
|
||||||
|
static disvalue2(card: any, player: any): number;
|
||||||
|
static skillthreaten(skill: any, player: any, target: any): number | void;
|
||||||
|
static cacheOrder(item: any): number;
|
||||||
|
/**
|
||||||
|
* @returns { number }
|
||||||
|
*/
|
||||||
|
static order(item: any, player?: import("../library/element/player.js").Player): number;
|
||||||
|
static result(item: any, skill: any): any;
|
||||||
|
static cacheEffectUse(target: any, card: any, player: any, player2: any, isLink: any): number;
|
||||||
|
static effect_use(target: any, card: any, player: any, player2: any, isLink: any): number;
|
||||||
|
static cacheEffect(target: any, card: any, player: any, player2: any, isLink: any): number;
|
||||||
|
static effect(target: any, card: any, player: any, player2: any, isLink: any): number;
|
||||||
|
static damageEffect(target: any, player: any, viewer: any, nature: any): any;
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param {any} source 如果参数是function,执行此函数并返回结果,传参为此方法剩余的参数。如果参数不是function,直接返回结果。
|
||||||
|
* @returns 返回的结果
|
||||||
|
*/
|
||||||
|
static dynamicVariable(source: any, ...args: any[]): any;
|
||||||
|
static recoverEffect(target: any, player: any, viewer: any): number;
|
||||||
|
static buttonValue(button: any): number;
|
||||||
|
static attitude2(to: any): any;
|
||||||
|
}
|
||||||
|
export const get: typeof Get;
|
||||||
|
export { Is };
|
||||||
|
import { Uninstantable } from "../util/index.js";
|
||||||
|
import { Is } from "./is.js";
|
194
node_modules/@types/noname-typings/nonameModules/noname/get/is.d.ts
generated
vendored
Normal file
194
node_modules/@types/noname-typings/nonameModules/noname/get/is.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,194 @@
|
||||||
|
export class Is extends Uninstantable {
|
||||||
|
/**
|
||||||
|
* 判断是否为进攻坐骑
|
||||||
|
* @param { Card | VCard } card
|
||||||
|
* @param { false | Player } [player]
|
||||||
|
* @returns { boolean }
|
||||||
|
*/
|
||||||
|
static attackingMount(card: Card | VCard, player?: false | Player): boolean;
|
||||||
|
/**
|
||||||
|
* 判断是否为防御坐骑
|
||||||
|
* @param { Card | VCard } card
|
||||||
|
* @param { false | Player } [player]
|
||||||
|
* @returns { boolean }
|
||||||
|
*/
|
||||||
|
static defendingMount(card: Card | VCard, player?: false | Player): boolean;
|
||||||
|
/**
|
||||||
|
* 判断坐骑栏是否被合并
|
||||||
|
* @returns { boolean }
|
||||||
|
*/
|
||||||
|
static mountCombined(): boolean;
|
||||||
|
/**
|
||||||
|
* 判断传入的参数的属性是否相同(参数可以为卡牌、卡牌信息、属性等)
|
||||||
|
* @param {...} infos 要判断的属性列表
|
||||||
|
* @param {boolean} every 是否判断每一个传入的属性是否完全相同而不是存在部分相同
|
||||||
|
*/
|
||||||
|
static sameNature(...args: any[]): boolean;
|
||||||
|
/**
|
||||||
|
* 判断传入的参数的属性是否不同(参数可以为卡牌、卡牌信息、属性等)
|
||||||
|
* @param ...infos 要判断的属性列表
|
||||||
|
* @param every {boolean} 是否判断每一个传入的属性是否完全不同而不是存在部分不同
|
||||||
|
*/
|
||||||
|
static differentNature(...args: any[]): boolean;
|
||||||
|
/**
|
||||||
|
* 判断一张牌是否为明置手牌
|
||||||
|
* @param { Card } card
|
||||||
|
*/
|
||||||
|
static shownCard(card: Card): boolean;
|
||||||
|
/**
|
||||||
|
* 是否是虚拟牌
|
||||||
|
* @param { Card | VCard } card
|
||||||
|
*/
|
||||||
|
static virtualCard(card: Card | VCard): boolean;
|
||||||
|
/**
|
||||||
|
* 是否是转化牌
|
||||||
|
* @param { Card | VCard } card
|
||||||
|
*/
|
||||||
|
static convertedCard(card: Card | VCard): boolean;
|
||||||
|
/**
|
||||||
|
* 是否是实体牌
|
||||||
|
* @param { Card | VCard } card
|
||||||
|
*/
|
||||||
|
static ordinaryCard(card: Card | VCard): boolean;
|
||||||
|
/**
|
||||||
|
* 押韵判断
|
||||||
|
* @param { string } str1
|
||||||
|
* @param { string } str2
|
||||||
|
*/
|
||||||
|
static yayun(str1: string, str2: string): boolean;
|
||||||
|
/**
|
||||||
|
* @param { string } skill 技能id
|
||||||
|
* @param { Player } player 玩家
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
static blocked(skill: string, player: Player): boolean;
|
||||||
|
/**
|
||||||
|
* 是否是双势力武将
|
||||||
|
* @param { string } name
|
||||||
|
* @param { string[] } array
|
||||||
|
* @returns { boolean | string[] }
|
||||||
|
*/
|
||||||
|
static double(name: string, array: string[]): boolean | string[];
|
||||||
|
/**
|
||||||
|
* Check if the card has a Yingbian condition
|
||||||
|
*
|
||||||
|
* 检测此牌是否具有应变条件
|
||||||
|
* @param { Card | VCard } card
|
||||||
|
*/
|
||||||
|
static yingbianConditional(card: Card | VCard): boolean;
|
||||||
|
/**
|
||||||
|
* @param { Card | VCard } card
|
||||||
|
*/
|
||||||
|
static complexlyYingbianConditional(card: Card | VCard): boolean;
|
||||||
|
/**
|
||||||
|
* @param { Card | VCard } card
|
||||||
|
*/
|
||||||
|
static simplyYingbianConditional(card: Card | VCard): boolean;
|
||||||
|
/**
|
||||||
|
* Check if the card has a Yingbian effect
|
||||||
|
*
|
||||||
|
* 检测此牌是否具有应变效果
|
||||||
|
*
|
||||||
|
* @param { Card | VCard } card
|
||||||
|
*/
|
||||||
|
static yingbianEffective(card: Card | VCard): boolean;
|
||||||
|
/**
|
||||||
|
* @param { Card | VCard } card
|
||||||
|
*/
|
||||||
|
static yingbian(card: Card | VCard): boolean;
|
||||||
|
/**
|
||||||
|
* @param { string } [substring]
|
||||||
|
*/
|
||||||
|
static emoji(substring?: string): boolean;
|
||||||
|
/**
|
||||||
|
* @param { string } str
|
||||||
|
*/
|
||||||
|
static banWords(str: string): boolean;
|
||||||
|
/**
|
||||||
|
* @param { GameEventPromise } event
|
||||||
|
*/
|
||||||
|
static converted(event: GameEventPromise): boolean;
|
||||||
|
static safari(): boolean;
|
||||||
|
/**
|
||||||
|
* @param { (Card | VCard)[]} cards
|
||||||
|
*/
|
||||||
|
static freePosition(cards: (Card | VCard)[]): boolean;
|
||||||
|
/**
|
||||||
|
* @param { string } name
|
||||||
|
* @param { boolean } item
|
||||||
|
*/
|
||||||
|
static nomenu(name: string, item: boolean): boolean;
|
||||||
|
static altered(skillName: any): boolean;
|
||||||
|
/**
|
||||||
|
* @param { any } obj
|
||||||
|
* @returns { boolean }
|
||||||
|
*/
|
||||||
|
static node(obj: any): boolean;
|
||||||
|
/**
|
||||||
|
* @param { any } obj
|
||||||
|
*/
|
||||||
|
static div(obj: any): boolean;
|
||||||
|
/**
|
||||||
|
* @param { any } obj
|
||||||
|
*/
|
||||||
|
static map(obj: any): boolean;
|
||||||
|
/**
|
||||||
|
* @param { any } obj
|
||||||
|
*/
|
||||||
|
static set(obj: any): boolean;
|
||||||
|
/**
|
||||||
|
* @param { any } obj
|
||||||
|
*/
|
||||||
|
static object(obj: any): boolean;
|
||||||
|
/**
|
||||||
|
* @overload
|
||||||
|
* @param { Function } func
|
||||||
|
* @returns { false }
|
||||||
|
*/
|
||||||
|
static singleSelect(func: Function): false;
|
||||||
|
/**
|
||||||
|
* @overload
|
||||||
|
* @param { number | [number, number] } func
|
||||||
|
* @returns { boolean }
|
||||||
|
*/
|
||||||
|
static singleSelect(func: number | [number, number]): boolean;
|
||||||
|
/**
|
||||||
|
* @param { string | Player } name
|
||||||
|
*/
|
||||||
|
static jun(name: string | Player): boolean;
|
||||||
|
static versus(): boolean;
|
||||||
|
static changban(): boolean;
|
||||||
|
static single(): boolean;
|
||||||
|
/**
|
||||||
|
* @param { Player } [player]
|
||||||
|
*/
|
||||||
|
static mobileMe(player?: Player): boolean;
|
||||||
|
static newLayout(): boolean;
|
||||||
|
static phoneLayout(): boolean;
|
||||||
|
static singleHandcard(): any;
|
||||||
|
/**
|
||||||
|
* @param { Player } player
|
||||||
|
*/
|
||||||
|
static linked2(player: Player): boolean;
|
||||||
|
/**
|
||||||
|
* @param { {} } obj
|
||||||
|
*/
|
||||||
|
static empty(obj: {}): boolean;
|
||||||
|
/**
|
||||||
|
* @param { string } str
|
||||||
|
*/
|
||||||
|
static pos(str: string): boolean;
|
||||||
|
/**
|
||||||
|
* @param { string } skill
|
||||||
|
* @param { Player } player
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
static locked(skill: string, player: Player): any;
|
||||||
|
/**
|
||||||
|
* @param { string } skill
|
||||||
|
* @param { Player } player
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
static zhuanhuanji(skill: string, player: Player): boolean;
|
||||||
|
}
|
||||||
|
import { Uninstantable } from "../util/index.js";
|
12
node_modules/@types/noname-typings/nonameModules/noname/gnc/index.d.ts
generated
vendored
Normal file
12
node_modules/@types/noname-typings/nonameModules/noname/gnc/index.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
export class GNC extends Uninstantable {
|
||||||
|
/**
|
||||||
|
* @param {GeneratorFunction} fn
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
static of(fn: GeneratorFunction): (...args: any[]) => Promise<Generator<unknown, any, unknown>>;
|
||||||
|
static is: typeof Is;
|
||||||
|
}
|
||||||
|
export const gnc: typeof GNC;
|
||||||
|
import { Uninstantable } from "../util/index.js";
|
||||||
|
import { GeneratorFunction } from "../util/index.js";
|
||||||
|
import { Is } from "./is.js";
|
18
node_modules/@types/noname-typings/nonameModules/noname/gnc/is.d.ts
generated
vendored
Normal file
18
node_modules/@types/noname-typings/nonameModules/noname/gnc/is.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
export class Is extends Uninstantable {
|
||||||
|
/**
|
||||||
|
* @param {*} item
|
||||||
|
* @returns {boolean}
|
||||||
|
*/
|
||||||
|
static coroutine(item: any): boolean;
|
||||||
|
/**
|
||||||
|
* @param {*} item
|
||||||
|
* @returns {boolean}
|
||||||
|
*/
|
||||||
|
static generatorFunc(item: any): boolean;
|
||||||
|
/**
|
||||||
|
* @param {*} item
|
||||||
|
* @returns {boolean}
|
||||||
|
*/
|
||||||
|
static generator(item: any): boolean;
|
||||||
|
}
|
||||||
|
import { Uninstantable } from "../util/index.js";
|
1
node_modules/@types/noname-typings/nonameModules/noname/init/cordova.d.ts
generated
vendored
Normal file
1
node_modules/@types/noname-typings/nonameModules/noname/init/cordova.d.ts
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
export function cordovaReady(): Promise<void>;
|
4
node_modules/@types/noname-typings/nonameModules/noname/init/import.d.ts
generated
vendored
Normal file
4
node_modules/@types/noname-typings/nonameModules/noname/init/import.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
export function importCardPack(name: string): Promise<void>;
|
||||||
|
export function importCharacterPack(name: string): Promise<void>;
|
||||||
|
export function importExtension(name: string): Promise<void>;
|
||||||
|
export function importMode(name: string): Promise<void>;
|
7
node_modules/@types/noname-typings/nonameModules/noname/init/index.d.ts
generated
vendored
Normal file
7
node_modules/@types/noname-typings/nonameModules/noname/init/index.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
export function canUseHttpProtocol(): boolean;
|
||||||
|
/**
|
||||||
|
* 传递升级完成的信息
|
||||||
|
* @returns { string | void } 返回一个网址
|
||||||
|
*/
|
||||||
|
export function sendUpdate(): string | void;
|
||||||
|
export function boot(): Promise<void>;
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue