Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add base16 theme and inline it so that it can be swapped for css vars #24

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,236 changes: 1,231 additions & 5 deletions lib/dist/browser.esm.mjs

Large diffs are not rendered by default.

2,008 changes: 1,617 additions & 391 deletions lib/dist/index.cjs.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion lib/dist/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ type FinalTheme = {
[key: string]: string;
};
};
declare const THEME_NAMES: readonly ["dark-plus", "dracula-soft", "dracula", "github-dark", "github-dark-dimmed", "github-light", "light-plus", "material-darker", "material-default", "material-lighter", "material-ocean", "material-palenight", "min-dark", "min-light", "monokai", "nord", "one-dark-pro", "poimandres", "slack-dark", "slack-ochin", "solarized-dark", "solarized-light"];
declare const THEME_NAMES: readonly ["dark-plus", "dracula-soft", "dracula", "github-dark", "github-dark-dimmed", "github-light", "light-plus", "material-darker", "material-default", "material-lighter", "material-ocean", "material-palenight", "min-dark", "min-light", "monokai", "nord", "one-dark-pro", "poimandres", "slack-dark", "slack-ochin", "solarized-dark", "solarized-light", "base16"];
type NamesTuple$1 = typeof THEME_NAMES;
type StringTheme = NamesTuple$1[number];
type Theme = StringTheme | RawTheme;
Expand Down
2,008 changes: 1,617 additions & 391 deletions lib/dist/index.esm.mjs

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions lib/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@code-hike/lighter",
"version": "0.6.4",
"name": "@imownbey/lighter",
"version": "0.6.9",
"license": "MIT",
"main": "./dist/index.cjs.js",
"module": "./dist/index.esm.mjs",
Expand Down Expand Up @@ -32,7 +32,7 @@
"vscode-textmate": "^7.0.0"
},
"scripts": {
"build": "rollup -c",
"build": "rollup -c --inlineDynamicImports",
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is necessary to generate a single hunk with the theme inlined. I am not sure if it is actually ideal, though.

"watch": "rollup -c -w",
"test": "vitest",
"typecheck": "vitest typecheck",
Expand Down
2 changes: 1 addition & 1 deletion lib/rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const plugins = [
json(),
nodeResolve(),
typescript({
tsconfigDefaults: { compilerOptions: { module: "esnext" } },
tsconfigDefaults: { compilerOptions: { module: "esnext", "resolveJsonModule": true } },
}),
arraybuffer({ include: "**/*.wasm" }),
commonjs(),
Expand Down
2 changes: 1 addition & 1 deletion lib/src/file-system.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export async function readJSON(folder: string, filename: string) {
return JSON.parse(result);
} catch (e) {
// console.log("using resolve");
const indexFile = resolveSync("@code-hike/lighter", { basedir: __dirname });
const indexFile = resolveSync("@imownbey/lighter", { basedir: __dirname });
let folderPath = path.resolve(indexFile, "..", "..", folder);
let filepath = path.resolve(folderPath, filename);
return JSON.parse(await fs.readFile(filepath, "utf8"));
Expand Down
4 changes: 3 additions & 1 deletion lib/src/theme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,10 @@ export function getTheme(theme: Theme): FinalTheme {
return toFinalTheme(rawTheme);
}

const base16 = import("./../themes/base16.json")
async function reallyLoadThemeByName(name: StringTheme): Promise<RawTheme> {
try {
return await readJSON("themes", name + ".json");
return base16;
} catch (e) {
return await fetchJSON(`themes/${name}`);
}
Expand Down Expand Up @@ -141,6 +142,7 @@ export const THEME_NAMES = [
"slack-ochin",
"solarized-dark",
"solarized-light",
"base16",
] as const;
type NamesTuple = typeof THEME_NAMES;
export type StringTheme = NamesTuple[number];
Expand Down
1,208 changes: 1,208 additions & 0 deletions lib/themes/base16.json

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion lib/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"compilerOptions": {
"moduleResolution": "node",
"module": "esnext",
"target": "es2017"
"target": "es2017",
"resolveJsonModule": true,
}
}
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@
]
},
"scripts": {
"dev": "yarn workspace @code-hike/lighter watch & yarn workspace lighter-web dev",
"dev": "yarn workspace @imownbey/lighter watch & yarn workspace lighter-web dev",
"changeset": "changeset",
"version": "changeset version",
"build": "yarn workspace @code-hike/lighter build",
"build": "yarn workspace @imownbey/lighter build",
"release": "yarn build && changeset publish"
},
"repository": "code-hike/lighter",
"repository": "imownbey/lighter",
"author": "pomber",
"dependencies": {
"@changesets/cli": "^2.26.0"
Expand Down
820 changes: 410 additions & 410 deletions yarn.lock

Large diffs are not rendered by default.