update interface button styles
This commit is contained in:
21
node_modules/@replit/codemirror-vim/LICENSE
generated
vendored
Normal file
21
node_modules/@replit/codemirror-vim/LICENSE
generated
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (C) 2018-2021 by Marijn Haverbeke <marijnh@gmail.com> and others
|
||||
|
||||
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.
|
||||
71
node_modules/@replit/codemirror-vim/README.md
generated
vendored
Normal file
71
node_modules/@replit/codemirror-vim/README.md
generated
vendored
Normal file
@ -0,0 +1,71 @@
|
||||
# Vim keybindings for CM6
|
||||
|
||||
<span><a href="https://replit.com/@util/codemirror-vim" title="Run on Replit badge"><img src="https://replit.com/badge/github/replit/codemirror-vim" alt="Run on Replit badge" /></a></span>
|
||||
<span><a href="https://www.npmjs.com/package/@replit/codemirror-vim" title="NPM version badge"><img src="https://img.shields.io/npm/v/@replit/codemirror-vim?color=blue" alt="NPM version badge" /></a></span>
|
||||
|
||||
## Installation
|
||||
|
||||
```sh
|
||||
npm i @replit/codemirror-vim
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
import { basicSetup, EditorView } from 'codemirror';
|
||||
import { vim } from "@replit/codemirror-vim"
|
||||
|
||||
let view = new EditorView({
|
||||
doc: "",
|
||||
extensions: [
|
||||
// make sure vim is included before other keymaps
|
||||
vim(),
|
||||
// include the default keymap and all other keymaps you want to use in insert mode
|
||||
basicSetup,
|
||||
],
|
||||
parent: document.querySelector('#editor'),
|
||||
})
|
||||
```
|
||||
> **Note**:
|
||||
> if you are not using `basicSetup`, make sure you include the [drawSelection](https://codemirror.net/docs/ref/#view.drawSelection) plugin to correctly render the selection in visual mode.
|
||||
|
||||
## Usage of cm5 vim extension api
|
||||
|
||||
The same api that could be used in previous version of codemirror https://codemirror.net/doc/manual.html#vimapi, can be used with this plugin too, just replace the old editor instance with `view.cm` in your code
|
||||
|
||||
```js
|
||||
import {Vim, getCM} from "@replit/codemirror-vim"
|
||||
|
||||
let cm = getCM(view)
|
||||
// use cm to access the old cm5 api
|
||||
Vim.exitInsertMode(cm)
|
||||
Vim.handleKey(cm, "<Esc>")
|
||||
```
|
||||
|
||||
### Define additional ex commands
|
||||
```js
|
||||
Vim.defineEx('write', 'w', function() {
|
||||
// save the file
|
||||
});
|
||||
```
|
||||
|
||||
### Map keys
|
||||
```js
|
||||
Vim.map("jj", "<Esc>", "insert"); // in insert mode
|
||||
Vim.map("Y", "y$"); // in normal mode
|
||||
```
|
||||
|
||||
### Unmap keys
|
||||
|
||||
```js
|
||||
Vim.unmap("jj", "insert");
|
||||
```
|
||||
|
||||
### Add custom key
|
||||
|
||||
```js
|
||||
defaultKeymap.push({ keys: 'gq', type: 'operator', operator: 'hardWrap' });
|
||||
Vim.defineOperator("hardWrap", function(cm, operatorArgs, ranges, oldAnchor, newHead) {
|
||||
// make changes and return new cursor position
|
||||
});
|
||||
```
|
||||
7806
node_modules/@replit/codemirror-vim/dist/index.cjs
generated
vendored
Normal file
7806
node_modules/@replit/codemirror-vim/dist/index.cjs
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
223
node_modules/@replit/codemirror-vim/dist/index.d.ts
generated
vendored
Normal file
223
node_modules/@replit/codemirror-vim/dist/index.d.ts
generated
vendored
Normal file
@ -0,0 +1,223 @@
|
||||
import { EditorSelection, ChangeDesc, Extension } from '@codemirror/state';
|
||||
import { StringStream } from '@codemirror/language';
|
||||
import { EditorView, ViewUpdate } from '@codemirror/view';
|
||||
import { SearchQuery } from '@codemirror/search';
|
||||
|
||||
interface CM5Range {
|
||||
anchor: Pos;
|
||||
head: Pos;
|
||||
}
|
||||
interface Pos {
|
||||
line: number;
|
||||
ch: number;
|
||||
}
|
||||
declare class Pos {
|
||||
constructor(line: number, ch: number);
|
||||
}
|
||||
declare function on(emitter: any, type: string, f: Function): void;
|
||||
declare function off(emitter: any, type: string, f: Function): void;
|
||||
declare function signal(emitter: any, type: string, ...args: any[]): void;
|
||||
interface Operation {
|
||||
$d: number;
|
||||
isVimOp?: boolean;
|
||||
cursorActivityHandlers?: Function[];
|
||||
cursorActivity?: boolean;
|
||||
lastChange?: any;
|
||||
change?: any;
|
||||
changeHandlers?: Function[];
|
||||
$changeStart?: number;
|
||||
}
|
||||
declare class CodeMirror {
|
||||
static isMac: boolean;
|
||||
static Pos: typeof Pos;
|
||||
static StringStream: typeof StringStream;
|
||||
static commands: {
|
||||
cursorCharLeft: (cm: CodeMirror) => void;
|
||||
redo: (cm: CodeMirror) => void;
|
||||
undo: (cm: CodeMirror) => void;
|
||||
newlineAndIndent: (cm: CodeMirror) => void;
|
||||
indentAuto: (cm: CodeMirror) => void;
|
||||
};
|
||||
static defineOption: (name: string, val: any, setter: Function) => void;
|
||||
static isWordChar: (ch: string) => boolean;
|
||||
static keys: any;
|
||||
static keyMap: {};
|
||||
static addClass: () => void;
|
||||
static rmClass: () => void;
|
||||
static e_preventDefault: (e: Event) => void;
|
||||
static e_stop: (e: Event) => void;
|
||||
static keyName: (e: KeyboardEvent) => string | undefined;
|
||||
static vimKey: (e: KeyboardEvent) => string | undefined;
|
||||
static lookupKey: (key: string, map: string, handle: Function) => void;
|
||||
static on: typeof on;
|
||||
static off: typeof off;
|
||||
static signal: typeof signal;
|
||||
openDialog(template: Element, callback: Function, options: any): (newVal?: string | undefined) => void;
|
||||
openNotification(template: Node, options: NotificationOptions): () => void;
|
||||
static findMatchingTag: typeof findMatchingTag;
|
||||
static findEnclosingTag: typeof findEnclosingTag;
|
||||
cm6: EditorView;
|
||||
state: {
|
||||
statusbar?: Element | null;
|
||||
dialog?: Element | null;
|
||||
vimPlugin?: any;
|
||||
vim?: any;
|
||||
currentNotificationClose?: Function | null;
|
||||
keyMap?: string;
|
||||
overwrite?: boolean;
|
||||
};
|
||||
marks: Record<string, Marker>;
|
||||
$mid: number;
|
||||
curOp: Operation | null | undefined;
|
||||
options: any;
|
||||
_handlers: any;
|
||||
constructor(cm6: EditorView);
|
||||
on(type: string, f: Function): void;
|
||||
off(type: string, f: Function): void;
|
||||
signal(type: string, e: any, handlers?: any): void;
|
||||
indexFromPos(pos: Pos): number;
|
||||
posFromIndex(offset: number): Pos;
|
||||
foldCode(pos: Pos): void;
|
||||
firstLine(): number;
|
||||
lastLine(): number;
|
||||
lineCount(): number;
|
||||
setCursor(line: Pos | number, ch: number): void;
|
||||
getCursor(p?: "head" | "anchor" | "start" | "end"): Pos;
|
||||
listSelections(): {
|
||||
anchor: Pos;
|
||||
head: Pos;
|
||||
}[];
|
||||
setSelections(p: CM5Range[], primIndex?: number): void;
|
||||
setSelection(anchor: Pos, head: Pos, options?: any): void;
|
||||
getLine(row: number): string;
|
||||
getLineHandle(row: number): {
|
||||
row: number;
|
||||
index: number;
|
||||
};
|
||||
getLineNumber(handle: any): number | null;
|
||||
releaseLineHandles(): void;
|
||||
getRange(s: Pos, e: Pos): string;
|
||||
replaceRange(text: string, s: Pos, e: Pos): void;
|
||||
replaceSelection(text: string): void;
|
||||
replaceSelections(replacements: string[]): void;
|
||||
getSelection(): string;
|
||||
getSelections(): string[];
|
||||
somethingSelected(): boolean;
|
||||
getInputField(): HTMLElement;
|
||||
clipPos(p: Pos): Pos;
|
||||
getValue(): string;
|
||||
setValue(text: string): void;
|
||||
focus(): void;
|
||||
blur(): void;
|
||||
defaultTextHeight(): number;
|
||||
findMatchingBracket(pos: Pos): {
|
||||
to: Pos;
|
||||
} | {
|
||||
to: undefined;
|
||||
};
|
||||
scanForBracket(pos: Pos, dir: 1 | -1, style: any, config: any): false | {
|
||||
pos: Pos;
|
||||
ch: string;
|
||||
} | null;
|
||||
indentLine(line: number, more: boolean): void;
|
||||
indentMore(): void;
|
||||
indentLess(): void;
|
||||
execCommand(name: string): void;
|
||||
setBookmark(cursor: Pos, options?: {
|
||||
insertLeft: boolean;
|
||||
}): Marker;
|
||||
cm6Query?: SearchQuery;
|
||||
addOverlay({ query }: {
|
||||
query: RegExp;
|
||||
}): SearchQuery | undefined;
|
||||
removeOverlay(overlay?: any): void;
|
||||
getSearchCursor(query: RegExp, pos: Pos): {
|
||||
findNext: () => string[] | null | undefined;
|
||||
findPrevious: () => string[] | null | undefined;
|
||||
find: (back?: boolean) => string[] | null | undefined;
|
||||
from: () => Pos | undefined;
|
||||
to: () => Pos | undefined;
|
||||
replace: (text: string) => void;
|
||||
};
|
||||
findPosV(start: Pos, amount: number, unit: "page" | "line", goalColumn?: number): Pos & {
|
||||
hitSide: boolean;
|
||||
};
|
||||
charCoords(pos: Pos, mode: "div" | "local"): {
|
||||
left: number;
|
||||
top: number;
|
||||
bottom: number;
|
||||
};
|
||||
coordsChar(coords: {
|
||||
left: number;
|
||||
top: number;
|
||||
}, mode: "div" | "local"): Pos;
|
||||
getScrollInfo(): {
|
||||
left: number;
|
||||
top: number;
|
||||
height: number;
|
||||
width: number;
|
||||
clientHeight: number;
|
||||
clientWidth: number;
|
||||
};
|
||||
scrollTo(x?: number, y?: number): void;
|
||||
scrollIntoView(pos?: Pos, margin?: number): void;
|
||||
getWrapperElement(): HTMLElement;
|
||||
getMode(): {
|
||||
name: string | number | boolean | undefined;
|
||||
};
|
||||
setSize(w: number, h: number): void;
|
||||
refresh(): void;
|
||||
destroy(): void;
|
||||
getLastEditEnd(): Pos;
|
||||
$lastChangeEndOffset: number;
|
||||
$lineHandleChanges: undefined | ViewUpdate[];
|
||||
onChange(update: ViewUpdate): void;
|
||||
onSelectionChange(): void;
|
||||
operation(fn: Function): any;
|
||||
onBeforeEndOperation(): void;
|
||||
moveH(increment: number, unit: string): void;
|
||||
setOption(name: string, val: any): void;
|
||||
getOption(name: string): string | number | boolean | undefined;
|
||||
toggleOverwrite(on: boolean): void;
|
||||
getTokenTypeAt(pos: Pos): "" | "string" | "comment";
|
||||
overWriteSelection(text: string): void;
|
||||
/*** multiselect ****/
|
||||
isInMultiSelectMode(): boolean;
|
||||
virtualSelectionMode(): boolean;
|
||||
virtualSelection: EditorSelection | null;
|
||||
forEachSelection(command: Function): void;
|
||||
}
|
||||
interface NotificationOptions {
|
||||
bottom?: boolean;
|
||||
duration?: number;
|
||||
}
|
||||
declare function findMatchingTag(cm: CodeMirror, pos: Pos): void;
|
||||
declare function findEnclosingTag(cm: CodeMirror, pos: Pos): {
|
||||
open: {
|
||||
from: Pos;
|
||||
to: Pos;
|
||||
};
|
||||
close: {
|
||||
from: Pos;
|
||||
to: Pos;
|
||||
};
|
||||
} | undefined;
|
||||
declare class Marker {
|
||||
cm: CodeMirror;
|
||||
id: number;
|
||||
offset: number | null;
|
||||
assoc: number;
|
||||
constructor(cm: CodeMirror, offset: number, assoc: number);
|
||||
clear(): void;
|
||||
find(): Pos | null;
|
||||
update(change: ChangeDesc): void;
|
||||
}
|
||||
|
||||
declare const Vim: any;
|
||||
declare function vim(options?: {
|
||||
status?: boolean;
|
||||
}): Extension;
|
||||
|
||||
declare function getCM(view: EditorView): CodeMirror | null;
|
||||
|
||||
export { CodeMirror, Vim, getCM, vim };
|
||||
7799
node_modules/@replit/codemirror-vim/dist/index.js
generated
vendored
Normal file
7799
node_modules/@replit/codemirror-vim/dist/index.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
46
node_modules/@replit/codemirror-vim/package.json
generated
vendored
Normal file
46
node_modules/@replit/codemirror-vim/package.json
generated
vendored
Normal file
@ -0,0 +1,46 @@
|
||||
{
|
||||
"name": "@replit/codemirror-vim",
|
||||
"version": "6.0.14",
|
||||
"description": "Vim keybindings for CodeMirror 6",
|
||||
"scripts": {
|
||||
"dev": "vite ./dev",
|
||||
"test": "cm-runtests",
|
||||
"testAll": "npm run test && cd dev/cm5 && npm run buildAndTest",
|
||||
"build": "cm-buildhelper src/index.ts",
|
||||
"publish": "npm run build && npm publish",
|
||||
"prepare": "npm run build"
|
||||
},
|
||||
"keywords": [
|
||||
"editor",
|
||||
"code"
|
||||
],
|
||||
"type": "module",
|
||||
"main": "dist/index.cjs",
|
||||
"exports": {
|
||||
"import": "./dist/index.js",
|
||||
"require": "./dist/index.cjs"
|
||||
},
|
||||
"types": "dist/index.d.ts",
|
||||
"module": "dist/index.js",
|
||||
"sideEffects": false,
|
||||
"license": "MIT",
|
||||
"peerDependencies": {
|
||||
"@codemirror/commands": "^6.0.0",
|
||||
"@codemirror/language": "^6.1.0",
|
||||
"@codemirror/search": "^6.2.0",
|
||||
"@codemirror/state": "^6.0.1",
|
||||
"@codemirror/view": "^6.0.3"
|
||||
},
|
||||
"devDependencies": {
|
||||
"codemirror": "6.0.0",
|
||||
"@codemirror/buildhelper": "^0.1.16",
|
||||
"@codemirror/lang-javascript": "^6.0.0",
|
||||
"@codemirror/lang-xml": "^6.0.0",
|
||||
"@codemirror/language": "^6.1.0",
|
||||
"vite": "^2.9.6"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/replit/codemirror-vim.git"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user