schoolbox web extension :)
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

refactor: disable auto imports

willow fdbaccaa 300d0c61

+92 -22
+4
src/entrypoints/background.ts
··· 1 + import type { Browser } from "#imports"; 2 + import { browser, defineBackground, storage } from "#imports"; 3 + import { logger } from "@/utils/logger"; 4 + import { globalSettings, updated } from "@/utils/storage"; 1 5 import semver from "semver"; 2 6 3 7 export default defineBackground(() => {
+5
src/entrypoints/end.content.ts
··· 1 + import { browser, defineContentScript } from "#imports"; 2 + import { EXCLUDE_MATCHES } from "@/utils/constants"; 3 + import { logger } from "@/utils/logger"; 4 + import { globalSettings, schoolboxUrls } from "@/utils/storage"; 5 + 1 6 export default defineContentScript({ 2 7 matches: ["<all_urls>"], 3 8 runAt: "document_end",
+2
src/entrypoints/plugins.content.ts
··· 1 + import { defineContentScript } from "#imports"; 2 + import { EXCLUDE_MATCHES } from "@/utils/constants"; 1 3 import homepageSwitcher from "./plugins/homepageSwitcher"; 2 4 import modernIcons from "./plugins/modernIcons"; 3 5 import progressBar from "./plugins/progressBar";
+3
src/entrypoints/plugins/homepageSwitcher.ts
··· 1 + import { browser } from "#imports"; 2 + import { definePlugin } from "@/utils/plugin"; 3 + 1 4 export default function init() { 2 5 definePlugin( 3 6 "homepageSwitcher",
+3 -8
src/entrypoints/plugins/modernIcons/index.ts
··· 1 + import { injectStyles } from "@/utils"; 2 + import { definePlugin } from "@/utils/plugin"; 1 3 import styleText from "./styles.css?inline"; 2 4 3 5 export default function init() { ··· 56 58 }); 57 59 } 58 60 59 - let fontFill = true; 60 - 61 - const filled = await data.settings?.toggle?.filled?.toggle?.storage?.getValue(); 62 - if (filled?.toggle !== undefined) { 63 - fontFill = filled.toggle; 64 - } 65 - 66 61 const iconNames = [...new Set(Object.values(icons))].sort(); 67 62 const fontUrl = `https://fonts.googleapis.com/css2?family=Material+Symbols+Rounded:FILL@0..1&icon_names=${iconNames.join(",")}`; 68 63 // logger.info(fontUrl); ··· 77 72 injectStyles(styleText); 78 73 79 74 for (const [className, iconName] of Object.entries(icons)) { 80 - insertIcon(className, iconName, fontFill); 75 + insertIcon(className, iconName, settings.toggle.filled); 81 76 } 82 77 }, 83 78 ["nav.tab-bar .top-menu", "#overflow-nav"],
+4
src/entrypoints/plugins/progressBar/index.ts
··· 1 + import { injectStyles } from "@/utils"; 2 + import type { Period } from "@/utils/periodUtils"; 3 + import { getListOfPeriods } from "@/utils/periodUtils"; 4 + import { definePlugin } from "@/utils/plugin"; 1 5 import styleText from "./styles.css?inline"; 2 6 3 7 export default function init() {
+3
src/entrypoints/plugins/scrollPeriod.ts
··· 1 + import { getCurrentPeriod } from "@/utils/periodUtils"; 2 + import { definePlugin } from "@/utils/plugin"; 3 + 1 4 export default function init() { 2 5 definePlugin( 3 6 "scrollPeriod",
+2
src/entrypoints/plugins/scrollSegments/index.ts
··· 1 + import { injectStyles } from "@/utils"; 2 + import { definePlugin } from "@/utils/plugin"; 1 3 import styleText from "./styles.css?inline"; 2 4 3 5 export default function init() {
+3
src/entrypoints/plugins/subheader.ts
··· 1 + import { getCurrentPeriod } from "@/utils/periodUtils"; 2 + import { definePlugin } from "@/utils/plugin"; 3 + 1 4 export default function init() { 2 5 definePlugin( 3 6 "subheader",
+2
src/entrypoints/plugins/tabTitle.ts
··· 1 + import { definePlugin } from "@/utils/plugin"; 2 + 1 3 export default function init() { 2 4 definePlugin( 3 5 "tabTitle",
+6 -4
src/entrypoints/popup/App.svelte
··· 1 1 <script lang="ts"> 2 + import { flavors } from "@catppuccin/palette"; 3 + import { globalSettings, needsRefresh, schoolboxUrls, updated } from "@/utils/storage"; 4 + import { RotateCw } from "@lucide/svelte"; 5 + import { logger } from "@/utils/logger"; 6 + import { browser, onMount } from "#imports"; 7 + 2 8 import Router from "svelte-spa-router"; 3 9 import active from "svelte-spa-router/active"; 4 10 import Home from "./routes/Home.svelte"; ··· 6 12 import Themes from "./routes/Themes.svelte"; 7 13 import Snippets from "./routes/Snippets.svelte"; 8 14 import Banner from "./components/Banner.svelte"; 9 - 10 - import { flavors } from "@catppuccin/palette"; 11 - import { needsRefresh } from "@/utils/storage"; 12 - import { RotateCw } from "@lucide/svelte"; 13 15 14 16 const routes = { 15 17 "/": Home,
+2
src/entrypoints/popup/components/Footer.svelte
··· 1 1 <script lang="ts"> 2 2 import { onMount } from "svelte"; 3 + import { browser } from "#imports"; 4 + import { updated } from "@/utils/storage"; 3 5 import Button from "./inputs/Button.svelte"; 4 6 import { RotateCcw, Globe, GitBranch } from "@lucide/svelte"; 5 7
+1
src/entrypoints/popup/components/Motd.svelte
··· 1 1 <script lang="ts"> 2 + import { motd } from "@/utils/storage"; 2 3 import { onMount } from "svelte"; 3 4 4 5 onMount(async () => {
+1
src/entrypoints/popup/routes/Home.svelte
··· 1 1 <script lang="ts"> 2 + import { globalSettings } from "@/utils/storage"; 2 3 import Footer from "../components/Footer.svelte"; 3 4 import Motd from "../components/Motd.svelte"; 4 5
+3 -1
src/entrypoints/popup/routes/Plugins.svelte
··· 1 1 <script lang="ts"> 2 + import type { PluginId } from "@/utils/storage"; 3 + import { globalSettings, plugins } from "@/utils/storage"; 4 + import { Settings } from "@lucide/svelte"; 2 5 import Title from "../components/Title.svelte"; 3 6 import Button from "../components/inputs/Button.svelte"; 4 - import { Settings } from "@lucide/svelte"; 5 7 import Modal from "../components/Modal.svelte"; 6 8 import Toggle from "../components/inputs/Toggle.svelte"; 7 9 import Slider from "../components/inputs/Slider.svelte";
+4 -1
src/entrypoints/popup/routes/Snippets.svelte
··· 1 1 <script lang="ts"> 2 + import type { SnippetId, UserSnippet } from "@/utils/storage"; 3 + import { globalSettings, snippets } from "@/utils/storage"; 4 + 2 5 import Title from "../components/Title.svelte"; 3 6 import Toggle from "../components/inputs/Toggle.svelte"; 4 7 import TextInput from "../components/inputs/TextInput.svelte"; ··· 71 74 </div> 72 75 73 76 <div class="user-snippets-container w-full"> 74 - {#each Object.entries(globalSettings.state.userSnippets as Record<string, UserSnippet>) as [id, snippet] (id)} 77 + {#each Object.entries(globalSettings.state.userSnippets as Record<SnippetId, UserSnippet>) as [id, snippet] (id)} 75 78 <div class="group my-4 w-full"> 76 79 <Toggle 77 80 {id}
+6 -1
src/entrypoints/popup/routes/Themes.svelte
··· 1 1 <script lang="ts"> 2 + import { browser } from "#imports"; 3 + import type { LogoId } from "@/utils/storage"; 4 + import { globalSettings } from "@/utils/storage"; 5 + import { LOGO_INFO } from "@/utils/constants"; 6 + import { Palette } from "@lucide/svelte"; 7 + 2 8 import Title from "../components/Title.svelte"; 3 9 import Modal from "../components/Modal.svelte"; 4 10 import Button from "../components/inputs/Button.svelte"; 5 11 import Toggle from "../components/inputs/Toggle.svelte"; 6 - import { Palette } from "@lucide/svelte"; 7 12 8 13 const flavours = ["latte", "frappe", "macchiato", "mocha"]; 9 14 const accents = [
+3
src/entrypoints/snippets.content.ts
··· 1 + import { defineContentScript } from "#imports"; 2 + import { EXCLUDE_MATCHES } from "@/utils/constants"; 3 + import { defineSnippet } from "@/utils/snippet"; 1 4 import censor from "./snippets/censor.css?inline"; 2 5 import hidePfp from "./snippets/hidePfp/styles.css?inline"; 3 6 import hidePwaPrompt from "./snippets/hidePwaPrompt.css?inline";
+5
src/entrypoints/start.content.ts
··· 1 + import { browser, defineContentScript } from "#imports"; 2 + import { injectCatppuccin, injectLogo, injectStylesheet, injectUserSnippets } from "@/utils"; 3 + import { EXCLUDE_MATCHES, LOGO_INFO } from "@/utils/constants"; 4 + import type { LogoId } from "@/utils/storage"; 5 + import { globalSettings, schoolboxUrls } from "@/utils/storage"; 1 6 import cssUrl from "./catppuccin.css?url"; 2 7 3 8 export default defineContentScript({
+2
src/utils/constants.ts
··· 1 + import type { LogoId, LogoInfo } from "./storage"; 2 + 1 3 export const EXCLUDE_MATCHES: string[] = ["*://*/learning/quiz/*"]; 2 4 export const LOGO_INFO: Record<LogoId, LogoInfo> = { 3 5 default: {
+3
src/utils/index.ts
··· 1 + import { browser } from "#imports"; 1 2 import { flavorEntries } from "@catppuccin/palette"; 3 + import { logger } from "./logger"; 4 + import type { LogoInfo, UserSnippet } from "./storage"; 2 5 3 6 export function injectStyles(styleText: string) { 4 7 logger.info(`[content-utils] Injecting styles: ${styleText}`);
+2
src/utils/periodUtils.ts
··· 1 1 // these utility functions are intended to be used on the dashboard, as that is where the timetable is displayed 2 2 3 + import { logger } from "./logger"; 4 + 3 5 interface PeriodHeader { 4 6 name: string; 5 7 time: {
+5 -1
src/utils/plugin.ts
··· 1 + import { logger } from "./logger"; 2 + import type { PluginData, PluginId, PluginSetting } from "./storage"; 3 + import { globalSettings, plugins, schoolboxUrls } from "./storage"; 4 + 1 5 export async function definePlugin( 2 6 pluginId: PluginId, 3 - injectLogic: (id: PluginId, data: PluginData, settings?: Record<string, PluginSetting>) => void, 7 + injectLogic: (id: PluginId, data: PluginData, settings?: Record<string, PluginSetting>) => Promise<void> | void, 4 8 elementsToWaitFor: string[] = [], 5 9 ) { 6 10 const plugin = await plugins[pluginId].toggle.storage.getValue();
+7 -2
src/utils/snippet.ts
··· 1 + import { injectStyles } from "."; 2 + import { logger } from "./logger"; 3 + import type { SnippetId } from "./storage"; 4 + import { globalSettings, schoolboxUrls, snippets } from "./storage"; 5 + 1 6 export async function defineSnippet(snippetId: SnippetId, styleText: string) { 2 7 const snippet = await snippets[snippetId].toggle.storage.getValue(); 3 8 4 - logger.info(`${snippets[snippetId].info.name}: ${snippet.toggle ? "enabled" : "disabled"}`); 9 + logger.info(`${snippets[snippetId].name}: ${snippet.toggle ? "enabled" : "disabled"}`); 5 10 6 11 const settings = await globalSettings.storage.getValue(); 7 12 const urls = (await schoolboxUrls.storage.getValue()).urls; ··· 9 14 if (snippet && typeof window !== "undefined" && urls.includes(window.location.origin)) { 10 15 if (settings.global && settings.snippets && snippet.toggle) { 11 16 // inject 12 - logger.info(`Injecting snippet: ${snippets[snippetId].info.name}`); 17 + logger.info(`Injecting snippet: ${snippets[snippetId].name}`); 13 18 injectStyles(styleText); 14 19 } 15 20 }
+2 -1
src/utils/storage/global.ts
··· 1 + import { storage } from "#imports"; 1 2 import { StorageState } from "./state.svelte"; 2 - import * as Types from "./types"; 3 + import type * as Types from "./types"; 3 4 4 5 export const globalSettings = new StorageState<Types.Settings>( 5 6 storage.defineItem<Types.Settings>("local:globalSettings", {
+2 -1
src/utils/storage/plugins.ts
··· 1 + import { storage } from "#imports"; 1 2 import { StorageState } from "./state.svelte"; 2 - import * as Types from "./types"; 3 + import type * as Types from "./types"; 3 4 4 5 const pluginConfig: Record<Types.PluginId, Types.PluginConfig> = { 5 6 subheader: {
+2 -1
src/utils/storage/snippets.ts
··· 1 + import { storage } from "#imports"; 1 2 import { StorageState } from "./state.svelte"; 2 - import * as Types from "./types"; 3 + import type * as Types from "./types"; 3 4 4 5 export const snippetConfig: Record<Types.SnippetId, Types.SnippetConfig> = { 5 6 roundedCorners: {
+3
src/utils/storage/state.svelte.ts
··· 1 + import type { WxtStorageItem } from "#imports"; 2 + import { needsRefresh } from "./global"; 3 + 1 4 export class StorageState<T> { 2 5 public state; 3 6
+1 -1
src/utils/storage/types.ts
··· 1 - import { StorageState } from "./state.svelte"; 1 + import type { StorageState } from "./state.svelte"; 2 2 3 3 // Global 4 4 export interface Settings {
+1
wxt.config.ts
··· 18 18 srcDir: "src", 19 19 outDir: "dist", 20 20 modules: ["@wxt-dev/module-svelte"], 21 + imports: false, 21 22 vite: () => ({ 22 23 plugins: [tailwindcss()], 23 24 }),