feat: Implement Gogh Theme Engine with options page, theme parsing, and semantic theme derivation
We're cooked. <skull emoji> - Added options page for YAML palette editing, live color preview, and diagnostics. - Implemented theme engine to parse Gogh YAML palettes and derive semantic themes. - Configured TypeScript and Vite for building the extension. - Created new tab and popup HTML pages with corresponding scripts and styles. - Established storage management for user configurations in Chrome storage. - Added icons for the extension and updated manifest for MV3 compatibility.
This commit is contained in:
5
common/settings.js
Normal file
5
common/settings.js
Normal file
@@ -0,0 +1,5 @@
|
||||
export const CHROME_SYNC_STORAGE_KEY = "chrome-extension-template";
|
||||
|
||||
export const PRESET_CONFIGURATION = {
|
||||
"storageValue": "https://clydedsouza.net",
|
||||
};
|
||||
10
common/settings.test.js
Normal file
10
common/settings.test.js
Normal file
@@ -0,0 +1,10 @@
|
||||
import * as settingsModule from "./settings";
|
||||
|
||||
describe("settings", () => {
|
||||
test("has a preset configuration key", () => {
|
||||
const presetConfig = settingsModule.PRESET_CONFIGURATION;
|
||||
const keys = Object.keys(presetConfig);
|
||||
expect(keys.length).toBe(1);
|
||||
expect(presetConfig["storageValue"]).toBe("https://clydedsouza.net");
|
||||
});
|
||||
});
|
||||
9
common/storage.js
Normal file
9
common/storage.js
Normal file
@@ -0,0 +1,9 @@
|
||||
export const getStorage = (componentKey, callback) => {
|
||||
chrome.storage.sync.get([componentKey], function(result) {
|
||||
callback(result[componentKey]);
|
||||
});
|
||||
};
|
||||
|
||||
export const setStorage = (componentKey, value) => {
|
||||
chrome.storage.sync.set({[componentKey]: value});
|
||||
};
|
||||
42
common/storage.test.js
Normal file
42
common/storage.test.js
Normal file
@@ -0,0 +1,42 @@
|
||||
import * as storageModule from "./storage";
|
||||
|
||||
const get = jest.fn();
|
||||
const set = jest.fn();
|
||||
|
||||
global.chrome = {
|
||||
storage: {
|
||||
sync: {
|
||||
set,
|
||||
get
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
const chromeGetStorageSpy = jest.spyOn(chrome.storage.sync, 'get');
|
||||
const chromeSetStorageSpy = jest.spyOn(chrome.storage.sync, 'set');
|
||||
|
||||
describe("storage → getStorage", () => {
|
||||
beforeEach(() => {
|
||||
jest.resetAllMocks();
|
||||
});
|
||||
|
||||
test("chrome get storage api method called", () => {
|
||||
const getCallback = jest.fn();
|
||||
|
||||
storageModule.getStorage("Test", getCallback);
|
||||
|
||||
expect(chromeGetStorageSpy).toHaveBeenCalledWith(["Test"], expect.any(Function));
|
||||
});
|
||||
});
|
||||
|
||||
describe("storage → setStorage", () => {
|
||||
beforeEach(() => {
|
||||
jest.resetAllMocks();
|
||||
});
|
||||
|
||||
test("chrome set storage api method called", () => {
|
||||
storageModule.setStorage("Test", "Value");
|
||||
|
||||
expect(chromeSetStorageSpy).toHaveBeenCalledWith({["Test"]: "Value"});
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user