@kaynooo/cli-pick 0.7.0 → 0.8.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.
package/README.md CHANGED
@@ -12,7 +12,7 @@ bun add -g @kaynooo/cli-pick
12
12
  | `ls \| pick --multi` | tab marks lines, enter prints the marked ones (the highlighted one when none is marked) |
13
13
  | `pick --prompt 'branch> ' --query main` | a custom prompt, a query to start with |
14
14
  | `ls \| pick --preview 'head -20 {}'` | a pane on the right (terminal at least 80 columns) shows the command run for the highlighted line, `{}` shell-quoted |
15
- | `--height 12`, `--height 60%` | lines or a share of the terminal to draw in (40%) |
15
+ | `--height 12`, `--height 60%` | lines or a share of the terminal to draw in (100%) |
16
16
 
17
17
  Keys: type to filter, up and down or ctrl-p and ctrl-n to move, enter to pick, esc or ctrl-c to cancel (exit 1, nothing printed), ctrl-u clears the query, ctrl-w deletes a word, ctrl-/ or f1 opens a legend of the keys until the next key. The count line ends in a `ctrl-/ keys` hint, and the characters a query matched are underlined.
18
18
 
package/dist/pick.js CHANGED
@@ -326,19 +326,21 @@ function userConfigPath(bin, where = {}) {
326
326
  }
327
327
 
328
328
  // ../kit/src/theme.ts
329
+ var ENDS = new Map;
329
330
  var DEFAULT = {
330
331
  colors: { accent: "cyan", id: "yellow", path: "blue", label: "dim", value: "bold", ok: "green", warn: "yellow", problem: "red", note: "dim", passed: "green", failed: "red", running: "cyan", queued: "yellow", skipped: "dim" },
331
332
  glyphs: { ok: "\u2713", warn: "\u25B2", problem: "\u2717", note: "\u203A", passed: "\u2713", failed: "\u2717", running: "\u25CF", queued: "\u25CB", skipped: "-", bar: "\u2501", rule: "\u2500", corner: "\u256D" },
332
333
  accents: ["cyan", "magenta", "green", "blue", "yellow", "redBright"],
333
- bins: {}
334
+ bins: {},
335
+ gradient: ["#c084fc", "#67e8f9"]
334
336
  };
335
337
  var BRIGHT = { accent: "cyanBright", id: "yellowBright", path: "blueBright", label: "white", value: "bold whiteBright", ok: "greenBright", warn: "yellowBright", problem: "redBright", note: "white", passed: "greenBright", failed: "redBright", running: "cyanBright", queued: "yellowBright", skipped: "white" };
336
338
  var MONO = { accent: "bold", id: "bold", path: "underline", label: "dim", value: "bold", ok: "bold", warn: "bold", problem: "bold", note: "dim", passed: "bold", failed: "bold", running: "bold", queued: "dim", skipped: "dim" };
337
339
  var ASCII = { ok: "+", warn: "!", problem: "x", note: ">", passed: "+", failed: "x", running: "*", queued: "o", skipped: "-", bar: "#", rule: "-", corner: "+" };
338
340
  var PRESETS = {
339
341
  default: {},
340
- "high-contrast": { colors: BRIGHT, accents: ["cyanBright", "magentaBright", "greenBright", "blueBright", "yellowBright", "redBright"] },
341
- mono: { colors: MONO, accents: ["bold"] },
342
+ "high-contrast": { colors: BRIGHT, accents: ["cyanBright", "magentaBright", "greenBright", "blueBright", "yellowBright", "redBright"], gradient: ["#d8b4fe", "#a5f3fc"] },
343
+ mono: { colors: MONO, accents: ["bold"], gradient: undefined },
342
344
  ascii: { glyphs: ASCII }
343
345
  };
344
346
  var STYLES = new Set(["bold", "dim", "italic", "underline", "inverse", "strikethrough", "black", "red", "green", "yellow", "blue", "magenta", "cyan", "white", "gray", "grey", "blackBright", "redBright", "greenBright", "yellowBright", "blueBright", "magentaBright", "cyanBright", "whiteBright"]);
