@tellaro/tql 0.1.0 → 0.1.2
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 +61 -31
- package/dist/src/completionProvider.js +226 -178
- package/dist/src/complexityAnalyzer.d.ts +55 -0
- package/dist/src/complexityAnalyzer.js +209 -0
- package/dist/src/fuzzyMatcher.d.ts +71 -0
- package/dist/src/fuzzyMatcher.js +110 -0
- package/dist/src/index.d.ts +5 -0
- package/dist/src/parser.d.ts +10 -0
- package/dist/src/parser.js +101 -48
- package/dist/src/schemaCache.d.ts +75 -0
- package/dist/src/schemaCache.js +104 -0
- package/dist/src/semanticPreview.d.ts +72 -0
- package/dist/src/semanticPreview.js +242 -0
- package/dist/src/types.d.ts +121 -0
- package/dist/style.css +1 -1
- package/dist/vue/TqlAutocomplete.vue.js +2 -2
- package/dist/vue/TqlAutocomplete.vue2.js +62 -56
- package/dist/vue/TqlInput.vue.js +2 -1
- package/dist/vue/TqlInput.vue2.js +477 -215
- package/dist/vue/components/TqlPreview.vue.d.ts +4 -0
- package/dist/vue/components/TqlPreview.vue.js +9 -0
- package/dist/vue/components/TqlPreview.vue2.js +264 -0
- package/dist/vue/composables/useQueryHistory.d.ts +35 -0
- package/dist/vue/composables/useQueryHistory.js +176 -0
- package/dist/vue/index.d.ts +2 -0
- package/dist/vue/index.js +10 -6
- package/dist/vue/useTqlInput.js +79 -77
- package/package.json +3 -1
|
@@ -1,23 +1,47 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
|
|
1
|
+
import { defineComponent as Ge, ref as y, toRef as j, computed as E, watch as ye, onMounted as Je, nextTick as V, onUnmounted as Xe, openBlock as i, createElementBlock as a, normalizeStyle as _, normalizeClass as w, unref as u, Fragment as T, renderList as z, toDisplayString as m, createCommentVNode as v, withDirectives as ee, vModelText as te, createElementVNode as r, withModifiers as D, withKeys as me, createVNode as ge, createBlock as Ye, Teleport as Ze } from "vue";
|
|
2
|
+
import _e from "./TqlAutocomplete.vue.js";
|
|
3
|
+
import et from "./components/TqlPreview.vue.js";
|
|
4
|
+
import { useTqlInput as tt } from "./useTqlInput.js";
|
|
5
|
+
import { useQueryHistory as lt } from "./composables/useQueryHistory.js";
|
|
6
|
+
import { analyzeComplexity as ot } from "../src/complexityAnalyzer.js";
|
|
7
|
+
const it = {
|
|
5
8
|
key: 0,
|
|
6
9
|
class: "tql-highlight-layer",
|
|
7
10
|
"aria-hidden": "true"
|
|
8
|
-
},
|
|
9
|
-
key: 3,
|
|
10
|
-
class: "tql-validation-icon"
|
|
11
|
-
}, Be = {
|
|
11
|
+
}, at = ["placeholder", "disabled", "readonly", "rows", "aria-expanded", "aria-invalid", "aria-describedby"], nt = ["placeholder", "disabled", "readonly", "aria-expanded", "aria-invalid", "aria-describedby"], st = { class: "tql-toolbar" }, ut = ["title"], rt = { class: "tql-complexity-label" }, dt = {
|
|
12
12
|
key: 0,
|
|
13
|
-
class: "
|
|
14
|
-
},
|
|
15
|
-
key:
|
|
16
|
-
class: "tql-validation-
|
|
17
|
-
},
|
|
13
|
+
class: "tql-complexity-count"
|
|
14
|
+
}, ct = {
|
|
15
|
+
key: 4,
|
|
16
|
+
class: "tql-validation-status"
|
|
17
|
+
}, vt = {
|
|
18
|
+
key: 0,
|
|
19
|
+
class: "pi pi-check-circle tql-icon-valid",
|
|
20
|
+
"aria-label": "Query is valid"
|
|
21
|
+
}, ft = ["aria-label", "aria-expanded"], pt = { class: "tql-history-header" }, ht = { class: "tql-history-list" }, yt = ["onClick"], mt = ["title", "onClick"], gt = { class: "tql-history-content" }, wt = {
|
|
22
|
+
key: 0,
|
|
23
|
+
class: "tql-history-label"
|
|
24
|
+
}, bt = { class: "tql-history-query" }, qt = { class: "tql-history-time" }, kt = {
|
|
25
|
+
key: 0,
|
|
26
|
+
class: "tql-history-empty"
|
|
27
|
+
}, xt = {
|
|
18
28
|
key: 0,
|
|
19
29
|
class: "tql-error-suggestion"
|
|
20
|
-
},
|
|
30
|
+
}, Ct = {
|
|
31
|
+
key: 4,
|
|
32
|
+
class: "tql-complexity-warnings"
|
|
33
|
+
}, St = {
|
|
34
|
+
key: 0,
|
|
35
|
+
class: "tql-complexity-suggestions"
|
|
36
|
+
}, Vt = {
|
|
37
|
+
key: 5,
|
|
38
|
+
class: "tql-preview-panel"
|
|
39
|
+
}, Pt = { class: "tql-preview-header" }, Ht = {
|
|
40
|
+
class: "sr-only",
|
|
41
|
+
role: "status",
|
|
42
|
+
"aria-live": "polite",
|
|
43
|
+
"aria-atomic": "true"
|
|
44
|
+
}, $t = { key: 0 }, Et = { key: 1 }, zt = /* @__PURE__ */ Ge({
|
|
21
45
|
__name: "TqlInput",
|
|
22
46
|
props: {
|
|
23
47
|
modelValue: {},
|
|
@@ -30,297 +54,535 @@ const Se = {
|
|
|
30
54
|
validateOnInput: { type: Boolean, default: !0 },
|
|
31
55
|
debounceMs: { default: 300 },
|
|
32
56
|
fieldSchema: {},
|
|
57
|
+
fieldValues: {},
|
|
33
58
|
modelName: {},
|
|
34
59
|
snippets: {},
|
|
35
60
|
showSnippetButton: { type: Boolean, default: !1 },
|
|
36
61
|
autocomplete: { type: Boolean, default: !0 },
|
|
37
|
-
syntaxHighlighting: { type: Boolean, default: !0 }
|
|
62
|
+
syntaxHighlighting: { type: Boolean, default: !0 },
|
|
63
|
+
alwaysShowErrors: { type: Boolean, default: !0 },
|
|
64
|
+
resizable: { type: Boolean, default: !1 },
|
|
65
|
+
minHeight: { default: void 0 },
|
|
66
|
+
showComplexity: { type: Boolean, default: !1 },
|
|
67
|
+
showHistory: { type: Boolean, default: !1 },
|
|
68
|
+
showPreview: { type: Boolean, default: !1 },
|
|
69
|
+
complexityThresholds: {},
|
|
70
|
+
historyOptions: {},
|
|
71
|
+
historyStorageKey: {}
|
|
38
72
|
},
|
|
39
73
|
emits: ["update:modelValue", "validation", "parse", "submit"],
|
|
40
|
-
setup(
|
|
41
|
-
const
|
|
42
|
-
tokens:
|
|
43
|
-
cursorPosition:
|
|
44
|
-
completionItems:
|
|
45
|
-
showAutocomplete:
|
|
46
|
-
isValid:
|
|
47
|
-
errors:
|
|
48
|
-
hasErrors:
|
|
49
|
-
validate:
|
|
50
|
-
handleInput:
|
|
51
|
-
handleCursorChange:
|
|
52
|
-
insertCompletion:
|
|
53
|
-
insertSnippet:
|
|
54
|
-
triggerAutocomplete:
|
|
55
|
-
hideAutocomplete:
|
|
56
|
-
getTokenAtCursor:
|
|
57
|
-
} =
|
|
58
|
-
modelValue:
|
|
59
|
-
fieldSchema:
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
74
|
+
setup(o, { expose: we, emit: be }) {
|
|
75
|
+
const c = o, b = be, d = y(null), L = y(null), I = y(null), s = y(c.modelValue), q = y(!1), p = y(!1), x = y(!1), C = y(!1), R = y(""), W = `tql-input-${Math.random().toString(36).substring(2, 9)}`, le = `${W}-input`, G = `${W}-autocomplete`, J = `${W}-errors`, M = y([]), B = y(-1), qe = j(c, "modelValue"), ke = j(c, "fieldSchema"), xe = j(c, "fieldValues"), Ce = j(c, "snippets"), {
|
|
76
|
+
tokens: Se,
|
|
77
|
+
cursorPosition: X,
|
|
78
|
+
completionItems: Q,
|
|
79
|
+
showAutocomplete: k,
|
|
80
|
+
isValid: Y,
|
|
81
|
+
errors: P,
|
|
82
|
+
hasErrors: H,
|
|
83
|
+
validate: Ve,
|
|
84
|
+
handleInput: oe,
|
|
85
|
+
handleCursorChange: $,
|
|
86
|
+
insertCompletion: Pe,
|
|
87
|
+
insertSnippet: He,
|
|
88
|
+
triggerAutocomplete: ie,
|
|
89
|
+
hideAutocomplete: K,
|
|
90
|
+
getTokenAtCursor: $e
|
|
91
|
+
} = tt({
|
|
92
|
+
modelValue: qe,
|
|
93
|
+
fieldSchema: ke,
|
|
94
|
+
fieldValues: xe,
|
|
95
|
+
snippets: Ce,
|
|
96
|
+
validateOnInput: c.validateOnInput,
|
|
97
|
+
debounceMs: c.debounceMs,
|
|
98
|
+
autocomplete: c.autocomplete,
|
|
99
|
+
onValidation: (e) => b("validation", e),
|
|
100
|
+
onParse: (e) => b("parse", e)
|
|
101
|
+
}), S = c.showHistory ? lt({
|
|
102
|
+
storageKey: c.historyStorageKey || "tql-history",
|
|
103
|
+
...c.historyOptions
|
|
104
|
+
}) : null, h = E(() => !c.showComplexity || !s.value.trim() ? null : ot(s.value, c.complexityThresholds)), Ee = E(() => h.value ? `tql-complexity-${h.value.score}` : ""), ae = E(() => h.value && {
|
|
105
|
+
low: "Low",
|
|
106
|
+
medium: "Medium",
|
|
107
|
+
high: "High"
|
|
108
|
+
}[h.value.score] || ""), ne = E(() => S ? R.value.trim() ? S.searchHistory(R.value).slice(0, 10) : S.getRecentQueries(10) : []);
|
|
109
|
+
function Re(e) {
|
|
110
|
+
s.value = e.query, b("update:modelValue", e.query), oe(e.query), x.value = !1, R.value = "", V(() => {
|
|
111
|
+
var t;
|
|
112
|
+
return (t = d.value) == null ? void 0 : t.focus();
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
function Be(e, t) {
|
|
116
|
+
t.stopPropagation(), S == null || S.toggleFavorite(e.id);
|
|
117
|
+
}
|
|
118
|
+
function se() {
|
|
119
|
+
S && s.value.trim() && S.addQuery(s.value);
|
|
120
|
+
}
|
|
121
|
+
function Te() {
|
|
122
|
+
x.value = !x.value, x.value && (C.value = !1);
|
|
123
|
+
}
|
|
124
|
+
function De() {
|
|
125
|
+
C.value = !C.value, C.value && (x.value = !1);
|
|
126
|
+
}
|
|
127
|
+
ye(
|
|
128
|
+
() => c.modelValue,
|
|
69
129
|
(e) => {
|
|
70
|
-
e !==
|
|
130
|
+
e !== s.value && (s.value = e);
|
|
71
131
|
}
|
|
72
132
|
);
|
|
73
|
-
const
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
133
|
+
const Ie = E(() => c.alwaysShowErrors === !0 || c.alwaysShowErrors === void 0 || p.value), A = y({ top: 0, left: 0 }), Me = E(() => A.value.top > 0 || A.value.left > 0), ue = y({ top: 0, left: 0, width: 0 }), ze = E(() => {
|
|
134
|
+
const e = ue.value;
|
|
135
|
+
return e.top === 0 && e.left === 0 && e.width === 0 ? { display: "none" } : {
|
|
136
|
+
position: "fixed",
|
|
137
|
+
top: `${e.top}px`,
|
|
138
|
+
left: `${e.left}px`,
|
|
139
|
+
width: `${e.width}px`,
|
|
140
|
+
zIndex: 9998
|
|
141
|
+
};
|
|
142
|
+
});
|
|
143
|
+
function F() {
|
|
144
|
+
if (!L.value)
|
|
145
|
+
return;
|
|
146
|
+
const e = L.value.getBoundingClientRect();
|
|
147
|
+
A.value = {
|
|
78
148
|
top: e.bottom + 4,
|
|
79
149
|
left: e.left
|
|
150
|
+
}, ue.value = {
|
|
151
|
+
top: e.bottom + 4,
|
|
152
|
+
left: e.left,
|
|
153
|
+
width: e.width
|
|
80
154
|
};
|
|
81
|
-
}
|
|
82
|
-
function
|
|
155
|
+
}
|
|
156
|
+
function Le(e) {
|
|
83
157
|
const t = `tql-token tql-token-${e.type}`;
|
|
84
|
-
return
|
|
158
|
+
return P.value.some((n) => e.start >= n.start && e.end <= n.end) ? `${t} tql-token-error-range` : t;
|
|
85
159
|
}
|
|
86
|
-
function
|
|
160
|
+
function re(e) {
|
|
87
161
|
const t = e.target;
|
|
88
|
-
|
|
89
|
-
|
|
162
|
+
s.value = t.value, b("update:modelValue", t.value), oe(t.value), V(() => {
|
|
163
|
+
d.value && $(d.value.selectionStart || 0);
|
|
90
164
|
});
|
|
91
165
|
}
|
|
92
|
-
function
|
|
93
|
-
if (
|
|
94
|
-
const e =
|
|
95
|
-
e !==
|
|
166
|
+
function O() {
|
|
167
|
+
if (d.value) {
|
|
168
|
+
const e = d.value.selectionStart || 0;
|
|
169
|
+
e !== X.value && $(e);
|
|
96
170
|
}
|
|
97
171
|
}
|
|
98
|
-
function
|
|
99
|
-
var t, l,
|
|
172
|
+
function de(e) {
|
|
173
|
+
var t, l, n, f, g;
|
|
100
174
|
if (e.key === "Tab" && !e.shiftKey) {
|
|
101
|
-
if (
|
|
102
|
-
e.preventDefault(),
|
|
175
|
+
if (M.value.length > 0 && B.value >= 0) {
|
|
176
|
+
e.preventDefault(), Qe();
|
|
103
177
|
return;
|
|
104
178
|
}
|
|
105
|
-
if (
|
|
106
|
-
e.preventDefault(),
|
|
179
|
+
if (Ke()) {
|
|
180
|
+
e.preventDefault(), Ae();
|
|
107
181
|
return;
|
|
108
182
|
}
|
|
109
183
|
}
|
|
110
|
-
if (
|
|
184
|
+
if (k.value && Q.value.length > 0)
|
|
111
185
|
switch (e.key) {
|
|
112
186
|
case "ArrowDown":
|
|
113
|
-
e.preventDefault(), (t =
|
|
187
|
+
e.preventDefault(), (t = I.value) == null || t.moveDown();
|
|
114
188
|
return;
|
|
115
189
|
case "ArrowUp":
|
|
116
|
-
e.preventDefault(), (l =
|
|
190
|
+
e.preventDefault(), (l = I.value) == null || l.moveUp();
|
|
117
191
|
return;
|
|
118
192
|
case "Tab":
|
|
193
|
+
e.preventDefault(), $(((n = d.value) == null ? void 0 : n.selectionStart) || 0), Q.value.length > 0 && ((f = I.value) == null || f.selectCurrent());
|
|
194
|
+
return;
|
|
119
195
|
case "Enter":
|
|
120
|
-
if (
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
}
|
|
125
|
-
} else {
|
|
126
|
-
e.preventDefault(), (c = g.value) == null || c.selectCurrent();
|
|
127
|
-
return;
|
|
128
|
-
}
|
|
129
|
-
break;
|
|
196
|
+
if (!c.multiline)
|
|
197
|
+
break;
|
|
198
|
+
e.preventDefault(), (g = I.value) == null || g.selectCurrent();
|
|
199
|
+
return;
|
|
130
200
|
case "Escape":
|
|
131
|
-
e.preventDefault(),
|
|
201
|
+
e.preventDefault(), K(), Z();
|
|
132
202
|
return;
|
|
133
203
|
}
|
|
134
204
|
if (e.key === " " && e.ctrlKey) {
|
|
135
|
-
e.preventDefault(),
|
|
205
|
+
e.preventDefault(), ie();
|
|
136
206
|
return;
|
|
137
207
|
}
|
|
138
|
-
e.key === "Enter" && (
|
|
208
|
+
e.key === "Enter" && (c.multiline && e.ctrlKey || !c.multiline && !k.value) && (e.preventDefault(), se(), b("submit", s.value));
|
|
139
209
|
}
|
|
140
|
-
function
|
|
141
|
-
if (
|
|
142
|
-
|
|
210
|
+
function Qe() {
|
|
211
|
+
if (B.value++, B.value >= M.value.length) {
|
|
212
|
+
Z();
|
|
143
213
|
return;
|
|
144
214
|
}
|
|
145
|
-
const e =
|
|
146
|
-
|
|
215
|
+
const e = M.value[B.value];
|
|
216
|
+
d.value && (d.value.setSelectionRange(e.start, e.end), d.value.focus(), $(e.start));
|
|
147
217
|
}
|
|
148
|
-
function
|
|
149
|
-
|
|
218
|
+
function Z() {
|
|
219
|
+
M.value = [], B.value = -1;
|
|
150
220
|
}
|
|
151
|
-
function
|
|
152
|
-
const e =
|
|
153
|
-
let l = !1,
|
|
154
|
-
for (let
|
|
155
|
-
const
|
|
156
|
-
(
|
|
221
|
+
function Ke() {
|
|
222
|
+
const e = X.value, t = s.value;
|
|
223
|
+
let l = !1, n = null;
|
|
224
|
+
for (let f = 0; f < e; f++) {
|
|
225
|
+
const g = t[f], U = f > 0 ? t[f - 1] : "";
|
|
226
|
+
(g === '"' || g === "'") && U !== "\\" && (l ? g === n && (l = !1, n = null) : (l = !0, n = g));
|
|
157
227
|
}
|
|
158
228
|
return l;
|
|
159
229
|
}
|
|
160
|
-
function
|
|
161
|
-
const e =
|
|
230
|
+
function Ae() {
|
|
231
|
+
const e = X.value, t = s.value;
|
|
162
232
|
for (let l = e; l < t.length; l++)
|
|
163
233
|
if (t[l] === '"' || t[l] === "'") {
|
|
164
|
-
const
|
|
165
|
-
|
|
234
|
+
const n = l + 1;
|
|
235
|
+
d.value && (d.value.setSelectionRange(n, n), $(n));
|
|
166
236
|
return;
|
|
167
237
|
}
|
|
168
238
|
}
|
|
169
|
-
function
|
|
170
|
-
|
|
239
|
+
function ce() {
|
|
240
|
+
q.value = !0, V(() => {
|
|
241
|
+
F(), ie();
|
|
242
|
+
});
|
|
171
243
|
}
|
|
172
|
-
function
|
|
173
|
-
|
|
174
|
-
|
|
244
|
+
function ve(e) {
|
|
245
|
+
const l = e.relatedTarget;
|
|
246
|
+
if (l != null && l.closest(".tql-autocomplete-dropdown")) {
|
|
247
|
+
setTimeout(() => {
|
|
248
|
+
q.value || (K(), p.value = !1);
|
|
249
|
+
}, 300);
|
|
250
|
+
return;
|
|
251
|
+
}
|
|
252
|
+
q.value = !1, setTimeout(() => {
|
|
253
|
+
q.value || (K(), p.value = !1);
|
|
175
254
|
}, 200);
|
|
176
255
|
}
|
|
177
|
-
function
|
|
178
|
-
const t =
|
|
179
|
-
|
|
180
|
-
|
|
256
|
+
function Fe(e) {
|
|
257
|
+
const t = Pe(e);
|
|
258
|
+
s.value = t.query, b("update:modelValue", t.query), t.placeholders.length > 0 ? (M.value = t.placeholders, B.value = 0) : Z(), V(() => {
|
|
259
|
+
d.value && (d.value.focus(), d.value.setSelectionRange(t.newCursorPosition, t.newCursorPosition), $(t.newCursorPosition));
|
|
181
260
|
});
|
|
182
261
|
}
|
|
183
|
-
function
|
|
184
|
-
const t =
|
|
185
|
-
|
|
186
|
-
|
|
262
|
+
function Oe(e) {
|
|
263
|
+
const t = He(e);
|
|
264
|
+
s.value = t, b("update:modelValue", t), V(() => {
|
|
265
|
+
d.value && d.value.focus();
|
|
187
266
|
});
|
|
188
267
|
}
|
|
189
|
-
function
|
|
268
|
+
function Ne() {
|
|
190
269
|
var e;
|
|
191
|
-
(e =
|
|
270
|
+
(e = d.value) == null || e.focus();
|
|
192
271
|
}
|
|
193
|
-
function
|
|
272
|
+
function Ue() {
|
|
194
273
|
var e;
|
|
195
|
-
(e =
|
|
274
|
+
(e = d.value) == null || e.blur();
|
|
196
275
|
}
|
|
197
|
-
function
|
|
276
|
+
function fe() {
|
|
198
277
|
var e;
|
|
199
|
-
return ((e =
|
|
278
|
+
return ((e = d.value) == null ? void 0 : e.selectionStart) || 0;
|
|
200
279
|
}
|
|
201
|
-
function
|
|
202
|
-
|
|
280
|
+
function pe(e) {
|
|
281
|
+
d.value && (d.value.setSelectionRange(e, e), $(e));
|
|
203
282
|
}
|
|
204
|
-
function
|
|
205
|
-
const t =
|
|
206
|
-
|
|
207
|
-
|
|
283
|
+
function je(e) {
|
|
284
|
+
const t = fe(), l = s.value.substring(0, t), n = s.value.substring(t), f = l + e + n;
|
|
285
|
+
s.value = f, b("update:modelValue", f), V(() => {
|
|
286
|
+
pe(t + e.length);
|
|
208
287
|
});
|
|
209
288
|
}
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
289
|
+
function We(e) {
|
|
290
|
+
const l = Date.now() - e, n = Math.floor(l / 1e3), f = Math.floor(n / 60), g = Math.floor(f / 60), U = Math.floor(g / 24);
|
|
291
|
+
return U > 0 ? `${U}d ago` : g > 0 ? `${g}h ago` : f > 0 ? `${f}m ago` : "just now";
|
|
292
|
+
}
|
|
293
|
+
function he(e) {
|
|
294
|
+
var l;
|
|
295
|
+
const t = e.target;
|
|
296
|
+
(l = L.value) != null && l.contains(t) || (x.value = !1, C.value = !1);
|
|
297
|
+
}
|
|
298
|
+
we({
|
|
299
|
+
focus: Ne,
|
|
300
|
+
blur: Ue,
|
|
301
|
+
validate: Ve,
|
|
302
|
+
insertText: je,
|
|
303
|
+
insertSnippet: Oe,
|
|
304
|
+
getTokenAtPosition: $e,
|
|
305
|
+
getCursorPosition: fe,
|
|
306
|
+
setCursorPosition: pe
|
|
307
|
+
});
|
|
308
|
+
function N() {
|
|
309
|
+
(k.value || H.value) && q.value && F();
|
|
310
|
+
}
|
|
311
|
+
return Je(() => {
|
|
312
|
+
document.addEventListener("selectionchange", O), document.addEventListener("click", he), window.addEventListener("scroll", N, !0), window.addEventListener("resize", N), V(() => {
|
|
313
|
+
F();
|
|
314
|
+
});
|
|
315
|
+
}), ye(
|
|
316
|
+
() => H.value,
|
|
317
|
+
(e) => {
|
|
318
|
+
e && V(() => {
|
|
319
|
+
F();
|
|
320
|
+
});
|
|
321
|
+
},
|
|
322
|
+
{ immediate: !0 }
|
|
323
|
+
), Xe(() => {
|
|
324
|
+
document.removeEventListener("selectionchange", O), document.removeEventListener("click", he), window.removeEventListener("scroll", N, !0), window.removeEventListener("resize", N);
|
|
325
|
+
}), (e, t) => (i(), a("div", {
|
|
222
326
|
ref_key: "wrapperRef",
|
|
223
|
-
ref:
|
|
224
|
-
class:
|
|
327
|
+
ref: L,
|
|
328
|
+
class: w([
|
|
225
329
|
"tql-input-wrapper",
|
|
226
330
|
{
|
|
227
|
-
"tql-input-focused":
|
|
228
|
-
"tql-input-invalid":
|
|
229
|
-
"tql-input-disabled":
|
|
230
|
-
"tql-input-multiline":
|
|
331
|
+
"tql-input-focused": q.value,
|
|
332
|
+
"tql-input-invalid": u(H) && o.showValidation,
|
|
333
|
+
"tql-input-disabled": o.disabled,
|
|
334
|
+
"tql-input-multiline": o.multiline,
|
|
335
|
+
"tql-input-autocomplete-active": u(k),
|
|
336
|
+
"tql-input-resizable": o.resizable && o.multiline
|
|
231
337
|
}
|
|
232
|
-
])
|
|
338
|
+
]),
|
|
339
|
+
style: _(o.minHeight ? { minHeight: o.minHeight } : void 0)
|
|
233
340
|
}, [
|
|
234
|
-
|
|
235
|
-
(
|
|
236
|
-
key:
|
|
237
|
-
class:
|
|
238
|
-
},
|
|
239
|
-
])) :
|
|
240
|
-
|
|
341
|
+
o.syntaxHighlighting ? (i(), a("div", it, [
|
|
342
|
+
(i(!0), a(T, null, z(u(Se), (l, n) => (i(), a("span", {
|
|
343
|
+
key: n,
|
|
344
|
+
class: w(Le(l))
|
|
345
|
+
}, m(l.raw || l.value), 3))), 128))
|
|
346
|
+
])) : v("", !0),
|
|
347
|
+
o.multiline ? ee((i(), a("textarea", {
|
|
241
348
|
key: 1,
|
|
349
|
+
id: le,
|
|
242
350
|
ref_key: "inputRef",
|
|
243
|
-
ref:
|
|
244
|
-
"onUpdate:modelValue": t[0] || (t[0] = (l) =>
|
|
245
|
-
class:
|
|
246
|
-
placeholder:
|
|
247
|
-
disabled:
|
|
248
|
-
readonly:
|
|
249
|
-
rows:
|
|
351
|
+
ref: d,
|
|
352
|
+
"onUpdate:modelValue": t[0] || (t[0] = (l) => s.value = l),
|
|
353
|
+
class: w(["tql-input", { "tql-input-highlighted": o.syntaxHighlighting, "tql-input-resizable-textarea": o.resizable }]),
|
|
354
|
+
placeholder: o.placeholder,
|
|
355
|
+
disabled: o.disabled,
|
|
356
|
+
readonly: o.readonly,
|
|
357
|
+
rows: o.rows,
|
|
358
|
+
style: _(o.minHeight ? { minHeight: o.minHeight } : void 0),
|
|
359
|
+
role: "combobox",
|
|
360
|
+
"aria-expanded": u(k) && q.value,
|
|
361
|
+
"aria-controls": G,
|
|
362
|
+
"aria-invalid": u(H) && o.showValidation,
|
|
363
|
+
"aria-describedby": u(H) && p.value ? J : void 0,
|
|
364
|
+
"aria-autocomplete": "list",
|
|
365
|
+
"aria-haspopup": "listbox",
|
|
250
366
|
spellcheck: "false",
|
|
251
367
|
autocomplete: "off",
|
|
252
368
|
autocapitalize: "off",
|
|
253
|
-
onInput:
|
|
254
|
-
onKeydown:
|
|
255
|
-
onFocus:
|
|
256
|
-
onBlur:
|
|
257
|
-
onClick:
|
|
258
|
-
}, null,
|
|
259
|
-
[
|
|
260
|
-
]) :
|
|
369
|
+
onInput: re,
|
|
370
|
+
onKeydown: de,
|
|
371
|
+
onFocus: ce,
|
|
372
|
+
onBlur: ve,
|
|
373
|
+
onClick: O
|
|
374
|
+
}, null, 46, at)), [
|
|
375
|
+
[te, s.value]
|
|
376
|
+
]) : ee((i(), a("input", {
|
|
261
377
|
key: 2,
|
|
378
|
+
id: le,
|
|
262
379
|
ref_key: "inputRef",
|
|
263
|
-
ref:
|
|
264
|
-
"onUpdate:modelValue": t[1] || (t[1] = (l) =>
|
|
380
|
+
ref: d,
|
|
381
|
+
"onUpdate:modelValue": t[1] || (t[1] = (l) => s.value = l),
|
|
265
382
|
type: "text",
|
|
266
|
-
class:
|
|
267
|
-
placeholder:
|
|
268
|
-
disabled:
|
|
269
|
-
readonly:
|
|
383
|
+
class: w(["tql-input", { "tql-input-highlighted": o.syntaxHighlighting }]),
|
|
384
|
+
placeholder: o.placeholder,
|
|
385
|
+
disabled: o.disabled,
|
|
386
|
+
readonly: o.readonly,
|
|
387
|
+
role: "combobox",
|
|
388
|
+
"aria-expanded": u(k) && q.value,
|
|
389
|
+
"aria-controls": G,
|
|
390
|
+
"aria-invalid": u(H) && o.showValidation,
|
|
391
|
+
"aria-describedby": u(H) && p.value ? J : void 0,
|
|
392
|
+
"aria-autocomplete": "list",
|
|
393
|
+
"aria-haspopup": "listbox",
|
|
270
394
|
spellcheck: "false",
|
|
271
395
|
autocomplete: "off",
|
|
272
396
|
autocapitalize: "off",
|
|
273
|
-
onInput:
|
|
274
|
-
onKeydown:
|
|
275
|
-
onFocus:
|
|
276
|
-
onBlur:
|
|
277
|
-
onClick:
|
|
278
|
-
}, null, 42,
|
|
279
|
-
[
|
|
397
|
+
onInput: re,
|
|
398
|
+
onKeydown: de,
|
|
399
|
+
onFocus: ce,
|
|
400
|
+
onBlur: ve,
|
|
401
|
+
onClick: O
|
|
402
|
+
}, null, 42, nt)), [
|
|
403
|
+
[te, s.value]
|
|
280
404
|
]),
|
|
281
|
-
|
|
282
|
-
|
|
405
|
+
r("div", st, [
|
|
406
|
+
o.showComplexity && h.value && s.value.trim() ? (i(), a("div", {
|
|
407
|
+
key: 0,
|
|
408
|
+
class: w(["tql-complexity-badge", Ee.value]),
|
|
409
|
+
title: `${ae.value} complexity - ${h.value.warnings.length} warning(s)`
|
|
410
|
+
}, [
|
|
411
|
+
r("span", rt, m(ae.value), 1),
|
|
412
|
+
h.value.warnings.length > 0 ? (i(), a("span", dt, m(h.value.warnings.length), 1)) : v("", !0)
|
|
413
|
+
], 10, ut)) : v("", !0),
|
|
414
|
+
o.showHistory ? (i(), a("button", {
|
|
283
415
|
key: 1,
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
416
|
+
type: "button",
|
|
417
|
+
class: w(["tql-toolbar-button", { "tql-toolbar-button--active": x.value }]),
|
|
418
|
+
title: "Query history",
|
|
419
|
+
onClick: D(Te, ["stop"])
|
|
420
|
+
}, [...t[10] || (t[10] = [
|
|
421
|
+
r("i", { class: "pi pi-history" }, null, -1)
|
|
422
|
+
])], 2)) : v("", !0),
|
|
423
|
+
o.showPreview ? (i(), a("button", {
|
|
424
|
+
key: 2,
|
|
425
|
+
type: "button",
|
|
426
|
+
class: w(["tql-toolbar-button", { "tql-toolbar-button--active": C.value }]),
|
|
427
|
+
title: "Preview query structure",
|
|
428
|
+
onClick: D(De, ["stop"])
|
|
429
|
+
}, [...t[11] || (t[11] = [
|
|
430
|
+
r("i", { class: "pi pi-sitemap" }, null, -1)
|
|
431
|
+
])], 2)) : v("", !0),
|
|
432
|
+
o.showSnippetButton && o.snippets && o.snippets.length > 0 ? (i(), a("button", {
|
|
433
|
+
key: 3,
|
|
434
|
+
type: "button",
|
|
435
|
+
class: "tql-toolbar-button tql-snippet-button",
|
|
436
|
+
title: "Insert snippet",
|
|
437
|
+
onClick: t[2] || (t[2] = D(() => {
|
|
438
|
+
}, ["stop"]))
|
|
439
|
+
}, [...t[12] || (t[12] = [
|
|
440
|
+
r("i", { class: "pi pi-code" }, null, -1)
|
|
441
|
+
])])) : v("", !0),
|
|
442
|
+
o.showValidation && s.value ? (i(), a("div", ct, [
|
|
443
|
+
u(Y) ? (i(), a("i", vt)) : (i(), a("i", {
|
|
444
|
+
key: 1,
|
|
445
|
+
class: "pi pi-exclamation-circle tql-icon-invalid tql-icon-clickable",
|
|
446
|
+
role: "button",
|
|
447
|
+
tabindex: "0",
|
|
448
|
+
title: "Click to show/hide errors",
|
|
449
|
+
"aria-label": `Query has ${u(P).length} error${u(P).length === 1 ? "" : "s"}. Click to ${p.value ? "hide" : "show"} details.`,
|
|
450
|
+
"aria-expanded": p.value,
|
|
451
|
+
onClick: t[3] || (t[3] = (l) => p.value = !p.value),
|
|
452
|
+
onKeydown: [
|
|
453
|
+
t[4] || (t[4] = me((l) => p.value = !p.value, ["enter"])),
|
|
454
|
+
t[5] || (t[5] = me(D((l) => p.value = !p.value, ["prevent"]), ["space"]))
|
|
455
|
+
]
|
|
456
|
+
}, null, 40, ft))
|
|
457
|
+
])) : v("", !0)
|
|
458
|
+
]),
|
|
459
|
+
o.showHistory && x.value ? (i(), a("div", {
|
|
460
|
+
key: 3,
|
|
461
|
+
class: "tql-history-dropdown",
|
|
462
|
+
onClick: t[8] || (t[8] = D(() => {
|
|
298
463
|
}, ["stop"]))
|
|
299
|
-
}, [
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
464
|
+
}, [
|
|
465
|
+
r("div", pt, [
|
|
466
|
+
ee(r("input", {
|
|
467
|
+
"onUpdate:modelValue": t[6] || (t[6] = (l) => R.value = l),
|
|
468
|
+
type: "text",
|
|
469
|
+
class: "tql-history-search",
|
|
470
|
+
placeholder: "Search history...",
|
|
471
|
+
onKeydown: t[7] || (t[7] = D(() => {
|
|
472
|
+
}, ["stop"]))
|
|
473
|
+
}, null, 544), [
|
|
474
|
+
[te, R.value]
|
|
475
|
+
])
|
|
476
|
+
]),
|
|
477
|
+
r("div", ht, [
|
|
478
|
+
(i(!0), a(T, null, z(ne.value, (l) => (i(), a("div", {
|
|
479
|
+
key: l.id,
|
|
480
|
+
class: w(["tql-history-item", { "tql-history-item--favorite": l.isFavorite }]),
|
|
481
|
+
onClick: (n) => Re(l)
|
|
482
|
+
}, [
|
|
483
|
+
r("button", {
|
|
484
|
+
type: "button",
|
|
485
|
+
class: "tql-history-favorite",
|
|
486
|
+
title: l.isFavorite ? "Remove from favorites" : "Add to favorites",
|
|
487
|
+
onClick: (n) => Be(l, n)
|
|
488
|
+
}, [
|
|
489
|
+
r("i", {
|
|
490
|
+
class: w(l.isFavorite ? "pi pi-star-fill" : "pi pi-star")
|
|
491
|
+
}, null, 2)
|
|
492
|
+
], 8, mt),
|
|
493
|
+
r("div", gt, [
|
|
494
|
+
l.label ? (i(), a("div", wt, m(l.label), 1)) : v("", !0),
|
|
495
|
+
r("div", bt, m(l.query), 1)
|
|
496
|
+
]),
|
|
497
|
+
r("div", qt, m(We(l.timestamp)), 1)
|
|
498
|
+
], 10, yt))), 128)),
|
|
499
|
+
ne.value.length === 0 ? (i(), a("div", kt, m(R.value ? "No matching queries" : "No query history"), 1)) : v("", !0)
|
|
500
|
+
])
|
|
501
|
+
])) : v("", !0),
|
|
502
|
+
ge(_e, {
|
|
503
|
+
id: G,
|
|
303
504
|
ref_key: "autocompleteRef",
|
|
304
|
-
ref:
|
|
305
|
-
items:
|
|
306
|
-
visible:
|
|
307
|
-
position:
|
|
308
|
-
onSelect:
|
|
309
|
-
onClose:
|
|
505
|
+
ref: I,
|
|
506
|
+
items: u(Q),
|
|
507
|
+
visible: u(k) && q.value && Me.value,
|
|
508
|
+
position: A.value,
|
|
509
|
+
onSelect: Fe,
|
|
510
|
+
onClose: u(K)
|
|
310
511
|
}, null, 8, ["items", "visible", "position", "onClose"]),
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
key:
|
|
314
|
-
|
|
512
|
+
(i(), Ye(Ze, { to: "body" }, [
|
|
513
|
+
o.showValidation && !u(Y) && Ie.value && s.value && u(P).length > 0 && !(u(k) && u(Q).length > 0) ? (i(), a("div", {
|
|
514
|
+
key: 0,
|
|
515
|
+
id: J,
|
|
516
|
+
class: "tql-validation-messages-portal",
|
|
517
|
+
style: _(ze.value),
|
|
518
|
+
role: "alert",
|
|
519
|
+
"aria-live": "polite"
|
|
315
520
|
}, [
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
521
|
+
(i(!0), a(T, null, z(u(P).slice(0, 3), (l, n) => (i(), a("div", {
|
|
522
|
+
key: n,
|
|
523
|
+
class: "tql-error-message"
|
|
524
|
+
}, [
|
|
525
|
+
t[13] || (t[13] = r("i", {
|
|
526
|
+
class: "pi pi-exclamation-triangle",
|
|
527
|
+
"aria-hidden": "true"
|
|
528
|
+
}, null, -1)),
|
|
529
|
+
r("span", null, m(l.message), 1),
|
|
530
|
+
l.suggestion ? (i(), a("span", xt, m(l.suggestion), 1)) : v("", !0)
|
|
531
|
+
]))), 128))
|
|
532
|
+
], 4)) : v("", !0)
|
|
533
|
+
])),
|
|
534
|
+
o.showComplexity && h.value && h.value.warnings.length > 0 && !u(k) ? (i(), a("div", Ct, [
|
|
535
|
+
(i(!0), a(T, null, z(h.value.warnings.slice(0, 3), (l, n) => (i(), a("div", {
|
|
536
|
+
key: n,
|
|
537
|
+
class: w(["tql-complexity-warning", `tql-complexity-warning--${l.severity}`])
|
|
538
|
+
}, [
|
|
539
|
+
t[14] || (t[14] = r("i", {
|
|
540
|
+
class: "pi pi-info-circle",
|
|
541
|
+
"aria-hidden": "true"
|
|
542
|
+
}, null, -1)),
|
|
543
|
+
r("span", null, m(l.message), 1)
|
|
544
|
+
], 2))), 128)),
|
|
545
|
+
h.value.suggestions.length > 0 ? (i(), a("div", St, [
|
|
546
|
+
(i(!0), a(T, null, z(h.value.suggestions.slice(0, 2), (l, n) => (i(), a("div", {
|
|
547
|
+
key: n,
|
|
548
|
+
class: "tql-complexity-suggestion"
|
|
549
|
+
}, [
|
|
550
|
+
t[15] || (t[15] = r("i", {
|
|
551
|
+
class: "pi pi-lightbulb",
|
|
552
|
+
"aria-hidden": "true"
|
|
553
|
+
}, null, -1)),
|
|
554
|
+
r("span", null, m(l), 1)
|
|
555
|
+
]))), 128))
|
|
556
|
+
])) : v("", !0)
|
|
557
|
+
])) : v("", !0),
|
|
558
|
+
o.showPreview && C.value && s.value.trim() ? (i(), a("div", Vt, [
|
|
559
|
+
r("div", Pt, [
|
|
560
|
+
t[17] || (t[17] = r("span", null, "Query Structure", -1)),
|
|
561
|
+
r("button", {
|
|
562
|
+
type: "button",
|
|
563
|
+
class: "tql-preview-close",
|
|
564
|
+
title: "Close preview",
|
|
565
|
+
onClick: t[9] || (t[9] = (l) => C.value = !1)
|
|
566
|
+
}, [...t[16] || (t[16] = [
|
|
567
|
+
r("i", { class: "pi pi-times" }, null, -1)
|
|
568
|
+
])])
|
|
569
|
+
]),
|
|
570
|
+
ge(et, {
|
|
571
|
+
query: s.value,
|
|
572
|
+
"show-complexity": !1,
|
|
573
|
+
"show-field-usage": !0,
|
|
574
|
+
"show-logic-tree": !0,
|
|
575
|
+
compact: ""
|
|
576
|
+
}, null, 8, ["query"])
|
|
577
|
+
])) : v("", !0),
|
|
578
|
+
r("div", Ht, [
|
|
579
|
+
o.showValidation && s.value ? (i(), a(T, { key: 0 }, [
|
|
580
|
+
u(Y) ? (i(), a("span", $t, "Query syntax is valid")) : (i(), a("span", Et, "Query has " + m(u(P).length) + " validation error" + m(u(P).length === 1 ? "" : "s"), 1))
|
|
581
|
+
], 64)) : v("", !0)
|
|
582
|
+
])
|
|
583
|
+
], 6));
|
|
322
584
|
}
|
|
323
585
|
});
|
|
324
586
|
export {
|
|
325
|
-
|
|
587
|
+
zt as default
|
|
326
588
|
};
|