@deaquinodev/querky 0.4.11 → 0.4.13

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.
Files changed (2) hide show
  1. package/dist/index.js +34 -43
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1767,14 +1767,21 @@ function ErrorBox({ message }) {
1767
1767
  // src/ui/components/Banner.tsx
1768
1768
  import { Box as Box4, Text as Text4 } from "ink";
1769
1769
  import { Fragment as Fragment2, jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
1770
- var version = true ? "0.4.11" : process.env.npm_package_version ?? "unknown";
1771
- var LOGO = [
1770
+ var version = true ? "0.4.13" : process.env.npm_package_version ?? "unknown";
1771
+ var MASCOT = [
1772
1772
  " \u2597\u2584\u2584\u2584\u2584\u2584\u2596",
1773
1773
  "\u2590\u2591 \u25CF \u25CF \u2591\u258C",
1774
1774
  "\u2590\u2591 \u25E1\u25E1\u25E1 \u2591\u258C",
1775
1775
  "\u2590\u2591 \u2597\u259F\u258C",
1776
1776
  " \u2580\u2580\u2580\u2580\u259D\u2580\u2584"
1777
1777
  ];
1778
+ var WORDMARK = [
1779
+ " \u259D\u259C\u2584 \u2597\u2588\u2580\u2580\u259C\u2599\u259D\u2588\u259B\u2580\u2580\u258C\u259C\u2588\u2588\u2596\u259F\u2588\u2588\u2598\u259C\u2588\u2598\u259C\u2588\u2588\u2596\u259D\u2588\u259B\u259D\u2588\u259B",
1780
+ " \u259D\u259C\u2584 \u2588\u258C \u2588\u2599\u259F \u2590\u2588\u259D\u2588\u259B\u2590\u2588 \u2590\u2588 \u2590\u2588\u259D\u2588\u2596\u2588\u258C \u2588\u258C",
1781
+ " \u2597\u259F\u2580 \u259C\u2599 \u259D\u2588\u259B \u2588\u258C\u259D \u2596\u2590\u2588 \u2590\u2588 \u2590\u2588 \u2590\u2588 \u259D\u2588\u2588\u258C \u2588\u258C",
1782
+ " \u259D\u2580 \u2580\u2580\u2580\u2580\u2598\u259D\u2580\u2580\u2580\u2580\u2598\u2580\u2580\u2598 \u2580\u2580\u2598\u2580\u2580\u2598\u2580\u2580\u2598 \u259D\u2580\u2580\u259D\u2580\u2580"
1783
+ ];
1784
+ var WORDMARK_WIDTH = Math.max(...WORDMARK.map((l) => [...l].length));
1778
1785
  var GRADIENT = [
1779
1786
  "#ff00dd",
1780
1787
  "#ff33bb",
@@ -1782,17 +1789,29 @@ var GRADIENT = [
1782
1789
  "#ff9966",
1783
1790
  "#ff7722"
1784
1791
  ];
1792
+ function hexToRgb(hex) {
1793
+ return [parseInt(hex.slice(1, 3), 16), parseInt(hex.slice(3, 5), 16), parseInt(hex.slice(5, 7), 16)];
1794
+ }
1795
+ function gradientColor(t) {
1796
+ const seg = Math.max(0, Math.min(1, t)) * (GRADIENT.length - 1);
1797
+ const i = Math.min(Math.floor(seg), GRADIENT.length - 2);
1798
+ const f = seg - i;
1799
+ const [r1, g1, b1] = hexToRgb(GRADIENT[i]);
1800
+ const [r2, g2, b2] = hexToRgb(GRADIENT[i + 1]);
1801
+ const mix = (a, b) => Math.round(a + (b - a) * f).toString(16).padStart(2, "0");
1802
+ return `#${mix(r1, r2)}${mix(g1, g2)}${mix(b1, b2)}`;
1803
+ }
1785
1804
  function Banner({ connectionState }) {
1786
1805
  const isConnected = connectionState.status === "connected";
1787
- return /* @__PURE__ */ jsxs4(Box4, { flexDirection: "row", marginTop: 2, marginBottom: 2, children: [
1788
- /* @__PURE__ */ jsx4(Box4, { flexDirection: "column", marginRight: 2, children: LOGO.map((line, i) => /* @__PURE__ */ jsx4(Text4, { color: GRADIENT[i], bold: true, children: line }, i)) }),
1789
- /* @__PURE__ */ jsxs4(Box4, { flexDirection: "column", children: [
1790
- /* @__PURE__ */ jsxs4(Text4, { bold: true, color: theme.accent, children: [
1791
- "Querky ",
1792
- /* @__PURE__ */ jsxs4(Text4, { dimColor: true, children: [
1793
- "v",
1794
- version
1795
- ] })
1806
+ return /* @__PURE__ */ jsxs4(Box4, { flexDirection: "column", marginTop: 2, marginBottom: 1, children: [
1807
+ /* @__PURE__ */ jsxs4(Box4, { flexDirection: "row", children: [
1808
+ /* @__PURE__ */ jsx4(Box4, { flexDirection: "column", marginRight: 2, children: MASCOT.map((line, i) => /* @__PURE__ */ jsx4(Text4, { color: GRADIENT[i], bold: true, children: line }, i)) }),
1809
+ /* @__PURE__ */ jsx4(Box4, { flexDirection: "column", marginTop: 1, children: WORDMARK.map((line, li) => /* @__PURE__ */ jsx4(Box4, { children: [...line].map((ch, x) => /* @__PURE__ */ jsx4(Text4, { color: gradientColor(WORDMARK_WIDTH > 1 ? x / (WORDMARK_WIDTH - 1) : 0), bold: true, children: ch }, x)) }, li)) })
1810
+ ] }),
1811
+ /* @__PURE__ */ jsxs4(Box4, { flexDirection: "column", marginTop: 1, marginLeft: 1, children: [
1812
+ /* @__PURE__ */ jsxs4(Text4, { dimColor: true, children: [
1813
+ "v",
1814
+ version
1796
1815
  ] }),
1797
1816
  /* @__PURE__ */ jsx4(Text4, { children: " " }),
1798
1817
  isConnected ? /* @__PURE__ */ jsxs4(Fragment2, { children: [
@@ -2011,10 +2030,8 @@ function fmtHelp(data) {
2011
2030
  }
2012
2031
  function fmtErd(data) {
2013
2032
  if (data.tables.length === 0) return dim("No tables found in the current schema.");
2014
- const termW = process.stdout.columns ?? 80;
2015
2033
  const FK_PREFIX = "FK \u2192 ";
2016
2034
  const PAD = 1;
2017
- const GAP = 2;
2018
2035
  const colorMap = new Map(
2019
2036
  data.tables.map((t, i) => [t.name, ERD_PALETTE[i % ERD_PALETTE.length]])
2020
2037
  );
@@ -2057,38 +2074,12 @@ function fmtErd(data) {
2057
2074
  out.push(bot);
2058
2075
  return out;
2059
2076
  }
2060
- const rows = [];
2061
- let row = [], usedW = 0;
2062
- for (let i = 0; i < allMetrics.length; i++) {
2063
- const w = allMetrics[i].totalW;
2064
- if (row.length === 0) {
2065
- row.push(i);
2066
- usedW = w;
2067
- } else if (usedW + GAP + w <= termW) {
2068
- row.push(i);
2069
- usedW += GAP + w;
2070
- } else {
2071
- rows.push(row);
2072
- row = [i];
2073
- usedW = w;
2074
- }
2075
- }
2076
- if (row.length > 0) rows.push(row);
2077
2077
  const output = [];
2078
- for (const tableRow of rows) {
2079
- const blocks = tableRow.map(
2080
- (ti) => renderTable(data.tables[ti], allMetrics[ti], colorMap.get(data.tables[ti].name) ?? ERD_PALETTE[0])
2081
- );
2082
- const height = Math.max(...blocks.map((b) => b.length));
2083
- for (let line = 0; line < height; line++) {
2084
- const parts = blocks.map((b, j) => {
2085
- const l = b[line] ?? " ".repeat(allMetrics[tableRow[j]].totalW);
2086
- return j < blocks.length - 1 ? l + " ".repeat(GAP) : l;
2087
- });
2088
- output.push(parts.join(""));
2089
- }
2078
+ data.tables.forEach((t, ti) => {
2079
+ const block = renderTable(t, allMetrics[ti], colorMap.get(t.name) ?? ERD_PALETTE[0]);
2080
+ output.push(...block);
2090
2081
  output.push("");
2091
- }
2082
+ });
2092
2083
  return output.join("\n").trimEnd();
2093
2084
  }
2094
2085
  function fmtAi(text, error) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@deaquinodev/querky",
3
- "version": "0.4.11",
3
+ "version": "0.4.13",
4
4
  "description": "A quirky terminal SQL client with vim mode, AI features, and schema-aware autocomplete",
5
5
  "main": "dist/index.js",
6
6
  "files": [