@@ -409,6 +411,8 @@ function applyPreset(theme, name, warn, where) {
409
411
  Object.assign(theme.glyphs, preset.glyphs);
410
412
  if (preset.accents !== undefined)
411
413
  theme.accents = [...preset.accents];
414
+ if (Object.hasOwn(preset, "gradient"))
415
+ theme.gradient = preset.gradient;
412
416
  return name;
413
417
  }
414
418
  function applyFile(theme, file, where, warn) {
@@ -436,6 +440,12 @@ function applyFile(theme, file, where, warn) {
436
440
  theme.accents = [...file.accents];
437
441
  else if (file.accents !== undefined)
438
442
  warn(`${where}: accents must be a non-empty list of colours`);
443
+ if (file.gradient === null)
444
+ theme.gradient = undefined;
445
+ else if (Array.isArray(file.gradient) && file.gradient.length === 2 && file.gradient.every((end) => typeof end === "string" && HEX.test(end)))
446
+ theme.gradient = [file.gradient[0], file.gradient[1]];
447
+ else if (file.gradient !== undefined)
448
+ warn(`${where}: gradient must be two \`#rrggbb\` colours, or null for none`);
439
449
  if (isRecord(file.bins)) {
440
450
  for (const [bin, value] of Object.entries(file.bins)) {
441
451
  if (isColorSpec(value))
@@ -459,7 +469,7 @@ function isPath(chosen) {
459
469
  return chosen.includes("/") || chosen.endsWith(".json");
460
470
  }
461
471
  function loadTheme({ env = process5.env, from = process5.cwd(), home = homedir2(), warn = warnOnce } = {}) {
462
- const theme = { colors: { ...DEFAULT.colors }, glyphs: { ...DEFAULT.glyphs }, accents: [...DEFAULT.accents], bins: Object.create(null) };
472
+ const theme = { colors: { ...DEFAULT.colors }, glyphs: { ...DEFAULT.glyphs }, accents: [...DEFAULT.accents], bins: Object.create(null), gradient: DEFAULT.gradient };
463
473
  const sources = [];
464
474
  const chosen = env.KIT_THEME ?? "";
465
475
  const wanted = chosen === "" ? [userConfigPath("theme", { home, xdg: env.XDG_CONFIG_HOME }), findUp(join3(".kaynooo", "theme.json"), from, endsWalk(home))] : [];
@@ -1381,7 +1391,7 @@ var PREVIEW_SHARE = 0.4;
1381
1391
  var RESET2 = "\x1B[0m";
1382
1392
  var SEPARATOR = " \u2502 ";
1383
1393
  var HEIGHT = /^(\d+)(%?)$/;
1384
- var DEFAULT_HEIGHT = { percent: 40 };
1394
+ var DEFAULT_HEIGHT = { percent: 100 };
1385
1395
  function parseHeight(text) {
1386
1396
  const found = HEIGHT.exec(text);
1387
1397
  if (found === null || Number(found[1]) < 1)
@@ -1718,7 +1728,7 @@ var OPTIONS = {
1718
1728
  prompt: { type: "string", short: "p", description: "the prompt before the query (> )" },
1719
1729
  query: { type: "string", short: "q", description: "the query to start with" },
1720
1730
  preview: { type: "string", description: "a command shown for the highlighted line, {} standing for it" },
1721
- height: { type: "string", description: "lines or a percentage of the terminal to draw in (40%)" },
1731
+ height: { type: "string", description: "lines or a percentage of the terminal to draw in (100%)" },
1722
1732
  json: jsonOption("{picked: [lines]}, the choice or the marked lines in input order")
1723
1733
  };
1724
1734
  function print(chosen, json) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@kaynooo/cli-pick",
3
3
  "type": "module",
4
- "version": "0.7.0",
4
+ "version": "0.8.0",
5
5
  "description": "pick: a themed fuzzy selector, lines on stdin, the chosen one on stdout.",
6
6
  "author": "Kaynooo <contact@kaynooo.fr>",
7
7
  "license": "MIT",
@@ -35,6 +35,6 @@
35
35
  "pick": "$npm_execpath src/pick.ts"
36
36
  },
37
37
  "devDependencies": {
38
- "@kaynooo/cli-kit": "0.28.0"
38
+ "@kaynooo/cli-kit": "0.33.0"
39
39
  }
40
40
  }