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