lone-format 0.15.0 → 0.16.1

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,4 +1,4 @@
1
- import { defineComponent as H, computed as _, resolveComponent as z, createElementBlock as N, openBlock as C, createElementVNode as q, createCommentVNode as Y, normalizeClass as $, Fragment as U, renderList as D, createBlock as W, useCssVars as X, ref as R, watch as P, toDisplayString as Z } from "vue";
1
+ import { defineComponent as M, computed as q, resolveComponent as z, createElementBlock as N, openBlock as C, createElementVNode as _, createCommentVNode as Y, normalizeClass as $, Fragment as U, renderList as D, createBlock as W, useCssVars as X, ref as B, watch as P, toDisplayString as Z } from "vue";
2
2
  import { format as F, supportedDialects as ee } from "sql-formatter";
3
3
  import { _ as K } from "./_plugin-vue_export-helper-CHgC5LLL.js";
4
4
  const te = {
@@ -152,6 +152,56 @@ const te = {
152
152
  // 对齐线 - 灰色
153
153
  }
154
154
  }, re = {
155
+ name: "min-dark",
156
+ colors: {
157
+ // 背景色 - 极简暗色
158
+ background: "#111111",
159
+ surfaceBackground: "#1a1a1a",
160
+ hoverBackground: "#1f1f1f",
161
+ // 边框色 - 柔和深灰
162
+ border: "#2a2a2a",
163
+ // 文本色 - 柔和浅灰
164
+ text: "#e5e5e5",
165
+ textSecondary: "#a3a3a3",
166
+ // 按钮样式 - 简约暗色
167
+ buttonBackground: "#1f1f1f",
168
+ buttonBackgroundHover: "#2a2a2a",
169
+ buttonBorder: "#333333",
170
+ buttonText: "#e5e5e5",
171
+ buttonPrimary: "#3b82f6",
172
+ buttonPrimaryHover: "#2563eb",
173
+ // 状态指示 - 暗色可读性
174
+ success: "#22c55e",
175
+ successBackground: "#052e16",
176
+ error: "#f87171",
177
+ errorBackground: "#450a0a",
178
+ // SQL 语法高亮 - 极简暗色配色
179
+ sqlKeyword: "#4ade80",
180
+ // 关键字 - 绿色
181
+ sqlFunction: "#c084fc",
182
+ // 函数 - 紫色
183
+ sqlString: "#f87171",
184
+ // 字符串 - 红色
185
+ sqlNumber: "#60a5fa",
186
+ // 数字 - 蓝色
187
+ sqlComment: "#9ca3af",
188
+ // 注释 - 灰色
189
+ sqlOperator: "#f87171",
190
+ // 操作符 - 红色
191
+ sqlIdentifier: "#f3f4f6",
192
+ // 标识符 - 浅灰
193
+ sqlPunctuation: "#d1d5db",
194
+ // 标点 - 浅灰
195
+ // 折叠效果
196
+ collapsedBackground: "#1e293b",
197
+ // 折叠信息背景色 - 深蓝灰
198
+ collapsedText: "#60a5fa",
199
+ // 折叠信息文本色 - 蓝色
200
+ // 缩进指示线
201
+ indentLine: "#374151"
202
+ // 对齐线 - 深灰
203
+ }
204
+ }, oe = {
155
205
  name: "slack-ochin",
156
206
  colors: {
157
207
  // 背景色
@@ -201,12 +251,13 @@ const te = {
201
251
  indentLine: "#3e4348"
202
252
  // 对齐线 - 灰色
203
253
  }
204
- }, M = {
254
+ }, H = {
205
255
  "github-light": te,
206
256
  "github-dark": se,
207
257
  "min-light": ne,
208
- "slack-ochin": re
209
- }, le = (o) => M[o] || M["github-light"], j = [
258
+ "min-dark": re,
259
+ "slack-ochin": oe
260
+ }, le = (l) => H[l] || H["github-light"], j = [
210
261
  "SELECT",
211
262
  "FROM",
212
263
  "WHERE",
@@ -254,7 +305,7 @@ const te = {
254
305
  "THEN",
255
306
  "ELSE",
256
307
  "END"
257
- ], oe = [
308
+ ], ae = [
258
309
  "WITH",
259
310
  "SELECT",
260
311
  "FROM",
@@ -281,79 +332,79 @@ const te = {
281
332
  "UNION",
282
333
  "INTERSECT",
283
334
  "EXCEPT"
284
- ], A = "sql", ae = new Set(ee), Q = (o = A) => {
285
- const t = String(o).trim().toLowerCase();
286
- if (!ae.has(t))
287
- throw new Error(`Unsupported SQL dialect: ${o}`);
335
+ ], A = "sql", ce = new Set(ee), Q = (l = A) => {
336
+ const t = String(l).trim().toLowerCase();
337
+ if (!ce.has(t))
338
+ throw new Error(`Unsupported SQL dialect: ${l}`);
288
339
  return t;
289
- }, ce = (o, t = A) => {
340
+ }, ie = (l, t = A) => {
290
341
  try {
291
- if (!o || !o.trim())
342
+ if (!l || !l.trim())
292
343
  return { valid: !1, error: "SQL string is empty" };
293
- const e = o.toUpperCase().trim();
344
+ const e = l.toUpperCase().trim();
294
345
  if (!j.some((h) => new RegExp(`\\b${h}\\b`).test(e)))
295
346
  return { valid: !1, error: "No valid SQL keywords found" };
296
347
  let s = 0, u = !1, n = "";
297
- for (let h = 0; h < o.length; h++) {
298
- const r = o[h], d = h > 0 ? o[h - 1] : "";
348
+ for (let h = 0; h < l.length; h++) {
349
+ const r = l[h], d = h > 0 ? l[h - 1] : "";
299
350
  if ((r === "'" || r === '"') && d !== "\\" && (u ? r === n && (u = !1, n = "") : (u = !0, n = r)), !u && (r === "(" && s++, r === ")" && s--, s < 0))
300
351
  return { valid: !1, error: "Mismatched parentheses: unexpected closing parenthesis" };
301
352
  }
302
353
  if (s !== 0)
303
354
  return { valid: !1, error: `Mismatched parentheses: ${s} unclosed opening parenthesis` };
304
355
  const i = Q(t);
305
- return F(o, { language: i }), { valid: !0 };
356
+ return F(l, { language: i }), { valid: !0 };
306
357
  } catch (e) {
307
358
  return {
308
359
  valid: !1,
309
360
  error: e instanceof Error ? e.message : "Unknown validation error"
310
361
  };
311
362
  }
312
- }, ie = (o, t) => {
313
- const e = o.match(/\bVALUES\s*/i);
314
- if (!e || e.index === void 0) return o;
315
- const f = o.slice(0, e.index + e[0].length), s = o.slice(e.index + e[0].length), u = [];
363
+ }, ue = (l, t) => {
364
+ const e = l.match(/\bVALUES\s*/i);
365
+ if (!e || e.index === void 0) return l;
366
+ const f = l.slice(0, e.index + e[0].length), s = l.slice(e.index + e[0].length), u = [];
316
367
  let n = 0, i = "", h = !1, r = "", d = 0;
317
368
  for (; d < s.length; ) {
318
- const l = s[d], E = d > 0 ? s[d - 1] : "";
319
- if ((l === "'" || l === '"') && E !== "\\" && (h ? l === r && (h = !1) : (h = !0, r = l)), h)
320
- n > 0 && (i += l);
321
- else if (l === "(")
322
- n === 0 ? i = l : i += l, n++;
323
- else if (l === ")")
324
- i += l, n--, n === 0 && i.trim() && (u.push(i.trim()), i = "");
369
+ const o = s[d], k = d > 0 ? s[d - 1] : "";
370
+ if ((o === "'" || o === '"') && k !== "\\" && (h ? o === r && (h = !1) : (h = !0, r = o)), h)
371
+ n > 0 && (i += o);
372
+ else if (o === "(")
373
+ n === 0 ? i = o : i += o, n++;
374
+ else if (o === ")")
375
+ i += o, n--, n === 0 && i.trim() && (u.push(i.trim()), i = "");
325
376
  else {
326
- if (l === ";" && n === 0)
377
+ if (o === ";" && n === 0)
327
378
  break;
328
- n > 0 && (i += l);
379
+ n > 0 && (i += o);
329
380
  }
330
381
  d++;
331
382
  }
332
383
  if (u.length === 0)
333
- return o;
334
- const g = " ".repeat(t), v = u.map((l) => {
335
- const E = l.slice(1, -1), y = [];
384
+ return l;
385
+ const g = " ".repeat(t), v = u.map((o) => {
386
+ const k = o.slice(1, -1), E = [];
336
387
  let S = "", I = 0, L = !1, x = "";
337
- for (let c = 0; c < E.length; c++) {
338
- const b = E[c], k = c > 0 ? E[c - 1] : "";
339
- if ((b === "'" || b === '"') && k !== "\\" && (L ? b === x && (L = !1) : (L = !0, x = b)), !L && (b === "(" && I++, b === ")" && I--, b === "," && I === 0)) {
340
- y.push(S.trim()), S = "";
388
+ for (let c = 0; c < k.length; c++) {
389
+ const b = k[c], y = c > 0 ? k[c - 1] : "";
390
+ if ((b === "'" || b === '"') && y !== "\\" && (L ? b === x && (L = !1) : (L = !0, x = b)), !L && (b === "(" && I++, b === ")" && I--, b === "," && I === 0)) {
391
+ E.push(S.trim()), S = "";
341
392
  continue;
342
393
  }
343
394
  S += b;
344
395
  }
345
- S.trim() && y.push(S.trim());
346
- const O = y.map((c, b) => {
347
- const k = b < y.length - 1 ? "," : "";
348
- return `${g}${g}${c}${k}`;
396
+ S.trim() && E.push(S.trim());
397
+ const O = E.map((c, b) => {
398
+ const y = b < E.length - 1 ? "," : "";
399
+ return `${g}${g}${c}${y}`;
349
400
  }).join(`
350
401
  `);
351
402
  return `${g}(
352
403
  ${O}
353
404
  ${g})`;
354
- }), m = v.map((l, E) => {
355
- const y = E < v.length - 1 ? "," : ";";
356
- return l + y;
405
+ }), m = v.map((o, k) => {
406
+ const E = k < v.length - 1 ? "," : ";";
407
+ return o + E;
357
408
  }).join(`
358
409
  `);
359
410
  let a = d;
@@ -361,10 +412,10 @@ ${g})`;
361
412
  const p = s.slice(a);
362
413
  return f.trimEnd() + `
363
414
  ` + m + p;
364
- }, V = (o, t) => {
415
+ }, V = (l, t) => {
365
416
  try {
366
417
  const e = Q(t?.dialect ?? A), f = t?.tabWidth || 2, s = t?.keywordCase || "upper", u = t?.useTabs || !1, n = t?.linesBetweenQueries || 1;
367
- let i = F(o, {
418
+ let i = F(l, {
368
419
  language: e,
369
420
  tabWidth: f,
370
421
  keywordCase: s,
@@ -373,23 +424,23 @@ ${g})`;
373
424
  // 其他默认配置
374
425
  indentStyle: "standard"
375
426
  });
376
- return /\bINSERT\s+INTO\b/i.test(i) && /\bVALUES\b/i.test(i) && (i = ie(i, f)), i;
427
+ return /\bINSERT\s+INTO\b/i.test(i) && /\bVALUES\b/i.test(i) && (i = ue(i, f)), i;
377
428
  } catch (e) {
378
429
  const f = e instanceof Error ? e.message : "Unknown formatting error";
379
430
  throw new Error(`SQL formatting error: ${f}`);
380
431
  }
381
- }, ue = (o) => {
432
+ }, de = (l) => {
382
433
  try {
383
434
  const t = [];
384
- let e = o.replace(/(["'])(?:(?=(\\?))\2.)*?\1/g, (f) => (t.push(f), `__STR_${t.length - 1}__`));
435
+ let e = l.replace(/(["'])(?:(?=(\\?))\2.)*?\1/g, (f) => (t.push(f), `__STR_${t.length - 1}__`));
385
436
  return e = e.replace(/--[^\n]*/g, "").replace(/\/\*[\s\S]*?\*\//g, ""), e = e.replace(/\s+/g, " ").trim(), t.forEach((f, s) => {
386
437
  e = e.replace(`__STR_${s}__`, f);
387
438
  }), e;
388
439
  } catch (t) {
389
- return console.error("SQL compression error:", t), o;
440
+ return console.error("SQL compression error:", t), l;
390
441
  }
391
- }, de = (o, t) => {
392
- const e = [], f = o.match(/^(.*?\bVALUES\b)/is);
442
+ }, fe = (l, t) => {
443
+ const e = [], f = l.match(/^(.*?\bVALUES\b)/is);
393
444
  if (!f) return [];
394
445
  const s = f[1].trim();
395
446
  e.push({
@@ -399,7 +450,7 @@ ${g})`;
399
450
  collapsible: !1,
400
451
  path: `clause-${t}`
401
452
  });
402
- let n = o.slice(f[1].length).trim(), i = 0, h = 0, r = "", d = !1, g = "";
453
+ let n = l.slice(f[1].length).trim(), i = 0, h = 0, r = "", d = !1, g = "";
403
454
  for (let v = 0; v < n.length; v++) {
404
455
  const m = n[v], a = v > 0 ? n[v - 1] : "";
405
456
  if ((m === "'" || m === '"') && a !== "\\" && (d ? m === g && (d = !1) : (d = !0, g = m)), d)
@@ -410,36 +461,36 @@ ${g})`;
410
461
  h++, r += m;
411
462
  else if (m === ")") {
412
463
  if (r += m, h--, h === 0) {
413
- let p = v + 1, l = "";
464
+ let p = v + 1, o = "";
414
465
  for (; p < n.length; ) {
415
- const y = n[p];
416
- if (y === "," || y === ";") {
417
- l = y;
466
+ const E = n[p];
467
+ if (E === "," || E === ";") {
468
+ o = E;
418
469
  break;
419
- } else if (!/\s/.test(y))
470
+ } else if (!/\s/.test(E))
420
471
  break;
421
472
  p++;
422
473
  }
423
- const E = r.trim();
424
- E && (e.push({
474
+ const k = r.trim();
475
+ k && (e.push({
425
476
  type: "VALUE_TUPLE",
426
- content: E + l,
427
- raw: E + l,
477
+ content: k + o,
478
+ raw: k + o,
428
479
  collapsible: !0,
429
480
  path: `clause-${t}-value-${i}`
430
- }), i++), r = "", l && (v = p);
481
+ }), i++), r = "", o && (v = p);
431
482
  }
432
483
  } else h > 0 && (r += m);
433
484
  }
434
485
  return e;
435
- }, fe = (o, t) => /\n\s*ON\b/i.test(t) ? t : t.replace(
486
+ }, pe = (l, t) => /\n\s*ON\b/i.test(t) ? t : t.replace(
436
487
  /^(\s*)((?:INNER|LEFT|RIGHT|FULL|CROSS|OUTER)?\s*JOIN\b[^\n]*?)\s+ON\b\s*/gim,
437
488
  `$1$2
438
489
  $1ON `
439
- ), pe = (o) => {
490
+ ), he = (l) => {
440
491
  let t = 0, e = !1, f = "";
441
- for (let s = 0; s < o.length; s++) {
442
- const u = o[s], n = s > 0 ? o[s - 1] : "";
492
+ for (let s = 0; s < l.length; s++) {
493
+ const u = l[s], n = s > 0 ? l[s - 1] : "";
443
494
  if ((u === "'" || u === '"') && n !== "\\") {
444
495
  e ? u === f && (e = !1, f = "") : (e = !0, f = u);
445
496
  continue;
@@ -447,11 +498,11 @@ $1ON `
447
498
  e || (u === "(" && t++, u === ")" && t--);
448
499
  }
449
500
  return t;
450
- }, he = (o) => {
501
+ }, me = (l) => {
451
502
  const t = [];
452
503
  let e = 0, f = -1, s = !1, u = "";
453
- for (let n = 0; n < o.length; n++) {
454
- const i = o[n], h = n > 0 ? o[n - 1] : "";
504
+ for (let n = 0; n < l.length; n++) {
505
+ const i = l[n], h = n > 0 ? l[n - 1] : "";
455
506
  if ((i === "'" || i === '"') && h !== "\\") {
456
507
  s ? i === u && (s = !1, u = "") : (s = !0, u = i);
457
508
  continue;
@@ -459,11 +510,11 @@ $1ON `
459
510
  s || (i === "(" ? (e === 0 && (f = n), e++) : i === ")" && (e--, e === 0 && f >= 0 && (t.push({ open: f, close: n }), f = -1)));
460
511
  }
461
512
  return t;
462
- }, me = (o) => {
463
- const t = o.trim();
464
- return t ? /^(SELECT|WITH)\b/i.test(t) ? !0 : /\n\s*(SELECT|FROM|WHERE|JOIN|UNION|INTERSECT|EXCEPT)\b/i.test(o) : !1;
465
- }, ge = (o) => {
466
- const t = o.content.split(`
513
+ }, ge = (l) => {
514
+ const t = l.trim();
515
+ return t ? /^(SELECT|WITH)\b/i.test(t) ? !0 : /\n\s*(SELECT|FROM|WHERE|JOIN|UNION|INTERSECT|EXCEPT)\b/i.test(l) : !1;
516
+ }, be = (l) => {
517
+ const t = l.content.split(`
467
518
  `);
468
519
  let e = -1;
469
520
  for (let r = 0; r < t.length; r++)
@@ -475,30 +526,30 @@ $1ON `
475
526
  const f = t.slice(e + 1).join(`
476
527
  `);
477
528
  if (!f) return;
478
- const u = he(f).filter(
479
- (r) => me(f.slice(r.open + 1, r.close))
529
+ const u = me(f).filter(
530
+ (r) => ge(f.slice(r.open + 1, r.close))
480
531
  );
481
532
  if (u.length === 0) return;
482
533
  const n = [];
483
534
  let i = 0;
484
- const h = o.path || "clause";
535
+ const h = l.path || "clause";
485
536
  u.forEach((r, d) => {
486
537
  r.open + 1 > i && n.push({ kind: "text", text: f.slice(i, r.open + 1) });
487
538
  const g = f.lastIndexOf(`
488
539
  `, r.close - 1) + 1, v = g > r.open, m = v ? g - 1 : r.close, a = f.slice(r.open + 1, m), p = J(a, `${h}-sub${d}-`);
489
- for (const l of p)
490
- n.push({ kind: "clause", clause: l });
540
+ for (const o of p)
541
+ n.push({ kind: "clause", clause: o });
491
542
  i = v ? g : r.close;
492
- }), i < f.length && n.push({ kind: "text", text: f.slice(i) }), o.body = n;
493
- }, J = (o, t) => {
494
- const e = [], f = o.split(`
543
+ }), i < f.length && n.push({ kind: "text", text: f.slice(i) }), l.body = n;
544
+ }, J = (l, t) => {
545
+ const e = [], f = l.split(`
495
546
  `);
496
547
  let s = null, u = [], n = [], i = 0;
497
- const h = [...oe].sort((d, g) => g.length - d.length), r = () => {
548
+ const h = [...ae].sort((d, g) => g.length - d.length), r = () => {
498
549
  if (!s || u.length === 0) return;
499
550
  let d = u.join(`
500
551
  `);
501
- if (d = fe(s.type, d), s.content = d, s.raw = d, s.type === "INSERT INTO" && /\bVALUES\b/i.test(d)) {
552
+ if (d = pe(s.type, d), s.content = d, s.raw = d, s.type === "INSERT INTO" && /\bVALUES\b/i.test(d)) {
502
553
  const g = d.match(/^(.*?\bINSERT\s+INTO\s+[^(]+\s*\([^)]+\))/is);
503
554
  if (g) {
504
555
  const v = {
@@ -509,14 +560,14 @@ $1ON `
509
560
  path: `${t}clause-${e.length}`
510
561
  };
511
562
  e.push(v);
512
- const m = d.slice(g[1].length).trim(), a = e.length, p = de(m, a);
513
- for (let l = 0; l < p.length; l++)
514
- p[l].path = `${t}clause-${a + l}`;
563
+ const m = d.slice(g[1].length).trim(), a = e.length, p = fe(m, a);
564
+ for (let o = 0; o < p.length; o++)
565
+ p[o].path = `${t}clause-${a + o}`;
515
566
  e.push(...p);
516
567
  return;
517
568
  }
518
569
  }
519
- ge(s), e.push(s);
570
+ be(s), e.push(s);
520
571
  };
521
572
  for (const d of f) {
522
573
  const g = d.trim();
@@ -556,7 +607,7 @@ $1ON `
556
607
  raw: "",
557
608
  collapsible: !1,
558
609
  path: `${t}clause-${e.length}`
559
- }), i = Math.max(0, i + pe(d));
610
+ }), i = Math.max(0, i + he(d));
560
611
  }
561
612
  return r(), n.length > 0 && e.push({
562
613
  type: "UNKNOWN",
@@ -567,12 +618,12 @@ $1ON `
567
618
  collapsible: !1,
568
619
  path: `${t}clause-${e.length}`
569
620
  }), e;
570
- }, be = (o, t = A) => {
571
- const e = V(o, { dialect: t, keywordCase: "upper" });
572
- return { clauses: J(e, ""), raw: o };
573
- }, G = (o) => {
621
+ }, ve = (l, t = A) => {
622
+ const e = V(l, { dialect: t, keywordCase: "upper" });
623
+ return { clauses: J(e, ""), raw: l };
624
+ }, G = (l) => {
574
625
  const t = [];
575
- let e = o;
626
+ let e = l;
576
627
  const f = [
577
628
  "COUNT",
578
629
  "SUM",
@@ -646,10 +697,10 @@ $1ON `
646
697
  t.push({ type: "punctuation", value: e[0] }), e = e.slice(1);
647
698
  }
648
699
  return t;
649
- }, ve = { class: "sql-clause-node" }, Ee = ["title"], ye = { class: "sql-clause-node__code" }, ke = ["innerHTML"], Se = {
700
+ }, ke = { class: "sql-clause-node" }, Ee = ["title"], ye = { class: "sql-clause-node__code" }, Se = ["innerHTML"], Te = {
650
701
  key: 0,
651
702
  class: "sql-clause-node__body"
652
- }, Te = ["title"], Ce = ["innerHTML"], Ne = ["title"], _e = ["innerHTML"], qe = /* @__PURE__ */ H({
703
+ }, Ce = ["title"], Ne = ["innerHTML"], qe = ["title"], _e = ["innerHTML"], Ie = /* @__PURE__ */ M({
653
704
  __name: "SqlClauseNode",
654
705
  props: {
655
706
  clause: {},
@@ -657,98 +708,98 @@ $1ON `
657
708
  theme: {}
658
709
  },
659
710
  emits: ["toggle"],
660
- setup(o, { emit: t }) {
661
- const e = o, f = t, s = _(() => e.clause.path || ""), u = _(() => e.expandedClauses.has(s.value)), n = _(() => {
711
+ setup(l, { emit: t }) {
712
+ const e = l, f = t, s = q(() => e.clause.path || ""), u = q(() => e.expandedClauses.has(s.value)), n = q(() => {
662
713
  const a = e.clause.content.split(`
663
714
  `);
664
715
  for (const p of a)
665
716
  if (p.trim()) return p;
666
717
  return "";
667
- }), i = _(() => {
718
+ }), i = q(() => {
668
719
  const a = e.clause.content.split(`
669
720
  `);
670
721
  if (a.length <= 1) return "";
671
722
  let p = 0;
672
- for (let l = 0; l < a.length; l++)
673
- if (a[l].trim()) {
674
- p = l;
723
+ for (let o = 0; o < a.length; o++)
724
+ if (a[o].trim()) {
725
+ p = o;
675
726
  break;
676
727
  }
677
728
  return a.slice(p + 1).join(`
678
729
  `);
679
- }), h = _(() => e.clause.body && e.clause.body.length > 0 ? !0 : !!i.value), r = (a) => {
680
- const p = G(a), l = e.theme.colors;
681
- return p.map((E) => {
682
- let y = l.text;
683
- switch (E.type) {
730
+ }), h = q(() => e.clause.body && e.clause.body.length > 0 ? !0 : !!i.value), r = (a) => {
731
+ const p = G(a), o = e.theme.colors;
732
+ return p.map((k) => {
733
+ let E = o.text;
734
+ switch (k.type) {
684
735
  case "keyword":
685
- y = l.sqlKeyword;
736
+ E = o.sqlKeyword;
686
737
  break;
687
738
  case "function":
688
- y = l.sqlFunction;
739
+ E = o.sqlFunction;
689
740
  break;
690
741
  case "string":
691
- y = l.sqlString;
742
+ E = o.sqlString;
692
743
  break;
693
744
  case "number":
694
- y = l.sqlNumber;
745
+ E = o.sqlNumber;
695
746
  break;
696
747
  case "comment":
697
- y = l.sqlComment;
748
+ E = o.sqlComment;
698
749
  break;
699
750
  case "operator":
700
- y = l.sqlOperator;
751
+ E = o.sqlOperator;
701
752
  break;
702
753
  case "identifier":
703
- y = l.sqlIdentifier;
754
+ E = o.sqlIdentifier;
704
755
  break;
705
756
  case "punctuation":
706
- y = l.sqlPunctuation;
757
+ E = o.sqlPunctuation;
707
758
  break;
708
759
  case "whitespace":
709
- return E.value.replace(/ /g, "&nbsp;").replace(/\n/g, `
760
+ return k.value.replace(/ /g, "&nbsp;").replace(/\n/g, `
710
761
  `);
711
762
  }
712
- const S = E.value.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#039;");
713
- return `<span style="color: ${y}">${S}</span>`;
763
+ const S = k.value.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#039;");
764
+ return `<span style="color: ${E}">${S}</span>`;
714
765
  }).join("");
715
- }, d = _(() => {
766
+ }, d = q(() => {
716
767
  const a = e.clause.body;
717
768
  if (!a || a.length === 0) return null;
718
- let p = "", l = !1;
769
+ let p = "", o = !1;
719
770
  for (const c of a)
720
771
  if (c.kind === "text") {
721
772
  const b = c.text.indexOf("(");
722
773
  if (b >= 0) {
723
- p += c.text.slice(0, b), l = !0;
774
+ p += c.text.slice(0, b), o = !0;
724
775
  break;
725
776
  }
726
777
  p += c.text;
727
778
  } else
728
779
  return null;
729
- if (!l) return null;
730
- let E = "";
780
+ if (!o) return null;
781
+ let k = "";
731
782
  for (let c = a.length - 1; c >= 0; c--) {
732
783
  const b = a[c];
733
784
  if (b.kind === "text") {
734
- const k = b.text.lastIndexOf(")");
735
- if (k >= 0) {
736
- E = b.text.slice(k + 1) + E;
785
+ const y = b.text.lastIndexOf(")");
786
+ if (y >= 0) {
787
+ k = b.text.slice(y + 1) + k;
737
788
  break;
738
789
  }
739
- E = b.text + E;
790
+ k = b.text + k;
740
791
  } else
741
792
  break;
742
793
  }
743
- const y = p.replace(/\s+/g, " ").trim(), S = E.replace(/\s+/g, " ").trim(), I = n.value, L = (I.match(/^\s*/) || [""])[0], O = [I.trimStart()];
744
- return y && O.push(y), O.push("(...)"), S && O.push(S), `${L}${O.join(" ")}`;
745
- }), g = _(() => {
794
+ const E = p.replace(/\s+/g, " ").trim(), S = k.replace(/\s+/g, " ").trim(), I = n.value, L = (I.match(/^\s*/) || [""])[0], O = [I.trimStart()];
795
+ return E && O.push(E), O.push("(...)"), S && O.push(S), `${L}${O.join(" ")}`;
796
+ }), g = q(() => {
746
797
  if (e.clause.collapsible && !u.value && h.value) {
747
798
  const a = d.value;
748
799
  if (a)
749
800
  return r(a);
750
- const p = r(n.value), l = e.theme.colors.textSecondary;
751
- return `${p}<span style="color: ${l}; opacity: 0.6; font-style: italic; margin-left: 4px;"> ...</span>`;
801
+ const p = r(n.value), o = e.theme.colors.textSecondary;
802
+ return `${p}<span style="color: ${o}; opacity: 0.6; font-style: italic; margin-left: 4px;"> ...</span>`;
752
803
  }
753
804
  return r(n.value);
754
805
  }), v = () => {
@@ -757,35 +808,35 @@ $1ON `
757
808
  if (!e.clause.collapsible) return;
758
809
  const p = a.target;
759
810
  if (!p) return;
760
- const l = (p.textContent || "").trim();
761
- (l === "(" || l === ")") && f("toggle", s.value);
811
+ const o = (p.textContent || "").trim();
812
+ (o === "(" || o === ")") && f("toggle", s.value);
762
813
  };
763
814
  return (a, p) => {
764
- const l = z("SqlClauseNode", !0);
765
- return C(), N("div", ve, [
766
- q("div", {
815
+ const o = z("SqlClauseNode", !0);
816
+ return C(), N("div", ke, [
817
+ _("div", {
767
818
  class: $(["sql-clause-node__header", { "sql-clause-node__header--collapsible": a.clause.collapsible }]),
768
819
  title: a.clause.collapsible ? u.value ? "Click to collapse" : "Click to expand" : "",
769
820
  onClick: v
770
821
  }, [
771
- q("pre", ye, [
772
- q("code", { innerHTML: g.value }, null, 8, ke)
822
+ _("pre", ye, [
823
+ _("code", { innerHTML: g.value }, null, 8, Se)
773
824
  ])
774
825
  ], 10, Ee),
775
- u.value && h.value ? (C(), N("div", Se, [
776
- a.clause.body && a.clause.body.length > 0 ? (C(!0), N(U, { key: 0 }, D(a.clause.body, (E, y) => (C(), N(U, { key: y }, [
777
- E.kind === "text" ? (C(), N("pre", {
826
+ u.value && h.value ? (C(), N("div", Te, [
827
+ a.clause.body && a.clause.body.length > 0 ? (C(!0), N(U, { key: 0 }, D(a.clause.body, (k, E) => (C(), N(U, { key: E }, [
828
+ k.kind === "text" ? (C(), N("pre", {
778
829
  key: 0,
779
830
  class: $(["sql-clause-node__code sql-clause-node__text-segment", { "sql-clause-node__text-segment--clickable": a.clause.collapsible }]),
780
831
  title: a.clause.collapsible ? "Click ( or ) to collapse" : "",
781
832
  onClick: p[0] || (p[0] = (S) => m(S))
782
833
  }, [
783
- q("code", {
784
- innerHTML: r(E.text)
785
- }, null, 8, Ce)
786
- ], 10, Te)) : (C(), W(l, {
834
+ _("code", {
835
+ innerHTML: r(k.text)
836
+ }, null, 8, Ne)
837
+ ], 10, Ce)) : (C(), W(o, {
787
838
  key: 1,
788
- clause: E.clause,
839
+ clause: k.clause,
789
840
  "expanded-clauses": a.expandedClauses,
790
841
  theme: a.theme,
791
842
  onToggle: p[1] || (p[1] = (S) => a.$emit("toggle", S))
@@ -794,29 +845,29 @@ $1ON `
794
845
  key: 1,
795
846
  class: $(["sql-clause-node__code sql-clause-node__rest", { "sql-clause-node__rest--clickable": a.clause.collapsible }]),
796
847
  title: a.clause.collapsible ? "Click ( or ) to collapse" : "",
797
- onClick: p[2] || (p[2] = (E) => m(E))
848
+ onClick: p[2] || (p[2] = (k) => m(k))
798
849
  }, [
799
- q("code", {
850
+ _("code", {
800
851
  innerHTML: r(i.value)
801
852
  }, null, 8, _e)
802
- ], 10, Ne))
853
+ ], 10, qe))
803
854
  ])) : Y("", !0)
804
855
  ]);
805
856
  };
806
857
  }
807
- }), Ie = /* @__PURE__ */ K(qe, [["__scopeId", "data-v-8b9383dc"]]), Le = { class: "sql-format__content" }, Oe = {
858
+ }), Le = /* @__PURE__ */ K(Ie, [["__scopeId", "data-v-8b9383dc"]]), Oe = { class: "sql-format__content" }, xe = {
808
859
  key: 0,
809
860
  class: "sql-format__error"
810
- }, xe = {
861
+ }, we = {
811
862
  key: 1,
812
863
  class: "sql-format__viewer"
813
- }, we = {
864
+ }, Be = {
814
865
  key: 0,
815
866
  class: "sql-format__clauses"
816
867
  }, Re = {
817
868
  key: 1,
818
869
  class: "sql-format__code"
819
- }, Be = ["innerHTML"], $e = /* @__PURE__ */ H({
870
+ }, $e = ["innerHTML"], Ae = /* @__PURE__ */ M({
820
871
  __name: "index",
821
872
  props: {
822
873
  modelValue: { default: "" },
@@ -826,7 +877,7 @@ $1ON `
826
877
  tabWidth: { default: 2 }
827
878
  },
828
879
  emits: ["update:modelValue", "copy-success", "copy-error", "expand-all", "collapse-all", "compress", "format"],
829
- setup(o, { expose: t, emit: e }) {
880
+ setup(l, { expose: t, emit: e }) {
830
881
  X((c) => ({
831
882
  eb378acc: v.value.colors.background,
832
883
  f6f4a8ce: v.value.colors.text,
@@ -834,78 +885,78 @@ $1ON `
834
885
  "0b62391c": v.value.colors.error
835
886
  }));
836
887
  const f = (c) => {
837
- const b = [], k = (w) => {
888
+ const b = [], y = (w) => {
838
889
  for (const T of w)
839
890
  if (T.path && b.push(T.path), T.body)
840
- for (const B of T.body)
841
- B.kind === "clause" && k([B.clause]);
891
+ for (const R of T.body)
892
+ R.kind === "clause" && y([R.clause]);
842
893
  };
843
- return k(c), b;
844
- }, s = o, u = e, n = R(""), i = R(s.dialect), h = R([]), r = R(/* @__PURE__ */ new Set()), d = R(""), g = _(() => n.value === ""), v = _(() => le(s.theme)), m = (c) => {
894
+ return y(c), b;
895
+ }, s = l, u = e, n = B(""), i = B(s.dialect), h = B([]), r = B(/* @__PURE__ */ new Set()), d = B(""), g = q(() => n.value === ""), v = q(() => le(s.theme)), m = (c) => {
845
896
  if (!c || !c.trim()) {
846
897
  n.value = "", h.value = [], r.value.clear();
847
898
  return;
848
899
  }
849
900
  try {
850
- const b = ce(c, i.value);
901
+ const b = ie(c, i.value);
851
902
  if (!b.valid) {
852
903
  n.value = b.error || "Invalid SQL", h.value = [], d.value = "";
853
904
  return;
854
905
  }
855
- const k = be(c, i.value);
856
- h.value = k.clauses, d.value = V(c, {
906
+ const y = ve(c, i.value);
907
+ h.value = y.clauses, d.value = V(c, {
857
908
  dialect: i.value,
858
909
  tabWidth: s.tabWidth
859
- }), r.value = new Set(f(k.clauses)), n.value = "";
910
+ }), r.value = new Set(f(y.clauses)), n.value = "";
860
911
  } catch (b) {
861
912
  n.value = b instanceof Error ? b.message : "Unknown parse error", h.value = [], d.value = "";
862
913
  }
863
914
  }, a = (c) => {
864
- const b = G(c), k = v.value.colors;
915
+ const b = G(c), y = v.value.colors;
865
916
  return b.map((w) => {
866
- let T = k.text;
917
+ let T = y.text;
867
918
  switch (w.type) {
868
919
  case "keyword":
869
- T = k.sqlKeyword;
920
+ T = y.sqlKeyword;
870
921
  break;
871
922
  case "function":
872
- T = k.sqlFunction;
923
+ T = y.sqlFunction;
873
924
  break;
874
925
  case "string":
875
- T = k.sqlString;
926
+ T = y.sqlString;
876
927
  break;
877
928
  case "number":
878
- T = k.sqlNumber;
929
+ T = y.sqlNumber;
879
930
  break;
880
931
  case "comment":
881
- T = k.sqlComment;
932
+ T = y.sqlComment;
882
933
  break;
883
934
  case "operator":
884
- T = k.sqlOperator;
935
+ T = y.sqlOperator;
885
936
  break;
886
937
  case "identifier":
887
- T = k.sqlIdentifier;
938
+ T = y.sqlIdentifier;
888
939
  break;
889
940
  case "punctuation":
890
- T = k.sqlPunctuation;
941
+ T = y.sqlPunctuation;
891
942
  break;
892
943
  case "whitespace":
893
944
  return w.value.replace(/ /g, "&nbsp;").replace(/\n/g, `
894
945
  `);
895
946
  }
896
- const B = w.value.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#039;");
897
- return `<span style="color: ${T}">${B}</span>`;
947
+ const R = w.value.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#039;");
948
+ return `<span style="color: ${T}">${R}</span>`;
898
949
  }).join("");
899
950
  }, p = (c) => {
900
951
  r.value.has(c) ? r.value.delete(c) : r.value.add(c), r.value = new Set(r.value);
901
- }, l = () => {
952
+ }, o = () => {
902
953
  r.value = new Set(f(h.value)), u("expand-all");
903
- }, E = () => {
954
+ }, k = () => {
904
955
  r.value = /* @__PURE__ */ new Set(), u("collapse-all");
905
- }, y = () => d.value || s.modelValue, S = async () => {
956
+ }, E = () => d.value || s.modelValue, S = async () => {
906
957
  if (g.value)
907
958
  try {
908
- const c = y();
959
+ const c = E();
909
960
  await navigator.clipboard.writeText(c), u("copy-success", c);
910
961
  } catch (c) {
911
962
  const b = c instanceof Error ? c : new Error("Failed to copy");
@@ -925,7 +976,7 @@ $1ON `
925
976
  }, L = () => {
926
977
  if (g.value)
927
978
  try {
928
- const c = ue(s.modelValue);
979
+ const c = de(s.modelValue);
929
980
  u("update:modelValue", c), u("compress", c);
930
981
  } catch (c) {
931
982
  console.error("Compress error:", c);
@@ -946,39 +997,39 @@ $1ON `
946
997
  copySql: S,
947
998
  formatSource: I,
948
999
  compressSource: L,
949
- expandAll: l,
950
- collapseAll: E,
1000
+ expandAll: o,
1001
+ collapseAll: k,
951
1002
  toggleExpand: p,
952
1003
  isValidSql: () => g.value,
953
1004
  getParsedSql: x,
954
1005
  getParseError: O,
955
- getValue: y
1006
+ getValue: E
956
1007
  }), (c, b) => (C(), N("div", {
957
1008
  class: $(["sql-format", `sql-format--${v.value.name}`])
958
1009
  }, [
959
- q("div", Le, [
960
- g.value ? (C(), N("div", xe, [
961
- h.value.length > 0 ? (C(), N("div", we, [
962
- (C(!0), N(U, null, D(h.value, (k) => (C(), W(Ie, {
963
- key: k.path,
964
- clause: k,
1010
+ _("div", Oe, [
1011
+ g.value ? (C(), N("div", we, [
1012
+ h.value.length > 0 ? (C(), N("div", Be, [
1013
+ (C(!0), N(U, null, D(h.value, (y) => (C(), W(Le, {
1014
+ key: y.path,
1015
+ clause: y,
965
1016
  "expanded-clauses": r.value,
966
1017
  theme: v.value,
967
1018
  onToggle: p
968
1019
  }, null, 8, ["clause", "expanded-clauses", "theme"]))), 128))
969
1020
  ])) : (C(), N("pre", Re, [
970
- q("code", {
1021
+ _("code", {
971
1022
  innerHTML: a(s.modelValue)
972
- }, null, 8, Be)
1023
+ }, null, 8, $e)
973
1024
  ]))
974
- ])) : (C(), N("div", Oe, [
975
- b[0] || (b[0] = q("h4", null, "SQL Parse Error:", -1)),
976
- q("pre", null, Z(n.value), 1)
1025
+ ])) : (C(), N("div", xe, [
1026
+ b[0] || (b[0] = _("h4", null, "SQL Parse Error:", -1)),
1027
+ _("pre", null, Z(n.value), 1)
977
1028
  ]))
978
1029
  ])
979
1030
  ], 2));
980
1031
  }
981
- }), Pe = /* @__PURE__ */ K($e, [["__scopeId", "data-v-d9005677"]]);
1032
+ }), He = /* @__PURE__ */ K(Ae, [["__scopeId", "data-v-d9005677"]]);
982
1033
  export {
983
- Pe as S
1034
+ He as S
984
1035
  };