From 2ae2effeccef2e26b29fe23c227c4d3411e81b4d Mon Sep 17 00:00:00 2001 From: JuanZoran <1430359574@qq.com> Date: Tue, 4 Apr 2023 16:18:18 +0800 Subject: [PATCH] chore: more spinner style support --- lua/Trans/frontend/hover/init.lua | 2 +- lua/Trans/style/spinner.lua | 593 ++++++++++++++++++++---------- 2 files changed, 408 insertions(+), 187 deletions(-) diff --git a/lua/Trans/frontend/hover/init.lua b/lua/Trans/frontend/hover/init.lua index 25b154a..5f9e400 100644 --- a/lua/Trans/frontend/hover/init.lua +++ b/lua/Trans/frontend/hover/init.lua @@ -127,7 +127,7 @@ function M:wait() local spinner = Trans.style.spinner[opts.spinner] local times = opts.width - spinner[1]:width() local size = #spinner - local interval = math.floor(opts.timeout / opts.width) + local interval = math.floor(opts.timeout / times) self:init_window { height = 2, diff --git a/lua/Trans/style/spinner.lua b/lua/Trans/style/spinner.lua index 30836b1..a3e3461 100644 --- a/lua/Trans/style/spinner.lua +++ b/lua/Trans/style/spinner.lua @@ -29,248 +29,469 @@ -- SOFTWARE. return { dots = { - "⠋", - "⠙", - "⠹", - "⠸", - "⠼", - "⠴", - "⠦", - "⠧", - "⠇", - "⠏", + '⠋', + '⠙', + '⠹', + '⠸', + '⠼', + '⠴', + '⠦', + '⠧', + '⠇', + '⠏', }, dots_negative = { -- dots2 - "⣾", - "⣽", - "⣻", - "⢿", - "⡿", - "⣟", - "⣯", - "⣷", + '⣾', + '⣽', + '⣻', + '⢿', + '⡿', + '⣟', + '⣯', + '⣷', }, dots_snake = { -- dots3 - "⠋", - "⠙", - "⠚", - "⠒", - "⠂", - "⠂", - "⠒", - "⠲", - "⠴", - "⠦", - "⠖", - "⠒", - "⠐", - "⠐", - "⠒", - "⠓", - "⠋", + '⠋', + '⠙', + '⠚', + '⠒', + '⠂', + '⠂', + '⠒', + '⠲', + '⠴', + '⠦', + '⠖', + '⠒', + '⠐', + '⠐', + '⠒', + '⠓', + '⠋', }, dots_footsteps = { -- dots10 - "⢄", - "⢂", - "⢁", - "⡁", - "⡈", - "⡐", - "⡠", + '⢄', + '⢂', + '⢁', + '⡁', + '⡈', + '⡐', + '⡠', }, dots_hop = { -- dots11 - "⠁", - "⠂", - "⠄", - "⡀", - "⢀", - "⠠", - "⠐", - "⠈", + '⠁', + '⠂', + '⠄', + '⡀', + '⢀', + '⠠', + '⠐', + '⠈', }, line = { - "-", - "\\", - "|", - "/", + '-', + '\\', + '|', + '/', }, pipe = { - "┤", - "┘", - "┴", - "└", - "├", - "┌", - "┬", - "┐", + '┤', + '┘', + '┴', + '└', + '├', + '┌', + '┬', + '┐', }, dots_ellipsis = { -- simpleDots - ". ", - ".. ", - "...", - " ", + '. ', + '.. ', + '...', + ' ', }, dots_scrolling = { -- simpleDotsScrolling - ". ", - ".. ", - "...", - " ..", - " .", - " ", + '. ', + '.. ', + '...', + ' ..', + ' .', + ' ', }, star = { - "✶", - "✸", - "✹", - "✺", - "✹", - "✷", + '✶', + '✸', + '✹', + '✺', + '✹', + '✷', }, flip = { - "_", - "_", - "_", - "-", - "`", - "`", + '_', + '_', + '_', + '-', + '`', + '`', "'", - "´", - "-", - "_", - "_", - "_", + '´', + '-', + '_', + '_', + '_', }, hamburger = { - "☱", - "☲", - "☴", + '☱', + '☲', + '☴', }, grow_vertical = { -- growVertical - "▁", - "▃", - "▄", - "▅", - "▆", - "▇", - "▆", - "▅", - "▄", - "▃", + '▁', + '▃', + '▄', + '▅', + '▆', + '▇', + '▆', + '▅', + '▄', + '▃', }, grow_horizontal = { -- growHorizontal - "▏", - "▎", - "▍", - "▌", - "▋", - "▊", - "▉", - "▊", - "▋", - "▌", - "▍", - "▎", + '▏', + '▎', + '▍', + '▌', + '▋', + '▊', + '▉', + '▊', + '▋', + '▌', + '▍', + '▎', }, noise = { - "▓", - "▒", - "░", + '▓', + '▒', + '░', }, dots_bounce = { -- bounce - "⠁", - "⠂", - "⠄", - "⠂", + '⠁', + '⠂', + '⠄', + '⠂', }, triangle = { - "◢", - "◣", - "◤", - "◥", + '◢', + '◣', + '◤', + '◥', }, arc = { - "◜", - "◠", - "◝", - "◞", - "◡", - "◟", + '◜', + '◠', + '◝', + '◞', + '◡', + '◟', }, circle = { - "◡", - "⊙", - "◠", + '◡', + '⊙', + '◠', }, square_corners = { -- squareCorners - "◰", - "◳", - "◲", - "◱", + '◰', + '◳', + '◲', + '◱', }, circle_quarters = { -- circleQuarters - "◴", - "◷", - "◶", - "◵", + '◴', + '◷', + '◶', + '◵', }, circle_halves = { -- circleHalves - "◐", - "◓", - "◑", - "◒", + '◐', + '◓', + '◑', + '◒', }, dots_toggle = { -- toggle - "⊶", - "⊷", + '⊶', + '⊷', }, box_toggle = { -- toggle2 - "▫", - "▪", + '▫', + '▪', }, arrow = { - "←", - "↖", - "↑", - "↗", - "→", - "↘", - "↓", - "↙", + '←', + '↖', + '↑', + '↗', + '→', + '↘', + '↓', + '↙', }, clock = { - "🕛 ", - "🕐 ", - "🕑 ", - "🕒 ", - "🕓 ", - "🕔 ", - "🕕 ", - "🕖 ", - "🕗 ", - "🕘 ", - "🕙 ", - "🕚 ", + '🕛 ', + '🕐 ', + '🕑 ', + '🕒 ', + '🕓 ', + '🕔 ', + '🕕 ', + '🕖 ', + '🕗 ', + '🕘 ', + '🕙 ', + '🕚 ', }, earth = { - "🌍 ", - "🌎 ", - "🌏 ", + '🌍 ', + '🌎 ', + '🌏 ', }, moon = { - "🌑 ", - "🌒 ", - "🌓 ", - "🌔 ", - "🌕 ", - "🌖 ", - "🌗 ", - "🌘 ", + '🌑 ', + '🌒 ', + '🌓 ', + '🌔 ', + '🌕 ', + '🌖 ', + '🌗 ', + '🌘 ', }, dots_pulse = { -- point - "∙∙∙", - "●∙∙", - "∙●∙", - "∙∙●", - "∙∙∙", + '∙∙∙', + '●∙∙', + '∙●∙', + '∙∙●', + '∙∙∙', + }, + fistBump = { + '🤜    🤛 ', + '🤜    🤛 ', + '🤜    🤛 ', + ' 🤜  🤛  ', + '  🤜🤛   ', + ' 🤜✨🤛   ', + '🤜 ✨ 🤛  ', + }, + monkey = { + '🙈 ', + '🙈 ', + '🙉 ', + '🙊 ' + }, + soccerHeader = { + ' 🧑⚽️ 🧑 ', + '🧑 ⚽️ 🧑 ', + '🧑 ⚽️ 🧑 ', + '🧑 ⚽️ 🧑 ', + '🧑 ⚽️ 🧑 ', + '🧑 ⚽️ 🧑 ', + '🧑 ⚽️🧑 ', + '🧑 ⚽️ 🧑 ', + '🧑 ⚽️ 🧑 ', + '🧑 ⚽️ 🧑 ', + '🧑 ⚽️ 🧑 ', + '🧑 ⚽️ 🧑 ', + }, + weather = { + '☀️ ', + '☀️ ', + '☀️ ', + '🌤 ', + '⛅️ ', + '🌥 ', + '☁️ ', + '🌧 ', + '🌨 ', + '🌧 ', + '🌨 ', + '🌧 ', + '🌨 ', + '⛈ ', + '🌨 ', + '🌧 ', + '🌨 ', + '☁️ ', + '🌥 ', + '⛅️ ', + '🌤 ', + '☀️ ', + '☀️ ', + }, + speaker = { + '🔈 ', + '🔉 ', + '🔊 ', + '🔉 ', + }, + smiley = { + '😄 ', + '😝 ', + }, + toggle = { + '⊶', + '⊷' + }, + toggle10 = { + '㊂', + '㊀', + '㊁' + }, + toggle11 = { + '⧇', + '⧆' + }, + toggle12 = { + '☗', + '☖' + }, + toggle13 = { + '=', + '*', + '-' + }, + toggle2 = { + '▫', + '▪' + }, + toggle3 = { + '□', + '■' + }, + toggle4 = { + '■', + '□', + '▪', + '▫' + }, + toggle5 = { + '▮', + '▯' + }, + toggle6 = { + 'ဝ', + '၀' + }, + toggle7 = { + '⦾', + '⦿' + }, + toggle8 = { + '◍', + '◌' + }, + toggle9 = { + '◉', + '◎' + }, + star = { + '✶', + '✸', + '✹', + '✺', + '✹', + '✷' + }, + star2 = { + '+', + 'x', + '*' + }, + orangeBluePulse = { + '🔸 ', + '🔶 ', + '🟠 ', + '🟠 ', + '🔶 ', + '🔹 ', + '🔷 ', + '🔵 ', + '🔵 ', + '🔷 ', + }, + orangePulse = { + '🔸 ', + '🔶 ', + '🟠 ', + '🟠 ', + '🔶 ' + }, + mindblown = { + '😐 ', + '😐 ', + '😮 ', + '😮 ', + '😦 ', + '😦 ', + '😧 ', + '😧 ', + '🤯 ', + '💥 ', + '✨ ', + '  ', + '  ', + '  ', + }, + hearts = { + '💛 ', + '💙 ', + '💜 ', + '💚 ', + '❤️ ' + }, + fingerDance = { + '🤘 ', + '🤟 ', + '🖖 ', + '✋ ', + '🤚 ', + '👆 ' + }, + christmas = { + '🌲', + '🎄' + }, + circleHalves = { + '◐', + '◓', + '◑', + '◒' + }, + bouncingBall = { + '( ● )', + '( ● )', + '( ● )', + '( ● )', + '( ●)', + '( ● )', + '( ● )', + '( ● )', + '( ● )', + '(● )', + }, + bluePulse = { + '🔹 ', + '🔷 ', + '🔵 ', + '🔵 ', + '🔷 ' + }, + betaWave = { + 'ρββββββ', + 'βρβββββ', + 'ββρββββ', + 'βββρβββ', + 'ββββρββ', + 'βββββρβ', + 'ββββββρ', }, }