@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.
@@ -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,109 @@ 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,
352
- // Reactive state for form validation
353
- isValid: W,
354
- hasErrors: T,
355
- errors: R
353
+ focus: tt,
354
+ blur: lt,
355
+ validate: Le,
356
+ insertText: ot,
357
+ insertSnippet: et,
358
+ getTokenAtPosition: Ae,
359
+ getCursorPosition: Se,
360
+ setCursorPosition: Ce,
361
+ // Reactive state for form validation. Getters, so the exposed value is live
362
+ // and matches TqlInputExpose; Vue would unwrap a ref here anyway.
363
+ get isValid() {
364
+ return G.value;
365
+ },
366
+ get hasErrors() {
367
+ return D.value;
368
+ },
369
+ get errors() {
370
+ return R.value;
371
+ }
356
372
  });
357
- function Z() {
358
- (x.value || T.value) && k.value && X();
373
+ function ee() {
374
+ (x.value || D.value) && k.value && Y();
359
375
  }
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);
376
+ return nt(() => {
377
+ 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(() => {
378
+ k.value && U.value > 0 && Date.now() - U.value >= Kt && !A.value && (A.value = !0);
363
379
  }, 500), S(() => {
364
- X();
380
+ Y();
365
381
  });
366
- }), ee(
367
- () => T.value,
382
+ }), le(
383
+ () => D.value,
368
384
  (e) => {
369
385
  e && S(() => {
370
- X();
386
+ Y();
371
387
  });
372
388
  },
373
389
  { immediate: !0 }
374
- ), ee(
390
+ ), le(
375
391
  B,
376
392
  (e) => {
377
393
  if (e && q.value) {
@@ -379,126 +395,136 @@ const ct = {
379
395
  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
396
  }
381
397
  }
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", {
398
+ ), st(() => {
399
+ document.removeEventListener("selectionchange", _), document.removeEventListener("click", Pe), window.removeEventListener("scroll", ee, !0), window.removeEventListener("resize", ee), j && (clearInterval(j), j = null);
400
+ }), (e, t) => (i(), n("div", {
385
401
  ref_key: "wrapperRef",
386
402
  ref: q,
387
403
  class: P([
388
404
  "tql-input-wrapper",
389
405
  {
390
406
  "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,
407
+ "tql-input-invalid": c(D) && a.showValidation,
408
+ "tql-input-disabled": a.disabled,
409
+ "tql-input-multiline": a.multiline,
394
410
  "tql-input-autocomplete-active": c(x),
395
- "tql-input-resizable": i.resizable && i.multiline,
396
- "tql-input-has-min-height": !!i.minHeight
411
+ "tql-input-resizable": a.resizable && a.multiline,
412
+ "tql-input-has-min-height": !!a.minHeight
397
413
  }
398
414
  ])
399
415
  }, [
400
- i.syntaxHighlighting ? (a(), n("div", ct, [
401
- (a(!0), n(M, null, F(c(Te), (l, u) => (a(), n("span", {
416
+ a.syntaxHighlighting ? (i(), n("div", {
417
+ key: 0,
418
+ ref_key: "highlightRef",
419
+ ref: ce,
420
+ class: "tql-highlight-layer",
421
+ "aria-hidden": "true"
422
+ }, [
423
+ (i(!0), n(L, null, N(c(Be), (l, u) => (i(), n("span", {
402
424
  key: u,
403
- class: P(Fe(l))
425
+ class: P(Ge(l))
404
426
  }, w(l.raw || l.value), 3))), 128))
405
- ])) : m("", !0),
406
- i.multiline ? ne((a(), n("textarea", {
427
+ ], 512)) : m("", !0),
428
+ a.multiline ? ue((i(), n("textarea", {
407
429
  key: 1,
408
- id: ue,
430
+ id: de,
409
431
  ref_key: "inputRef",
410
432
  ref: o,
411
433
  "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,
434
+ class: P(["tql-input", { "tql-input-highlighted": a.syntaxHighlighting, "tql-input-resizable-textarea": a.resizable }]),
435
+ placeholder: a.placeholder,
436
+ disabled: a.disabled,
437
+ readonly: a.readonly,
438
+ rows: a.rows,
417
439
  role: "combobox",
418
440
  "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,
441
+ "aria-controls": ie,
442
+ "aria-invalid": c(D) && a.showValidation,
443
+ "aria-describedby": c(D) && y.value ? ae : void 0,
422
444
  "aria-autocomplete": "list",
423
445
  "aria-haspopup": "listbox",
424
446
  spellcheck: "false",
425
447
  autocomplete: "off",
426
448
  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", {
449
+ onInput: we,
450
+ onKeydown: be,
451
+ onFocus: ke,
452
+ onBlur: xe,
453
+ onClick: _,
454
+ onSelect: ge,
455
+ onScroll: ye
456
+ }, null, 42, ht)), [
457
+ [re, s.value]
458
+ ]) : ue((i(), n("input", {
435
459
  key: 2,
436
- id: ue,
460
+ id: de,
437
461
  ref_key: "inputRef",
438
462
  ref: o,
439
463
  "onUpdate:modelValue": t[1] || (t[1] = (l) => s.value = l),
440
464
  type: "text",
441
- class: P(["tql-input", { "tql-input-highlighted": i.syntaxHighlighting }]),
442
- placeholder: i.placeholder,
443
- disabled: i.disabled,
444
- readonly: i.readonly,
465
+ class: P(["tql-input", { "tql-input-highlighted": a.syntaxHighlighting }]),
466
+ placeholder: a.placeholder,
467
+ disabled: a.disabled,
468
+ readonly: a.readonly,
445
469
  role: "combobox",
446
470
  "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,
471
+ "aria-controls": ie,
472
+ "aria-invalid": c(D) && a.showValidation,
473
+ "aria-describedby": c(D) && y.value ? ae : void 0,
450
474
  "aria-autocomplete": "list",
451
475
  "aria-haspopup": "listbox",
452
476
  spellcheck: "false",
453
477
  autocomplete: "off",
454
478
  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]
479
+ onInput: we,
480
+ onKeydown: be,
481
+ onFocus: ke,
482
+ onBlur: xe,
483
+ onClick: _,
484
+ onSelect: ge,
485
+ onScroll: ye
486
+ }, null, 42, mt)), [
487
+ [re, s.value]
462
488
  ]),
463
- d("div", ft, [
464
- i.showComplexity && g.value && s.value.trim() ? (a(), n("div", {
489
+ d("div", yt, [
490
+ a.showComplexity && g.value && s.value.trim() ? (i(), n("div", {
465
491
  key: 0,
466
- class: P(["tql-complexity-badge", Be.value]),
467
- title: `${ce.value} complexity - ${g.value.warnings.length} warning(s)`
492
+ class: P(["tql-complexity-badge", ze.value]),
493
+ title: `${fe.value} complexity - ${g.value.warnings.length} warning(s)`
468
494
  }, [
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", {
495
+ d("span", wt, w(fe.value), 1),
496
+ g.value.warnings.length > 0 ? (i(), n("span", bt, w(g.value.warnings.length), 1)) : m("", !0)
497
+ ], 10, gt)) : m("", !0),
498
+ a.showHistory ? (i(), n("button", {
473
499
  key: 1,
474
500
  type: "button",
475
501
  class: P(["tql-toolbar-button", { "tql-toolbar-button--active": V.value }]),
476
502
  title: "Query history",
477
- onClick: Q(Ae, ["stop"])
503
+ onClick: M(Fe, ["stop"])
478
504
  }, [...t[10] || (t[10] = [
479
505
  d("i", { class: "pi pi-history" }, null, -1)
480
506
  ])], 2)) : m("", !0),
481
- i.showPreview ? (a(), n("button", {
507
+ a.showPreview ? (i(), n("button", {
482
508
  key: 2,
483
509
  type: "button",
484
- class: P(["tql-toolbar-button", { "tql-toolbar-button--active": D.value }]),
510
+ class: P(["tql-toolbar-button", { "tql-toolbar-button--active": T.value }]),
485
511
  title: "Preview query structure",
486
- onClick: Q(Le, ["stop"])
512
+ onClick: M(Ne, ["stop"])
487
513
  }, [...t[11] || (t[11] = [
488
514
  d("i", { class: "pi pi-sitemap" }, null, -1)
489
515
  ])], 2)) : m("", !0),
490
- i.showSnippetButton && i.snippets && i.snippets.length > 0 ? (a(), n("button", {
516
+ a.showSnippetButton && a.snippets && a.snippets.length > 0 ? (i(), n("button", {
491
517
  key: 3,
492
518
  type: "button",
493
519
  class: "tql-toolbar-button tql-snippet-button",
494
520
  title: "Insert snippet",
495
- onClick: t[2] || (t[2] = Q(() => {
521
+ onClick: t[2] || (t[2] = M(() => {
496
522
  }, ["stop"]))
497
523
  }, [...t[12] || (t[12] = [
498
524
  d("i", { class: "pi pi-code" }, null, -1)
499
525
  ])])) : m("", !0),
500
- i.showValidation && s.value ? (a(), n("div", yt, [
501
- c(W) ? (a(), n("i", gt)) : (a(), n("i", {
526
+ a.showValidation && s.value ? (i(), n("div", qt, [
527
+ c(G) ? (i(), n("i", kt)) : (i(), n("i", {
502
528
  key: 1,
503
529
  class: "pi pi-exclamation-circle tql-icon-invalid tql-icon-clickable",
504
530
  role: "button",
@@ -508,76 +534,76 @@ const ct = {
508
534
  "aria-expanded": y.value,
509
535
  onClick: t[3] || (t[3] = (l) => y.value = !y.value),
510
536
  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"]))
537
+ t[4] || (t[4] = Ve((l) => y.value = !y.value, ["enter"])),
538
+ t[5] || (t[5] = Ve(M((l) => y.value = !y.value, ["prevent"]), ["space"]))
513
539
  ]
514
- }, null, 40, wt))
540
+ }, null, 40, xt))
515
541
  ])) : m("", !0)
516
542
  ]),
517
- i.showHistory && V.value ? (a(), n("div", {
543
+ a.showHistory && V.value ? (i(), n("div", {
518
544
  key: 3,
519
545
  class: "tql-history-dropdown",
520
- onClick: t[8] || (t[8] = Q(() => {
546
+ onClick: t[8] || (t[8] = M(() => {
521
547
  }, ["stop"]))
522
548
  }, [
523
- d("div", bt, [
524
- ne(d("input", {
525
- "onUpdate:modelValue": t[6] || (t[6] = (l) => I.value = l),
549
+ d("div", St, [
550
+ ue(d("input", {
551
+ "onUpdate:modelValue": t[6] || (t[6] = (l) => $.value = l),
526
552
  type: "text",
527
553
  class: "tql-history-search",
528
554
  placeholder: "Search history...",
529
- onKeydown: t[7] || (t[7] = Q(() => {
555
+ onKeydown: t[7] || (t[7] = M(() => {
530
556
  }, ["stop"]))
531
557
  }, null, 544), [
532
- [se, I.value]
558
+ [re, $.value]
533
559
  ])
534
560
  ]),
535
- d("div", qt, [
536
- (a(!0), n(M, null, F(de.value, (l) => (a(), n("div", {
561
+ d("div", Ct, [
562
+ (i(!0), n(L, null, N(pe.value, (l) => (i(), n("div", {
537
563
  key: l.id,
538
564
  class: P(["tql-history-item", { "tql-history-item--favorite": l.isFavorite }]),
539
- onClick: (u) => Me(l)
565
+ onClick: (u) => Ke(l)
540
566
  }, [
541
567
  d("button", {
542
568
  type: "button",
543
569
  class: "tql-history-favorite",
544
570
  title: l.isFavorite ? "Remove from favorites" : "Add to favorites",
545
- onClick: (u) => Qe(l, u)
571
+ onClick: (u) => Oe(l, u)
546
572
  }, [
547
573
  d("i", {
548
574
  class: P(l.isFavorite ? "pi pi-star-fill" : "pi pi-star")
549
575
  }, 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)
576
+ ], 8, Vt),
577
+ d("div", Tt, [
578
+ l.label ? (i(), n("div", Rt, w(l.label), 1)) : m("", !0),
579
+ d("div", Dt, w(l.query), 1)
554
580
  ]),
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)
581
+ d("div", It, w(it(l.timestamp)), 1)
582
+ ], 10, Pt))), 128)),
583
+ pe.value.length === 0 ? (i(), n("div", $t, w($.value ? "No matching queries" : "No query history"), 1)) : m("", !0)
558
584
  ])
559
585
  ])) : m("", !0),
560
- xe(it, {
561
- id: le,
586
+ Te(ct, {
587
+ id: ie,
562
588
  ref_key: "autocompleteRef",
563
- ref: A,
589
+ ref: Q,
564
590
  items: c(O),
565
- visible: c(x) && k.value && Ke.value,
566
- position: J.value,
567
- onSelect: Ge,
568
- onClose: c(G)
591
+ visible: c(x) && k.value && je.value,
592
+ position: X.value,
593
+ onSelect: _e,
594
+ onClose: c(J)
569
595
  }, 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", {
596
+ (i(), ut(rt, { to: "body" }, [
597
+ a.showValidation && !c(G) && Ue.value && s.value && c(R).length > 0 && !(c(x) && c(O).length > 0) && We.value ? (i(), n("div", {
572
598
  key: 0,
573
599
  ref_key: "validationMessagesRef",
574
600
  ref: B,
575
- id: oe,
601
+ id: ae,
576
602
  class: "tql-validation-messages-portal",
577
603
  role: "alert",
578
604
  "aria-live": "polite"
579
605
  }, [
580
- (a(!0), n(M, null, F(c(R).slice(0, 3), (l, u) => (a(), n("div", {
606
+ (i(!0), n(L, null, N(c(R).slice(0, 3), (l, u) => (i(), n("div", {
581
607
  key: u,
582
608
  class: "tql-error-message"
583
609
  }, [
@@ -586,12 +612,12 @@ const ct = {
586
612
  "aria-hidden": "true"
587
613
  }, null, -1)),
588
614
  d("span", null, w(l.message), 1),
589
- l.suggestion ? (a(), n("span", Rt, w(l.suggestion), 1)) : m("", !0)
615
+ l.suggestion ? (i(), n("span", Ht, w(l.suggestion), 1)) : m("", !0)
590
616
  ]))), 128))
591
617
  ], 512)) : m("", !0)
592
618
  ])),
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", {
619
+ a.showComplexity && g.value && g.value.warnings.length > 0 && !c(x) ? (i(), n("div", Et, [
620
+ (i(!0), n(L, null, N(g.value.warnings.slice(0, 3), (l, u) => (i(), n("div", {
595
621
  key: u,
596
622
  class: P(["tql-complexity-warning", `tql-complexity-warning--${l.severity}`])
597
623
  }, [
@@ -601,8 +627,8 @@ const ct = {
601
627
  }, null, -1)),
602
628
  d("span", null, w(l.message), 1)
603
629
  ], 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", {
630
+ g.value.suggestions.length > 0 ? (i(), n("div", Bt, [
631
+ (i(!0), n(L, null, N(g.value.suggestions.slice(0, 2), (l, u) => (i(), n("div", {
606
632
  key: u,
607
633
  class: "tql-complexity-suggestion"
608
634
  }, [
@@ -614,19 +640,19 @@ const ct = {
614
640
  ]))), 128))
615
641
  ])) : m("", !0)
616
642
  ])) : m("", !0),
617
- i.showPreview && D.value && s.value.trim() ? (a(), n("div", It, [
618
- d("div", Et, [
643
+ a.showPreview && T.value && s.value.trim() ? (i(), n("div", Lt, [
644
+ d("div", Mt, [
619
645
  t[17] || (t[17] = d("span", null, "Query Structure", -1)),
620
646
  d("button", {
621
647
  type: "button",
622
648
  class: "tql-preview-close",
623
649
  title: "Close preview",
624
- onClick: t[9] || (t[9] = (l) => D.value = !1)
650
+ onClick: t[9] || (t[9] = (l) => T.value = !1)
625
651
  }, [...t[16] || (t[16] = [
626
652
  d("i", { class: "pi pi-times" }, null, -1)
627
653
  ])])
628
654
  ]),
629
- xe(nt, {
655
+ Te(dt, {
630
656
  query: s.value,
631
657
  "show-complexity": !1,
632
658
  "show-field-usage": !0,
@@ -634,14 +660,14 @@ const ct = {
634
660
  compact: ""
635
661
  }, null, 8, ["query"])
636
662
  ])) : 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))
663
+ d("div", Qt, [
664
+ a.showValidation && s.value ? (i(), n(L, { key: 0 }, [
665
+ 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
666
  ], 64)) : m("", !0)
641
667
  ])
642
668
  ], 2));
643
669
  }
644
670
  });
645
671
  export {
646
- Nt as default
672
+ Gt as default
647
673
  };