@tellaro/tql 1.3.8 → 1.4.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 +44 -41
- package/dist/node_modules/@kurkle/color/dist/color.esm.js +442 -0
- package/dist/node_modules/chart.js/dist/chart.js +6149 -0
- package/dist/node_modules/chart.js/dist/chunks/helpers.dataset.js +1685 -0
- package/dist/node_modules/chartjs-adapter-luxon/dist/chartjs-adapter-luxon.esm.js +56 -0
- package/dist/node_modules/chartjs-plugin-annotation/dist/chartjs-plugin-annotation.esm.js +1655 -0
- package/dist/node_modules/chartjs-plugin-datalabels/dist/chartjs-plugin-datalabels.esm.js +607 -0
- package/dist/node_modules/luxon/build/es6/luxon.js +5524 -0
- package/dist/src/builder.d.ts +62 -0
- package/dist/src/builder.js +56 -0
- package/dist/src/chart/colors.d.ts +23 -0
- package/dist/src/chart/colors.js +101 -0
- package/dist/src/chart/formatters.d.ts +17 -0
- package/dist/src/chart/formatters.js +49 -0
- package/dist/src/chart/index.d.ts +9 -0
- package/dist/src/chart/index.js +31 -0
- package/dist/src/chart/mappers.d.ts +849 -0
- package/dist/src/chart/mappers.js +613 -0
- package/dist/src/completionProvider.js +294 -165
- package/dist/src/index.d.ts +2 -1
- package/dist/src/parser.d.ts +10 -0
- package/dist/src/parser.js +41 -9
- package/dist/src/tokenizer.js +124 -103
- package/dist/src/types.d.ts +27 -3
- package/dist/src/validator.js +10 -9
- package/dist/tql.css +1 -1
- package/dist/vue/TqlChart.vue.d.ts +2 -0
- package/dist/vue/TqlChart.vue.js +7 -0
- package/dist/vue/TqlChart.vue2.js +212 -0
- package/dist/vue/index.d.ts +1 -0
- package/dist/vue/index.js +12 -10
- package/dist/vue/useTqlInput.js +80 -80
- package/package.json +39 -3
package/dist/vue/useTqlInput.js
CHANGED
|
@@ -1,158 +1,158 @@
|
|
|
1
1
|
import { useDebounceFn as E } from "@vueuse/core";
|
|
2
|
-
import {
|
|
3
|
-
import { getCompletions as
|
|
4
|
-
import { parseTql as
|
|
5
|
-
import { findTokenAtPosition as W, tokenizeTql as
|
|
6
|
-
import { validateTql as
|
|
7
|
-
function
|
|
2
|
+
import { computed as d, ref as i, watch as le } from "vue";
|
|
3
|
+
import { getCompletions as re, shouldTriggerCompletion as ue } from "../src/completionProvider.js";
|
|
4
|
+
import { parseTql as ae } from "../src/parser.js";
|
|
5
|
+
import { findTokenAtPosition as W, tokenizeTql as ie } from "../src/tokenizer.js";
|
|
6
|
+
import { validateTql as ce } from "../src/validator.js";
|
|
7
|
+
function Te(z) {
|
|
8
8
|
const {
|
|
9
|
-
modelValue:
|
|
10
|
-
fieldSchema:
|
|
9
|
+
modelValue: D,
|
|
10
|
+
fieldSchema: y,
|
|
11
11
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
12
|
-
snippets:
|
|
12
|
+
snippets: pe,
|
|
13
13
|
// Reserved for future snippet support
|
|
14
|
-
fieldValues:
|
|
15
|
-
validateOnInput:
|
|
16
|
-
debounceMs:
|
|
14
|
+
fieldValues: F,
|
|
15
|
+
validateOnInput: O = !0,
|
|
16
|
+
debounceMs: Q = 300,
|
|
17
17
|
completionDebounceMs: R = 50,
|
|
18
18
|
// Faster debounce for completions
|
|
19
19
|
autocomplete: C = !0,
|
|
20
20
|
onValidation: j,
|
|
21
|
-
onParse:
|
|
22
|
-
} = z, c = i([]), k = i(null),
|
|
23
|
-
function
|
|
24
|
-
return c.value =
|
|
21
|
+
onParse: U
|
|
22
|
+
} = z, u = d(() => D.value ?? ""), c = i([]), k = i(null), f = i(null), a = i(0), v = i([]), p = i(!1), I = i(!1), _ = d(() => f.value?.valid ?? !0), h = d(() => f.value?.errors ?? []), q = d(() => f.value?.warnings ?? []), $ = d(() => h.value.length > 0), B = d(() => q.value.length > 0);
|
|
23
|
+
function w() {
|
|
24
|
+
return c.value = ie(u.value), c.value;
|
|
25
25
|
}
|
|
26
|
-
function
|
|
27
|
-
const e =
|
|
28
|
-
return k.value = e,
|
|
26
|
+
function G() {
|
|
27
|
+
const e = ae(u.value);
|
|
28
|
+
return k.value = e, U?.(e), e;
|
|
29
29
|
}
|
|
30
|
-
function
|
|
31
|
-
|
|
32
|
-
const e =
|
|
30
|
+
function A() {
|
|
31
|
+
I.value = !0;
|
|
32
|
+
const e = y?.value?.map((t) => t.name), n = y?.value?.reduce(
|
|
33
33
|
(t, l) => (t[l.name] = l.type, t),
|
|
34
34
|
{}
|
|
35
|
-
),
|
|
35
|
+
), s = ce(u.value, {
|
|
36
36
|
availableFields: e,
|
|
37
37
|
fieldTypes: n,
|
|
38
38
|
strictMode: !1
|
|
39
39
|
});
|
|
40
|
-
return
|
|
40
|
+
return f.value = s, I.value = !1, j?.(s), s;
|
|
41
41
|
}
|
|
42
|
-
const
|
|
42
|
+
const H = E(A, Q), J = E(g, R);
|
|
43
43
|
function g() {
|
|
44
44
|
if (!C) {
|
|
45
|
-
|
|
45
|
+
v.value = [], p.value = !1;
|
|
46
46
|
return;
|
|
47
47
|
}
|
|
48
|
-
const e =
|
|
48
|
+
const e = re(
|
|
49
49
|
{
|
|
50
50
|
query: u.value,
|
|
51
51
|
cursorPosition: a.value
|
|
52
52
|
},
|
|
53
53
|
{
|
|
54
|
-
fields:
|
|
55
|
-
fieldValues:
|
|
54
|
+
fields: y?.value,
|
|
55
|
+
fieldValues: F?.value,
|
|
56
56
|
includeSnippets: !0,
|
|
57
57
|
maxItems: 15
|
|
58
58
|
}
|
|
59
59
|
);
|
|
60
|
-
|
|
60
|
+
v.value = e, p.value = e.length > 0;
|
|
61
61
|
}
|
|
62
|
-
function
|
|
63
|
-
g(),
|
|
62
|
+
function K() {
|
|
63
|
+
g(), p.value = v.value.length > 0;
|
|
64
64
|
}
|
|
65
|
-
function
|
|
66
|
-
|
|
65
|
+
function P() {
|
|
66
|
+
p.value = !1;
|
|
67
67
|
}
|
|
68
68
|
function V(e) {
|
|
69
|
-
|
|
69
|
+
w(), O && H(), C && ue(e, a.value) && (J(), v.value.length > 0 && (p.value = !0));
|
|
70
70
|
}
|
|
71
|
-
function
|
|
71
|
+
function L(e) {
|
|
72
72
|
a.value = e, g();
|
|
73
73
|
}
|
|
74
|
-
function
|
|
75
|
-
const n = u.value,
|
|
76
|
-
let l =
|
|
74
|
+
function N(e) {
|
|
75
|
+
const n = u.value, s = a.value, t = W(c.value, s);
|
|
76
|
+
let l = s, T = s;
|
|
77
77
|
if (t && t.type !== "whitespace")
|
|
78
78
|
l = t.start, T = t.end;
|
|
79
79
|
else {
|
|
80
|
-
const r = c.value.filter((
|
|
80
|
+
const r = c.value.filter((o) => o.end <= s && o.type !== "whitespace");
|
|
81
81
|
if (r.length > 0) {
|
|
82
|
-
const
|
|
83
|
-
|
|
82
|
+
const o = r[r.length - 1];
|
|
83
|
+
o.end === s && (l = o.start, T = o.end);
|
|
84
84
|
}
|
|
85
85
|
}
|
|
86
|
-
const
|
|
87
|
-
let
|
|
88
|
-
const
|
|
89
|
-
(r,
|
|
86
|
+
const x = n.substring(0, l), te = n.substring(T), b = [];
|
|
87
|
+
let m = e.insertText;
|
|
88
|
+
const ne = [...e.insertText.matchAll(/\$(\d+)/g)].sort(
|
|
89
|
+
(r, o) => parseInt(r[1]) - parseInt(o[1])
|
|
90
90
|
);
|
|
91
91
|
let S = 0;
|
|
92
|
-
for (const r of
|
|
93
|
-
const
|
|
94
|
-
if (
|
|
95
|
-
const M = l +
|
|
92
|
+
for (const r of ne) {
|
|
93
|
+
const o = m.indexOf(r[0]);
|
|
94
|
+
if (o !== -1) {
|
|
95
|
+
const M = l + o - S;
|
|
96
96
|
b.push({
|
|
97
97
|
start: M,
|
|
98
98
|
end: M
|
|
99
99
|
// Zero-width cursor position
|
|
100
|
-
}),
|
|
100
|
+
}), m = m.replace(r[0], ""), S += r[0].length;
|
|
101
101
|
}
|
|
102
102
|
}
|
|
103
|
-
const
|
|
104
|
-
return
|
|
103
|
+
const se = x + m + te, oe = b.length > 0 ? b[0].start : l + m.length;
|
|
104
|
+
return P(), { query: se, newCursorPosition: oe, placeholders: b };
|
|
105
105
|
}
|
|
106
|
-
function
|
|
107
|
-
const n = u.value,
|
|
108
|
-
return t +
|
|
106
|
+
function X(e) {
|
|
107
|
+
const n = u.value, s = a.value, t = n.substring(0, s), l = n.substring(s), x = t.length > 0 && !t.endsWith(" ") && !t.endsWith("(") ? " " : "";
|
|
108
|
+
return t + x + e.insertText + l;
|
|
109
109
|
}
|
|
110
|
-
function
|
|
110
|
+
function Y() {
|
|
111
111
|
return W(c.value, a.value);
|
|
112
112
|
}
|
|
113
|
-
function
|
|
113
|
+
function Z(e) {
|
|
114
114
|
return h.value.some((n) => e >= n.start && e < n.end);
|
|
115
115
|
}
|
|
116
|
-
function
|
|
116
|
+
function ee(e) {
|
|
117
117
|
return h.value.filter((n) => e >= n.start && e < n.end);
|
|
118
118
|
}
|
|
119
|
-
return
|
|
119
|
+
return le(
|
|
120
120
|
u,
|
|
121
121
|
(e) => {
|
|
122
|
-
|
|
122
|
+
V(e);
|
|
123
123
|
},
|
|
124
124
|
{ immediate: !0 }
|
|
125
125
|
), {
|
|
126
126
|
// State
|
|
127
127
|
tokens: c,
|
|
128
128
|
parseResult: k,
|
|
129
|
-
validationResult:
|
|
129
|
+
validationResult: f,
|
|
130
130
|
cursorPosition: a,
|
|
131
|
-
completionItems:
|
|
132
|
-
showAutocomplete:
|
|
133
|
-
isValidating:
|
|
131
|
+
completionItems: v,
|
|
132
|
+
showAutocomplete: p,
|
|
133
|
+
isValidating: I,
|
|
134
134
|
// Computed
|
|
135
|
-
isValid:
|
|
135
|
+
isValid: _,
|
|
136
136
|
errors: h,
|
|
137
137
|
warnings: q,
|
|
138
|
-
hasErrors:
|
|
139
|
-
hasWarnings:
|
|
138
|
+
hasErrors: $,
|
|
139
|
+
hasWarnings: B,
|
|
140
140
|
// Methods
|
|
141
|
-
tokenize:
|
|
142
|
-
parse:
|
|
143
|
-
validate:
|
|
141
|
+
tokenize: w,
|
|
142
|
+
parse: G,
|
|
143
|
+
validate: A,
|
|
144
144
|
updateCompletions: g,
|
|
145
|
-
triggerAutocomplete:
|
|
146
|
-
hideAutocomplete:
|
|
145
|
+
triggerAutocomplete: K,
|
|
146
|
+
hideAutocomplete: P,
|
|
147
147
|
handleInput: V,
|
|
148
|
-
handleCursorChange:
|
|
149
|
-
insertCompletion:
|
|
150
|
-
insertSnippet:
|
|
151
|
-
getTokenAtCursor:
|
|
152
|
-
isPositionInError:
|
|
153
|
-
getErrorsAtPosition:
|
|
148
|
+
handleCursorChange: L,
|
|
149
|
+
insertCompletion: N,
|
|
150
|
+
insertSnippet: X,
|
|
151
|
+
getTokenAtCursor: Y,
|
|
152
|
+
isPositionInError: Z,
|
|
153
|
+
getErrorsAtPosition: ee
|
|
154
154
|
};
|
|
155
155
|
}
|
|
156
156
|
export {
|
|
157
|
-
|
|
157
|
+
Te as useTqlInput
|
|
158
158
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tellaro/tql",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.4.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",
|
|
@@ -15,6 +15,10 @@
|
|
|
15
15
|
"import": "./dist/vue/index.js",
|
|
16
16
|
"types": "./dist/vue/index.d.ts"
|
|
17
17
|
},
|
|
18
|
+
"./chart": {
|
|
19
|
+
"import": "./dist/src/chart/index.js",
|
|
20
|
+
"types": "./dist/src/chart/index.d.ts"
|
|
21
|
+
},
|
|
18
22
|
"./style.css": "./dist/tql.css",
|
|
19
23
|
"./dist/style.css": "./dist/tql.css",
|
|
20
24
|
"./dist/tql.css": "./dist/tql.css"
|
|
@@ -55,6 +59,11 @@
|
|
|
55
59
|
"license": "MIT",
|
|
56
60
|
"peerDependencies": {
|
|
57
61
|
"@vueuse/core": "^10.0.0",
|
|
62
|
+
"chart.js": "^3.9.0 || ^4.0.0",
|
|
63
|
+
"chartjs-adapter-luxon": "^1.3.0",
|
|
64
|
+
"chartjs-plugin-annotation": "^3.0.0",
|
|
65
|
+
"chartjs-plugin-datalabels": "^2.0.0",
|
|
66
|
+
"luxon": "^3.0.0",
|
|
58
67
|
"vue": "^3.4.0"
|
|
59
68
|
},
|
|
60
69
|
"peerDependenciesMeta": {
|
|
@@ -63,22 +72,42 @@
|
|
|
63
72
|
},
|
|
64
73
|
"@vueuse/core": {
|
|
65
74
|
"optional": true
|
|
75
|
+
},
|
|
76
|
+
"chart.js": {
|
|
77
|
+
"optional": true
|
|
78
|
+
},
|
|
79
|
+
"chartjs-adapter-luxon": {
|
|
80
|
+
"optional": true
|
|
81
|
+
},
|
|
82
|
+
"chartjs-plugin-annotation": {
|
|
83
|
+
"optional": true
|
|
84
|
+
},
|
|
85
|
+
"chartjs-plugin-datalabels": {
|
|
86
|
+
"optional": true
|
|
87
|
+
},
|
|
88
|
+
"luxon": {
|
|
89
|
+
"optional": true
|
|
66
90
|
}
|
|
67
91
|
},
|
|
68
92
|
"devDependencies": {
|
|
69
93
|
"@playwright/test": "^1.40.0",
|
|
70
94
|
"@types/js-yaml": "^4.0.9",
|
|
71
95
|
"@types/node": "^20.11.0",
|
|
72
|
-
"@vitejs/plugin-vue": "^
|
|
96
|
+
"@vitejs/plugin-vue": "^6.0.4",
|
|
73
97
|
"@vue/test-utils": "^2.4.0",
|
|
74
98
|
"@vue/tsconfig": "^0.5.1",
|
|
75
99
|
"@vueuse/core": "^10.0.0",
|
|
76
100
|
"ajv": "^8.17.1",
|
|
101
|
+
"chart.js": "^4.5.1",
|
|
102
|
+
"chartjs-adapter-luxon": "^1.3.1",
|
|
103
|
+
"chartjs-plugin-annotation": "^3.1.0",
|
|
104
|
+
"chartjs-plugin-datalabels": "^2.2.0",
|
|
77
105
|
"eslint": "^8.56.0",
|
|
78
106
|
"js-yaml": "^4.1.0",
|
|
79
107
|
"jsdom": "^24.0.0",
|
|
108
|
+
"luxon": "^3.7.2",
|
|
80
109
|
"typescript": "^5.3.0",
|
|
81
|
-
"vite": "^7.3.
|
|
110
|
+
"vite": "^7.3.2",
|
|
82
111
|
"vite-plugin-dts": "^4.5.4",
|
|
83
112
|
"vitest": "^4.0.18",
|
|
84
113
|
"vue": "^3.4.0",
|
|
@@ -86,5 +115,12 @@
|
|
|
86
115
|
},
|
|
87
116
|
"engines": {
|
|
88
117
|
"node": ">=18.0.0"
|
|
118
|
+
},
|
|
119
|
+
"overrides": {
|
|
120
|
+
"@microsoft/api-extractor": {
|
|
121
|
+
"minimatch": ">=10.2.3"
|
|
122
|
+
},
|
|
123
|
+
"flatted": ">=3.4.0",
|
|
124
|
+
"lodash": ">=4.18.0"
|
|
89
125
|
}
|
|
90
126
|
}
|