diff --git a/.eslintrc.js b/.eslintrc.js index 85a30b0..33532f8 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -14,15 +14,12 @@ module.exports = { project: './tsconfig.json', }, rules: { - '@typescript-eslint/no-explicit-any': false, '@typescript-eslint/consistent-type-assertions': ['error', { assertionStyle: 'as' }], '@typescript-eslint/no-floating-promises': ['error'], '@typescript-eslint/explicit-function-return-type': ['warn', { allowExpressions: true }], '@typescript-eslint/no-unused-vars': ['warn', { varsIgnorePattern: '(^h$|Component$)' }], - // Need these two for TSXDom. - '@typescript-eslint/no-namespace': false, - '@typescript-eslint/no-empty-interface': false, + // Use sparingly ;). + '@typescript-eslint/no-explicit-any': false, '@typescript-eslint/ban-ts-ignore': false, - 'prefer-spread': false, }, }; diff --git a/.travis.yml b/.travis.yml index 7b9226b..5a431c8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,6 +11,6 @@ jobs: - name: Test and Upload Coverage script: npm run test:coveralls - name: Bundle Extension - script: npx ts-node bundle.ts + script: npx ts-node scripts/bundle.ts - name: Lint script: npm run lint diff --git a/package-lock.json b/package-lock.json index 9d73308..5959d72 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,8 +1,6 @@ { - "name": "graytabby", - "version": "0.0.1", - "lockfileVersion": 1, "requires": true, + "lockfileVersion": 1, "dependencies": { "@babel/code-frame": { "version": "7.5.5", @@ -251,6 +249,7 @@ "version": "3.1.0", "resolved": "https://registry.npmjs.org/@types/archiver/-/archiver-3.1.0.tgz", "integrity": "sha512-nTvHwgWONL+iXG+9CX+gnQ/tTOV+qucAjwpXqeUn4OCRMxP42T29FFP/7XaOo0EqqO3TlENhObeZEe7RUJAriw==", + "dev": true, "requires": { "@types/glob": "*" } @@ -285,7 +284,8 @@ "@types/events": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/@types/events/-/events-3.0.0.tgz", - "integrity": "sha512-EaObqwIvayI5a8dCzhFrjKzVwKLxjoG9T6Ppd5CEo07LRKfQ8Yokw54r5+Wq7FaBQ+yXRvQAYPrHwya1/UFt9g==" + "integrity": "sha512-EaObqwIvayI5a8dCzhFrjKzVwKLxjoG9T6Ppd5CEo07LRKfQ8Yokw54r5+Wq7FaBQ+yXRvQAYPrHwya1/UFt9g==", + "dev": true }, "@types/filesystem": { "version": "0.0.29", @@ -312,6 +312,7 @@ "version": "7.1.1", "resolved": "https://registry.npmjs.org/@types/glob/-/glob-7.1.1.tgz", "integrity": "sha512-1Bh06cbWJUHMC97acuD6UMG29nMt0Aqz1vF3guLfG+kHHJhy3AyohZFFxYk2f7Q1SQIrNwvncxAE0N/9s70F2w==", + "dev": true, "requires": { "@types/events": "*", "@types/minimatch": "*", @@ -355,7 +356,8 @@ "@types/minimatch": { "version": "3.0.3", "resolved": "https://registry.npmjs.org/@types/minimatch/-/minimatch-3.0.3.tgz", - "integrity": "sha512-tHq6qdbT9U1IRSGf14CL0pUlULksvY9OZ+5eEgl1N7t+OA3tGvNpxJCzuKQlsNgCVwbAs670L1vcVQi8j9HjnA==" + "integrity": "sha512-tHq6qdbT9U1IRSGf14CL0pUlULksvY9OZ+5eEgl1N7t+OA3tGvNpxJCzuKQlsNgCVwbAs670L1vcVQi8j9HjnA==", + "dev": true }, "@types/mocha": { "version": "5.2.7", @@ -366,12 +368,14 @@ "@types/node": { "version": "12.12.3", "resolved": "https://registry.npmjs.org/@types/node/-/node-12.12.3.tgz", - "integrity": "sha512-opgSsy+cEF9N8MgaVPnWVtdJ3o4mV2aMHvDq7thkQUFt0EuOHJon4rQpJfhjmNHB+ikl0Cd6WhWIErOyQ+f7tw==" + "integrity": "sha512-opgSsy+cEF9N8MgaVPnWVtdJ3o4mV2aMHvDq7thkQUFt0EuOHJon4rQpJfhjmNHB+ikl0Cd6WhWIErOyQ+f7tw==", + "dev": true }, "@types/recursive-readdir": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/@types/recursive-readdir/-/recursive-readdir-2.2.0.tgz", "integrity": "sha512-HGk753KRu2N4mWduovY4BLjYq4jTOL29gV2OfGdGxHcPSWGFkC5RRIdk+VTs5XmYd7MVAD+JwKrcb5+5Y7FOCg==", + "dev": true, "requires": { "@types/node": "*" } @@ -380,6 +384,7 @@ "version": "3.0.0", "resolved": "https://registry.npmjs.org/@types/rimraf/-/rimraf-3.0.0.tgz", "integrity": "sha512-7WhJ0MdpFgYQPXlF4Dx+DhgvlPCfz/x5mHaeDQAKhcenvQP1KCpLQ18JklAqeGMYSAT2PxLpzd0g2/HE7fj7hQ==", + "dev": true, "requires": { "@types/glob": "*", "@types/node": "*" @@ -1565,6 +1570,7 @@ "version": "4.0.1", "resolved": "https://registry.npmjs.org/archiver/-/archiver-4.0.1.tgz", "integrity": "sha512-/YV1pU4Nhpf/rJArM23W6GTUjT0l++VbjykrCRua1TSXrn+yM8Qs7XvtwSiRse0iCe49EPNf7ktXnPsWuSb91Q==", + "dev": true, "requires": { "archiver-utils": "^2.1.0", "async": "^2.6.3", @@ -1579,6 +1585,7 @@ "version": "2.6.3", "resolved": "https://registry.npmjs.org/async/-/async-2.6.3.tgz", "integrity": "sha512-zflvls11DCy+dQWzTW2dzuilv8Z5X/pjfmZOWba6TNIVDm+2UDaJmXSOXlasHKfNBs8oo3M0aT50fDEWfKZjXg==", + "dev": true, "requires": { "lodash": "^4.17.14" } @@ -1587,6 +1594,7 @@ "version": "7.1.6", "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.6.tgz", "integrity": "sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA==", + "dev": true, "requires": { "fs.realpath": "^1.0.0", "inflight": "^1.0.4", @@ -1600,6 +1608,7 @@ "version": "3.6.0", "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz", "integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==", + "dev": true, "requires": { "inherits": "^2.0.3", "string_decoder": "^1.1.1", @@ -1612,6 +1621,7 @@ "version": "2.1.0", "resolved": "https://registry.npmjs.org/archiver-utils/-/archiver-utils-2.1.0.tgz", "integrity": "sha512-bEL/yUb/fNNiNTuUz979Z0Yg5L+LzLxGJz8x79lYmR54fmTIb6ob/hNQgkQnIUDWIFjZVQwl9Xs356I6BAMHfw==", + "dev": true, "requires": { "glob": "^7.1.4", "graceful-fs": "^4.2.0", @@ -1913,14 +1923,6 @@ "integrity": "sha512-ReZxvNHIOv88FlT7rxcXIIC0fPt4KZqZbOlivyWtXLt8ESx84zd3kMC6iK5jVeS2qt+g7ftS7ye4fi06X5rtRQ==", "dev": true }, - "axios": { - "version": "0.19.2", - "resolved": "https://registry.npmjs.org/axios/-/axios-0.19.2.tgz", - "integrity": "sha512-fjgm5MvRHLhx+osE2xoekY70AhARk3a6hkN+3Io1jc00jtquGvxYlKlsFUhmUET0V5te6CcZI7lcv2Ym61mjHA==", - "requires": { - "follow-redirects": "1.5.10" - } - }, "babel-code-frame": { "version": "6.26.0", "resolved": "https://registry.npmjs.org/babel-code-frame/-/babel-code-frame-6.26.0.tgz", @@ -1983,7 +1985,8 @@ "balanced-match": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", - "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=" + "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=", + "dev": true }, "base": { "version": "0.11.2", @@ -2043,7 +2046,8 @@ "base64-js": { "version": "1.3.1", "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.3.1.tgz", - "integrity": "sha512-mLQ4i2QO1ytvGWFWmcngKO//JXAQueZvwEKtjgQFM4jIK0kU+ytMfplL8j+n5mspOfjHwoAg+9yhb7BwAHm36g==" + "integrity": "sha512-mLQ4i2QO1ytvGWFWmcngKO//JXAQueZvwEKtjgQFM4jIK0kU+ytMfplL8j+n5mspOfjHwoAg+9yhb7BwAHm36g==", + "dev": true }, "bcrypt-pbkdf": { "version": "1.0.2", @@ -2080,6 +2084,7 @@ "version": "4.0.2", "resolved": "https://registry.npmjs.org/bl/-/bl-4.0.2.tgz", "integrity": "sha512-j4OH8f6Qg2bGuWfRiltT2HYGx0e1QcBTrK9KAHNMwMZdQnDZFk0ZSYIpADjYCB3U12nicC5tVJwSIhwOWjb4RQ==", + "dev": true, "requires": { "buffer": "^5.5.0", "inherits": "^2.0.4", @@ -2090,6 +2095,7 @@ "version": "3.6.0", "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz", "integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==", + "dev": true, "requires": { "inherits": "^2.0.3", "string_decoder": "^1.1.1", @@ -2235,6 +2241,7 @@ "version": "1.1.11", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, "requires": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" @@ -2430,6 +2437,7 @@ "version": "5.6.0", "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.6.0.tgz", "integrity": "sha512-/gDYp/UtU0eA1ys8bOs9J6a+E/KWIY+DZ+Q2WESNUA0jFRsJOc0SNUO6xJ5SGA1xueg3NL65W6s+NY5l9cunuw==", + "dev": true, "requires": { "base64-js": "^1.0.2", "ieee754": "^1.1.4" @@ -2454,7 +2462,8 @@ "buffer-crc32": { "version": "0.2.13", "resolved": "https://registry.npmjs.org/buffer-crc32/-/buffer-crc32-0.2.13.tgz", - "integrity": "sha1-DTM+PwDqxQqhRUq9MO+MKl2ackI=" + "integrity": "sha1-DTM+PwDqxQqhRUq9MO+MKl2ackI=", + "dev": true }, "buffer-equal-constant-time": { "version": "1.0.1", @@ -3052,7 +3061,8 @@ "commondir": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/commondir/-/commondir-1.0.1.tgz", - "integrity": "sha1-3dgA2gxmEnOTzKWVDqloo6rxJTs=" + "integrity": "sha1-3dgA2gxmEnOTzKWVDqloo6rxJTs=", + "dev": true }, "component-emitter": { "version": "1.3.0", @@ -3064,6 +3074,7 @@ "version": "3.0.0", "resolved": "https://registry.npmjs.org/compress-commons/-/compress-commons-3.0.0.tgz", "integrity": "sha512-FyDqr8TKX5/X0qo+aVfaZ+PVmNJHJeckFBlq8jZGSJOgnynhfifoyl24qaqdUdDIBe0EVTHByN6NAkqYvE/2Xg==", + "dev": true, "requires": { "buffer-crc32": "^0.2.13", "crc32-stream": "^3.0.1", @@ -3074,7 +3085,8 @@ "concat-map": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", - "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=" + "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", + "dev": true }, "concat-stream": { "version": "1.6.2", @@ -3235,7 +3247,8 @@ "core-util-is": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", - "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=" + "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=", + "dev": true }, "cosmiconfig": { "version": "5.2.1", @@ -3337,6 +3350,7 @@ "version": "3.8.0", "resolved": "https://registry.npmjs.org/crc/-/crc-3.8.0.tgz", "integrity": "sha512-iX3mfgcTMIq3ZKLIsVFAbv7+Mc10kxabAGQb8HvjA1o3T1PIYprbakQ65d3I+2HGHt6nSKkM9PYjgoJO2KcFBQ==", + "dev": true, "requires": { "buffer": "^5.1.0" } @@ -3345,6 +3359,7 @@ "version": "3.0.1", "resolved": "https://registry.npmjs.org/crc32-stream/-/crc32-stream-3.0.1.tgz", "integrity": "sha512-mctvpXlbzsvK+6z8kJwSJ5crm7yBwrQMTybJzMw1O4lLGJqjlDCXY2Zw7KheiA6XBEcBmfLx1D88mjRGVJtY9w==", + "dev": true, "requires": { "crc": "^3.4.4", "readable-stream": "^3.4.0" @@ -3354,6 +3369,7 @@ "version": "3.6.0", "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz", "integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==", + "dev": true, "requires": { "inherits": "^2.0.3", "string_decoder": "^1.1.1", @@ -4175,6 +4191,7 @@ "version": "1.4.1", "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.1.tgz", "integrity": "sha512-1MkrZNvWTKCaigbn+W15elq2BB/L22nqrSY5DKlo3X6+vclJm8Bb5djXJBmEX6fS3+zCh/F4VBK5Z2KxJt4s2Q==", + "dev": true, "requires": { "once": "^1.4.0" } @@ -5357,6 +5374,7 @@ "version": "3.0.0", "resolved": "https://registry.npmjs.org/find-up/-/find-up-3.0.0.tgz", "integrity": "sha512-1yD6RmLI1XBfxugvORwlck6f75tYL+iR0jqwsOrOxMZyGYqUuDhJ0l4AXdO1iX/FTs9cBAMEk1gWSEx1kSbylg==", + "dev": true, "requires": { "locate-path": "^3.0.0" } @@ -5677,29 +5695,6 @@ "readable-stream": "^2.3.6" } }, - "follow-redirects": { - "version": "1.5.10", - "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.5.10.tgz", - "integrity": "sha512-0V5l4Cizzvqt5D44aTXbFZz+FtyXV1vrDN6qrelxtfYQKW0KO0W2T/hkE8xvGa/540LkZlkaUjO4ailYTFtHVQ==", - "requires": { - "debug": "=3.1.0" - }, - "dependencies": { - "debug": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", - "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", - "requires": { - "ms": "2.0.0" - } - }, - "ms": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" - } - } - }, "for-in": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/for-in/-/for-in-1.0.2.tgz", @@ -5783,7 +5778,8 @@ "fs-constants": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/fs-constants/-/fs-constants-1.0.0.tgz", - "integrity": "sha512-y6OAwoSIf7FyjMIv94u+b5rdheZEjzR63GTyZJm5qh4Bi+2YgwLCcI/fPFZkL5PSixOt6ZNKm+w+Hfp/Bciwow==" + "integrity": "sha512-y6OAwoSIf7FyjMIv94u+b5rdheZEjzR63GTyZJm5qh4Bi+2YgwLCcI/fPFZkL5PSixOt6ZNKm+w+Hfp/Bciwow==", + "dev": true }, "fs-extra": { "version": "4.0.3", @@ -5811,7 +5807,8 @@ "fs.realpath": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", - "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=" + "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", + "dev": true }, "fsevents": { "version": "2.1.2", @@ -6052,6 +6049,7 @@ "version": "7.1.4", "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.4.tgz", "integrity": "sha512-hkLPepehmnKk41pUGm3sYxoFs/umurYfYJCerbXEyFIWcAzvpipAgVkBqqT9RBKMGjnq6kMuyYwha6csxbiM1A==", + "dev": true, "requires": { "fs.realpath": "^1.0.0", "inflight": "^1.0.4", @@ -6165,79 +6163,6 @@ "minimatch": "~3.0.2" } }, - "google-fonts-plugin": { - "version": "5.0.2", - "resolved": "https://registry.npmjs.org/google-fonts-plugin/-/google-fonts-plugin-5.0.2.tgz", - "integrity": "sha512-KYpJ9RbjIEmd5Q45GeNnsUyz4ca2R9L8GWZjbdnTWxOV+59Q300q2cFIcDtGpdkEjrh8ARVK9nOLAYRR9eAU4w==", - "requires": { - "axios": "^0.19.0", - "find-cache-dir": "^3.0.0", - "pkg-up": "^3.1.0" - }, - "dependencies": { - "find-cache-dir": { - "version": "3.3.1", - "resolved": "https://registry.npmjs.org/find-cache-dir/-/find-cache-dir-3.3.1.tgz", - "integrity": "sha512-t2GDMt3oGC/v+BMwzmllWDuJF/xcDtE5j/fCGbqDD7OLuJkj0cfh1YSA5VKPvwMeLFLNDBkwOKZ2X85jGLVftQ==", - "requires": { - "commondir": "^1.0.1", - "make-dir": "^3.0.2", - "pkg-dir": "^4.1.0" - } - }, - "find-up": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", - "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", - "requires": { - "locate-path": "^5.0.0", - "path-exists": "^4.0.0" - } - }, - "locate-path": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", - "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", - "requires": { - "p-locate": "^4.1.0" - } - }, - "make-dir": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.1.0.tgz", - "integrity": "sha512-g3FeP20LNwhALb/6Cz6Dd4F2ngze0jz7tbzrD2wAV+o9FeNHe4rL+yK2md0J/fiSf1sa1ADhXqi5+oVwOM/eGw==", - "requires": { - "semver": "^6.0.0" - } - }, - "p-locate": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", - "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", - "requires": { - "p-limit": "^2.2.0" - } - }, - "path-exists": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", - "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==" - }, - "pkg-dir": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-4.2.0.tgz", - "integrity": "sha512-HRDzbaKjC+AOWVXxAU/x54COGeIv9eb+6CkDSQoNTt4XyWoIJvuPsXizxu/Fr23EiekbtZwmh1IcIG/l/a10GQ==", - "requires": { - "find-up": "^4.0.0" - } - }, - "semver": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", - "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==" - } - } - }, "got": { "version": "9.6.0", "resolved": "https://registry.npmjs.org/got/-/got-9.6.0.tgz", @@ -6260,7 +6185,8 @@ "graceful-fs": { "version": "4.2.0", "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.0.tgz", - "integrity": "sha512-jpSvDPV4Cq/bgtpndIWbI5hmYxhQGHPC4d4cqBPb4DLniCfhJokdXhwhaDuLBGLQdvvRum/UiX6ECVIPvDXqdg==" + "integrity": "sha512-jpSvDPV4Cq/bgtpndIWbI5hmYxhQGHPC4d4cqBPb4DLniCfhJokdXhwhaDuLBGLQdvvRum/UiX6ECVIPvDXqdg==", + "dev": true }, "graceful-readlink": { "version": "1.0.1", @@ -6577,7 +6503,8 @@ "ieee754": { "version": "1.1.13", "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.1.13.tgz", - "integrity": "sha512-4vf7I2LYV/HaWerSo3XmlMkp5eZ83i+/CDluXi/IGTs/O1sejBNhTtnxzmRZfvOUqj7lZjqHkeTvpgSFDlWZTg==" + "integrity": "sha512-4vf7I2LYV/HaWerSo3XmlMkp5eZ83i+/CDluXi/IGTs/O1sejBNhTtnxzmRZfvOUqj7lZjqHkeTvpgSFDlWZTg==", + "dev": true }, "iferr": { "version": "0.1.5", @@ -6688,6 +6615,7 @@ "version": "1.0.6", "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", + "dev": true, "requires": { "once": "^1.3.0", "wrappy": "1" @@ -6696,7 +6624,8 @@ "inherits": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", - "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", + "dev": true }, "ini": { "version": "1.3.5", @@ -7085,7 +7014,8 @@ "isarray": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", - "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=" + "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", + "dev": true }, "isexe": { "version": "2.0.0", @@ -7514,6 +7444,7 @@ "version": "1.0.0", "resolved": "https://registry.npmjs.org/lazystream/-/lazystream-1.0.0.tgz", "integrity": "sha1-9plf4PggOS9hOWvolGJAe7dxaOQ=", + "dev": true, "requires": { "readable-stream": "^2.0.5" } @@ -7618,6 +7549,7 @@ "version": "3.0.0", "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-3.0.0.tgz", "integrity": "sha512-7AO748wWnIhNqAuaty2ZWHkQHRSNfPVIsPIfwEOWO22AmaoVrWavlOcMR5nzTLNYvp36X220/maaRsrec1G65A==", + "dev": true, "requires": { "p-locate": "^3.0.0", "path-exists": "^3.0.0" @@ -7626,22 +7558,26 @@ "lodash": { "version": "4.17.14", "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.14.tgz", - "integrity": "sha512-mmKYbW3GLuJeX+iGP+Y7Gp1AiGHGbXHCOh/jZmrawMmsE7MS4znI3RL2FsjbqOyMayHInjOeykW7PEajUk1/xw==" + "integrity": "sha512-mmKYbW3GLuJeX+iGP+Y7Gp1AiGHGbXHCOh/jZmrawMmsE7MS4znI3RL2FsjbqOyMayHInjOeykW7PEajUk1/xw==", + "dev": true }, "lodash.defaults": { "version": "4.2.0", "resolved": "https://registry.npmjs.org/lodash.defaults/-/lodash.defaults-4.2.0.tgz", - "integrity": "sha1-0JF4cW/+pN3p5ft7N/bwgCJ0WAw=" + "integrity": "sha1-0JF4cW/+pN3p5ft7N/bwgCJ0WAw=", + "dev": true }, "lodash.difference": { "version": "4.5.0", "resolved": "https://registry.npmjs.org/lodash.difference/-/lodash.difference-4.5.0.tgz", - "integrity": "sha1-nMtOUF1Ia5FlE0V3KIWi3yf9AXw=" + "integrity": "sha1-nMtOUF1Ia5FlE0V3KIWi3yf9AXw=", + "dev": true }, "lodash.flatten": { "version": "4.4.0", "resolved": "https://registry.npmjs.org/lodash.flatten/-/lodash.flatten-4.4.0.tgz", - "integrity": "sha1-8xwiIlqWMtK7+OSt2+8kCqdlph8=" + "integrity": "sha1-8xwiIlqWMtK7+OSt2+8kCqdlph8=", + "dev": true }, "lodash.flattendeep": { "version": "4.4.0", @@ -7682,7 +7618,8 @@ "lodash.isplainobject": { "version": "4.0.6", "resolved": "https://registry.npmjs.org/lodash.isplainobject/-/lodash.isplainobject-4.0.6.tgz", - "integrity": "sha1-fFJqUtibRcRcxpC4gWO+BJf1UMs=" + "integrity": "sha1-fFJqUtibRcRcxpC4gWO+BJf1UMs=", + "dev": true }, "lodash.isstring": { "version": "4.0.1", @@ -7705,7 +7642,8 @@ "lodash.union": { "version": "4.6.0", "resolved": "https://registry.npmjs.org/lodash.union/-/lodash.union-4.6.0.tgz", - "integrity": "sha1-SLtQiECfFvGCFmZkHETdGqrjzYg=" + "integrity": "sha1-SLtQiECfFvGCFmZkHETdGqrjzYg=", + "dev": true }, "log-driver": { "version": "1.2.7", @@ -7970,6 +7908,7 @@ "version": "3.0.4", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", + "dev": true, "requires": { "brace-expansion": "^1.1.7" } @@ -8663,7 +8602,8 @@ "normalize-path": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", - "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==" + "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", + "dev": true }, "normalize-range": { "version": "0.1.2", @@ -8850,6 +8790,7 @@ "version": "1.6.0", "resolved": "https://registry.npmjs.org/object-sizeof/-/object-sizeof-1.6.0.tgz", "integrity": "sha512-Z+suoK94o8WjEMYItJjpPyG6I78STcI1CxM7rjxM8LhbgegAY+jhGSFY0c5Ez20LXgDGtyKzYZNXHpDyr6hj8Q==", + "dev": true, "requires": { "buffer": "^5.5.0" } @@ -8898,6 +8839,7 @@ "version": "1.4.0", "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", + "dev": true, "requires": { "wrappy": "1" } @@ -9023,6 +8965,7 @@ "version": "2.2.0", "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.2.0.tgz", "integrity": "sha512-pZbTJpoUsCzV48Mc9Nh51VbwO0X9cuPFE8gYwx9BTCt9SF8/b7Zljd2fVgOxhIF/HDTKgpVzs+GPhyKfjLLFRQ==", + "dev": true, "requires": { "p-try": "^2.0.0" } @@ -9031,6 +8974,7 @@ "version": "3.0.0", "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-3.0.0.tgz", "integrity": "sha512-x+12w/To+4GFfgJhBEpiDcLozRJGegY+Ei7/z0tSLkMmxGZNybVMSfWj9aJn8Z5Fc7dBUNJOOVgPv2H7IwulSQ==", + "dev": true, "requires": { "p-limit": "^2.0.0" } @@ -9038,7 +8982,8 @@ "p-try": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", - "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==" + "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", + "dev": true }, "package-hash": { "version": "3.0.0", @@ -9165,12 +9110,14 @@ "path-exists": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", - "integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=" + "integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=", + "dev": true }, "path-is-absolute": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", - "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=" + "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", + "dev": true }, "path-is-inside": { "version": "1.0.2", @@ -9311,14 +9258,6 @@ "find-up": "^3.0.0" } }, - "pkg-up": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/pkg-up/-/pkg-up-3.1.0.tgz", - "integrity": "sha512-nDywThFk1i4BQK4twPQ6TA4RT8bDY96yeuCVBWL3ePARCiEKDRSrNGbFIgUJpLp+XeIR65v8ra7WuJOFUBtkMA==", - "requires": { - "find-up": "^3.0.0" - } - }, "pluralize": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/pluralize/-/pluralize-1.2.1.tgz", @@ -9488,7 +9427,8 @@ "process-nextick-args": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz", - "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==" + "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==", + "dev": true }, "progress": { "version": "2.0.3", @@ -9584,7 +9524,8 @@ "purecss": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/purecss/-/purecss-2.0.3.tgz", - "integrity": "sha512-jK5t8Wdyh1xiskKt9Pk3psruRP7XHcHYfsBkA9tu+CGGxaC3goTyd9EFCFyYuhC7AK/68NqDfuOsP8FgQ9vHRg==" + "integrity": "sha512-jK5t8Wdyh1xiskKt9Pk3psruRP7XHcHYfsBkA9tu+CGGxaC3goTyd9EFCFyYuhC7AK/68NqDfuOsP8FgQ9vHRg==", + "dev": true }, "qs": { "version": "6.5.2", @@ -9716,6 +9657,7 @@ "version": "2.3.7", "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz", "integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==", + "dev": true, "requires": { "core-util-is": "~1.0.0", "inherits": "~2.0.3", @@ -9889,6 +9831,7 @@ "version": "2.2.2", "resolved": "https://registry.npmjs.org/recursive-readdir/-/recursive-readdir-2.2.2.tgz", "integrity": "sha512-nRCcW9Sj7NuZwa2XvH9co8NPeXUBhZP7CRKJtU+cS6PW9FpCIFoI5ib0NT1ZrbNuPoRy0ylyCaUL8Gih4LSyFg==", + "dev": true, "requires": { "minimatch": "3.0.4" } @@ -10190,6 +10133,7 @@ "version": "3.0.2", "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", + "dev": true, "requires": { "glob": "^7.1.3" } @@ -10237,7 +10181,8 @@ "safe-buffer": { "version": "5.1.2", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", - "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", + "dev": true }, "safe-json-stringify": { "version": "1.2.0", @@ -11151,6 +11096,7 @@ "version": "1.1.1", "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", + "dev": true, "requires": { "safe-buffer": "~5.1.0" } @@ -11303,6 +11249,7 @@ "version": "2.1.2", "resolved": "https://registry.npmjs.org/tar-stream/-/tar-stream-2.1.2.tgz", "integrity": "sha512-UaF6FoJ32WqALZGOIAApXx+OdxhekNMChu6axLJR85zMMjXKWFGjbIRe+J6P4UnRGg9rAwWvbTT0oI7hD/Un7Q==", + "dev": true, "requires": { "bl": "^4.0.1", "end-of-stream": "^1.4.1", @@ -11315,6 +11262,7 @@ "version": "3.6.0", "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz", "integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==", + "dev": true, "requires": { "inherits": "^2.0.3", "string_decoder": "^1.1.1", @@ -12116,7 +12064,8 @@ "util-deprecate": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", - "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=" + "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=", + "dev": true }, "uuid": { "version": "3.3.2", @@ -12151,11 +12100,6 @@ "extsprintf": "^1.2.0" } }, - "vlq": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/vlq/-/vlq-1.0.1.tgz", - "integrity": "sha512-gQpnTgkubC6hQgdIcRdYGDSDc+SaujOdyesZQMv6JlfQee/9Mp0Qhnys6WxDWvQnL5WZdT7o2Ul187aSt0Rq+w==" - }, "vm-browserify": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/vm-browserify/-/vm-browserify-1.1.2.tgz", @@ -13014,7 +12958,8 @@ "wrappy": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", - "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=" + "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", + "dev": true }, "write": { "version": "1.0.3", @@ -13296,6 +13241,7 @@ "version": "3.0.1", "resolved": "https://registry.npmjs.org/zip-stream/-/zip-stream-3.0.1.tgz", "integrity": "sha512-r+JdDipt93ttDjsOVPU5zaq5bAyY+3H19bDrThkvuVxC0xMQzU1PJcS6D+KrP3u96gH9XLomcHPb+2skoDjulQ==", + "dev": true, "requires": { "archiver-utils": "^2.1.0", "compress-commons": "^3.0.0", @@ -13306,6 +13252,7 @@ "version": "3.6.0", "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz", "integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==", + "dev": true, "requires": { "inherits": "^2.0.3", "string_decoder": "^1.1.1", diff --git a/package.json b/package.json index 00a9f8d..8e3d22e 100644 --- a/package.json +++ b/package.json @@ -1,9 +1,6 @@ { - "name": "graytabby", - "version": "0.0.1", - "description": "A browser tab archiver.", "scripts": { - "test": "mocha --opts tests/unit.opts", + "test": "mocha --require ts-node/register/transpile-only --recursive tests/**/*.test.ts", "test:coverage": "nyc npm run test", "test:coveralls": "npm run test:coverage && cat ./coverage/lcov.info | coveralls", "develop": "NODE_ENV=development webpack --watch", @@ -14,19 +11,22 @@ "bundle": "ts-node scripts/bundle.ts", "lint": "eslint src/**/*.ts tests/**/*.ts" }, - "keywords": [], - "author": "", + "author": "Mori Bellamy", "license": "MIT", "devDependencies": { + "@types/archiver": "^3.1.0", "@types/chai": "^4.2.11", "@types/chrome": "0.0.86", "@types/firefox-webext-browser": "^67.0.2", "@types/jquery": "^3.3.38", "@types/jsdom": "^12.2.4", "@types/mocha": "^5.2.7", + "@types/recursive-readdir": "^2.2.0", + "@types/rimraf": "^3.0.0", "@types/sinon-chrome": "^2.2.8", "@typescript-eslint/eslint-plugin": "^2.31.0", "@typescript-eslint/parser": "^2.31.0", + "archiver": "^4.0.1", "autoprefixer": "^9.7.6", "chai": "^4.2.0", "copy-webpack-plugin": "^5.1.1", @@ -41,8 +41,12 @@ "mocha": "^6.2.3", "node-sass": "^4.14.1", "nyc": "^14.1.1", + "object-sizeof": "^1.6.0", "postcss-loader": "^3.0.0", "prettier": "^1.19.1", + "purecss": "^2.0.3", + "recursive-readdir": "^2.2.2", + "rimraf": "^3.0.2", "sass-loader": "^7.3.1", "sinon-chrome": "^3.0.1", "ts-loader": "^6.2.2", @@ -55,17 +59,5 @@ "webpack": "^4.43.0", "webpack-cli": "^3.3.11", "webpack-shell-plugin-next": "^1.1.9" - }, - "dependencies": { - "@types/archiver": "^3.1.0", - "@types/recursive-readdir": "^2.2.0", - "@types/rimraf": "^3.0.0", - "archiver": "^4.0.1", - "google-fonts-plugin": "^5.0.2", - "object-sizeof": "^1.6.0", - "purecss": "^2.0.3", - "recursive-readdir": "^2.2.2", - "rimraf": "^3.0.2", - "vlq": "^1.0.1" } } diff --git a/src/app.ts b/src/app.ts index f2971e4..0c52f88 100644 --- a/src/app.ts +++ b/src/app.ts @@ -4,11 +4,10 @@ */ // Webpack uses MiniCssExtractPlugin when it sees this. -import './style/app.scss'; -import { DOCUMENT } from './lib/globals'; import { App } from './components/app'; -import { PAGE_LOAD } from './lib/globals'; +import { DOCUMENT, PAGE_LOAD } from './lib/globals'; import { loadAllTabGroups } from './lib/tabs_store'; +import './style/app.scss'; export class Debugger { async double(): Promise { @@ -35,8 +34,9 @@ declare global { * The main entry point for GrayTabby. */ export async function graytabby(): Promise { - DOCUMENT.get().title = 'GrayTabbyzee'; - DOCUMENT.get().body.appendChild(App()); + DOCUMENT.get().title = 'GrayTabby'; + const app = DOCUMENT.get().body.appendChild(App()); + await app.initialRender; DOCUMENT.get().defaultView.gt = new Debugger(); } diff --git a/src/components/app.tsx b/src/components/app.tsx index 0b2a096..cd5c3ab 100644 --- a/src/components/app.tsx +++ b/src/components/app.tsx @@ -1,5 +1,5 @@ import { h } from 'tsx-dom'; -import { ARCHIVAL, DOCUMENT } from '../lib/globals'; +import { ARCHIVAL } from '../lib/globals'; import { getOptions } from '../lib/options'; import { GrayTabGroup, loadAllTabGroups, saveTabGroup } from '../lib/tabs_store'; import { BrowserTab } from '../lib/types'; @@ -8,12 +8,6 @@ import { GroupComponent } from './group'; import { OptionsComponent, setVisible } from './options'; import { PaginatorComponent } from './paginator'; -// function prependInsideContainer(parent: Element, child: Element): Element { -// if (parent.firstChild == null) parent.appendChild(child); -// else parent.insertBefore(child, parent.firstChild); -// return child; -// } - async function ingestTabs( tabSummaries: BrowserTab[], groupsNode: HTMLDivElement, @@ -31,12 +25,14 @@ async function ingestTabs( } export interface AppElement extends HTMLDivElement { - lastRender: Promise; + _signalWatcher: () => void; + initialRender: Promise; } -export async function settleApp(): Promise { - const app: AppElement = DOCUMENT.get().querySelector('#app'); - return app.lastRender; +export function watchRender(app: AppElement): Promise { + return new Promise(resolve => { + app._signalWatcher = resolve; + }); } export function App(): AppElement { @@ -47,9 +43,9 @@ export function App(): AppElement { const self = (
{optionsWrapper} -
- {paginatorWrapper} +

Welcome to GrayTabby!

+ {paginatorWrapper}

{groupsWrapper} => { - if (pageNum == null) pageNum = lastRenderPage; - const options = await getOptions(); - setOnlyChild(optionsWrapper, ); - groupsWrapper.innerHTML = ''; + async function render(pageNum?: number /* 0 indexed */): Promise { + if (pageNum == null) pageNum = lastRenderPage; + const options = await getOptions(); + setOnlyChild(optionsWrapper, ); + groupsWrapper.innerHTML = ''; - const loaded = await loadAllTabGroups(); + const loaded = await loadAllTabGroups(); - const totalPages = Math.max(1, Math.ceil(loaded.length / options.groupsPerPage)); - pageNum = clamp(pageNum, 0, totalPages - 1); - const firstIdx = pageNum * options.groupsPerPage; - const lastIdx = firstIdx + options.groupsPerPage; + const totalPages = Math.max(1, Math.ceil(loaded.length / options.groupsPerPage)); + pageNum = clamp(pageNum, 0, totalPages - 1); + const firstIdx = pageNum * options.groupsPerPage; + const lastIdx = firstIdx + options.groupsPerPage; - setOnlyChild( - paginatorWrapper, + setOnlyChild( + paginatorWrapper, + totalPages > 1 ? ( render(clicked)} - />, - ); - for (const group of loaded.slice(firstIdx, lastIdx)) { - groupsWrapper.appendChild(); - } - lastRenderPage = pageNum; - }; - self.lastRender = renderFunc(); + /> + ) : ( +
+ ), + ); + for (const group of loaded.slice(firstIdx, lastIdx)) { + groupsWrapper.appendChild(); + } + lastRenderPage = pageNum; + if (self._signalWatcher != null) { + self._signalWatcher(); + self._signalWatcher = null; + } } - render(0); // Floating promise on self.lastRender + self.initialRender = render(0); ARCHIVAL.get().sub(async summaries => { await ingestTabs(summaries, groupsWrapper); - render(0); - await self.lastRender; + await render(0); }); return self; diff --git a/src/components/group.tsx b/src/components/group.tsx index 932cf2b..3c91d79 100644 --- a/src/components/group.tsx +++ b/src/components/group.tsx @@ -14,14 +14,13 @@ interface GroupProps extends BaseProps { removeCallback: () => void; } -function groupFromDiv(target: HTMLDivElement): GrayTabGroup { - const date = dateFromKey(target.id); +function groupFromDiv(self: GroupElement): GrayTabGroup { + const date = dateFromKey(self.id); const group: GrayTabGroup = { date: date, tabs: [], }; - if (target == null) return group; - const lis = target.querySelectorAll('li'); + const lis = self.querySelectorAll('li'); lis.forEach(li => { const a: HTMLAnchorElement = li.querySelector('a'); const tab: GrayTab = { @@ -34,8 +33,8 @@ function groupFromDiv(target: HTMLDivElement): GrayTabGroup { return group; } -async function syncGroupFromDOM(target: HTMLDivElement): Promise { - const group = groupFromDiv(target); +async function syncGroupFromDOM(self: GroupElement): Promise { + const group = groupFromDiv(self); if (group.tabs.length == 0) { await eraseTabGroup(group.date); } else { @@ -53,30 +52,32 @@ async function childClickCallback(event: MouseEvent): Promise { } // now target is a
    and tail is an
  • target.removeChild(tail); - const self = target.parentElement as HTMLDivElement; + const self = target.parentElement as GroupElement; const group = await syncGroupFromDOM(self); if (group.tabs.length == 0) { - self.dispatchEvent(new Event('remove')); self.remove(); + self.removeCallback(); } } -export function GroupComponent({ group, removeCallback }: GroupProps): HTMLDivElement { +interface GroupElement extends HTMLDivElement { + removeCallback: () => void; +} + +export function GroupComponent({ group, removeCallback }: GroupProps): GroupElement { const rows =
      ; - const groupDiv = ( + const self = (
      {new Date(group.date).toLocaleString()} {rows}
      - ) as HTMLDivElement; + ) as GroupElement; + + self.removeCallback = removeCallback; for (const tab of group.tabs) { rows.appendChild(); } - groupDiv.addEventListener('remove', () => { - removeCallback(); - }); - - return groupDiv; + return self; } diff --git a/src/components/options.tsx b/src/components/options.tsx index 2b74ad3..2b99ffc 100644 --- a/src/components/options.tsx +++ b/src/components/options.tsx @@ -7,9 +7,10 @@ export function setVisible(self: HTMLDivElement, visible: boolean): void { interface OptionsProps { options: Options; + closeCallback: () => void; } -export function OptionsComponent({ options }: OptionsProps): HTMLDivElement { +export function OptionsComponent({ options, closeCallback }: OptionsProps): HTMLDivElement { const optionsDupesCheckbox = ( ) as HTMLInputElement; @@ -78,11 +79,9 @@ export function OptionsComponent({ options }: OptionsProps): HTMLDivElement { How many tabs to keep. Older tab groups are removed to keep you under this limit. - + {groupsPerPageTextbox} - - How many tabs to keep. Older tab groups are removed to keep you under this limit. - + How many tab groups to load per page.