Merge pull request #1164 from nonameShijian/PR-Branch
setBackgroundImage支持数组传入,修复部分类型提示问题
This commit is contained in:
commit
300c83ad46
|
@ -61,6 +61,10 @@ var sawReadOnlySpans = false, sawCollapsedSpans = false;
|
|||
// You can find some technical background for some of the code below
|
||||
// at http://marijnhaverbeke.nl/blog/#cm-internals .
|
||||
|
||||
/**
|
||||
* @type { typeof import('codemirror/index') }
|
||||
*/
|
||||
// @ts-ignore
|
||||
var CodeMirror = (function () {
|
||||
|
||||
// A CodeMirror instance represents an editor. This is the object
|
||||
|
|
17387
game/jszip.js
17387
game/jszip.js
File diff suppressed because it is too large
Load Diff
|
@ -5565,11 +5565,12 @@ div[data-decoration="bronze"]::after{
|
|||
}
|
||||
}
|
||||
/*--------其它--------*/
|
||||
::-webkit-scrollbar {
|
||||
/* 解放下拉框滚动条! */
|
||||
:not(select)::-webkit-scrollbar {
|
||||
display: none;
|
||||
}
|
||||
/* 火狐隐藏滚动条 */
|
||||
* {
|
||||
/* 火狐和chrome120+隐藏滚动条 */
|
||||
:not(select) {
|
||||
scrollbar-width: none;
|
||||
}
|
||||
/* 更新进度条 */
|
||||
|
|
|
@ -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"
|
||||
}
|
|
@ -4,6 +4,8 @@ declare interface Array<T> {
|
|||
* @deprecated 已废弃,请使用includes
|
||||
*/
|
||||
contains(item: T): boolean;
|
||||
containsSome(...item: T): boolean;
|
||||
containsAll(...item: T): boolean;
|
||||
/**
|
||||
* 添加任意元素进数组中
|
||||
* @param args
|
||||
|
@ -32,7 +34,7 @@ declare interface Array<T> {
|
|||
* 将一个数组的所有元素移除出该数组(循环执行this.remove),此时参数arr中若有一个数组元素可能会出现bug
|
||||
* @param arr
|
||||
*/
|
||||
removeArray(arr: T[]): this;
|
||||
removeArray(...arr: T[]): this;
|
||||
/**
|
||||
* 随机获得该数组的一个元素
|
||||
* @param args 设置需要排除掉的部分元素;
|
||||
|
@ -46,8 +48,8 @@ declare interface Array<T> {
|
|||
* 2. 移除多个元素,返回一个被移除元素组成的数组
|
||||
* 3. 数组无元素返回undefined
|
||||
*/
|
||||
randomRemove(num: number): T | T[];
|
||||
randomRemove(num: T): T | undefined;
|
||||
randomRemove(num?: number): T | T[];
|
||||
randomRemove(num?: T): T | undefined;
|
||||
/**
|
||||
* 随机重新排序数组(数组乱序)
|
||||
*/
|
||||
|
@ -77,7 +79,9 @@ declare interface Array<T> {
|
|||
* 例:list.filterInD('h') 即判断数组中所有位于手牌区的卡牌
|
||||
* @param poiston 指定的区域,默认是 'o'
|
||||
*/
|
||||
filterInD(poiston?: string): Card[];
|
||||
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;
|
||||
|
||||
//关于处理区:
|
||||
/*
|
||||
|
@ -100,5 +104,9 @@ declare interface Array<T> {
|
|||
/**
|
||||
* 获取 item 在数组中出现的次数
|
||||
*/
|
||||
numOf(item: T): number
|
||||
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
node_modules/noname-typings/Card.d.ts → node_modules/@types/noname-typings/Card.d.ts
generated
vendored
0
node_modules/noname-typings/Card.d.ts → node_modules/@types/noname-typings/Card.d.ts
generated
vendored
|
@ -1,6 +1,12 @@
|
|||
//noname内扩展的一些HTMLDivElement方法:
|
||||
interface HTMLDivElement {
|
||||
_link: any;
|
||||
timeout?: number;
|
||||
destiny?: HTMLDivElement;
|
||||
_listeningEnd?: boolean;
|
||||
_transitionEnded?: boolean;
|
||||
_onEndDelete?: boolean;
|
||||
_selfDestroyed?: boolean;
|
||||
/**
|
||||
* 增加一个动画(增加className动画标记)
|
||||
*
|
||||
|
@ -20,8 +26,7 @@ interface HTMLDivElement {
|
|||
* @param time 调用后删除的时间(延时删除)
|
||||
* @param callback 删除后的回调
|
||||
*/
|
||||
delete(time: number, callback?: () => void): this;
|
||||
delete(): this;
|
||||
delete(time?: number, callback?: () => void): this;
|
||||
/**
|
||||
* 将该节点div移除,并添加到目标处
|
||||
*
|
||||
|
@ -46,12 +51,12 @@ interface HTMLDivElement {
|
|||
* 设置游戏背景,并且缓存该设置
|
||||
* @param img
|
||||
*/
|
||||
setBackgroundDB(img: string): this;
|
||||
setBackgroundDB(img: string): Promise<this>;
|
||||
/**
|
||||
* 设置背景
|
||||
* @param img
|
||||
*/
|
||||
setBackgroundImage(img: string): this;
|
||||
setBackgroundImage(img: string | string[]): this;
|
||||
/**
|
||||
* 设置触摸/点击监听
|
||||
* @param func
|
||||
|
@ -73,6 +78,8 @@ interface HTMLDivElement {
|
|||
* @param style
|
||||
*/
|
||||
css<T extends keyof CSSStyleDeclaration>(style: {
|
||||
[key in T]?: string
|
||||
[key in T]?: string;
|
||||
} & {
|
||||
innerHTML?: string;
|
||||
}): this;
|
||||
}
|
|
@ -4,5 +4,5 @@ interface HTMLTableElement {
|
|||
* @param row
|
||||
* @param col
|
||||
*/
|
||||
get(row: number, col: number): HTMLElement;
|
||||
get(row: number, col: number): HTMLElement | void;
|
||||
}
|
0
node_modules/noname-typings/LICENSE → node_modules/@types/noname-typings/LICENSE
generated
vendored
0
node_modules/noname-typings/LICENSE → node_modules/@types/noname-typings/LICENSE
generated
vendored
|
@ -13,4 +13,8 @@
|
|||
/// <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="./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";
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue