react-dsl-editor 0.3.2 → 0.3.4
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/dist/index.d.ts +8 -1
- package/dist/react-dsl-editor.js +4 -4
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -17,6 +17,8 @@ export declare interface CSTNode<T extends string> {
|
|
|
17
17
|
|
|
18
18
|
export declare type CSTOf<T> = CSTNode<_NodeTypes<T>>;
|
|
19
19
|
|
|
20
|
+
export declare function defaultSyntaxColors(theme: keyof typeof themes): (node: CSTNode<string>) => CSSProperties | undefined;
|
|
21
|
+
|
|
20
22
|
export declare interface DSL<T extends string> {
|
|
21
23
|
cst: CSTNode<T>;
|
|
22
24
|
terminals: CSTNode<T>[];
|
|
@@ -114,10 +116,15 @@ export declare function sequence<T extends string>(...nodes: GrammarNode<T>[]):
|
|
|
114
116
|
|
|
115
117
|
export declare function success<T extends string>(param: ParserSuccess<T>): ParserSuccess<T>;
|
|
116
118
|
|
|
117
|
-
declare type SyntaxColorsProvider = (node: CSTNode<string>) => CSSProperties | undefined;
|
|
119
|
+
export declare type SyntaxColorsProvider = (node: CSTNode<string>) => CSSProperties | undefined;
|
|
118
120
|
|
|
119
121
|
export declare function term(str: string): GrammarNode<never>;
|
|
120
122
|
|
|
123
|
+
declare const themes: {
|
|
124
|
+
readonly light: string[];
|
|
125
|
+
readonly dark: string[];
|
|
126
|
+
};
|
|
127
|
+
|
|
121
128
|
export declare function visit<T extends string, V = string>(parserResult: ParserSuccess<T>, type: T[], extractor?: (node: ParserSuccess<T>) => V): V[];
|
|
122
129
|
|
|
123
130
|
export declare const ws: GrammarNode<never>;
|
package/dist/react-dsl-editor.js
CHANGED
|
@@ -531,9 +531,9 @@ var DSLParser = class {
|
|
|
531
531
|
}, colorAssignments = /* @__PURE__ */ new Map();
|
|
532
532
|
function getColorAssigment(o, h) {
|
|
533
533
|
let g = String(o), _ = colorAssignments.get(g);
|
|
534
|
-
if (_) return _;
|
|
535
|
-
let v =
|
|
536
|
-
return colorAssignments.set(g, v),
|
|
534
|
+
if (_) return h[_];
|
|
535
|
+
let v = colorAssignments.size % h.length;
|
|
536
|
+
return colorAssignments.set(g, v), h[v];
|
|
537
537
|
}
|
|
538
538
|
function defaultStyleFor(o, h) {
|
|
539
539
|
let { name: g, regex: _ } = o.grammar.meta ?? {}, v = g ?? _;
|
|
@@ -1375,4 +1375,4 @@ function repeat(o, h = 1, g = 1e3) {
|
|
|
1375
1375
|
};
|
|
1376
1376
|
return _;
|
|
1377
1377
|
}
|
|
1378
|
-
export { DSLParser, DslEditor, ParsingError, alternative, asException, eof, error, isParserError, isParserSuccess, named, optional, pattern, rational, repeat, seq, sequence, success, term, visit, ws };
|
|
1378
|
+
export { DSLParser, DslEditor, ParsingError, alternative, asException, defaultSyntaxColors, eof, error, isParserError, isParserSuccess, named, optional, pattern, rational, repeat, seq, sequence, success, term, visit, ws };
|