@singapore-editor/scope-lines 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/README.md +27 -0
- package/dist/bracketColors.d.ts +33 -0
- package/dist/bracketColors.d.ts.map +1 -0
- package/dist/bracketColors.js +146 -0
- package/dist/bracketColors.js.map +1 -0
- package/dist/index.d.ts +16 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +473 -0
- package/dist/index.js.map +1 -0
- package/dist/stickyScroll.d.ts +8 -0
- package/dist/stickyScroll.d.ts.map +1 -0
- package/dist/stickyScroll.js +302 -0
- package/dist/stickyScroll.js.map +1 -0
- package/dist/style.css +153 -0
- package/package.json +46 -0
package/README.md
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# @singapore-editor/scope-lines
|
|
2
|
+
|
|
3
|
+
Scope-line view contribution plugin for `@singapore-editor/core`.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```sh
|
|
8
|
+
npm install @singapore-editor/core @singapore-editor/scope-lines
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
```ts
|
|
14
|
+
import { Editor } from '@singapore-editor/core/editor'
|
|
15
|
+
import { createScopeLinesPlugin } from '@singapore-editor/scope-lines'
|
|
16
|
+
import '@singapore-editor/core/style.css'
|
|
17
|
+
import '@singapore-editor/scope-lines/style.css'
|
|
18
|
+
|
|
19
|
+
const editor = new Editor(document.querySelector('#editor')!, {
|
|
20
|
+
plugins: [createScopeLinesPlugin()],
|
|
21
|
+
})
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Exports
|
|
25
|
+
|
|
26
|
+
- `createScopeLinesPlugin` renders vertical guides for visible syntax scopes.
|
|
27
|
+
- `ScopeLinesPluginOptions` controls mode, active-scope rendering, minimum span, and custom classes.
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { EditorPlugin } from '@singapore-editor/core/extensions';
|
|
2
|
+
export type BracketColorsPluginOptions = {
|
|
3
|
+
readonly enabled?: boolean;
|
|
4
|
+
/** Deepest nesting painted; anything nested deeper keeps the colour the grammar gave it. */
|
|
5
|
+
readonly maxLevel?: number;
|
|
6
|
+
/** A document with more brackets than this is left uncoloured. */
|
|
7
|
+
readonly maxBrackets?: number;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* Where depth colouring sits in the shared highlight priority band.
|
|
11
|
+
*
|
|
12
|
+
* A level colour has to replace the one the grammar gave the bracket, and the grammar reaches that
|
|
13
|
+
* same glyph through the same painting mechanism at the default rank: left equal, which of the two
|
|
14
|
+
* wins would come down to the order the two happened to register in.
|
|
15
|
+
*
|
|
16
|
+
* Exported because the band is one document-global namespace shared across packages, and this is
|
|
17
|
+
* the fifth producer to declare a `color` in it. It sat on the semantic token layer's number until
|
|
18
|
+
* the band was renumbered — a tie no one had noticed because no semantic scope covers a bracket
|
|
19
|
+
* glyph today, which makes it the kind of thing that surfaces the first time a host writes a
|
|
20
|
+
* `scopeAliases` entry mapping a server's `brace` onto `operator`.
|
|
21
|
+
*/
|
|
22
|
+
export declare const BRACKET_COLOR_Z_INDEX = 1;
|
|
23
|
+
/**
|
|
24
|
+
* Colours bracket characters by the nesting depth of the pair they belong to, rotating through the
|
|
25
|
+
* registered level palette.
|
|
26
|
+
*
|
|
27
|
+
* Off until a host installs it: the affordance divides opinion, and it overrides the grammar's own
|
|
28
|
+
* colouring of those characters. Depth comes from the structural parse, so brackets inside strings
|
|
29
|
+
* and comments are not part of the nesting and nothing is painted before a parse has covered the
|
|
30
|
+
* document — a plausible-looking wrong depth is worse here than no colour at all.
|
|
31
|
+
*/
|
|
32
|
+
export declare function createBracketColorsPlugin(options?: BracketColorsPluginOptions): EditorPlugin;
|
|
33
|
+
//# sourceMappingURL=bracketColors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bracketColors.d.ts","sourceRoot":"","sources":["../src/bracketColors.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EACV,YAAY,EAKb,MAAM,mCAAmC,CAAA;AAE1C,MAAM,MAAM,0BAA0B,GAAG;IACvC,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAA;IAC1B,4FAA4F;IAC5F,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;IAC1B,kEAAkE;IAClE,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAA;CAC9B,CAAA;AAwBD;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,qBAAqB,IAAI,CAAA;AAmCtC;;;;;;;;GAQG;AACH,wBAAgB,yBAAyB,CAAC,OAAO,GAAE,0BAA+B,GAAG,YAAY,CAYhG"}
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
import { editorColorReference, firstEditorColor, registerEditorColor } from "@singapore-editor/core/rendering";
|
|
2
|
+
import { collectBracketLevels } from "@singapore-editor/core/editor";
|
|
3
|
+
//#region src/bracketColors.ts
|
|
4
|
+
/**
|
|
5
|
+
* Where depth colouring sits in the shared highlight priority band.
|
|
6
|
+
*
|
|
7
|
+
* A level colour has to replace the one the grammar gave the bracket, and the grammar reaches that
|
|
8
|
+
* same glyph through the same painting mechanism at the default rank: left equal, which of the two
|
|
9
|
+
* wins would come down to the order the two happened to register in.
|
|
10
|
+
*
|
|
11
|
+
* Exported because the band is one document-global namespace shared across packages, and this is
|
|
12
|
+
* the fifth producer to declare a `color` in it. It sat on the semantic token layer's number until
|
|
13
|
+
* the band was renumbered — a tie no one had noticed because no semantic scope covers a bracket
|
|
14
|
+
* glyph today, which makes it the kind of thing that surfaces the first time a host writes a
|
|
15
|
+
* `scopeAliases` entry mapping a server's `brace` onto `operator`.
|
|
16
|
+
*/
|
|
17
|
+
var BRACKET_COLOR_Z_INDEX = 1;
|
|
18
|
+
var BRACKET_LEVEL_STYLES = [
|
|
19
|
+
"syntax.type",
|
|
20
|
+
"syntax.keyword",
|
|
21
|
+
"syntax.string",
|
|
22
|
+
"syntax.number",
|
|
23
|
+
"syntax.function",
|
|
24
|
+
"syntax.variableBuiltin"
|
|
25
|
+
].map((syntaxColorId, level) => ({
|
|
26
|
+
color: bracketLevelColor(level, syntaxColorId),
|
|
27
|
+
zIndex: 1
|
|
28
|
+
}));
|
|
29
|
+
var BRACKET_UNEXPECTED_STYLE = {
|
|
30
|
+
color: registerEditorColor("brackets.unexpected", {
|
|
31
|
+
dark: "#f87171",
|
|
32
|
+
light: "#dc2626"
|
|
33
|
+
}),
|
|
34
|
+
zIndex: 1
|
|
35
|
+
};
|
|
36
|
+
var DEFAULT_MAX_LEVEL = 200;
|
|
37
|
+
var DEFAULT_MAX_BRACKETS = 2e4;
|
|
38
|
+
/**
|
|
39
|
+
* Colours bracket characters by the nesting depth of the pair they belong to, rotating through the
|
|
40
|
+
* registered level palette.
|
|
41
|
+
*
|
|
42
|
+
* Off until a host installs it: the affordance divides opinion, and it overrides the grammar's own
|
|
43
|
+
* colouring of those characters. Depth comes from the structural parse, so brackets inside strings
|
|
44
|
+
* and comments are not part of the nesting and nothing is painted before a parse has covered the
|
|
45
|
+
* document — a plausible-looking wrong depth is worse here than no colour at all.
|
|
46
|
+
*/
|
|
47
|
+
function createBracketColorsPlugin(options = {}) {
|
|
48
|
+
const resolved = resolveBracketColorsOptions(options);
|
|
49
|
+
return {
|
|
50
|
+
name: "bracket-colors",
|
|
51
|
+
activate(context) {
|
|
52
|
+
return context.registerViewContribution({ createContribution: (contributionContext) => createBracketColorsContribution(contributionContext, resolved) });
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
function createBracketColorsContribution(context, options) {
|
|
57
|
+
if (!options.enabled) return null;
|
|
58
|
+
return new BracketColorsContribution(context, options);
|
|
59
|
+
}
|
|
60
|
+
var BracketColorsContribution = class {
|
|
61
|
+
context;
|
|
62
|
+
options;
|
|
63
|
+
levelPaints;
|
|
64
|
+
unexpectedName;
|
|
65
|
+
painted = null;
|
|
66
|
+
constructor(context, options) {
|
|
67
|
+
this.context = context;
|
|
68
|
+
this.options = options;
|
|
69
|
+
const prefix = context.highlightPrefix;
|
|
70
|
+
this.levelPaints = BRACKET_LEVEL_STYLES.map((style, level) => ({
|
|
71
|
+
name: `${prefix}-bracket-level-${level}`,
|
|
72
|
+
style
|
|
73
|
+
}));
|
|
74
|
+
this.unexpectedName = `${prefix}-bracket-unexpected`;
|
|
75
|
+
this.update(context.getSnapshot(), "document");
|
|
76
|
+
}
|
|
77
|
+
update(snapshot, kind) {
|
|
78
|
+
if (kind === "clear") {
|
|
79
|
+
this.clear();
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
this.paint(snapshot);
|
|
83
|
+
}
|
|
84
|
+
dispose() {
|
|
85
|
+
this.clear();
|
|
86
|
+
}
|
|
87
|
+
paint(snapshot) {
|
|
88
|
+
if (this.painted === snapshot.brackets) return;
|
|
89
|
+
this.painted = snapshot.brackets;
|
|
90
|
+
const ranges = bracketColorRanges(snapshot.brackets, this.options);
|
|
91
|
+
this.levelPaints.forEach((paint, level) => {
|
|
92
|
+
this.setHighlight(paint.name, ranges.levels[level] ?? [], paint.style);
|
|
93
|
+
});
|
|
94
|
+
this.setHighlight(this.unexpectedName, ranges.unexpected, BRACKET_UNEXPECTED_STYLE);
|
|
95
|
+
}
|
|
96
|
+
clear() {
|
|
97
|
+
this.painted = null;
|
|
98
|
+
for (const paint of this.levelPaints) this.context.clearRangeHighlight(paint.name);
|
|
99
|
+
this.context.clearRangeHighlight(this.unexpectedName);
|
|
100
|
+
}
|
|
101
|
+
setHighlight(name, ranges, style) {
|
|
102
|
+
this.context.setRangeHighlight(name, ranges, style);
|
|
103
|
+
}
|
|
104
|
+
};
|
|
105
|
+
function bracketColorRanges(brackets, options) {
|
|
106
|
+
const levels = BRACKET_LEVEL_STYLES.map(() => []);
|
|
107
|
+
const unexpected = [];
|
|
108
|
+
if (brackets.length > options.maxBrackets) return {
|
|
109
|
+
levels,
|
|
110
|
+
unexpected
|
|
111
|
+
};
|
|
112
|
+
for (const bracket of collectBracketLevels(brackets, { maxLevel: options.maxLevel })) {
|
|
113
|
+
const range = {
|
|
114
|
+
start: bracket.offset,
|
|
115
|
+
end: bracket.offset + bracket.char.length
|
|
116
|
+
};
|
|
117
|
+
if (bracket.unexpected) {
|
|
118
|
+
unexpected.push(range);
|
|
119
|
+
continue;
|
|
120
|
+
}
|
|
121
|
+
levels[bracket.level % levels.length]?.push(range);
|
|
122
|
+
}
|
|
123
|
+
return {
|
|
124
|
+
levels,
|
|
125
|
+
unexpected
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
function resolveBracketColorsOptions(options) {
|
|
129
|
+
return {
|
|
130
|
+
enabled: options.enabled ?? true,
|
|
131
|
+
maxLevel: normalizeBracketColorsLimit(options.maxLevel, DEFAULT_MAX_LEVEL),
|
|
132
|
+
maxBrackets: normalizeBracketColorsLimit(options.maxBrackets, DEFAULT_MAX_BRACKETS)
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
function normalizeBracketColorsLimit(value, fallback) {
|
|
136
|
+
if (value === void 0) return fallback;
|
|
137
|
+
if (!Number.isFinite(value)) return fallback;
|
|
138
|
+
return Math.max(0, Math.floor(value));
|
|
139
|
+
}
|
|
140
|
+
function bracketLevelColor(level, syntaxColorId) {
|
|
141
|
+
return registerEditorColor(`brackets.level${level}`, firstEditorColor(editorColorReference(syntaxColorId), editorColorReference("syntax.bracket")));
|
|
142
|
+
}
|
|
143
|
+
//#endregion
|
|
144
|
+
export { BRACKET_COLOR_Z_INDEX, createBracketColorsPlugin };
|
|
145
|
+
|
|
146
|
+
//# sourceMappingURL=bracketColors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bracketColors.js","names":[],"sources":["../src/bracketColors.ts"],"sourcesContent":["import type { BracketInfo } from '@singapore-editor/core/syntax'\nimport { collectBracketLevels } from '@singapore-editor/core/editor'\nimport {\n editorColorReference,\n firstEditorColor,\n registerEditorColor,\n type VirtualizedTextHighlightStyle,\n} from '@singapore-editor/core/rendering'\nimport type {\n EditorPlugin,\n EditorViewContribution,\n EditorViewContributionContext,\n EditorViewContributionUpdateKind,\n EditorViewSnapshot,\n} from '@singapore-editor/core/extensions'\n\nexport type BracketColorsPluginOptions = {\n readonly enabled?: boolean\n /** Deepest nesting painted; anything nested deeper keeps the colour the grammar gave it. */\n readonly maxLevel?: number\n /** A document with more brackets than this is left uncoloured. */\n readonly maxBrackets?: number\n}\n\ntype ResolvedBracketColorsOptions = {\n readonly enabled: boolean\n readonly maxLevel: number\n readonly maxBrackets: number\n}\n\ntype BracketColorRange = {\n readonly start: number\n readonly end: number\n}\n\ntype BracketColorRanges = {\n /** One bucket per level colour, in palette order. */\n readonly levels: readonly (readonly BracketColorRange[])[]\n readonly unexpected: readonly BracketColorRange[]\n}\n\ntype BracketLevelPaint = {\n readonly name: string\n readonly style: VirtualizedTextHighlightStyle\n}\n\n/**\n * Where depth colouring sits in the shared highlight priority band.\n *\n * A level colour has to replace the one the grammar gave the bracket, and the grammar reaches that\n * same glyph through the same painting mechanism at the default rank: left equal, which of the two\n * wins would come down to the order the two happened to register in.\n *\n * Exported because the band is one document-global namespace shared across packages, and this is\n * the fifth producer to declare a `color` in it. It sat on the semantic token layer's number until\n * the band was renumbered — a tie no one had noticed because no semantic scope covers a bracket\n * glyph today, which makes it the kind of thing that surfaces the first time a host writes a\n * `scopeAliases` entry mapping a server's `brace` onto `operator`.\n */\nexport const BRACKET_COLOR_Z_INDEX = 1\n\n/*\n * Depth is painted with registered colour ids, so a theme restyles nesting the way it restyles\n * anything else, and each level leans on a syntax colour the theme has already picked rather than on\n * a palette of its own: those hues are distinguishable from one another because the theme had to make\n * them distinguishable to be readable at all, and they follow a theme this file has never heard of. A\n * theme that names none of them leaves the declaration invalid, which drops it and leaves the bracket\n * the colour it already had — the honest outcome for a palette nobody supplied.\n */\nconst BRACKET_LEVEL_STYLES: readonly VirtualizedTextHighlightStyle[] = [\n 'syntax.type',\n 'syntax.keyword',\n 'syntax.string',\n 'syntax.number',\n 'syntax.function',\n 'syntax.variableBuiltin',\n].map((syntaxColorId, level) => ({\n color: bracketLevelColor(level, syntaxColorId),\n zIndex: BRACKET_COLOR_Z_INDEX,\n}))\n\n// A closer with nothing to close is a mistake rather than a depth, so it is the one bracket that does\n// not take part in the rotation. Nothing in the syntax palette is reliably an error colour to derive\n// it from, and the two canvases need different cuts of red to stay legible.\nconst BRACKET_UNEXPECTED_STYLE: VirtualizedTextHighlightStyle = {\n color: registerEditorColor('brackets.unexpected', { dark: '#f87171', light: '#dc2626' }),\n zIndex: BRACKET_COLOR_Z_INDEX,\n}\n\nconst DEFAULT_MAX_LEVEL = 200\n// Past this the pass and the ranges it produces cost more than the affordance is worth, and painting\n// only the part of the file that fit would read as brackets losing their colour halfway down.\nconst DEFAULT_MAX_BRACKETS = 20_000\n\n/**\n * Colours bracket characters by the nesting depth of the pair they belong to, rotating through the\n * registered level palette.\n *\n * Off until a host installs it: the affordance divides opinion, and it overrides the grammar's own\n * colouring of those characters. Depth comes from the structural parse, so brackets inside strings\n * and comments are not part of the nesting and nothing is painted before a parse has covered the\n * document — a plausible-looking wrong depth is worse here than no colour at all.\n */\nexport function createBracketColorsPlugin(options: BracketColorsPluginOptions = {}): EditorPlugin {\n const resolved = resolveBracketColorsOptions(options)\n\n return {\n name: 'bracket-colors',\n activate(context) {\n return context.registerViewContribution({\n createContribution: (contributionContext) =>\n createBracketColorsContribution(contributionContext, resolved),\n })\n },\n }\n}\n\nfunction createBracketColorsContribution(\n context: EditorViewContributionContext,\n options: ResolvedBracketColorsOptions,\n): EditorViewContribution | null {\n if (!options.enabled) return null\n return new BracketColorsContribution(context, options)\n}\n\nclass BracketColorsContribution implements EditorViewContribution {\n private readonly context: EditorViewContributionContext\n private readonly options: ResolvedBracketColorsOptions\n private readonly levelPaints: readonly BracketLevelPaint[]\n private readonly unexpectedName: string\n private painted: readonly BracketInfo[] | null = null\n\n public constructor(\n context: EditorViewContributionContext,\n options: ResolvedBracketColorsOptions,\n ) {\n this.context = context\n this.options = options\n const prefix = context.highlightPrefix\n this.levelPaints = BRACKET_LEVEL_STYLES.map((style, level) => ({\n name: `${prefix}-bracket-level-${level}`,\n style,\n }))\n this.unexpectedName = `${prefix}-bracket-unexpected`\n this.update(context.getSnapshot(), 'document')\n }\n\n // Every kind is considered rather than a chosen few: a parse that finishes between notifications\n // reaches the first update published after it, whichever kind that happens to be, and a bracket\n // list that only shows up on a scroll would otherwise stay unpainted until the next keystroke.\n public update(snapshot: EditorViewSnapshot, kind: EditorViewContributionUpdateKind): void {\n if (kind === 'clear') {\n this.clear()\n return\n }\n\n this.paint(snapshot)\n }\n\n public dispose(): void {\n this.clear()\n }\n\n // A parse replaces the bracket list wholesale and every snapshot until the next one shares it, so\n // its identity is the cheapest honest answer to 'has anything moved'.\n private paint(snapshot: EditorViewSnapshot): void {\n if (this.painted === snapshot.brackets) return\n\n this.painted = snapshot.brackets\n const ranges = bracketColorRanges(snapshot.brackets, this.options)\n this.levelPaints.forEach((paint, level) => {\n this.setHighlight(paint.name, ranges.levels[level] ?? [], paint.style)\n })\n this.setHighlight(this.unexpectedName, ranges.unexpected, BRACKET_UNEXPECTED_STYLE)\n }\n\n private clear(): void {\n this.painted = null\n for (const paint of this.levelPaints) this.context.clearRangeHighlight(paint.name)\n this.context.clearRangeHighlight(this.unexpectedName)\n }\n\n private setHighlight(\n name: string,\n ranges: readonly BracketColorRange[],\n style: VirtualizedTextHighlightStyle,\n ): void {\n this.context.setRangeHighlight(name, ranges, style)\n }\n}\n\nfunction bracketColorRanges(\n brackets: readonly BracketInfo[],\n options: ResolvedBracketColorsOptions,\n): BracketColorRanges {\n const levels: BracketColorRange[][] = BRACKET_LEVEL_STYLES.map(() => [])\n const unexpected: BracketColorRange[] = []\n if (brackets.length > options.maxBrackets) return { levels, unexpected }\n\n for (const bracket of collectBracketLevels(brackets, { maxLevel: options.maxLevel })) {\n const range = { start: bracket.offset, end: bracket.offset + bracket.char.length }\n if (bracket.unexpected) {\n unexpected.push(range)\n continue\n }\n\n levels[bracket.level % levels.length]?.push(range)\n }\n\n return { levels, unexpected }\n}\n\nfunction resolveBracketColorsOptions(\n options: BracketColorsPluginOptions,\n): ResolvedBracketColorsOptions {\n return {\n enabled: options.enabled ?? true,\n maxLevel: normalizeBracketColorsLimit(options.maxLevel, DEFAULT_MAX_LEVEL),\n maxBrackets: normalizeBracketColorsLimit(options.maxBrackets, DEFAULT_MAX_BRACKETS),\n }\n}\n\nfunction normalizeBracketColorsLimit(value: number | undefined, fallback: number): number {\n if (value === undefined) return fallback\n if (!Number.isFinite(value)) return fallback\n return Math.max(0, Math.floor(value))\n}\n\nfunction bracketLevelColor(level: number, syntaxColorId: string): string {\n return registerEditorColor(\n `brackets.level${level}`,\n firstEditorColor(editorColorReference(syntaxColorId), editorColorReference('syntax.bracket')),\n )\n}\n"],"mappings":"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"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { EditorPlugin } from '@singapore-editor/core/extensions';
|
|
2
|
+
import './style.css';
|
|
3
|
+
export { BRACKET_COLOR_Z_INDEX, createBracketColorsPlugin } from './bracketColors';
|
|
4
|
+
export type { BracketColorsPluginOptions } from './bracketColors';
|
|
5
|
+
export { createStickyScrollPlugin } from './stickyScroll';
|
|
6
|
+
export type { StickyScrollPluginOptions } from './stickyScroll';
|
|
7
|
+
export type ScopeLinesPluginOptions = {
|
|
8
|
+
readonly enabled?: boolean;
|
|
9
|
+
readonly className?: string;
|
|
10
|
+
readonly minLineSpan?: number;
|
|
11
|
+
readonly mode?: ScopeLinesMode;
|
|
12
|
+
readonly showActive?: boolean;
|
|
13
|
+
};
|
|
14
|
+
export type ScopeLinesMode = 'all' | 'current';
|
|
15
|
+
export declare function createScopeLinesPlugin(options?: ScopeLinesPluginOptions): EditorPlugin;
|
|
16
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAEV,YAAY,EAQb,MAAM,mCAAmC,CAAA;AAC1C,OAAO,aAAa,CAAA;AAEpB,OAAO,EAAE,qBAAqB,EAAE,yBAAyB,EAAE,MAAM,iBAAiB,CAAA;AAClF,YAAY,EAAE,0BAA0B,EAAE,MAAM,iBAAiB,CAAA;AACjE,OAAO,EAAE,wBAAwB,EAAE,MAAM,gBAAgB,CAAA;AACzD,YAAY,EAAE,yBAAyB,EAAE,MAAM,gBAAgB,CAAA;AAE/D,MAAM,MAAM,uBAAuB,GAAG;IACpC,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAA;IAC1B,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAA;IAC3B,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAA;IAC7B,QAAQ,CAAC,IAAI,CAAC,EAAE,cAAc,CAAA;IAC9B,QAAQ,CAAC,UAAU,CAAC,EAAE,OAAO,CAAA;CAC9B,CAAA;AAED,MAAM,MAAM,cAAc,GAAG,KAAK,GAAG,SAAS,CAAA;AAgE9C,wBAAgB,sBAAsB,CAAC,OAAO,GAAE,uBAA4B,GAAG,YAAY,CAY1F"}
|