@difizen/libro-codemirror 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/auto-complete/closebrackets.d.ts +12 -0
- package/es/auto-complete/closebrackets.d.ts.map +1 -0
- package/es/auto-complete/completion.d.ts +57 -0
- package/es/auto-complete/completion.d.ts.map +1 -0
- package/es/auto-complete/config.d.ts +22 -0
- package/es/auto-complete/config.d.ts.map +1 -0
- package/es/auto-complete/filter.d.ts +13 -0
- package/es/auto-complete/filter.d.ts.map +1 -0
- package/es/auto-complete/snippet.d.ts +14 -0
- package/es/auto-complete/snippet.d.ts.map +1 -0
- package/es/auto-complete/state.d.ts +63 -0
- package/es/auto-complete/state.d.ts.map +1 -0
- package/es/auto-complete/theme.d.ts +6 -0
- package/es/auto-complete/theme.d.ts.map +1 -0
- package/es/auto-complete/tooltip.d.ts +5 -0
- package/es/auto-complete/tooltip.d.ts.map +1 -0
- package/es/auto-complete/view.d.ts +38 -0
- package/es/auto-complete/view.d.ts.map +1 -0
- package/es/auto-complete/word.d.ts +3 -0
- package/es/auto-complete/word.d.ts.map +1 -0
- package/es/hyperlink.d.ts +15 -0
- package/es/hyperlink.d.ts.map +1 -0
- package/es/indentation-markers/config.d.ts +17 -0
- package/es/indentation-markers/config.d.ts.map +1 -0
- package/es/indentation-markers/index.d.ts +3 -0
- package/es/indentation-markers/index.d.ts.map +1 -0
- package/es/indentation-markers/map.d.ts +77 -0
- package/es/indentation-markers/map.d.ts.map +1 -0
- package/es/indentation-markers/utils.d.ts +27 -0
- package/es/indentation-markers/utils.d.ts.map +1 -0
- package/es/libro-icon.d.ts +3 -0
- package/es/libro-icon.d.ts.map +1 -0
- package/es/monitor.d.ts +32 -0
- package/es/monitor.d.ts.map +1 -0
- package/es/python-lang.d.ts +3 -0
- package/es/python-lang.d.ts.map +1 -0
- package/es/theme.d.ts +35 -0
- package/es/theme.d.ts.map +1 -0
- package/es/tooltip.d.ts +1 -1
- package/package.json +4 -4
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { EditorState, Transaction, Extension, StateCommand } from '@codemirror/state';
|
|
2
|
+
import type { KeyBinding } from '@codemirror/view';
|
|
3
|
+
export interface CloseBracketConfig {
|
|
4
|
+
brackets?: string[];
|
|
5
|
+
before?: string;
|
|
6
|
+
stringPrefixes?: string[];
|
|
7
|
+
}
|
|
8
|
+
export declare function closeBrackets(): Extension;
|
|
9
|
+
export declare const deleteBracketPair: StateCommand;
|
|
10
|
+
export declare const closeBracketsKeymap: readonly KeyBinding[];
|
|
11
|
+
export declare function insertBracket(state: EditorState, bracket: string): Transaction | null;
|
|
12
|
+
//# sourceMappingURL=closebrackets.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"closebrackets.d.ts","sourceRoot":"","sources":["../../src/auto-complete/closebrackets.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,WAAW,EACX,WAAW,EACX,SAAS,EACT,YAAY,EAEb,MAAM,mBAAmB,CAAC;AAa3B,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAMnD,MAAM,WAAW,kBAAkB;IAIjC,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IAIpB,MAAM,CAAC,EAAE,MAAM,CAAC;IAGhB,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;CAC3B;AAyDD,wBAAgB,aAAa,IAAI,SAAS,CAEzC;AA0CD,eAAO,MAAM,iBAAiB,EAAE,YAiC/B,CAAC;AAIF,eAAO,MAAM,mBAAmB,EAAE,SAAS,UAAU,EAEpD,CAAC;AAWF,wBAAgB,aAAa,CAAC,KAAK,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,GAAG,WAAW,GAAG,IAAI,CAerF"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import type { EditorState, TransactionSpec } from '@codemirror/state';
|
|
2
|
+
import type { EditorView } from '@codemirror/view';
|
|
3
|
+
import type { ActiveResult } from './state.js';
|
|
4
|
+
export interface Completion {
|
|
5
|
+
label: string;
|
|
6
|
+
detail?: string;
|
|
7
|
+
info?: string | ((completion: Completion) => Node | null | Promise<Node | null>);
|
|
8
|
+
apply?: string | ((view: EditorView, completion: Completion, from: number, to: number) => void);
|
|
9
|
+
type?: string;
|
|
10
|
+
boost?: number;
|
|
11
|
+
}
|
|
12
|
+
export declare class CompletionContext {
|
|
13
|
+
readonly state: EditorState;
|
|
14
|
+
readonly pos: number;
|
|
15
|
+
readonly explicit: boolean;
|
|
16
|
+
abortListeners: (() => void)[] | null;
|
|
17
|
+
constructor(state: EditorState, pos: number, explicit: boolean);
|
|
18
|
+
tokenBefore(types: readonly string[]): {
|
|
19
|
+
from: number;
|
|
20
|
+
to: number;
|
|
21
|
+
text: string;
|
|
22
|
+
type: import("@lezer/common").NodeType;
|
|
23
|
+
} | null;
|
|
24
|
+
matchBefore(expr: RegExp): {
|
|
25
|
+
from: number;
|
|
26
|
+
to: number;
|
|
27
|
+
text: string;
|
|
28
|
+
} | null;
|
|
29
|
+
get aborted(): boolean;
|
|
30
|
+
addEventListener(type: 'abort', listener: () => void): void;
|
|
31
|
+
}
|
|
32
|
+
export declare function completeFromList(list: readonly (string | Completion)[]): CompletionSource;
|
|
33
|
+
export declare function ifIn(nodes: readonly string[], source: CompletionSource): CompletionSource;
|
|
34
|
+
export declare function ifNotIn(nodes: readonly string[], source: CompletionSource): CompletionSource;
|
|
35
|
+
export type CompletionSource = (context: CompletionContext) => CompletionResult | null | Promise<CompletionResult | null>;
|
|
36
|
+
export interface CompletionResult {
|
|
37
|
+
from: number;
|
|
38
|
+
to?: number;
|
|
39
|
+
options: readonly Completion[];
|
|
40
|
+
validFor?: RegExp | ((text: string, from: number, to: number, state: EditorState) => boolean);
|
|
41
|
+
filter?: boolean;
|
|
42
|
+
getMatch?: (completion: Completion) => readonly number[];
|
|
43
|
+
update?: (current: CompletionResult, from: number, to: number, context: CompletionContext) => CompletionResult | null;
|
|
44
|
+
}
|
|
45
|
+
export declare class Option {
|
|
46
|
+
readonly completion: Completion;
|
|
47
|
+
readonly source: ActiveResult;
|
|
48
|
+
readonly match: readonly number[];
|
|
49
|
+
constructor(completion: Completion, source: ActiveResult, match: readonly number[]);
|
|
50
|
+
}
|
|
51
|
+
export declare function cur(state: EditorState): number;
|
|
52
|
+
export declare function ensureAnchor(expr: RegExp, start: boolean): RegExp;
|
|
53
|
+
export declare const pickedCompletion: import("@codemirror/state").AnnotationType<Completion>;
|
|
54
|
+
export declare function insertCompletionText(state: EditorState, text: string, from: number, to: number): TransactionSpec;
|
|
55
|
+
export declare function applyCompletion(view: EditorView, option: Option): void;
|
|
56
|
+
export declare function asSource(source: CompletionSource | readonly (string | Completion)[]): CompletionSource;
|
|
57
|
+
//# sourceMappingURL=completion.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"completion.d.ts","sourceRoot":"","sources":["../../src/auto-complete/completion.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEtE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAGnD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAG/C,MAAM,WAAW,UAAU;IAIzB,KAAK,EAAE,MAAM,CAAC;IAGd,MAAM,CAAC,EAAE,MAAM,CAAC;IAIhB,IAAI,CAAC,EAAE,MAAM,GAAG,CAAC,CAAC,UAAU,EAAE,UAAU,KAAK,IAAI,GAAG,IAAI,GAAG,OAAO,CAAC,IAAI,GAAG,IAAI,CAAC,CAAC,CAAC;IAQjF,KAAK,CAAC,EACF,MAAM,GACN,CAAC,CAAC,IAAI,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC,CAAC;IAUnF,IAAI,CAAC,EAAE,M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AE,MAAM,EAAE,KAAK,EAAE,WAAW,KAAK,OAAO,CAAC,CAAC;IAO9E,MAAM,CAAC,EAAE,OAAO,CAAC;IAMjB,QAAQ,CAAC,EAAE,CAAC,UAAU,EAAE,UAAU,KAAK,SAAS,MAAM,EAAE,CAAC;IAOzD,MAAM,CAAC,EAAE,CACP,OAAO,EAAE,gBAAgB,EACzB,IAAI,EAAE,MAAM,EACZ,EAAE,EAAE,MAAM,EACV,OAAO,EAAE,iBAAiB,KACvB,gBAAgB,GAAG,IAAI,CAAC;CAC9B;AAED,qBAAa,MAAM;IAEf,QAAQ,CAAC,UAAU,EAAE,UAAU;IAC/B,QAAQ,CAAC,MAAM,EAAE,YAAY;IAC7B,QAAQ,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE;gBAFxB,UAAU,EAAE,UAAU,EACtB,MAAM,EAAE,YAAY,EACpB,KAAK,EAAE,SAAS,MAAM,EAAE;CAEpC;AAED,wBAAgB,GAAG,CAAC,KAAK,EAAE,WAAW,UAErC;AAID,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,UAWxD;AAID,eAAO,MAAM,gBAAgB,wDAAkC,CAAC;AAKhE,wBAAgB,oBAAoB,CAClC,KAAK,EAAE,WAAW,EAClB,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,EACZ,EAAE,EAAE,MAAM,GACT,eAAe,CAwBjB;AAED,wBAAgB,eAAe,CAAC,IAAI,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,QAQ/D;AAID,wBAAgB,QAAQ,CACtB,MAAM,EAAE,gBAAgB,GAAG,SAAS,CAAC,MAAM,GAAG,UAAU,CAAC,EAAE,GAC1D,gBAAgB,CASlB"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { EditorState } from '@codemirror/state';
|
|
2
|
+
import { Facet } from '@codemirror/state';
|
|
3
|
+
import type { Completion, CompletionSource } from './completion.js';
|
|
4
|
+
export interface CompletionConfig {
|
|
5
|
+
activateOnTyping?: boolean;
|
|
6
|
+
selectOnOpen?: boolean;
|
|
7
|
+
override?: readonly CompletionSource[] | null;
|
|
8
|
+
closeOnBlur?: boolean;
|
|
9
|
+
maxRenderedOptions?: number;
|
|
10
|
+
defaultKeymap?: boolean;
|
|
11
|
+
aboveCursor?: boolean;
|
|
12
|
+
optionClass?: (completion: Completion) => string;
|
|
13
|
+
icons?: boolean;
|
|
14
|
+
addToOptions?: {
|
|
15
|
+
render: (completion: Completion, state: EditorState) => Node | null;
|
|
16
|
+
position: number;
|
|
17
|
+
}[];
|
|
18
|
+
compareCompletions?: (a: Completion, b: Completion) => number;
|
|
19
|
+
interactionDelay?: number;
|
|
20
|
+
}
|
|
21
|
+
export declare const completionConfig: Facet<CompletionConfig, Required<CompletionConfig>>;
|
|
22
|
+
//# sourceMappingURL=config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/auto-complete/config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,EAAE,KAAK,EAAiB,MAAM,mBAAmB,CAAC;AAEzD,OAAO,KAAK,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAEpE,MAAM,WAAW,gBAAgB;IAG/B,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAO3B,YAAY,CAAC,EAAE,OAAO,CAAC;IAMvB,QAAQ,CAAC,EAAE,SAAS,gBAAgB,EAAE,GAAG,IAAI,CAAC;IAG9C,WAAW,CAAC,EAAE,OAAO,CAAC;IAEtB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAM5B,aAAa,CAAC,EAAE,OAAO,CAAC;IAIxB,WAAW,CAAC,EAAE,OAAO,CAAC;IAGtB,WAAW,CAAC,EAAE,CAAC,UAAU,EAAE,UAAU,KAAK,MAAM,CAAC;IAIjD,KAAK,CAAC,EAAE,OAAO,CAAC;IAQhB,YAAY,CAAC,EAAE;QACb,MAAM,EAAE,CAAC,UAAU,EAAE,UAAU,EAAE,KAAK,EAAE,WAAW,KAAK,IAAI,GAAG,IAAI,CAAC;QACpE,QAAQ,EAAE,MAAM,CAAC;KAClB,EAAE,CAAC;IAIJ,kBAAkB,CAAC,EAAE,CAAC,CAAC,EAAE,UAAU,EAAE,CAAC,EAAE,UAAU,KAAK,MAAM,CAAC;IAK9D,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED,eAAO,MAAM,gBAAgB,qDA8B3B,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export declare class FuzzyMatcher {
|
|
2
|
+
readonly pattern: string;
|
|
3
|
+
chars: number[];
|
|
4
|
+
folded: number[];
|
|
5
|
+
astral: boolean;
|
|
6
|
+
any: number[];
|
|
7
|
+
precise: number[];
|
|
8
|
+
byWord: number[];
|
|
9
|
+
constructor(pattern: string);
|
|
10
|
+
match(word: string): number[] | null;
|
|
11
|
+
result(score: number, positions: number[], word: string): number[];
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=filter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"filter.d.ts","sourceRoot":"","sources":["../../src/auto-complete/filter.ts"],"names":[],"mappings":"AAsBA,qBAAa,YAAY;IAWX,QAAQ,CAAC,OAAO,EAAE,MAAM;IAVpC,KAAK,EAAE,MAAM,EAAE,CAAM;IACrB,MAAM,EAAE,MAAM,EAAE,CAAM;IACtB,MAAM,EAAE,OAAO,CAAC;IAIhB,GAAG,EAAE,MAAM,EAAE,CAAM;IACnB,OAAO,EAAE,MAAM,EAAE,CAAM;IACvB,MAAM,EAAE,MAAM,EAAE,CAAM;gBAED,OAAO,EAAE,MAAM;IAoBpC,KAAK,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,IAAI;IAoJpC,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,EAAE,IAAI,EAAE,MAAM;CAcxD"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { EditorState, Transaction, StateCommand } from '@codemirror/state';
|
|
2
|
+
import { Facet } from '@codemirror/state';
|
|
3
|
+
import type { KeyBinding } from '@codemirror/view';
|
|
4
|
+
import type { Completion } from './completion.js';
|
|
5
|
+
export declare function snippet(template: string): (editor: {
|
|
6
|
+
state: EditorState;
|
|
7
|
+
dispatch: (tr: Transaction) => void;
|
|
8
|
+
}, _completion: Completion, from: number, to: number) => void;
|
|
9
|
+
export declare const clearSnippet: StateCommand;
|
|
10
|
+
export declare const nextSnippetField: StateCommand;
|
|
11
|
+
export declare const prevSnippetField: StateCommand;
|
|
12
|
+
export declare const snippetKeymap: Facet<readonly KeyBinding[], readonly KeyBinding[]>;
|
|
13
|
+
export declare function snippetCompletion(template: string, completion: Completion): Completion;
|
|
14
|
+
//# sourceMappingURL=snippet.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"snippet.d.ts","sourceRoot":"","sources":["../../src/auto-complete/snippet.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAEV,WAAW,EACX,WAAW,EAEX,YAAY,EACb,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAML,KAAK,EAEN,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EAAiB,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAGlE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AA8OlD,wBAAgB,OAAO,CAAC,QAAQ,EAAE,MAAM;WAGnB,WAAW;mBAAiB,WAAW,KAAK,IAAI;gBACpD,UAAU,QACjB,MAAM,MACR,MAAM,UA0Bb;AAqBD,eAAO,MAAM,YAAY,EAAE,YAO1B,CAAC;AAGF,eAAO,MAAM,gBAAgB,cAAe,CAAC;AAG7C,eAAO,MAAM,gBAAgB,cAAgB,CAAC;AAY9C,eAAO,MAAM,aAAa,qDAMzB,CAAC;AASF,wBAAgB,iBAAiB,CAC/B,QAAQ,EAAE,MAAM,EAChB,UAAU,EAAE,UAAU,GACrB,UAAU,CAEZ"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import type { Transaction, EditorState, ChangeDesc } from '@codemirror/state';
|
|
2
|
+
import { StateField } from '@codemirror/state';
|
|
3
|
+
import type { Tooltip } from '@codemirror/view';
|
|
4
|
+
import type { CompletionSource, CompletionResult } from './completion.js';
|
|
5
|
+
import { Option } from './completion.js';
|
|
6
|
+
import type { CompletionConfig } from './config.js';
|
|
7
|
+
declare class CompletionDialog {
|
|
8
|
+
readonly options: readonly Option[];
|
|
9
|
+
readonly attrs: Record<string, string>;
|
|
10
|
+
readonly tooltip: Tooltip;
|
|
11
|
+
readonly timestamp: number;
|
|
12
|
+
readonly selected: number;
|
|
13
|
+
constructor(options: readonly Option[], attrs: Record<string, string>, tooltip: Tooltip, timestamp: number, selected: number);
|
|
14
|
+
setSelected(selected: number, id: string): CompletionDialog;
|
|
15
|
+
static build(active: readonly ActiveSource[], state: EditorState, id: string, prev: CompletionDialog | null, conf: Required<CompletionConfig>): CompletionDialog | null;
|
|
16
|
+
map(changes: ChangeDesc): CompletionDialog;
|
|
17
|
+
}
|
|
18
|
+
export declare class CompletionState {
|
|
19
|
+
readonly active: readonly ActiveSource[];
|
|
20
|
+
readonly id: string;
|
|
21
|
+
readonly open: CompletionDialog | null;
|
|
22
|
+
constructor(active: readonly ActiveSource[], id: string, open: CompletionDialog | null);
|
|
23
|
+
static start(): CompletionState;
|
|
24
|
+
update(tr: Transaction): CompletionState;
|
|
25
|
+
get tooltip(): Tooltip | null;
|
|
26
|
+
get attrs(): Record<string, string> | {
|
|
27
|
+
'aria-autocomplete': string;
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
export declare const enum State {
|
|
31
|
+
Inactive = 0,
|
|
32
|
+
Pending = 1,
|
|
33
|
+
Result = 2
|
|
34
|
+
}
|
|
35
|
+
export declare function getUserEvent(tr: Transaction): 'input' | 'delete' | null;
|
|
36
|
+
export declare class ActiveSource {
|
|
37
|
+
readonly source: CompletionSource;
|
|
38
|
+
readonly state: State;
|
|
39
|
+
readonly explicitPos: number;
|
|
40
|
+
constructor(source: CompletionSource, state: State, explicitPos?: number);
|
|
41
|
+
hasResult(): this is ActiveResult;
|
|
42
|
+
update(tr: Transaction, conf: Required<CompletionConfig>): ActiveSource;
|
|
43
|
+
handleUserEvent(tr: Transaction, type: 'input' | 'delete', conf: Required<CompletionConfig>): ActiveSource;
|
|
44
|
+
handleChange(tr: Transaction): ActiveSource;
|
|
45
|
+
map(changes: ChangeDesc): ActiveSource;
|
|
46
|
+
}
|
|
47
|
+
export declare class ActiveResult extends ActiveSource {
|
|
48
|
+
readonly result: CompletionResult;
|
|
49
|
+
readonly from: number;
|
|
50
|
+
readonly to: number;
|
|
51
|
+
constructor(source: CompletionSource, explicitPos: number, result: CompletionResult, from: number, to: number);
|
|
52
|
+
hasResult(): this is ActiveResult;
|
|
53
|
+
handleUserEvent(tr: Transaction, type: 'input' | 'delete', conf: Required<CompletionConfig>): ActiveSource;
|
|
54
|
+
handleChange(tr: Transaction): ActiveSource;
|
|
55
|
+
map(mapping: ChangeDesc): ActiveResult;
|
|
56
|
+
}
|
|
57
|
+
export declare const startCompletionEffect: import("@codemirror/state").StateEffectType<boolean>;
|
|
58
|
+
export declare const closeCompletionEffect: import("@codemirror/state").StateEffectType<null>;
|
|
59
|
+
export declare const setActiveEffect: import("@codemirror/state").StateEffectType<readonly ActiveSource[]>;
|
|
60
|
+
export declare const setSelectedEffect: import("@codemirror/state").StateEffectType<number>;
|
|
61
|
+
export declare const completionState: StateField<CompletionState>;
|
|
62
|
+
export {};
|
|
63
|
+
//# sourceMappingURL=state.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"state.d.ts","sourceRoot":"","sources":["../../src/auto-complete/state.ts"],"names":[],"mappings":"AACA,OAAO,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AgB,EACxB,IAAI,EAAE,MAAM,EACZ,EAAE,EAAE,MAAM;IAKZ,SAAS,IAAI,IAAI,IAAI,YAAY;IAIjC,eAAe,CACtB,EAAE,EAAE,WAAW,EACf,IAAI,EAAE,OAAO,GAAG,QAAQ,EACxB,IAAI,EAAE,QAAQ,CAAC,gBAAgB,CAAC,GAC/B,YAAY;IAuCN,YAAY,CAAC,EAAE,EAAE,WAAW,GAAG,YAAY;IAM3C,GAAG,CAAC,OAAO,EAAE,UAAU;CAWjC;AAoBD,eAAO,MAAM,qBAAqB,sDAAgC,CAAC;AACnE,eAAO,MAAM,qBAAqB,mDAA6B,CAAC;AAChE,eAAO,MAAM,eAAe,sEAI1B,CAAC;AACH,eAAO,MAAM,iBAAiB,qDAA+B,CAAC;AAE9D,eAAO,MAAM,eAAe,6BAa1B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../../src/auto-complete/theme.ts"],"names":[],"mappings":"AAEA,0BAAkB,IAAI;IACpB,MAAM,KAAK;IACX,KAAK,MAAM;CACZ;AAED,eAAO,MAAM,SAAS,uCAsHpB,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { StateField } from '@codemirror/state';
|
|
2
|
+
import type { EditorView, TooltipView } from '@codemirror/view';
|
|
3
|
+
import type { CompletionState } from './state.js';
|
|
4
|
+
export declare function completionTooltip(stateField: StateField<CompletionState>): (view: EditorView) => TooltipView;
|
|
5
|
+
//# sourceMappingURL=tooltip.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tooltip.d.ts","sourceRoot":"","sources":["../../src/auto-complete/tooltip.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,UAAU,EAAe,MAAM,mBAAmB,CAAC;AACjE,OAAO,KAAK,EAAE,UAAU,EAAc,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAO5E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAyWlD,wBAAgB,iBAAiB,CAAC,UAAU,EAAE,UAAU,CAAC,eAAe,CAAC,UACzD,UAAU,KAAG,WAAW,CACvC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { Transaction } from '@codemirror/state';
|
|
2
|
+
import type { EditorView, Command, ViewUpdate } from '@codemirror/view';
|
|
3
|
+
import { ViewPlugin } from '@codemirror/view';
|
|
4
|
+
import type { CompletionResult } from './completion.js';
|
|
5
|
+
import { CompletionContext } from './completion.js';
|
|
6
|
+
import { ActiveSource } from './state.js';
|
|
7
|
+
export declare function moveCompletionSelection(forward: boolean, by?: 'option' | 'page'): Command;
|
|
8
|
+
export declare const acceptCompletion: Command;
|
|
9
|
+
export declare const startCompletion: Command;
|
|
10
|
+
export declare const closeCompletion: Command;
|
|
11
|
+
declare class RunningQuery {
|
|
12
|
+
readonly active: ActiveSource;
|
|
13
|
+
readonly context: CompletionContext;
|
|
14
|
+
time: number;
|
|
15
|
+
updates: Transaction[];
|
|
16
|
+
done: undefined | CompletionResult | null;
|
|
17
|
+
constructor(active: ActiveSource, context: CompletionContext);
|
|
18
|
+
}
|
|
19
|
+
declare const enum CompositionState {
|
|
20
|
+
None = 0,
|
|
21
|
+
Started = 1,
|
|
22
|
+
Changed = 2,
|
|
23
|
+
ChangedAndMoved = 3
|
|
24
|
+
}
|
|
25
|
+
export declare const completionPlugin: ViewPlugin<{
|
|
26
|
+
debounceUpdate: NodeJS.Timeout | -1;
|
|
27
|
+
running: RunningQuery[];
|
|
28
|
+
debounceAccept: NodeJS.Timeout | -1;
|
|
29
|
+
composing: CompositionState;
|
|
30
|
+
readonly view: EditorView;
|
|
31
|
+
update(update: ViewUpdate): void;
|
|
32
|
+
startUpdate(): void;
|
|
33
|
+
startQuery(active: ActiveSource): void;
|
|
34
|
+
scheduleAccept(): void;
|
|
35
|
+
accept(): void;
|
|
36
|
+
}>;
|
|
37
|
+
export {};
|
|
38
|
+
//# sourceM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YAAY;;;EA6HlC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"word.d.ts","sourceRoot":"","sources":["../../src/auto-complete/word.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAc,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AA+FpE,eAAO,MAAM,eAAe,EAAE,gBAkB7B,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { Extension } from '@codemirror/state';
|
|
2
|
+
import type { DecorationSet, ViewUpdate } from '@codemirror/view';
|
|
3
|
+
import { ViewPlugin } from '@codemirror/view';
|
|
4
|
+
export interface HyperLinkState {
|
|
5
|
+
from: number;
|
|
6
|
+
to: number;
|
|
7
|
+
url: string;
|
|
8
|
+
}
|
|
9
|
+
export declare function hyperLinkExtension(): ViewPlugin<{
|
|
10
|
+
decorations: DecorationSet;
|
|
11
|
+
update(update: ViewUpdate): void;
|
|
12
|
+
}>;
|
|
13
|
+
export declare const hyperLinkStyle: Extension;
|
|
14
|
+
export declare const hyperLink: Extension;
|
|
15
|
+
//# sourceMappingURL=hyperlink.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hyperlink.d.ts","sourceRoot":"","sources":["../src/hyperlink.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAS,MAAM,mBAAmB,CAAC;AAC1D,OAAO,KAAK,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAClE,OAAO,EAAE,UAAU,EAAsC,MAAM,kBAAkB,CAAC;AAIlF,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;IACX,GAAG,EAAE,MAAM,CAAC;CACb;AAqDD,wBAAgB,kBAAkB;;mBAOb,UAAU;GAU9B;AAED,eAAO,MAAM,cAAc,WASzB,CAAC;AAEH,eAAO,MAAM,SAAS,EAAE,SAAkD,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Facet } from '@codemirror/state';
|
|
2
|
+
export interface IndentationMarkerConfiguration {
|
|
3
|
+
/**
|
|
4
|
+
* Determines whether active block marker is styled differently.
|
|
5
|
+
*/
|
|
6
|
+
highlightActiveBlock?: boolean;
|
|
7
|
+
/**
|
|
8
|
+
* Determines whether markers in the first column are omitted.
|
|
9
|
+
*/
|
|
10
|
+
hideFirstIndent?: boolean;
|
|
11
|
+
/**
|
|
12
|
+
* Determines the type of indentation marker.
|
|
13
|
+
*/
|
|
14
|
+
markerType?: 'fullScope' | 'codeOnly';
|
|
15
|
+
}
|
|
16
|
+
export declare const indentationMarkerConfig: Facet<IndentationMarkerConfiguration, Required<IndentationMarkerConfiguration>>;
|
|
17
|
+
//# sourceMappingURL=config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/indentation-markers/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAEzD,MAAM,WAAW,8BAA8B;IAC7C;;OAEG;IACH,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAE/B;;OAEG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;IAE1B;;OAEG;IACH,UAAU,CAAC,EAAE,WAAW,GAAG,UAAU,CAAC;CACvC;AAED,eAAO,MAAM,uBAAuB,iFAWlC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/indentation-markers/index.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,aAAa,CAAC;AAgLlE,wBAAgB,kBAAkB,CAAC,MAAM,GAAE,8BAAmC,2CAQ7E"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import type { EditorState, Line } from '@codemirror/state';
|
|
2
|
+
export interface IndentEntry {
|
|
3
|
+
line: Line;
|
|
4
|
+
col: number;
|
|
5
|
+
level: number;
|
|
6
|
+
empty: boolean;
|
|
7
|
+
active?: number;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Indentation map for a set of lines.
|
|
11
|
+
*
|
|
12
|
+
* This map will contain the indentation for lines that are not a part of the given set,
|
|
13
|
+
* but this is because calculating the indentation for those lines was necessary to
|
|
14
|
+
* calculate the indentation for the lines provided to the constructor.
|
|
15
|
+
*
|
|
16
|
+
* @see {@link IndentEntry}
|
|
17
|
+
*/
|
|
18
|
+
export declare class IndentationMap {
|
|
19
|
+
/** The {@link EditorState} indentation is derived from. */
|
|
20
|
+
private state;
|
|
21
|
+
/** The set of lines that are used as an entrypoint. */
|
|
22
|
+
private lines;
|
|
23
|
+
/** The internal mapping of line numbers to {@link IndentEntry} objects. */
|
|
24
|
+
private map;
|
|
25
|
+
/** The width of the editor's indent unit. */
|
|
26
|
+
private unitWidth;
|
|
27
|
+
/** The type of indentation to use (terminate at end of scope vs last non-empty line in scope) */
|
|
28
|
+
private markerType;
|
|
29
|
+
/**
|
|
30
|
+
* @param lines - The set of lines to get the indentation map for.
|
|
31
|
+
* @param state - The {@link EditorState} to derive the indentation map from.
|
|
32
|
+
* @param unitWidth - The width of the editor's indent unit.
|
|
33
|
+
* @param markerType - The type of indentation to use (terminate at end of scope vs last line of code in scope)
|
|
34
|
+
*/
|
|
35
|
+
constructor(lines: Set<Line>, state: EditorState, unitWidth: number, markerType: 'fullScope' | 'codeOnly');
|
|
36
|
+
/**
|
|
37
|
+
* Checks if the indentation map has an entry for the given line.
|
|
38
|
+
*
|
|
39
|
+
* @param line - The {@link Line} or line number to check for.
|
|
40
|
+
*/
|
|
41
|
+
has(line: Line | number): boolean;
|
|
42
|
+
/**
|
|
43
|
+
* Returns the {@link IndentEntry} for the given line.
|
|
44
|
+
*
|
|
45
|
+
* Note that this function will throw an error if the line does not exist in the map.
|
|
46
|
+
*
|
|
47
|
+
* @param line - The {@link Line} or line number to get the entry for.
|
|
48
|
+
*/
|
|
49
|
+
get(line: Line | number): IndentEntry;
|
|
50
|
+
/**
|
|
51
|
+
* Sets the {@link IndentEntry} for the given line.
|
|
52
|
+
*
|
|
53
|
+
* @param line - The {@link Line} to set the entry for.
|
|
54
|
+
* @param col - The visual beginning whitespace width of the line.
|
|
55
|
+
* @param level - The indentation level of the line.
|
|
56
|
+
*/
|
|
57
|
+
private set;
|
|
58
|
+
/**
|
|
59
|
+
* Adds a line to the indentation map.
|
|
60
|
+
*
|
|
61
|
+
* @param line - The {@link Line} to add to the map.
|
|
62
|
+
*/
|
|
63
|
+
private add;
|
|
64
|
+
/**
|
|
65
|
+
* Finds the closest non-empty line, starting from the given line.
|
|
66
|
+
*
|
|
67
|
+
* @param from - The {@link Line} to start from.
|
|
68
|
+
* @param dir - The direction to search in. Either `1` or `-1`.
|
|
69
|
+
*/
|
|
70
|
+
private closestNonEmpty;
|
|
71
|
+
/**
|
|
72
|
+
* Finds the state's active block (via the current selection) and sets all
|
|
73
|
+
* the active indent level for the lines in the block.
|
|
74
|
+
*/
|
|
75
|
+
private findAndSetActiveLines;
|
|
76
|
+
}
|
|
77
|
+
//# sourceMappingURL=map.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"map.d.ts","sourceRoot":"","sources":["../../src/indentation-markers/map.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAK3D,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,IAAI,CAAC;IACX,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,OAAO,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;;;;;;;GAQG;AACH,qBAAa,cAAc;IACzB,2DAA2D;IAC3D,OAAO,CAAC,KAAK,CAAc;IAE3B,uDAAuD;IACvD,OAAO,CAAC,KAAK,CAAY;IAEzB,2EAA2E;IAC3E,OAAO,CAAC,GAAG,CAA2B;IAEtC,6CAA6C;IAC7C,OAAO,CAAC,SAAS,CAAS;IAE1B,iGAAiG;IACjG,OAAO,CAAC,UAAU,CAA2B;IAE7C;;;;;OAKG;gBAED,KAAK,EAAE,GAAG,CAAC,IAAI,CAAC,EAChB,KAAK,EAAE,WAAW,EAClB,SAAS,EAAE,MAAM,EACjB,UAAU,EAAE,WAAW,GAAG,UAAU;IAiBtC;;;;OAIG;IACH,GAAG,CAAC,IAAI,EAAE,IAAI,GAAG,MAAM;IAIvB;;;;;;OAMG;IACH,GAAG,CAAC,IAAI,EAAE,IAAI,GAAG,MAAM;IAUvB;;;;;;OAMG;IACH,OAAO,CAAC,GAAG;IAQX;;;;OAIG;IACH,OAAO,CAAC,GAAG;IAkDX;;;;;OAKG;IACH,OAAO,CAAC,eAAe;IAoCvB;;;OAGG;IACH,OAAO,CAAC,qBAAqB;CAiE9B"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { EditorState, Line } from '@codemirror/state';
|
|
2
|
+
import type { EditorView } from '@codemirror/view';
|
|
3
|
+
/**
|
|
4
|
+
* Gets the visible lines in the editor. Lines will not be repeated.
|
|
5
|
+
*
|
|
6
|
+
* @param view - The editor view to get the visible lines from.
|
|
7
|
+
* @param state - The editor state. Defaults to the view's current one.
|
|
8
|
+
*/
|
|
9
|
+
export declare function getVisibleLines(view: EditorView, state?: EditorState): Set<Line>;
|
|
10
|
+
/**
|
|
11
|
+
* Gets the line at the position of the primary cursor.
|
|
12
|
+
*
|
|
13
|
+
* @param state - The editor state from which to extract the line.
|
|
14
|
+
*/
|
|
15
|
+
export declare function getCurrentLine(state: EditorState): Line;
|
|
16
|
+
/**
|
|
17
|
+
* Returns the number of columns that a string is indented, controlling for
|
|
18
|
+
* tabs. This is useful for determining the indentation level of a line.
|
|
19
|
+
*
|
|
20
|
+
* Note that this only returns the number of _visible_ columns, not the number
|
|
21
|
+
* of whitespace characters at the start of the string.
|
|
22
|
+
*
|
|
23
|
+
* @param str - The string to check.
|
|
24
|
+
* @param tabSize - The size of a tab character. Usually 2 or 4.
|
|
25
|
+
*/
|
|
26
|
+
export declare function numColumns(str: string, tabSize: number): number;
|
|
27
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/indentation-markers/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAC3D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAEnD;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,UAAU,EAAE,KAAK,cAAa,aAkBnE;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,WAAW,QAGhD;AAED;;;;;;;;;GASG;AACH,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,UAkCtD"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export declare const FoldIcon = "<svg width=\"8px\" height=\"6px\" viewBox=\"0 0 8 6\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\"><title>1.\u901A\u7528/2.Icon\u56FE\u6807/Line/Down</title><g id=\"0424\" stroke=\"none\" stroke-width=\"1\" fill=\"none\" fillRule=\"evenodd\"><g id=\"Notebook-cell-\u8272\u9636\" transform=\"translate(-2015.000000, -434.000000)\" fill=\"#A4AECB\"><g id=\"\u7F16\u7EC4-15\" transform=\"translate(2004.000000, 407.000000)\"><g id=\"1.\u901A\u7528/2.Icon\u56FE\u6807/Line/Down\" transform=\"translate(11.250000, 27.500000)\"><path d=\"M7.34387369,0 L6.61145181,0 C6.56164712,0 6.51477212,0.0244140625 6.48547525,0.064453125 L3.71106119,3.88867188 L0.936647123,0.064453125 C0.907350248,0.0244140625 0.860475248,0 0.81067056,0 L0.0782486852,0 C0.0147721227,0 -0.0223372523,0.072265625 0.0147721227,0.124023438 L3.4581315,4.87109375 C3.5831315,5.04296875 3.83899087,5.04296875 3.96301431,4.87109375 L7.40637369,0.124023437 C7.44445962,0.072265625 7.40735025,0 7.34387369,0 Z\" id=\"Down\"></path></g></g></g></g></svg>";
|
|
2
|
+
export declare const UnFoldIcon = "<svg width=\"6px\" height=\"8px\" viewBox=\"0 0 6 8\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\"><title>1.\u901A\u7528/2.Icon\u56FE\u6807/Line/Down\u6536\u8D77</title><g id=\"0424\" stroke=\"none\" stroke-width=\"1\" fill=\"none\" fillRule=\"evenodd\"><g id=\"Notebook-cell-\u8272\u9636\" transform=\"translate(-2094.000000, -433.000000)\" fill=\"#A4AECB\"><g id=\"\u7F16\u7EC4-15\u5907\u4EFD\" transform=\"translate(2082.000000, 407.000000)\"><g id=\"1.\u901A\u7528/2.Icon\u56FE\u6807/Line/Down\" transform=\"translate(15.000000, 30.039124) rotate(270.000000) translate(-15.000000, -30.039124) translate(11.289124, 27.539124)\"><path d=\"M7.34387369,1.77635684e-15 L6.61145181,1.77635684e-15 C6.56164712,1.77635684e-15 6.51477212,0.0244140625 6.48547525,0.064453125 L3.71106119,3.88867188 L0.936647123,0.064453125 C0.907350248,0.0244140625 0.860475248,1.77635684e-15 0.81067056,1.77635684e-15 L0.0782486852,1.77635684e-15 C0.0147721227,1.77635684e-15 -0.0223372523,0.072265625 0.0147721227,0.124023438 L3.4581315,4.87109375 C3.5831315,5.04296875 3.83899087,5.04296875 3.96301431,4.87109375 L7.40637369,0.124023438 C7.44445962,0.072265625 7.40735025,1.77635684e-15 7.34387369,1.77635684e-15 Z\" id=\"Down\"></path></g></g></g></g></svg>";
|
|
3
|
+
//# sourceMappingURL=libro-icon.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"libro-icon.d.ts","sourceRoot":"","sources":["../src/libro-icon.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,QAAQ,8iCACo7B,CAAC;AAC18B,eAAO,MAAM,UAAU,gxCACgoC,CAAC"}
|
package/es/monitor.d.ts
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { Emitter } from '@difizen/mana-app';
|
|
2
|
+
interface DocStatus {
|
|
3
|
+
source: string[];
|
|
4
|
+
cursor: number;
|
|
5
|
+
changes?: string;
|
|
6
|
+
}
|
|
7
|
+
interface CompletionChange {
|
|
8
|
+
start?: DocStatus;
|
|
9
|
+
accept?: DocStatus;
|
|
10
|
+
close?: DocStatus;
|
|
11
|
+
selectIndex?: number;
|
|
12
|
+
}
|
|
13
|
+
export declare class CompletionMonitor {
|
|
14
|
+
protected static instance: CompletionMonitor;
|
|
15
|
+
static getInstance(): CompletionMonitor;
|
|
16
|
+
protected completionChangeEmitter: Emitter<CompletionChange>;
|
|
17
|
+
get compeltionChange(): import("@difizen/mana-app").Event<CompletionChange>;
|
|
18
|
+
protected tooltipChangeEmitter: Emitter<boolean>;
|
|
19
|
+
get onTooltipChange(): import("@difizen/mana-app").Event<boolean>;
|
|
20
|
+
protected currentChange: CompletionChange | undefined;
|
|
21
|
+
start(doc: DocStatus): void;
|
|
22
|
+
accept(doc: DocStatus): void;
|
|
23
|
+
close(doc: DocStatus): void;
|
|
24
|
+
updateIndex(index: number): void;
|
|
25
|
+
emitChange(change: CompletionChange): void;
|
|
26
|
+
}
|
|
27
|
+
export interface MonitorPluginOptions {
|
|
28
|
+
onTooltipChange?: (visible: boolean) => void;
|
|
29
|
+
}
|
|
30
|
+
export declare const monitorPlugin: (options: MonitorPluginOptions) => import("@codemirror/state").Extension;
|
|
31
|
+
export {};
|
|
32
|
+
//# sourceMappingURL=monitor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"monitor.d.ts","sourceRoot":"","sources":["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AAgB,MAAM,oBAErB"}
|
package/es/theme.d.ts
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { HighlightStyle } from '@codemirror/language';
|
|
2
|
+
import type { Extension } from '@codemirror/state';
|
|
3
|
+
export declare const jupyterEditorTheme: Extension;
|
|
4
|
+
export declare const jupyterHighlightStyle: HighlightStyle;
|
|
5
|
+
/**
|
|
6
|
+
* JupyterLab CodeMirror 6 theme
|
|
7
|
+
*/
|
|
8
|
+
export declare const jupyterTheme: Extension;
|
|
9
|
+
/**
|
|
10
|
+
* Get the default CodeMirror 6 theme for JupyterLab
|
|
11
|
+
*
|
|
12
|
+
* @alpha
|
|
13
|
+
* @returns Default theme
|
|
14
|
+
*/
|
|
15
|
+
export declare function defaultTheme(): Extension;
|
|
16
|
+
/**
|
|
17
|
+
* Register a new theme.
|
|
18
|
+
*
|
|
19
|
+
* @alpha
|
|
20
|
+
* @param name Theme name
|
|
21
|
+
* @param theme Codemirror 6 theme extension
|
|
22
|
+
*/
|
|
23
|
+
export declare function registerTheme(name: string, theme: Extension): void;
|
|
24
|
+
/**
|
|
25
|
+
* Get a theme.
|
|
26
|
+
*
|
|
27
|
+
* #### Notes
|
|
28
|
+
* It falls back to the default theme
|
|
29
|
+
*
|
|
30
|
+
* @alpha
|
|
31
|
+
* @param name Theme name
|
|
32
|
+
* @returns Theme extension
|
|
33
|
+
*/
|
|
34
|
+
export declare function getTheme(name: string): Extension;
|
|
35
|
+
//# sourceMappingURL=theme.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../src/theme.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,cAAc,EAEf,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAInD,eAAO,MAAM,kBAAkB,WA0G7B,CAAC;AAEH,eAAO,MAAM,qBAAqB,gBAuDhC,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,YAAY,EAAE,SAG1B,CAAC;AAeF;;;;;GAKG;AACH,wBAAgB,YAAY,IAAI,SAAS,CAExC;AAED;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,QAE3D;AAED;;;;;;;;;GASG;AACH,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,CAIhD"}
|
package/es/tooltip.d.ts
CHANGED
|
@@ -6,5 +6,5 @@ export declare const closeTooltipEffect: import("@codemirror/state").StateEffect
|
|
|
6
6
|
export declare const startTooltip: Command;
|
|
7
7
|
export declare const closeTooltip: Command;
|
|
8
8
|
export declare const tooltipKeymap: readonly KeyBinding[];
|
|
9
|
-
export declare function tabTooltip(tooltipProvider: TooltipProvider | undefined): (
|
|
9
|
+
export declare function tabTooltip(tooltipProvider: TooltipProvider | undefined): (import("@codemirror/state").Extension | StateField<Tooltip | null>)[];
|
|
10
10
|
//# sourceMappingURL=tooltip.d.ts.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@difizen/libro-codemirror",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"libro",
|
|
@@ -45,9 +45,9 @@
|
|
|
45
45
|
"@codemirror/search": "^6.0.0",
|
|
46
46
|
"@codemirror/state": "^6.0.0",
|
|
47
47
|
"@codemirror/view": "^6.2.2",
|
|
48
|
-
"@difizen/libro-code-editor": "^0.1.
|
|
49
|
-
"@difizen/libro-common": "^0.1.
|
|
50
|
-
"@difizen/libro-rendermime": "^0.1.
|
|
48
|
+
"@difizen/libro-code-editor": "^0.1.1",
|
|
49
|
+
"@difizen/libro-common": "^0.1.1",
|
|
50
|
+
"@difizen/libro-rendermime": "^0.1.1",
|
|
51
51
|
"@lezer/common": "^1.1.0",
|
|
52
52
|
"@lezer/highlight": "^1.1.4",
|
|
53
53
|
"markdown-it": "^13.0.1",
|