aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTeddy Wing2019-05-01 15:49:26 +0200
committerTeddy Wing2019-05-01 15:49:26 +0200
commita17a9e2b3d890711f5f5f86c04cfef1a5c64a2aa (patch)
treee0a76fb7995b389cc2ba6b40b81e1eba3b49f57e
parent33f83a17badb4586c0eb0e3b78aef9c8debe371f (diff)
downloadmuttagen-a17a9e2b3d890711f5f5f86c04cfef1a5c64a2aa.tar.bz2
Move Gmail CSS class definitions to a new module
Allow them to be used for a new Sidebar module that will enable sidebar toggling. Had to switch the compiled module system to `amd` because of this error message: tsconfig.json:3:3 - error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. Thinking I'm going to switch to Typescript namespaces to save myself the trouble of using a 'require' library for the AMD modules.
-rw-r--r--src/gmail_css_class.ts5
-rw-r--r--src/sidebar.ts1
-rw-r--r--src/style.ts13
-rw-r--r--tsconfig.json2
4 files changed, 11 insertions, 10 deletions
diff --git a/src/gmail_css_class.ts b/src/gmail_css_class.ts
new file mode 100644
index 0000000..70b91e1
--- /dev/null
+++ b/src/gmail_css_class.ts
@@ -0,0 +1,5 @@
+export type GmailCSSClass = string;
+
+export const TOOLS_PANEL: GmailCSSClass = 'bAw';
+export const SIDEBAR: GmailCSSClass = 'aeN';
+export const MESSAGE_PAGER: GmailCSSClass = 'AO';
diff --git a/src/sidebar.ts b/src/sidebar.ts
new file mode 100644
index 0000000..6e20980
--- /dev/null
+++ b/src/sidebar.ts
@@ -0,0 +1 @@
+import SIDEBAR from './gmail_css_class.ts';
diff --git a/src/style.ts b/src/style.ts
index 93ce355..4ed8fd3 100644
--- a/src/style.ts
+++ b/src/style.ts
@@ -1,15 +1,10 @@
-type GmailCSSClass = string;
+import * as g from './gmail_css_class.ts';
-const TOOLS_PANEL: GmailCSSClass = 'bAw';
-const SIDEBAR: GmailCSSClass = 'aeN';
-const MESSAGE_PAGER: GmailCSSClass = 'AO';
-
-
-type GmailCSSDefinitions = { [selector in GmailCSSClass]: string };
+type GmailCSSDefinitions = { [selector in g.GmailCSSClass]: string };
var css: GmailCSSDefinitions = {};
-css[TOOLS_PANEL] = 'display: none;';
-css[MESSAGE_PAGER] = 'filter: invert(100%);';
+css[g.TOOLS_PANEL] = 'display: none;';
+css[g.MESSAGE_PAGER] = 'filter: invert(100%);';
function construct_css(css: GmailCSSDefinitions): string {
var joined = '';
diff --git a/tsconfig.json b/tsconfig.json
index 1c994f4..637f7ff 100644
--- a/tsconfig.json
+++ b/tsconfig.json
@@ -1,6 +1,6 @@
{
"compilerOptions": {
- "module": "commonjs",
+ "module": "amd",
"target": "ES5",
"outFile": "./build/muttagen.user.js",
"sourceMap": true