@tellaro/tql 1.5.0 → 3.0.0
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.js +73 -65
- package/dist/src/builder.d.ts +6 -0
- package/dist/src/completionProvider.js +276 -195
- package/dist/src/complexityAnalyzer.js +41 -32
- package/dist/src/index.d.ts +3 -3
- package/dist/src/parser.d.ts +193 -1
- package/dist/src/parser.js +614 -127
- package/dist/src/semanticPreview.d.ts +23 -0
- package/dist/src/semanticPreview.js +111 -41
- package/dist/src/tokenizer.d.ts +134 -5
- package/dist/src/tokenizer.js +47 -30
- package/dist/src/types.d.ts +138 -10
- package/dist/src/validator.d.ts +235 -1
- package/dist/src/validator.js +468 -150
- package/dist/tql.css +1 -1
- package/dist/vue/TqlAutocomplete.vue.d.ts +24 -1
- package/dist/vue/TqlChart.vue.d.ts +19 -1
- package/dist/vue/TqlChart.vue.js +1 -1
- package/dist/vue/TqlInput.vue.d.ts +92 -1
- package/dist/vue/TqlInput.vue.js +1 -1
- package/dist/vue/TqlInput.vue2.js +282 -256
- package/dist/vue/components/TqlPreview.vue.d.ts +89 -2
- package/dist/vue/components/TqlPreview.vue.js +4 -4
- package/dist/vue/index.d.ts +1 -1
- package/dist/vue/useTqlInput.d.ts +38 -29
- package/package.json +3 -5
|
@@ -1,4 +1,91 @@
|
|
|
1
|
-
|
|
1
|
+
import { FieldUsage, LogicTreeNode } from '../../src/types';
|
|
2
|
+
import { PropType } from 'vue';
|
|
3
|
+
export interface Props {
|
|
4
|
+
/** The TQL query to preview */
|
|
5
|
+
query: string;
|
|
6
|
+
/** Whether to show the logic tree (default: true) */
|
|
7
|
+
showLogicTree?: boolean;
|
|
8
|
+
/** Whether to show field usage list (default: true) */
|
|
9
|
+
showFieldUsage?: boolean;
|
|
10
|
+
/** Whether to show complexity warnings (default: true) */
|
|
11
|
+
showComplexity?: boolean;
|
|
12
|
+
/** Whether to show operator summary (default: false) */
|
|
13
|
+
showOperatorSummary?: boolean;
|
|
14
|
+
/** Maximum depth to expand in logic tree (default: 3) */
|
|
15
|
+
maxExpandedDepth?: number;
|
|
16
|
+
/** Compact mode for smaller display (default: false) */
|
|
17
|
+
compact?: boolean;
|
|
18
|
+
}
|
|
19
|
+
declare const TqlPreviewNode: import('vue').DefineComponent<import('vue').ExtractPropTypes<{
|
|
20
|
+
node: {
|
|
21
|
+
type: PropType<LogicTreeNode>;
|
|
22
|
+
required: true;
|
|
23
|
+
};
|
|
24
|
+
depth: {
|
|
25
|
+
type: NumberConstructor;
|
|
26
|
+
default: number;
|
|
27
|
+
};
|
|
28
|
+
nodeKey: {
|
|
29
|
+
type: StringConstructor;
|
|
30
|
+
required: true;
|
|
31
|
+
};
|
|
32
|
+
isExpanded: {
|
|
33
|
+
type: BooleanConstructor;
|
|
34
|
+
default: boolean;
|
|
35
|
+
};
|
|
36
|
+
autoExpandDepth: {
|
|
37
|
+
type: NumberConstructor;
|
|
38
|
+
default: number;
|
|
39
|
+
};
|
|
40
|
+
}>, {
|
|
41
|
+
hasChildren: import('vue').ComputedRef<boolean | undefined>;
|
|
42
|
+
nodeLabel: import('vue').ComputedRef<string>;
|
|
43
|
+
handleToggle: () => void;
|
|
44
|
+
handleClick: () => void;
|
|
45
|
+
getChildKey: (index: number) => string;
|
|
46
|
+
shouldChildExpand: (_childIndex: number) => boolean;
|
|
47
|
+
}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, ("toggle" | "node-click")[], "toggle" | "node-click", import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<{
|
|
48
|
+
node: {
|
|
49
|
+
type: PropType<LogicTreeNode>;
|
|
50
|
+
required: true;
|
|
51
|
+
};
|
|
52
|
+
depth: {
|
|
53
|
+
type: NumberConstructor;
|
|
54
|
+
default: number;
|
|
55
|
+
};
|
|
56
|
+
nodeKey: {
|
|
57
|
+
type: StringConstructor;
|
|
58
|
+
required: true;
|
|
59
|
+
};
|
|
60
|
+
isExpanded: {
|
|
61
|
+
type: BooleanConstructor;
|
|
62
|
+
default: boolean;
|
|
63
|
+
};
|
|
64
|
+
autoExpandDepth: {
|
|
65
|
+
type: NumberConstructor;
|
|
66
|
+
default: number;
|
|
67
|
+
};
|
|
68
|
+
}>> & Readonly<{
|
|
69
|
+
onToggle?: ((...args: any[]) => any) | undefined;
|
|
70
|
+
"onNode-click"?: ((...args: any[]) => any) | undefined;
|
|
71
|
+
}>, {
|
|
72
|
+
depth: number;
|
|
73
|
+
isExpanded: boolean;
|
|
74
|
+
autoExpandDepth: number;
|
|
75
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
|
|
2
76
|
export { TqlPreviewNode };
|
|
3
|
-
declare const _default:
|
|
77
|
+
declare const _default: import('vue').DefineComponent<Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {} & {
|
|
78
|
+
"node-click": (node: LogicTreeNode) => any;
|
|
79
|
+
"field-click": (field: FieldUsage) => any;
|
|
80
|
+
}, string, import('vue').PublicProps, Readonly<Props> & Readonly<{
|
|
81
|
+
"onNode-click"?: ((node: LogicTreeNode) => any) | undefined;
|
|
82
|
+
"onField-click"?: ((field: FieldUsage) => any) | undefined;
|
|
83
|
+
}>, {
|
|
84
|
+
showLogicTree: boolean;
|
|
85
|
+
showFieldUsage: boolean;
|
|
86
|
+
showComplexity: boolean;
|
|
87
|
+
showOperatorSummary: boolean;
|
|
88
|
+
maxExpandedDepth: number;
|
|
89
|
+
compact: boolean;
|
|
90
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, HTMLDivElement>;
|
|
4
91
|
export default _default;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import o from "./TqlPreview.vue2.js";
|
|
2
|
-
import { TqlPreviewNode as
|
|
2
|
+
import { TqlPreviewNode as _ } from "./TqlPreview.vue2.js";
|
|
3
3
|
/* empty css */
|
|
4
4
|
import r from "../../_virtual/_plugin-vue_export-helper.js";
|
|
5
|
-
const
|
|
5
|
+
const p = /* @__PURE__ */ r(o, [["__scopeId", "data-v-53107944"]]);
|
|
6
6
|
export {
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
_ as TqlPreviewNode,
|
|
8
|
+
p as default
|
|
9
9
|
};
|
package/dist/vue/index.d.ts
CHANGED
|
@@ -9,5 +9,5 @@ export { default as TqlInput } from './TqlInput.vue';
|
|
|
9
9
|
export { default as TqlAutocomplete } from './TqlAutocomplete.vue';
|
|
10
10
|
export { default as TqlPreview } from './components/TqlPreview.vue';
|
|
11
11
|
export { default as TqlChart } from './TqlChart.vue';
|
|
12
|
-
export { useTqlInput, type UseTqlInputOptions } from './useTqlInput';
|
|
12
|
+
export { useTqlInput, type UseTqlInputOptions, type UseTqlInputReturn } from './useTqlInput';
|
|
13
13
|
export { useQueryHistory, type UseQueryHistoryReturn, type QueryHistoryEntry, type UseQueryHistoryOptions } from './composables/useQueryHistory';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Ref } from 'vue';
|
|
2
|
-
import { TqlCompletionItem, TqlFieldSchema, TqlParseResult, TqlSnippet, TqlToken, TqlValidationResult } from '../src/types';
|
|
1
|
+
import { ComputedRef, Ref } from 'vue';
|
|
2
|
+
import { TqlCompletionItem, TqlFieldSchema, TqlParseError, TqlParseResult, TqlParseWarning, TqlSnippet, TqlToken, TqlValidationResult } from '../src/types';
|
|
3
3
|
export interface UseTqlInputOptions {
|
|
4
4
|
modelValue: Ref<string>;
|
|
5
5
|
fieldSchema?: Ref<TqlFieldSchema[] | undefined>;
|
|
@@ -21,34 +21,43 @@ export interface PlaceholderPosition {
|
|
|
21
21
|
start: number;
|
|
22
22
|
end: number;
|
|
23
23
|
}
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
24
|
+
/**
|
|
25
|
+
* What `useTqlInput` returns.
|
|
26
|
+
*
|
|
27
|
+
* Spelled out rather than inferred: with `declaration: true` the inferred type
|
|
28
|
+
* of the returned object (every `Ref<UnwrapRef<...>>` expanded) exceeds what the
|
|
29
|
+
* compiler will serialize (TS7056), so vue-tsc refused to type-check the package
|
|
30
|
+
* and no declaration for this composable could be emitted.
|
|
31
|
+
*/
|
|
32
|
+
export interface UseTqlInputReturn {
|
|
33
|
+
tokens: Ref<TqlToken[]>;
|
|
34
|
+
parseResult: Ref<TqlParseResult | null>;
|
|
35
|
+
validationResult: Ref<TqlValidationResult | null>;
|
|
36
|
+
cursorPosition: Ref<number>;
|
|
37
|
+
completionItems: Ref<TqlCompletionItem[]>;
|
|
38
|
+
showAutocomplete: Ref<boolean>;
|
|
39
|
+
isValidating: Ref<boolean>;
|
|
40
|
+
isValid: ComputedRef<boolean>;
|
|
41
|
+
errors: ComputedRef<TqlParseError[]>;
|
|
42
|
+
warnings: ComputedRef<TqlParseWarning[]>;
|
|
43
|
+
hasErrors: ComputedRef<boolean>;
|
|
44
|
+
hasWarnings: ComputedRef<boolean>;
|
|
45
|
+
tokenize(): TqlToken[];
|
|
46
|
+
parse(): TqlParseResult;
|
|
47
|
+
validate(): TqlValidationResult;
|
|
48
|
+
updateCompletions(): void;
|
|
49
|
+
triggerAutocomplete(): void;
|
|
50
|
+
hideAutocomplete(): void;
|
|
51
|
+
handleInput(value: string): void;
|
|
52
|
+
handleCursorChange(position: number): void;
|
|
53
|
+
insertCompletion(item: TqlCompletionItem): {
|
|
46
54
|
query: string;
|
|
47
55
|
newCursorPosition: number;
|
|
48
56
|
placeholders: PlaceholderPosition[];
|
|
49
57
|
};
|
|
50
|
-
insertSnippet
|
|
51
|
-
getTokenAtCursor
|
|
52
|
-
isPositionInError
|
|
53
|
-
getErrorsAtPosition
|
|
54
|
-
}
|
|
58
|
+
insertSnippet(snippet: TqlSnippet): string;
|
|
59
|
+
getTokenAtCursor(): TqlToken | null;
|
|
60
|
+
isPositionInError(position: number): boolean;
|
|
61
|
+
getErrorsAtPosition(position: number): TqlParseError[];
|
|
62
|
+
}
|
|
63
|
+
export declare function useTqlInput(options: UseTqlInputOptions): UseTqlInputReturn;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tellaro/tql",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.0",
|
|
4
4
|
"description": "Tellaro Query Language (TQL) parser, validator, and autocomplete for JavaScript/TypeScript",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -36,7 +36,6 @@
|
|
|
36
36
|
"test:e2e:ui": "playwright test --ui",
|
|
37
37
|
"playground:serve": "vite --config vite.playground.config.ts --port 5174",
|
|
38
38
|
"playground:dev": "vite --config vite.playground.config.ts",
|
|
39
|
-
"lint": "eslint src vue tests --ext .ts,.vue",
|
|
40
39
|
"typecheck": "vue-tsc --noEmit",
|
|
41
40
|
"prepublishOnly": "npm run build"
|
|
42
41
|
},
|
|
@@ -102,14 +101,13 @@
|
|
|
102
101
|
"chartjs-adapter-luxon": "^1.3.1",
|
|
103
102
|
"chartjs-plugin-annotation": "^3.1.0",
|
|
104
103
|
"chartjs-plugin-datalabels": "^2.2.0",
|
|
105
|
-
"
|
|
106
|
-
"js-yaml": "^4.1.0",
|
|
104
|
+
"js-yaml": "^4.3.2",
|
|
107
105
|
"jsdom": "^24.0.0",
|
|
108
106
|
"luxon": "^3.7.2",
|
|
109
107
|
"typescript": "^5.3.0",
|
|
110
108
|
"vite": "^7.3.2",
|
|
111
109
|
"vite-plugin-dts": "^4.5.4",
|
|
112
|
-
"vitest": "^4.
|
|
110
|
+
"vitest": "^4.1.11",
|
|
113
111
|
"vue": "^3.4.0",
|
|
114
112
|
"vue-tsc": "^3.2.4"
|
|
115
113
|
},
|