From 28c0bda708250911776499c3fbb145ab8b94c531 Mon Sep 17 00:00:00 2001 From: trickypr <23250792+trickypr@users.noreply.github.com> Date: Fri, 10 Nov 2023 20:25:37 +1100 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20Tab=20loading=20spinner?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 1 + pnpm-lock.yaml | 15 +++++- .../browser/components/tabs/Tab.svelte | 18 ++++++-- src/content/browser/components/tabs/tab.ts | 46 +++++++++++++++++-- src/content/browser/lib/binaryEnums.ts | 4 ++ src/content/shared/components/Spinner.svelte | 28 +++++++++++ 6 files changed, 104 insertions(+), 8 deletions(-) create mode 100644 src/content/browser/lib/binaryEnums.ts create mode 100644 src/content/shared/components/Spinner.svelte diff --git a/package.json b/package.json index 30c514b..382b141 100644 --- a/package.json +++ b/package.json @@ -54,6 +54,7 @@ }, "dependencies": { "@catppuccin/palette": "^0.2.0", + "fnts": "^2.0.1", "mitt": "^3.0.1", "remixicon": "^3.5.0", "snarkdown": "^2.0.0" diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index f6cfeed..e236617 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -13,6 +13,9 @@ dependencies: '@catppuccin/palette': specifier: ^0.2.0 version: 0.2.0 + fnts: + specifier: ^2.0.1 + version: 2.0.1(typescript@5.2.2) mitt: specifier: ^3.0.1 version: 3.0.1 @@ -1422,6 +1425,17 @@ packages: path-exists: 4.0.0 dev: true + /fnts@2.0.1(typescript@5.2.2): + resolution: {integrity: sha512-pg5jBjtTdWMen8OzFKd0gPOHgnvAzm0ndKKrGT4xYZYBSobDLhqLSf2tnDpmdPuPvV3rMwae0lOmmvOJ+l1VNg==} + peerDependencies: + typescript: '>=4.7' + peerDependenciesMeta: + typescript: + optional: true + dependencies: + typescript: 5.2.2 + dev: false + /follow-redirects@1.15.3: resolution: {integrity: sha512-1VzOtuEM8pC9SFU1E+8KfTjZyMztRsgEfwQl44z8A25uy13jSzTj6dyK2Df52iV0vgHCfBwLhDWevLn95w5v6Q==} engines: {node: '>=4.0'} @@ -3213,7 +3227,6 @@ packages: resolution: {integrity: sha512-mI4WrpHsbCIcwT9cF4FZvr80QUeKvsUsUvKDoR+X/7XHQH98xYD8YHZg7ANtz2GtZt/CBq2QJ0thkGJMHfqc1w==} engines: {node: '>=14.17'} hasBin: true - dev: true /undici-types@5.25.3: resolution: {integrity: sha512-Ga1jfYwRn7+cP9v8auvEXN1rX3sWqlayd4HP7OKk4mZWylEmu3KzXDUGrQUN6Ol7qo1gPvB2e5gX6udnyEPgdA==} diff --git a/src/content/browser/components/tabs/Tab.svelte b/src/content/browser/components/tabs/Tab.svelte index 5eda03e..c8cb28f 100644 --- a/src/content/browser/components/tabs/Tab.svelte +++ b/src/content/browser/components/tabs/Tab.svelte @@ -6,13 +6,14 @@ import { type Tab } from './tab' import { closeTab, moveTabBefore, moveTabAfter } from '../../lib/globalApi' import type { DragEventHandler } from 'svelte/elements' + import Spinner from '../../../shared/components/Spinner.svelte' export let tab: Tab export let selectedTab: number let lastDragIsBefore: undefined | boolean - const { title, icon, uri } = tab + const { title, icon, uri, loading } = tab $: tab.getId() == selectedTab && (document.title = $title) @@ -53,8 +54,12 @@ aria-selected={tab.getId() == selectedTab} draggable="true" > - {#if $icon} - favicon + {#if $loading} +
+ +
+ {:else if $icon} + favicon {/if} {$title || $uri.asciiSpec}