@kecan0406/ttheme 1.2.20 → 1.2.21

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kecan0406/ttheme",
3
- "version": "1.2.20",
3
+ "version": "1.2.21",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "ttheme": "bin/ttheme.js"
package/shell/preview.zsh CHANGED
@@ -4,7 +4,7 @@ __tt_pv_seek() {
4
4
  local t part key REPLY
5
5
  for t in ${(k)TTHEME_PALETTE}; do
6
6
  key=""
7
- for part in "$t" "${TTHEME_GROUP[$t]:-Other}" "${TTHEME_NATIVE[$t]}" "${TTHEME_CATALOG[$t]}" "${(@s:|:)TTHEME_NATIVE_NAMES[$t]}" "${TTHEME_CHARACTER[$t]}" "${(@s:|:)TTHEME_ALIASES[$t]}"; do
7
+ for part in "$t" "${TTHEME_MARKETPLACE[$t]}" "${TTHEME_NATIVE[$t]}" "${TTHEME_CATALOG[$t]}" "${(@s:|:)TTHEME_NATIVE_NAMES[$t]}" "${TTHEME_CHARACTER[$t]}" "${(@s:|:)TTHEME_ALIASES[$t]}"; do
8
8
  [[ -n $part ]] || continue
9
9
  __tt_pv_norm "$part"
10
10
  key+="|$REPLY"
@@ -33,9 +33,9 @@ __tt_pv_rows() {
33
33
  __tt_pv_norm "$flt"
34
34
  nflt=$REPLY
35
35
  fi
36
- for g in $groups; do
36
+ for g in $tops; do
37
37
  ts=()
38
- for t in ${=gthemes[$g]}; do
38
+ for t in ${=tmembers[$g]}; do
39
39
  [[ -z $flt || ${pvseek[$t]} == *$nflt* ]] && ts+=($t)
40
40
  done
41
41
  [[ -n $flt ]] && (( ! ${#ts} )) && continue
@@ -91,7 +91,7 @@ __tt_pv_first() {
91
91
  }
92
92
 
93
93
  __tt_pv_goto() {
94
- local name=$1 i g=${TTHEME_GROUP[$1]:-Other} c=${TTHEME_CATALOG[$1]}
94
+ local name=$1 i g=${TTHEME_MARKETPLACE[$1]:-${TTHEME_CATALOG[$1]:-Other}} c=${TTHEME_CATALOG[$1]}
95
95
  exp[$g]=1
96
96
  [[ -n $c && $g == *@* ]] && exp[$g/$c]=1
97
97
  __tt_pv_rows
@@ -143,7 +143,7 @@ __tt_pv_left() {
143
143
  fi
144
144
  return 0
145
145
  fi
146
- local g=${TTHEME_GROUP[${rval[cur]}]:-Other} c=${TTHEME_CATALOG[${rval[cur]}]}
146
+ local g=${TTHEME_MARKETPLACE[${rval[cur]}]:-${TTHEME_CATALOG[${rval[cur]}]:-Other}} c=${TTHEME_CATALOG[${rval[cur]}]}
147
147
  [[ -n $c && $g == *@* ]] && g=$g/$c
148
148
  exp[$g]=""
149
149
  __tt_pv_rows
@@ -241,7 +241,7 @@ __tt_pv_row() {
241
241
  (( color )) && on=$sb
242
242
  fi
243
243
  if [[ ${rtype[$1]} == rule ]]; then
244
- name='── Markets '
244
+ name='── Marketplaces '
245
245
  REPLY=" "$d$name${(l:lw - 4 - ${#name}::─:)}$z
246
246
  return 0
247
247
  fi
@@ -258,7 +258,7 @@ __tt_pv_row() {
258
258
  __tt_pv_hl "$name" "$base"
259
259
  hl=$REPLY
260
260
  w=$(( lw - 6 - ${(m)#name} - ${#rcnt[$1]} ))
261
- __tt_pv_alias "$t" "${TTHEME_NATIVE[${${=gthemes[$t]}[1]}]}"
261
+ __tt_pv_alias "$t" "${TTHEME_NATIVE[${${=tmembers[$t]}[1]}]}"
262
262
  __tt_pv_fit "$REPLY"
263
263
  extra=$REPLY
264
264
  (( w < 1 )) && w=1
@@ -287,7 +287,7 @@ __tt_pv_row() {
287
287
  mark=$ac$cdot$r
288
288
  fi
289
289
  name=${t##*/}
290
- [[ -n ${TTHEME_CATALOG[$t]} && ${TTHEME_GROUP[$t]} == *@* ]] && ind=" "
290
+ [[ -n ${TTHEME_CATALOG[$t]} && -n ${TTHEME_MARKETPLACE[$t]} ]] && ind=" "
291
291
  (( ${TTHEME_TUNED[(Ie)$t]} )) && w=-2
292
292
  (( ${(m)#name} > lw - 17 - ${#ind} + w )) && name="${name[1,lw-18-${#ind}+w]}…"
293
293
  __tt_pv_hl "$name" "$base"
@@ -640,10 +640,10 @@ __tt_pv_help() {
640
640
  "esc · back to the list, dropping picture changes since s"
641
641
  )
642
642
  else
643
- hk=(Move Series Filter "" Example Apply Edit)
643
+ hk=(Move Catalogs Filter "" Example Apply Edit)
644
644
  hv=(
645
645
  "↑↓ home end pgup pgdn"
646
- "←→ · enter or space on a series"
646
+ "←→ · enter or space on a catalog"
647
647
  "Any text · bksp · ctrl-u clears"
648
648
  "Names and titles, in Japanese too"
649
649
  "⇧←→ ${(Lj:, :)TTHEME_SCENES}"
@@ -652,7 +652,7 @@ __tt_pv_help() {
652
652
  )
653
653
  hk+=(Config "")
654
654
  hv+=("alt-c · ↑↓ setting ←→ value" "enter saves · esc undoes")
655
- (( hub )) && { hk+=(Screens); hv+=("shift+tab · tab on a series") }
655
+ (( hub )) && { hk+=(Screens); hv+=("shift+tab · tab on a catalog") }
656
656
  fi
657
657
  hk+=(Close)
658
658
  if (( help == 2 )); then
@@ -844,7 +844,7 @@ __tt_pv_untune() {
844
844
 
845
845
  __tt_pv_regroup() {
846
846
  local ty=${rtype[cur]} v=${rval[cur]} i
847
- __tt_pv_group
847
+ __tt_pv_tops
848
848
  __tt_pv_rows
849
849
  for (( i = 1; i <= ${#rval}; i++ )); do
850
850
  [[ ${rtype[i]} == "$ty" && ${rval[i]} == "$v" ]] && { cur=$i; return 0 }
@@ -1112,8 +1112,8 @@ __tt_pv_draw() {
1112
1112
  fi
1113
1113
  fi
1114
1114
  if [[ ${rtype[cur]} == thm ]]; then
1115
- ag=${TTHEME_GROUP[${rval[cur]}]:-Other}
1116
- [[ -n ${TTHEME_CATALOG[${rval[cur]}]} ]] && acat=$ag/${TTHEME_CATALOG[${rval[cur]}]}
1115
+ ag=${TTHEME_MARKETPLACE[${rval[cur]}]:-${TTHEME_CATALOG[${rval[cur]}]:-Other}}
1116
+ [[ -n ${TTHEME_MARKETPLACE[${rval[cur]}]} && -n ${TTHEME_CATALOG[${rval[cur]}]} ]] && acat=$ag/${TTHEME_CATALOG[${rval[cur]}]}
1117
1117
  fi
1118
1118
  fi
1119
1119
  if [[ -n $flt ]]; then
@@ -1150,7 +1150,7 @@ __tt_pv_draw() {
1150
1150
  if [[ -n $flt ]]; then
1151
1151
  find=$flt"_"
1152
1152
  else
1153
- ex="$expal | $exgrp"
1153
+ ex="$expal | $extop"
1154
1154
  local -i room=$(( tall ? lw - 21 : lw - 19 - ${#cnt} ))
1155
1155
  (( ${#ex} > room )) && ex="${ex[1,room-1]}…"
1156
1156
  if (( gstep > 0 )); then
@@ -1263,14 +1263,14 @@ __tt_pv_draw() {
1263
1263
  __tt_pv_flush
1264
1264
  }
1265
1265
 
1266
- __tt_pv_group() {
1266
+ __tt_pv_tops() {
1267
1267
  local k g
1268
- groups=() gthemes=()
1268
+ tops=() tmembers=()
1269
1269
  __tt_order
1270
1270
  for k in $reply; do
1271
- g=${TTHEME_GROUP[$k]:-Other}
1272
- [[ -n ${gthemes[$g]} ]] || groups+=($g)
1273
- gthemes[$g]+=" $k"
1271
+ g=${TTHEME_MARKETPLACE[$k]:-${TTHEME_CATALOG[$k]:-Other}}
1272
+ [[ -n ${tmembers[$g]} ]] || tops+=($g)
1273
+ tmembers[$g]+=" $k"
1274
1274
  done
1275
1275
  }
1276
1276
 
@@ -1300,7 +1300,7 @@ __tt_pv_strip() {
1300
1300
  }
1301
1301
 
1302
1302
  __tt_pv_init() {
1303
- __tt_pv_group
1303
+ __tt_pv_tops
1304
1304
  [[ -n $orig ]] && __tt_name_of "$orig" && cn=$REPLY
1305
1305
  [[ -n ${TTHEME_PALETTE[$cn]} ]] || return 0
1306
1306
  cdot="◆"
@@ -1308,7 +1308,7 @@ __tt_pv_init() {
1308
1308
 
1309
1309
  __tt_pv_roll() {
1310
1310
  expal=${TTHEME_ORDER[RANDOM % ${#TTHEME_ORDER} + 1]}
1311
- exgrp=${groups[RANDOM % ${#groups} + 1]}
1311
+ extop=${tops[RANDOM % ${#tops} + 1]}
1312
1312
  gseed=$RANDOM
1313
1313
  exnext=$(( SECONDS + 3 ))
1314
1314
  }
@@ -1979,7 +1979,9 @@ __tt_pv_te_head() {
1979
1979
  (( color )) || z= d= b= y=
1980
1980
  __tt_te_unsaved && (( room -= 11 ))
1981
1981
  line=$b$ac"◆"$z" "$b$tename$z
1982
- [[ -n ${TTHEME_GROUP[$tename]} ]] && line+=" "$d"· ${TTHEME_GROUP[$tename]}"$z
1982
+ local REPLY
1983
+ __tt_shelf $tename
1984
+ line+=" "$d"· $REPLY"$z
1983
1985
  __tt_clip "$line" $room
1984
1986
  out+=$'\e[1;'$col'H'$REPLY$z
1985
1987
  __tt_te_unsaved && out+=$'\e[1;'$(( end - 8 ))'H'$y"●"$z" "$d"unsaved"$z
@@ -2378,7 +2380,7 @@ __tt_preview() {
2378
2380
  print -u2 "ttheme $mode: needs a terminal"
2379
2381
  return 1
2380
2382
  fi
2381
- local orig=$TTHEME_SPEC applied=$TTHEME_SPEC painted=$TTHEME_SPEC flt="" sel="" cn="" cdot="" key="" REPLY="" cur=1 top=1 color=0 pw=80 ph=24 resized=1 expal="" exgrp="" exnext=0 gstep=0 gseed=0 tick=0 pvhd=2 pvsr=1 pvsc=4
2383
+ local orig=$TTHEME_SPEC applied=$TTHEME_SPEC painted=$TTHEME_SPEC flt="" sel="" cn="" cdot="" key="" REPLY="" cur=1 top=1 color=0 pw=80 ph=24 resized=1 expal="" extop="" exnext=0 gstep=0 gseed=0 tick=0 pvhd=2 pvsr=1 pvsc=4
2382
2384
  local pick="" pk=1 pkdef=1 picked=0 canpick=0 bgcw=0 bgch=0 bgname="" bgshown="" bginc="" osd="" osdt=0
2383
2385
  local tune="" tpick="" tf=1 help=0 msg="" msgt=0 an="" bgrel=0 bgmx=0 bgmy=0 bganchor=0 bgcut="" bgnext=0 bgbytes=0 bgstrip="" pvscene="" pvscenes=""
2384
2386
  local -i scene=0
@@ -2393,12 +2395,12 @@ __tt_preview() {
2393
2395
  local mact="" mzone="" pvmouse="" pasted=""
2394
2396
  local -a pvz=()
2395
2397
  local -a cvars=(TTHEME_TAB_PALETTE TTHEME_ANNOUNCE TTHEME_FX TTHEME_SORT TTHEME_MOUSE TTHEME_BG_BLUR TTHEME_BG_COLORS) clabel=("New tabs" Announce "Search fx" Sort Mouse Blur Colors)
2396
- local -a cchoice=("off seq" "1 0" "typewriter decode glitch" "abc series" "on off" "0 1 2 3 4" "tone original") cshow=("off seq" "on off" "typewriter decode glitch" "abc series" "on off" "off 1px 2px 3px 4px" "tone original")
2398
+ local -a cchoice=("off seq" "1 0" "typewriter decode glitch" "abc catalog" "on off" "0 1 2 3 4" "tone original") cshow=("off seq" "on off" "typewriter decode glitch" "abc catalog" "on off" "off 1px 2px 3px 4px" "tone original")
2397
2399
  local -A cnote=(
2398
2400
  TTHEME_TAB_PALETTE:seq "New tabs rotate through palettes" TTHEME_TAB_PALETTE:off "New tabs keep the terminal theme"
2399
2401
  TTHEME_ANNOUNCE:1 "Shows the palette notice" TTHEME_ANNOUNCE:0 "Silences the palette notice"
2400
2402
  TTHEME_FX:typewriter "The search hint types itself" TTHEME_FX:decode "The search hint decodes" TTHEME_FX:glitch "The search hint glitches in"
2401
- TTHEME_SORT:abc "Series and palettes by name" TTHEME_SORT:series "Series in the order added"
2403
+ TTHEME_SORT:abc "Catalogs and palettes by name" TTHEME_SORT:catalog "Catalogs in the order added"
2402
2404
  TTHEME_MOUSE:on "Clicks, the wheel and drags work in ttheme's screens" TTHEME_MOUSE:off "The terminal keeps the mouse, so a drag selects text"
2403
2405
  TTHEME_BG_BLUR:0 "Pictures stay sharp" TTHEME_BG_BLUR:1 "Pictures soften a little behind the text"
2404
2406
  TTHEME_BG_BLUR:2 "Pictures soften behind the text" TTHEME_BG_BLUR:3 "Pictures blur behind the text"
@@ -2410,8 +2412,8 @@ __tt_preview() {
2410
2412
  [[ $mode == pin ]] && __tt_pin_scopes "$pdir"
2411
2413
  __tt_pv_canpick
2412
2414
  __tt_pv_size
2413
- local -a groups=() rtype=() rval=() rcnt=() reply=()
2414
- local -A gthemes=() exp=() tstrip=()
2415
+ local -a tops=() rtype=() rval=() rcnt=() reply=()
2416
+ local -A tmembers=() exp=() tstrip=()
2415
2417
  __tt_color && color=1
2416
2418
  __tt_pv_init
2417
2419
  __tt_pv_roll
@@ -2482,7 +2484,7 @@ __tt_preview() {
2482
2484
  else
2483
2485
  (( ${#bgedit} + ${#bgswap} )) && [[ -n ${TTHEME_PALETTE[$cn]} ]] && { __tt_shown "$cn" && __tt_reload }
2484
2486
  fi
2485
- (( hubleft )) && __tt_catalog_done "$hubwas"
2487
+ (( hubleft )) && __tt_installs_done "$hubwas"
2486
2488
  }
2487
2489
  return 0
2488
2490
  }
package/shell/ttheme.zsh CHANGED
@@ -20,7 +20,7 @@ typeset -gA TTHEME_SGR=(
20
20
  __tt_palettes_load() {
21
21
  emulate -L zsh ${=${options[xtrace]:#off}:+-o xtrace}
22
22
  local -a at
23
- unset TTHEME_PALETTE TTHEME_GROUP TTHEME_CATALOG TTHEME_NATIVE TTHEME_SRC
23
+ unset TTHEME_PALETTE TTHEME_MARKETPLACE TTHEME_CATALOG TTHEME_NATIVE TTHEME_SRC
24
24
  source $TTHEME_HOME/palettes.zsh || return 1
25
25
  zstat -F %s.%N -A at +mtime -- $TTHEME_HOME/palettes.zsh 2>/dev/null
26
26
  TTHEME_PALETTES_AT=$at[1]
@@ -172,7 +172,7 @@ __tt_pins_load
172
172
 
173
173
  : ${TTHEME_WARP_FAST:=on}
174
174
 
175
- : ${TTHEME_MARKET_LOOKUP:=on}
175
+ : ${TTHEME_MARKETPLACE_LOOKUP:=on}
176
176
 
177
177
  typeset -g TTHEME_STATE_DIR=${XDG_STATE_HOME:-$HOME/.local/state}/ttheme
178
178
 
@@ -327,7 +327,8 @@ __tt_announce() {
327
327
  __tt_name_of "$TTHEME_SPEC"
328
328
  [[ -n ${TTHEME_PALETTE[$REPLY]} ]] || return 0
329
329
  local name=$REPLY
330
- local grp=${TTHEME_GROUP[$name]:-Other} src=${TTHEME_SRC[$name]:-unknown}
330
+ __tt_shelf $name
331
+ local grp=$REPLY src=${TTHEME_SRC[$name]:-unknown}
331
332
  if ! __tt_color; then
332
333
  print -r -- "$name · $grp · ANSI $src"
333
334
  return 0
@@ -1300,19 +1301,26 @@ __tt_keep() {
1300
1301
  }
1301
1302
 
1302
1303
  __tt_order() {
1303
- if [[ $TTHEME_SORT == series ]]; then
1304
+ if [[ $TTHEME_SORT == catalog ]]; then
1304
1305
  reply=($TTHEME_ORDER)
1305
1306
  else
1306
1307
  reply=($TTHEME_ABC)
1307
1308
  fi
1308
1309
  }
1309
1310
 
1311
+ __tt_shelf() {
1312
+ local m=${TTHEME_MARKETPLACE[$1]} c=${TTHEME_CATALOG[$1]}
1313
+ REPLY=${m:+$m${c:+ / }}$c
1314
+ REPLY=${REPLY:-Other}
1315
+ }
1316
+
1310
1317
  __tt_menu() {
1311
- local k
1318
+ local k REPLY
1312
1319
  local -a reply
1313
1320
  __tt_order
1314
1321
  for k in $reply; do
1315
- printf '%s\t%s\t%s\n' "$k" "${TTHEME_GROUP[$k]:-Other}" "${TTHEME_SRC[$k]:-unknown}"
1322
+ __tt_shelf $k
1323
+ printf '%s\t%s\t%s\n' "$k" "$REPLY" "${TTHEME_SRC[$k]:-unknown}"
1316
1324
  done
1317
1325
  }
1318
1326
 
@@ -1366,14 +1374,14 @@ __tt_cli() {
1366
1374
  env $pass node $TTHEME_HOME/ttheme.js "$@"
1367
1375
  }
1368
1376
 
1369
- __tt_catalog() {
1377
+ __tt_installs() {
1370
1378
  local was="$TTHEME_STARTUP ${TTHEME_PALETTE[$TTHEME_STARTUP]}"
1371
1379
  __tt_cli "$@" || return
1372
1380
  [[ $1 == (list|share) ]] && return 0
1373
- __tt_catalog_done "$was"
1381
+ __tt_installs_done "$was"
1374
1382
  }
1375
1383
 
1376
- __tt_catalog_done() {
1384
+ __tt_installs_done() {
1377
1385
  [[ -r $TTHEME_HOME/palettes.zsh ]] || return 0
1378
1386
  local was=$TTHEME_PALETTES_AT
1379
1387
  local -a reply
@@ -1548,7 +1556,7 @@ ttheme() {
1548
1556
  if (( ${#TTHEME_PALETTE} )); then
1549
1557
  __tt_preview hub
1550
1558
  else
1551
- __tt_catalog browse
1559
+ __tt_installs browse
1552
1560
  fi
1553
1561
  else
1554
1562
  (( ${#TTHEME_PALETTE} )) || { __tt_empty; return }
@@ -1558,11 +1566,11 @@ ttheme() {
1558
1566
  fi
1559
1567
 
1560
1568
  case $1 in
1561
- list|add|remove|update|market|new) __tt_catalog "$@"; return ;;
1569
+ list|add|remove|update|marketplace|new) __tt_installs "$@"; return ;;
1562
1570
  edit|check|share)
1563
1571
  local REPLY
1564
1572
  __tt_name_of "$TTHEME_SPEC"
1565
- TTHEME_WORN=${TTHEME_PALETTE[$REPLY]:+$REPLY} __tt_catalog "$@"
1573
+ TTHEME_WORN=${TTHEME_PALETTE[$REPLY]:+$REPLY} __tt_installs "$@"
1566
1574
  return ;;
1567
1575
  on|off) __tt_switch "$@"; return ;;
1568
1576
  info) TTHEME_ZSH=$ZSH_VERSION __tt_cli "$@"; return ;;
@@ -1612,9 +1620,9 @@ if (( ${+functions[compdef]} )); then
1612
1620
  _files -/
1613
1621
  elif [[ $words[2] == new ]]; then
1614
1622
  compadd -- --from --in
1615
- elif [[ $words[2] == market && $CURRENT == 3 ]]; then
1623
+ elif [[ $words[2] == marketplace && $CURRENT == 3 ]]; then
1616
1624
  compadd -- add remove search init
1617
- elif [[ $words[2] == market && $words[3] == (add|init) && $CURRENT == 4 ]]; then
1625
+ elif [[ $words[2] == marketplace && $words[3] == (add|init) && $CURRENT == 4 ]]; then
1618
1626
  _files -/
1619
1627
  elif [[ $words[2] == (pin|unpin) && $CURRENT == 3 ]]; then
1620
1628
  reply=(${${(M)${(k)TTHEME_PINS}:#ssh:*}#ssh:})
@@ -1628,11 +1636,11 @@ if (( ${+functions[compdef]} )); then
1628
1636
  _files -/
1629
1637
  [[ $words[2] == pin || ${#reply} -gt 0 ]] && compadd -S '' -- ssh:
1630
1638
  fi
1631
- elif [[ $words[2] == add && $words[CURRENT-1] == --market ]]; then
1639
+ elif [[ $words[2] == add && $words[CURRENT-1] == --marketplace ]]; then
1632
1640
  _files -/
1633
1641
  elif [[ $words[2] == add ]]; then
1634
1642
  reply=(${${${(M)${(f)"$(__tt_cli list --json 2>/dev/null)"}:#*\"name\": *}#*\"name\": \"}%%\"*})
1635
- compadd -- --market ${reply:|TTHEME_ORDER}
1643
+ compadd -- --marketplace ${reply:|TTHEME_ORDER}
1636
1644
  fi
1637
1645
  }
1638
1646
  compdef __tt_complete ttheme