feat: inline chrome-extension-toolkit (#744)

* feat(build): inline chrome-extension-toolkit

fix: tsconfig

docs: add chrome-extension-toolkit README.md

chore: update imports

fix: stores

fix: chrome-extension-toolkit ForegroundMessenger

fix: calendarBackgroundHandler

fix: format and lint

fix: path alias

fix: add jsdom env and fix imports

Co-authored-by: Sriram Hariharan <sghsri@gmail.com>

* build: vite storybook config crx toolkit line

---------

Co-authored-by: Sriram Hariharan <sghsri@gmail.com>
Co-authored-by: Derek <derex1987@gmail.com>
This commit is contained in:
Diego Perez
2026-02-11 00:50:27 -06:00
committed by GitHub
parent d5954410a7
commit a537d17a2f
67 changed files with 1833 additions and 92 deletions

View File

@@ -1,4 +1,4 @@
import { createMessenger } from 'chrome-extension-toolkit';
import { createMessenger } from '@chrome-extension-toolkit';
import type BrowserActionMessages from './BrowserActionMessages';
import type { CalendarBackgroundMessages, CalendarTabMessages } from './CalendarMessages';

View File

@@ -1,5 +1,5 @@
import { createLocalStore } from '@chrome-extension-toolkit';
import type { CachedData } from '@shared/types/CachedData';
import { createLocalStore, debugStore } from 'chrome-extension-toolkit';
interface ICacheStore {
github: Record<string, CachedData<unknown>>;
@@ -8,8 +8,8 @@ interface ICacheStore {
/**
* A store that is used for storing cached data such as GitHub contributors
*/
export const CacheStore = createLocalStore<ICacheStore>({
export const CacheStore = createLocalStore<ICacheStore>('CacheStore', {
github: {},
});
debugStore({ cacheStore: CacheStore });
// debugStore({ cacheStore: CacheStore });

View File

@@ -1,4 +1,4 @@
import { createLocalStore, debugStore } from 'chrome-extension-toolkit';
import { createLocalStore } from '@chrome-extension-toolkit';
/**
* A store that is used to store data that is only relevant during development
@@ -18,7 +18,7 @@ interface IDevStore {
reloadTabId?: number;
}
export const DevStore = createLocalStore<IDevStore>({
export const DevStore = createLocalStore<IDevStore>('DevStore', {
isDeveloper: false,
debugTabId: undefined,
isTabReloading: true,
@@ -27,4 +27,4 @@ export const DevStore = createLocalStore<IDevStore>({
reloadTabId: undefined,
});
debugStore({ devStore: DevStore });
// debugStore({ devStore: DevStore });

View File

@@ -1,4 +1,4 @@
import { createLocalStore, debugStore } from 'chrome-extension-toolkit';
import { createLocalStore } from '@chrome-extension-toolkit';
/**
* A store that is used for storing user options
@@ -12,10 +12,10 @@ interface IExtensionStore {
lastWhatsNewPopupVersion: number;
}
export const ExtensionStore = createLocalStore<IExtensionStore>({
export const ExtensionStore = createLocalStore<IExtensionStore>('ExtensionStore', {
version: chrome.runtime.getManifest().version,
lastUpdate: Date.now(),
lastWhatsNewPopupVersion: 0,
});
debugStore({ ExtensionStore });
// debugStore({ ExtensionStore });

View File

@@ -1,4 +1,4 @@
import { createSyncStore, debugStore } from 'chrome-extension-toolkit';
import { createSyncStore } from '@chrome-extension-toolkit';
/**
* A store that is used for storing user options
@@ -28,7 +28,7 @@ export interface IOptionsStore {
allowMoreSchedules: boolean;
}
export const OptionsStore = createSyncStore<IOptionsStore>({
export const OptionsStore = createSyncStore<IOptionsStore>('OptionsStore', {
enableCourseStatusChips: false,
enableHighlightConflicts: true,
enableScrollToLoad: true,
@@ -58,4 +58,4 @@ export const initSettings = async () =>
// Clothing retailer right
debugStore({ OptionsStore });
// debugStore({ OptionsStore });

View File

@@ -1,5 +1,5 @@
import { createLocalStore } from '@chrome-extension-toolkit';
import { UserSchedule } from '@shared/types/UserSchedule';
import { createLocalStore, debugStore } from 'chrome-extension-toolkit';
import { generateRandomId } from '../util/random';
@@ -11,7 +11,7 @@ interface IUserScheduleStore {
/**
* A store that is used for storing user schedules (and the active schedule)
*/
export const UserScheduleStore = createLocalStore<IUserScheduleStore>({
export const UserScheduleStore = createLocalStore<IUserScheduleStore>('UserScheduleStore', {
schedules: [
new UserSchedule({
courses: [],
@@ -24,4 +24,4 @@ export const UserScheduleStore = createLocalStore<IUserScheduleStore>({
activeIndex: 0,
});
debugStore({ userScheduleStore: UserScheduleStore });
// debugStore({ userScheduleStore: UserScheduleStore });

View File

@@ -1,5 +1,5 @@
import type { Serialized } from '@chrome-extension-toolkit';
import { getCourseColors } from '@shared/util/colors';
import type { Serialized } from 'chrome-extension-toolkit';
import type { CourseMeeting } from './CourseMeeting';
import { CourseSchedule } from './CourseSchedule';

View File

@@ -1,4 +1,4 @@
import type { Serialized } from 'chrome-extension-toolkit';
import type { Serialized } from '@chrome-extension-toolkit';
/**
* a map of the days of the week that a class is taught, and the corresponding abbreviation

View File

@@ -1,4 +1,4 @@
import type { Serialized } from 'chrome-extension-toolkit';
import type { Serialized } from '@chrome-extension-toolkit';
import type { Day } from './CourseMeeting';
import { CourseMeeting, DAY_MAP } from './CourseMeeting';

View File

@@ -1,5 +1,5 @@
import type { Serialized } from '@chrome-extension-toolkit';
import { capitalize } from '@shared/util/string';
import type { Serialized } from 'chrome-extension-toolkit';
/**
* A type representing an instructor for a course (who teaches it)

View File

@@ -1,4 +1,4 @@
import type { Serialized } from 'chrome-extension-toolkit';
import type { Serialized } from '@chrome-extension-toolkit';
import { generateRandomId } from '../util/random';
import { Course } from './Course';

View File

@@ -1,4 +1,4 @@
import type { Serialized } from 'chrome-extension-toolkit';
import type { Serialized } from '@chrome-extension-toolkit';
import { theme } from 'unocss/preset-mini';
import type { HexColor, HSL, Lab, RGB, sRGB } from '../types/Color';