From 454f42b3323c1b0bcf66ca0ddee62d4eba7d8e3d Mon Sep 17 00:00:00 2001 From: "alex.kopachov" Date: Mon, 24 Jun 2024 10:03:23 +0200 Subject: [PATCH] refactor(Webextension): made possible for any image background provider to load image from OPFS --- .nx/workspace-data/file-map.json | 804 +++++++++--------- .../backgrounds/common-image/provider-base.ts | 55 +- .../src/backgrounds/static-image/provider.ts | 20 +- 3 files changed, 442 insertions(+), 437 deletions(-) diff --git a/.nx/workspace-data/file-map.json b/.nx/workspace-data/file-map.json index ebc5707..360706d 100644 --- a/.nx/workspace-data/file-map.json +++ b/.nx/workspace-data/file-map.json @@ -42,313 +42,6 @@ "hash": "4336780397135653243" } ], - "owm-redirect": [ - { - "file": "apps/owm-redirect/.editorconfig", - "hash": "9035647012319884894" - }, - { - "file": "apps/owm-redirect/.gitignore", - "hash": "10657848430346760040" - }, - { - "file": "apps/owm-redirect/package.json", - "hash": "17134678572050872525", - "deps": [ - "npm:wrangler", - "npm:geo-position.ts" - ] - }, - { - "file": "apps/owm-redirect/src/worker.ts", - "hash": "13031713532980002527" - }, - { - "file": "apps/owm-redirect/wrangler.toml", - "hash": "16151197575438519813" - } - ], - "landing": [ - { - "file": "apps/landing/.editorconfig", - "hash": "7656052162757445104" - }, - { - "file": "apps/landing/.eslintignore", - "hash": "12866345277008372755" - }, - { - "file": "apps/landing/.eslintrc.cjs", - "hash": "15647399974590712086" - }, - { - "file": "apps/landing/.gitignore", - "hash": "2615793248884789625" - }, - { - "file": "apps/landing/.npmrc", - "hash": "16306061729883149313" - }, - { - "file": "apps/landing/.prettierignore", - "hash": "9861187265567348571" - }, - { - "file": "apps/landing/.prettierrc", - "hash": "8590646213043532286" - }, - { - "file": "apps/landing/netlify.toml", - "hash": "6484258719775923400" - }, - { - "file": "apps/landing/package.json", - "hash": "3712875329528442112", - "deps": [ - "npm:@fontsource/inter", - "npm:@iconify/json", - "npm:@iconify/tailwind", - "npm:@iconify/utils", - "npm:@neoconfetti/svelte", - "npm:@sveltejs/adapter-static", - "npm:@sveltejs/enhanced-img", - "npm:@sveltejs/kit", - "npm:@sveltejs/vite-plugin-svelte", - "npm:@tailwindcss/forms", - "npm:@types/aos", - "npm:@types/eslint", - "npm:@typescript-eslint/eslint-plugin", - "npm:@typescript-eslint/parser", - "npm:aos", - "npm:autoprefixer", - "npm:cssnano", - "npm:cssnano-preset-default", - "npm:cssnano-preset-lite", - "npm:daisyui", - "npm:embla-carousel-svelte", - "npm:eslint", - "npm:eslint-config-prettier", - "npm:eslint-plugin-svelte", - "is-wsl2", - "npm:postcss", - "npm:postcss-load-config@6.0.1", - "npm:prettier", - "npm:prettier-plugin-svelte", - "npm:prettier-plugin-tailwindcss", - "npm:svelte", - "npm:svelte-body", - "npm:svelte-check", - "npm:tailwindcss", - "npm:tslib", - "npm:typescript", - "npm:vite" - ] - }, - { - "file": "apps/landing/postcss.config.cjs", - "hash": "7910658628078544505" - }, - { - "file": "apps/landing/src/app.d.ts", - "hash": "17522384083550949823" - }, - { - "file": "apps/landing/src/app.html", - "hash": "17841630233698801912" - }, - { - "file": "apps/landing/src/app.pcss", - "hash": "14810236820657831828" - }, - { - "file": "apps/landing/src/components/features.svelte", - "hash": "7661422588996331189" - }, - { - "file": "apps/landing/src/components/footer.svelte", - "hash": "13121746684541395301" - }, - { - "file": "apps/landing/src/components/header.svelte", - "hash": "17934009167654308491" - }, - { - "file": "apps/landing/src/components/navigation.svelte", - "hash": "14988055686807007102" - }, - { - "file": "apps/landing/src/components/screenshots.svelte", - "hash": "13102879630609783136" - }, - { - "file": "apps/landing/src/components/support.svelte", - "hash": "7310236108946124037" - }, - { - "file": "apps/landing/src/components/welcome.svelte", - "hash": "718645630279054264" - }, - { - "file": "apps/landing/src/lib/assets/amo-button.svg", - "hash": "10638019120008779628" - }, - { - "file": "apps/landing/src/lib/assets/cwo-button.svg", - "hash": "18021027240333141996" - }, - { - "file": "apps/landing/src/lib/assets/edge-button.svg", - "hash": "14822606946037564973" - }, - { - "file": "apps/landing/src/lib/css/theme.css", - "hash": "9028311825916970864" - }, - { - "file": "apps/landing/src/lib/css/utility-patterns.css", - "hash": "12126172961868927401" - }, - { - "file": "apps/landing/src/lib/screenshots/0.jpeg", - "hash": "14185278729368134872" - }, - { - "file": "apps/landing/src/lib/screenshots/1.png", - "hash": "2305235227382566427" - }, - { - "file": "apps/landing/src/lib/screenshots/2.jpeg", - "hash": "9183676362714503382" - }, - { - "file": "apps/landing/src/lib/screenshots/3.jpeg", - "hash": "3962158966037601750" - }, - { - "file": "apps/landing/src/lib/screenshots/4.jpeg", - "hash": "9225345747745698130" - }, - { - "file": "apps/landing/src/lib/screenshots/5.png", - "hash": "6558862023349455654" - }, - { - "file": "apps/landing/src/lib/screenshots/6.jpeg", - "hash": "5392268130969410636" - }, - { - "file": "apps/landing/src/lib/screenshots/7.png", - "hash": "10289934768717743098" - }, - { - "file": "apps/landing/src/routes/+error.svelte", - "hash": "11260399356154979818" - }, - { - "file": "apps/landing/src/routes/+layout.svelte", - "hash": "11467319100262057112" - }, - { - "file": "apps/landing/src/routes/+layout.ts", - "hash": "3656248653335203942" - }, - { - "file": "apps/landing/src/routes/+page.svelte", - "hash": "4490183109275284451" - }, - { - "file": "apps/landing/static/favicon/android-chrome-192x192.png", - "hash": "17747222593322570913" - }, - { - "file": "apps/landing/static/favicon/android-chrome-512x512.png", - "hash": "10992519659870263635" - }, - { - "file": "apps/landing/static/favicon/apple-touch-icon.png", - "hash": "8319709282744640903" - }, - { - "file": "apps/landing/static/favicon/browserconfig.xml", - "hash": "9030448547662640771" - }, - { - "file": "apps/landing/static/favicon/favicon-128x128.png", - "hash": "3574285871798273089" - }, - { - "file": "apps/landing/static/favicon/favicon-16x16.png", - "hash": "1484907360946902538" - }, - { - "file": "apps/landing/static/favicon/favicon-32x32.png", - "hash": "12914832945126627537" - }, - { - "file": "apps/landing/static/favicon/favicon-48x48.png", - "hash": "16296114082698355954" - }, - { - "file": "apps/landing/static/favicon/favicon-96x96.png", - "hash": "15400891981776800899" - }, - { - "file": "apps/landing/static/favicon/favicon.ico", - "hash": "6080578060923793650" - }, - { - "file": "apps/landing/static/favicon/favicon.svg", - "hash": "16149112273573293908" - }, - { - "file": "apps/landing/static/favicon/mstile-144x144.png", - "hash": "17090102562471781642" - }, - { - "file": "apps/landing/static/favicon/mstile-150x150.png", - "hash": "2987547776851300371" - }, - { - "file": "apps/landing/static/favicon/mstile-310x150.png", - "hash": "8240165320902303268" - }, - { - "file": "apps/landing/static/favicon/mstile-310x310.png", - "hash": "11331575352337162409" - }, - { - "file": "apps/landing/static/favicon/mstile-70x70.png", - "hash": "4598816931621196495" - }, - { - "file": "apps/landing/static/favicon/safari-pinned-tab.svg", - "hash": "12657718850154108143" - }, - { - "file": "apps/landing/static/favicon/site.webmanifest.json", - "hash": "10433911047657634548" - }, - { - "file": "apps/landing/static/robots.txt", - "hash": "2790380794362165217" - }, - { - "file": "apps/landing/svelte.config.js", - "hash": "14256732300601504382" - }, - { - "file": "apps/landing/tailwind.config.cjs", - "hash": "9821587412396646719" - }, - { - "file": "apps/landing/tsconfig.json", - "hash": "14611439694374538873" - }, - { - "file": "apps/landing/vite.config.ts", - "hash": "2155460198681927953" - } - ], "webextension": [ { "file": "apps/webextension/.editorconfig", @@ -564,7 +257,7 @@ }, { "file": "apps/webextension/src/backgrounds/common-image/provider-base.ts", - "hash": "5552968420499727469" + "hash": "14493446672099302892" }, { "file": "apps/webextension/src/backgrounds/common-image/settings-base.svelte", @@ -660,7 +353,7 @@ }, { "file": "apps/webextension/src/backgrounds/static-image/provider.ts", - "hash": "16889363929472402360" + "hash": "16413186880010544235" }, { "file": "apps/webextension/src/backgrounds/static-image/settings.svelte", @@ -1291,204 +984,485 @@ "hash": "9843907418063189654" }, { - "file": "apps/webextension/src/widgets/search/providers/google.ts", - "hash": "16848377991953079100" + "file": "apps/webextension/src/widgets/search/providers/google.ts", + "hash": "16848377991953079100" + }, + { + "file": "apps/webextension/src/widgets/search/providers/index.ts", + "hash": "2318286520842264627" + }, + { + "file": "apps/webextension/src/widgets/search/providers/search-provider.ts", + "hash": "6178822893274229849" + }, + { + "file": "apps/webextension/src/widgets/search/providers/youtube.ts", + "hash": "3563789026995690671" + }, + { + "file": "apps/webextension/src/widgets/search/settings-tabs.ts", + "hash": "5909444457264753250" + }, + { + "file": "apps/webextension/src/widgets/search/settings.svelte", + "hash": "1492437250913277194" + }, + { + "file": "apps/webextension/src/widgets/search/settings.ts", + "hash": "357087038590269192" + }, + { + "file": "apps/webextension/src/widgets/search/widget.svelte", + "hash": "9980285193167831367" + }, + { + "file": "apps/webextension/src/widgets/top-sites/index.ts", + "hash": "16704349236156841535" + }, + { + "file": "apps/webextension/src/widgets/top-sites/preview.svelte", + "hash": "17879558767959311687" + }, + { + "file": "apps/webextension/src/widgets/top-sites/settings-tabs.ts", + "hash": "12307568850927806972" + }, + { + "file": "apps/webextension/src/widgets/top-sites/settings.svelte", + "hash": "8221831334989299183" + }, + { + "file": "apps/webextension/src/widgets/top-sites/settings.ts", + "hash": "7244032658967811055" + }, + { + "file": "apps/webextension/src/widgets/top-sites/top-sites-store.ts", + "hash": "7151818548601343006" + }, + { + "file": "apps/webextension/src/widgets/top-sites/widget.svelte", + "hash": "7370765343150472180" + }, + { + "file": "apps/webextension/src/widgets/weather/asset-packs/asset-pack-base.ts", + "hash": "15719170141281758925" + }, + { + "file": "apps/webextension/src/widgets/weather/asset-packs/asset-packs.tmpl.mjs", + "hash": "14265891568843040437" + }, + { + "file": "apps/webextension/src/widgets/weather/asset-packs/degry.json", + "hash": "4914741692122152947" + }, + { + "file": "apps/webextension/src/widgets/weather/asset-packs/iconify.json", + "hash": "9896088172918968293" + }, + { + "file": "apps/webextension/src/widgets/weather/asset-packs/index.ts", + "hash": "13698853447965384859" + }, + { + "file": "apps/webextension/src/widgets/weather/asset-packs/modern.json", + "hash": "14150609010917454842" + }, + { + "file": "apps/webextension/src/widgets/weather/index.ts", + "hash": "11620949632277007097" + }, + { + "file": "apps/webextension/src/widgets/weather/owm-redirect.tmpl.mjs", + "hash": "3852886854167392205" + }, + { + "file": "apps/webextension/src/widgets/weather/preview.svelte", + "hash": "8780682343064561336" + }, + { + "file": "apps/webextension/src/widgets/weather/settings-tabs.ts", + "hash": "12946274845543736838" + }, + { + "file": "apps/webextension/src/widgets/weather/settings.svelte", + "hash": "4412949319608610029" + }, + { + "file": "apps/webextension/src/widgets/weather/settings.ts", + "hash": "15947274235729617355" + }, + { + "file": "apps/webextension/src/widgets/weather/widget.svelte", + "hash": "1699691085783918540" + }, + { + "file": "apps/webextension/static/favicon/android-chrome-192x192.png", + "hash": "17747222593322570913" + }, + { + "file": "apps/webextension/static/favicon/android-chrome-512x512.png", + "hash": "10992519659870263635" + }, + { + "file": "apps/webextension/static/favicon/apple-touch-icon.png", + "hash": "8319709282744640903" + }, + { + "file": "apps/webextension/static/favicon/browserconfig.xml", + "hash": "9030448547662640771" + }, + { + "file": "apps/webextension/static/favicon/favicon-128x128.png", + "hash": "3574285871798273089" + }, + { + "file": "apps/webextension/static/favicon/favicon-16x16.png", + "hash": "1484907360946902538" + }, + { + "file": "apps/webextension/static/favicon/favicon-32x32.png", + "hash": "12914832945126627537" + }, + { + "file": "apps/webextension/static/favicon/favicon-48x48.png", + "hash": "16296114082698355954" + }, + { + "file": "apps/webextension/static/favicon/favicon-96x96.png", + "hash": "15400891981776800899" + }, + { + "file": "apps/webextension/static/favicon/favicon.ico", + "hash": "6080578060923793650" + }, + { + "file": "apps/webextension/static/favicon/favicon.svg", + "hash": "16149112273573293908" + }, + { + "file": "apps/webextension/static/favicon/mstile-144x144.png", + "hash": "17090102562471781642" + }, + { + "file": "apps/webextension/static/favicon/mstile-150x150.png", + "hash": "2987547776851300371" + }, + { + "file": "apps/webextension/static/favicon/mstile-310x150.png", + "hash": "8240165320902303268" + }, + { + "file": "apps/webextension/static/favicon/mstile-310x310.png", + "hash": "11331575352337162409" + }, + { + "file": "apps/webextension/static/favicon/mstile-70x70.png", + "hash": "4598816931621196495" + }, + { + "file": "apps/webextension/static/favicon/safari-pinned-tab.svg", + "hash": "12657718850154108143" + }, + { + "file": "apps/webextension/static/favicon/site.webmanifest.json", + "hash": "10433911047657634548" + }, + { + "file": "apps/webextension/svelte.config.js", + "hash": "6852886641038529940" + }, + { + "file": "apps/webextension/tailwind.config.cjs", + "hash": "8923680068350003414" + }, + { + "file": "apps/webextension/tsconfig.json", + "hash": "1239849719523029168" + }, + { + "file": "apps/webextension/vite.config.ts", + "hash": "15202531478258444856" + } + ], + "landing": [ + { + "file": "apps/landing/.editorconfig", + "hash": "7656052162757445104" + }, + { + "file": "apps/landing/.eslintignore", + "hash": "12866345277008372755" + }, + { + "file": "apps/landing/.eslintrc.cjs", + "hash": "15647399974590712086" + }, + { + "file": "apps/landing/.gitignore", + "hash": "2615793248884789625" + }, + { + "file": "apps/landing/.npmrc", + "hash": "16306061729883149313" + }, + { + "file": "apps/landing/.prettierignore", + "hash": "9861187265567348571" + }, + { + "file": "apps/landing/.prettierrc", + "hash": "8590646213043532286" + }, + { + "file": "apps/landing/netlify.toml", + "hash": "6484258719775923400" + }, + { + "file": "apps/landing/package.json", + "hash": "3712875329528442112", + "deps": [ + "npm:@fontsource/inter", + "npm:@iconify/json", + "npm:@iconify/tailwind", + "npm:@iconify/utils", + "npm:@neoconfetti/svelte", + "npm:@sveltejs/adapter-static", + "npm:@sveltejs/enhanced-img", + "npm:@sveltejs/kit", + "npm:@sveltejs/vite-plugin-svelte", + "npm:@tailwindcss/forms", + "npm:@types/aos", + "npm:@types/eslint", + "npm:@typescript-eslint/eslint-plugin", + "npm:@typescript-eslint/parser", + "npm:aos", + "npm:autoprefixer", + "npm:cssnano", + "npm:cssnano-preset-default", + "npm:cssnano-preset-lite", + "npm:daisyui", + "npm:embla-carousel-svelte", + "npm:eslint", + "npm:eslint-config-prettier", + "npm:eslint-plugin-svelte", + "is-wsl2", + "npm:postcss", + "npm:postcss-load-config@6.0.1", + "npm:prettier", + "npm:prettier-plugin-svelte", + "npm:prettier-plugin-tailwindcss", + "npm:svelte", + "npm:svelte-body", + "npm:svelte-check", + "npm:tailwindcss", + "npm:tslib", + "npm:typescript", + "npm:vite" + ] + }, + { + "file": "apps/landing/postcss.config.cjs", + "hash": "7910658628078544505" }, { - "file": "apps/webextension/src/widgets/search/providers/index.ts", - "hash": "2318286520842264627" + "file": "apps/landing/src/app.d.ts", + "hash": "17522384083550949823" }, { - "file": "apps/webextension/src/widgets/search/providers/search-provider.ts", - "hash": "6178822893274229849" + "file": "apps/landing/src/app.html", + "hash": "17841630233698801912" }, { - "file": "apps/webextension/src/widgets/search/providers/youtube.ts", - "hash": "3563789026995690671" + "file": "apps/landing/src/app.pcss", + "hash": "14810236820657831828" }, { - "file": "apps/webextension/src/widgets/search/settings-tabs.ts", - "hash": "5909444457264753250" + "file": "apps/landing/src/components/features.svelte", + "hash": "7661422588996331189" }, { - "file": "apps/webextension/src/widgets/search/settings.svelte", - "hash": "1492437250913277194" + "file": "apps/landing/src/components/footer.svelte", + "hash": "13121746684541395301" }, { - "file": "apps/webextension/src/widgets/search/settings.ts", - "hash": "357087038590269192" + "file": "apps/landing/src/components/header.svelte", + "hash": "17934009167654308491" }, { - "file": "apps/webextension/src/widgets/search/widget.svelte", - "hash": "9980285193167831367" + "file": "apps/landing/src/components/navigation.svelte", + "hash": "14988055686807007102" }, { - "file": "apps/webextension/src/widgets/top-sites/index.ts", - "hash": "16704349236156841535" + "file": "apps/landing/src/components/screenshots.svelte", + "hash": "13102879630609783136" }, { - "file": "apps/webextension/src/widgets/top-sites/preview.svelte", - "hash": "17879558767959311687" + "file": "apps/landing/src/components/support.svelte", + "hash": "7310236108946124037" }, { - "file": "apps/webextension/src/widgets/top-sites/settings-tabs.ts", - "hash": "12307568850927806972" + "file": "apps/landing/src/components/welcome.svelte", + "hash": "718645630279054264" }, { - "file": "apps/webextension/src/widgets/top-sites/settings.svelte", - "hash": "8221831334989299183" + "file": "apps/landing/src/lib/assets/amo-button.svg", + "hash": "10638019120008779628" }, { - "file": "apps/webextension/src/widgets/top-sites/settings.ts", - "hash": "7244032658967811055" + "file": "apps/landing/src/lib/assets/cwo-button.svg", + "hash": "18021027240333141996" }, { - "file": "apps/webextension/src/widgets/top-sites/top-sites-store.ts", - "hash": "7151818548601343006" + "file": "apps/landing/src/lib/assets/edge-button.svg", + "hash": "14822606946037564973" }, { - "file": "apps/webextension/src/widgets/top-sites/widget.svelte", - "hash": "7370765343150472180" + "file": "apps/landing/src/lib/css/theme.css", + "hash": "9028311825916970864" }, { - "file": "apps/webextension/src/widgets/weather/asset-packs/asset-pack-base.ts", - "hash": "15719170141281758925" + "file": "apps/landing/src/lib/css/utility-patterns.css", + "hash": "12126172961868927401" }, { - "file": "apps/webextension/src/widgets/weather/asset-packs/asset-packs.tmpl.mjs", - "hash": "14265891568843040437" + "file": "apps/landing/src/lib/screenshots/0.jpeg", + "hash": "14185278729368134872" }, { - "file": "apps/webextension/src/widgets/weather/asset-packs/degry.json", - "hash": "4914741692122152947" + "file": "apps/landing/src/lib/screenshots/1.png", + "hash": "2305235227382566427" }, { - "file": "apps/webextension/src/widgets/weather/asset-packs/iconify.json", - "hash": "9896088172918968293" + "file": "apps/landing/src/lib/screenshots/2.jpeg", + "hash": "9183676362714503382" }, { - "file": "apps/webextension/src/widgets/weather/asset-packs/index.ts", - "hash": "13698853447965384859" + "file": "apps/landing/src/lib/screenshots/3.jpeg", + "hash": "3962158966037601750" }, { - "file": "apps/webextension/src/widgets/weather/asset-packs/modern.json", - "hash": "14150609010917454842" + "file": "apps/landing/src/lib/screenshots/4.jpeg", + "hash": "9225345747745698130" }, { - "file": "apps/webextension/src/widgets/weather/index.ts", - "hash": "11620949632277007097" + "file": "apps/landing/src/lib/screenshots/5.png", + "hash": "6558862023349455654" }, { - "file": "apps/webextension/src/widgets/weather/owm-redirect.tmpl.mjs", - "hash": "3852886854167392205" + "file": "apps/landing/src/lib/screenshots/6.jpeg", + "hash": "5392268130969410636" }, { - "file": "apps/webextension/src/widgets/weather/preview.svelte", - "hash": "8780682343064561336" + "file": "apps/landing/src/lib/screenshots/7.png", + "hash": "10289934768717743098" }, { - "file": "apps/webextension/src/widgets/weather/settings-tabs.ts", - "hash": "12946274845543736838" + "file": "apps/landing/src/routes/+error.svelte", + "hash": "11260399356154979818" }, { - "file": "apps/webextension/src/widgets/weather/settings.svelte", - "hash": "4412949319608610029" + "file": "apps/landing/src/routes/+layout.svelte", + "hash": "11467319100262057112" }, { - "file": "apps/webextension/src/widgets/weather/settings.ts", - "hash": "15947274235729617355" + "file": "apps/landing/src/routes/+layout.ts", + "hash": "3656248653335203942" }, { - "file": "apps/webextension/src/widgets/weather/widget.svelte", - "hash": "1699691085783918540" + "file": "apps/landing/src/routes/+page.svelte", + "hash": "4490183109275284451" }, { - "file": "apps/webextension/static/favicon/android-chrome-192x192.png", + "file": "apps/landing/static/favicon/android-chrome-192x192.png", "hash": "17747222593322570913" }, { - "file": "apps/webextension/static/favicon/android-chrome-512x512.png", + "file": "apps/landing/static/favicon/android-chrome-512x512.png", "hash": "10992519659870263635" }, { - "file": "apps/webextension/static/favicon/apple-touch-icon.png", + "file": "apps/landing/static/favicon/apple-touch-icon.png", "hash": "8319709282744640903" }, { - "file": "apps/webextension/static/favicon/browserconfig.xml", + "file": "apps/landing/static/favicon/browserconfig.xml", "hash": "9030448547662640771" }, { - "file": "apps/webextension/static/favicon/favicon-128x128.png", + "file": "apps/landing/static/favicon/favicon-128x128.png", "hash": "3574285871798273089" }, { - "file": "apps/webextension/static/favicon/favicon-16x16.png", + "file": "apps/landing/static/favicon/favicon-16x16.png", "hash": "1484907360946902538" }, { - "file": "apps/webextension/static/favicon/favicon-32x32.png", + "file": "apps/landing/static/favicon/favicon-32x32.png", "hash": "12914832945126627537" }, { - "file": "apps/webextension/static/favicon/favicon-48x48.png", + "file": "apps/landing/static/favicon/favicon-48x48.png", "hash": "16296114082698355954" }, { - "file": "apps/webextension/static/favicon/favicon-96x96.png", + "file": "apps/landing/static/favicon/favicon-96x96.png", "hash": "15400891981776800899" }, { - "file": "apps/webextension/static/favicon/favicon.ico", + "file": "apps/landing/static/favicon/favicon.ico", "hash": "6080578060923793650" }, { - "file": "apps/webextension/static/favicon/favicon.svg", + "file": "apps/landing/static/favicon/favicon.svg", "hash": "16149112273573293908" }, { - "file": "apps/webextension/static/favicon/mstile-144x144.png", + "file": "apps/landing/static/favicon/mstile-144x144.png", "hash": "17090102562471781642" }, { - "file": "apps/webextension/static/favicon/mstile-150x150.png", + "file": "apps/landing/static/favicon/mstile-150x150.png", "hash": "2987547776851300371" }, { - "file": "apps/webextension/static/favicon/mstile-310x150.png", + "file": "apps/landing/static/favicon/mstile-310x150.png", "hash": "8240165320902303268" }, { - "file": "apps/webextension/static/favicon/mstile-310x310.png", + "file": "apps/landing/static/favicon/mstile-310x310.png", "hash": "11331575352337162409" }, { - "file": "apps/webextension/static/favicon/mstile-70x70.png", + "file": "apps/landing/static/favicon/mstile-70x70.png", "hash": "4598816931621196495" }, { - "file": "apps/webextension/static/favicon/safari-pinned-tab.svg", + "file": "apps/landing/static/favicon/safari-pinned-tab.svg", "hash": "12657718850154108143" }, { - "file": "apps/webextension/static/favicon/site.webmanifest.json", + "file": "apps/landing/static/favicon/site.webmanifest.json", "hash": "10433911047657634548" }, { - "file": "apps/webextension/svelte.config.js", - "hash": "6852886641038529940" + "file": "apps/landing/static/robots.txt", + "hash": "2790380794362165217" }, { - "file": "apps/webextension/tailwind.config.cjs", - "hash": "8923680068350003414" + "file": "apps/landing/svelte.config.js", + "hash": "14256732300601504382" }, { - "file": "apps/webextension/tsconfig.json", - "hash": "1239849719523029168" + "file": "apps/landing/tailwind.config.cjs", + "hash": "9821587412396646719" }, { - "file": "apps/webextension/vite.config.ts", - "hash": "15202531478258444856" + "file": "apps/landing/tsconfig.json", + "hash": "14611439694374538873" + }, + { + "file": "apps/landing/vite.config.ts", + "hash": "2155460198681927953" } ], "vite-plugin-run-generator": [ @@ -1534,6 +1508,33 @@ "hash": "4336780397135653243" } ], + "iqair-redirect": [ + { + "file": "apps/iqair-redirect/.editorconfig", + "hash": "9035647012319884894" + }, + { + "file": "apps/iqair-redirect/.gitignore", + "hash": "10657848430346760040" + }, + { + "file": "apps/iqair-redirect/package.json", + "hash": "8964089113339022677", + "deps": [ + "npm:wrangler", + "npm:geo-position.ts", + "npm:unidecode" + ] + }, + { + "file": "apps/iqair-redirect/src/worker.ts", + "hash": "12279403779427720829" + }, + { + "file": "apps/iqair-redirect/wrangler.toml", + "hash": "11886815432978647150" + } + ], "netlify-plugin-interpolate-env-variable": [ { "file": "packages/netlify-plugin-interpolate-env-variable/index.js", @@ -1548,31 +1549,30 @@ "hash": "3398827628914074956" } ], - "iqair-redirect": [ + "owm-redirect": [ { - "file": "apps/iqair-redirect/.editorconfig", + "file": "apps/owm-redirect/.editorconfig", "hash": "9035647012319884894" }, { - "file": "apps/iqair-redirect/.gitignore", + "file": "apps/owm-redirect/.gitignore", "hash": "10657848430346760040" }, { - "file": "apps/iqair-redirect/package.json", - "hash": "8964089113339022677", + "file": "apps/owm-redirect/package.json", + "hash": "17134678572050872525", "deps": [ "npm:wrangler", - "npm:geo-position.ts", - "npm:unidecode" + "npm:geo-position.ts" ] }, { - "file": "apps/iqair-redirect/src/worker.ts", - "hash": "12279403779427720829" + "file": "apps/owm-redirect/src/worker.ts", + "hash": "13031713532980002527" }, { - "file": "apps/iqair-redirect/wrangler.toml", - "hash": "11886815432978647150" + "file": "apps/owm-redirect/wrangler.toml", + "hash": "16151197575438519813" } ], "preview": [ diff --git a/apps/webextension/src/backgrounds/common-image/provider-base.ts b/apps/webextension/src/backgrounds/common-image/provider-base.ts index ce9e1e3..6d5bc3a 100644 --- a/apps/webextension/src/backgrounds/common-image/provider-base.ts +++ b/apps/webextension/src/backgrounds/common-image/provider-base.ts @@ -6,11 +6,13 @@ import type { ImageBackgroundProviderSettingsBase } from './settings-base'; import { FastAverageColorEx } from './fast-average-color-ex'; import type { BackgroundCornerColorChangedEventArgs } from '$actions/dynamic-background'; import type { FastAverageColorResult } from 'fast-average-color'; +import { Opfs, OpfsSchema } from '$lib/opfs'; export abstract class ImageBackgroundProviderBase< T extends ImageBackgroundProviderSettingsBase, > extends BackgroundProvider { #unsubscribeFilterChange!: () => void; + #unsubscribeResizeType!: () => void; #lastImageUrl: string | undefined | null; #img: HTMLImageElement | undefined; #dominantColor: FastAverageColorResult | undefined; @@ -20,16 +22,25 @@ export abstract class ImageBackgroundProviderBase< super(node, settings); } - protected setImage(url: string | undefined | null): void { - if (this.#lastImageUrl) { + protected async setImage(url: string | undefined | null): Promise { + this.#releaseBlob(); + + if (this.#lastImageUrl && !this.#lastImageUrl.startsWith('blob://')) { ResourcesToPreload.delete({ src: this.#lastImageUrl }); } - this.#img!.src = url || ''; if (url) { + if (url.startsWith(`${OpfsSchema}://`)) { + const blob = await Opfs.get(this.settings.url.value); + url = URL.createObjectURL(blob); + } else { + ResourcesToPreload.add({ src: url, as: 'image' }); + } + + this.#img!.src = url; this.#img!.style.visibility = 'visible'; - ResourcesToPreload.add({ src: url, as: 'image' }); } else { + this.#img!.src = ''; this.#img!.style.visibility = 'hidden'; } @@ -48,6 +59,15 @@ export abstract class ImageBackgroundProviderBase< } } + #updateDominantColor() { + if (this.settings.resizeType.value === ImageResizeType.Contain) { + this.#dominantColor = this.#imageColor!.getDominantColor(this.#img!); + this.#img!.style.backgroundColor = this.#dominantColor.hex; + } else { + this.#img!.style.backgroundColor = ''; + } + } + // eslint-disable-next-line @typescript-eslint/no-unused-vars apply(abortSignal: AbortSignal) { abortSignal.throwIfAborted(); @@ -59,26 +79,23 @@ export abstract class ImageBackgroundProviderBase< this.#img.style.maxHeight = 'none'; this.#img.crossOrigin = 'anonymous'; this.#img.onload = () => { - if (this.settings.resizeType.value === ImageResizeType.Contain) { - this.#dominantColor = this.#imageColor!.getDominantColor(this.#img!); - this.#img!.style.backgroundColor = this.#dominantColor.hex; - } else { - this.#img!.style.backgroundColor = ''; - } - + this.#updateDominantColor(); this.#updateCornerColor(); }; - this.#resizeObserver = new ResizeObserver( - debounce(() => { - this.#updateCornerColor(); - }, 500), - ); + const updateCornerColorDeb = debounce(() => { + this.#updateDominantColor(); + this.#updateCornerColor(); + }, 500); + this.#resizeObserver = new ResizeObserver(updateCornerColorDeb); this.#resizeObserver.observe(this.#img); + this.#unsubscribeResizeType = this.settings.resizeType.subscribe(updateCornerColorDeb); this.#applyFilters(); } destroy(): void { + this.#releaseBlob(); this.#unsubscribeFilterChange!(); + this.#unsubscribeResizeType!(); this.#resizeObserver?.unobserve(this.#img!); this.#resizeObserver?.disconnect(); this.#imageColor?.destroy(); @@ -145,4 +162,10 @@ export abstract class ImageBackgroundProviderBase< this.#img!.style.objectFit = 'cover'; } } + + #releaseBlob() { + if (this.#lastImageUrl?.startsWith('blob://')) { + URL.revokeObjectURL(this.#lastImageUrl); + } + } } diff --git a/apps/webextension/src/backgrounds/static-image/provider.ts b/apps/webextension/src/backgrounds/static-image/provider.ts index c4394c8..f7dce7f 100644 --- a/apps/webextension/src/backgrounds/static-image/provider.ts +++ b/apps/webextension/src/backgrounds/static-image/provider.ts @@ -2,11 +2,9 @@ import { ImageBackgroundProviderBase } from '$backgrounds/common-image/provider- import debounce from 'debounce'; import type { Settings } from './settings'; import { secondsToMilliseconds } from 'date-fns'; -import { Opfs, OpfsSchema } from '$lib/opfs'; export class StaticImageBackgroundProvider extends ImageBackgroundProviderBase { #unsubscribe!: () => void; - #lastUrl: string | null = null; get canGoNext() { return false; } @@ -17,26 +15,10 @@ export class StaticImageBackgroundProvider extends ImageBackgroundProviderBase { - const url = URL.createObjectURL(blob); - this.setImage(url); - this.#lastUrl = url; - }); - } else { - this.setImage(this.settings.url.value); - this.#lastUrl = this.settings.url.value; - } + this.setImage(this.settings.url.value); } destroy(): void { - this.#releaseBlob(); super.destroy(); this.#unsubscribe(); } - #releaseBlob() { - if (this.#lastUrl?.startsWith('blob://')) { - URL.revokeObjectURL(this.#lastUrl); - } - } }