@tellaro/tql 0.1.9 → 0.1.11

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