Compare commits

...

2 commits

Author SHA1 Message Date
Rodolphe Bréard
bbf5bff023 Detect the dark theme 2023-09-29 18:11:25 +02:00
Rodolphe Bréard
58ed576b85 Update dependencies 2023-09-29 17:54:35 +02:00
3 changed files with 52 additions and 42 deletions

View file

@ -12,6 +12,12 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [Unreleased]
### Changed
- If the browser uses a dark theme, the default theme is also set to dark
## [0.4.0] - 2023-09-26
### Added

82
package-lock.json generated
View file

@ -1,12 +1,12 @@
{
"name": "sake-app",
"version": "0.3.0",
"version": "0.4.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "sake-app",
"version": "0.3.0",
"version": "0.4.0",
"license": "(MIT OR Apache-2.0)",
"dependencies": {
"@noble/hashes": "^1.3.1",
@ -28,9 +28,9 @@
}
},
"node_modules/@babel/parser": {
"version": "7.22.16",
"resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.22.16.tgz",
"integrity": "sha512-+gPfKv8UWeKKeJTUxe59+OobVcrYHETCsORl61EmSkmgymguYk/X5bp7GuUIXaFsc6y++v8ZxPsLSSuujqDphA==",
"version": "7.23.0",
"resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.23.0.tgz",
"integrity": "sha512-vvPKKdMemU85V9WE/l5wZEmImpCtLqbnTvqDS2U1fJ96KrxoW7KrXhNsNCblQlg8Ck4b85yxdTyelsMUgFUXiw==",
"bin": {
"parser": "bin/babel-parser.js"
},
@ -391,9 +391,9 @@
}
},
"node_modules/@intlify/bundle-utils": {
"version": "7.3.0",
"resolved": "https://registry.npmjs.org/@intlify/bundle-utils/-/bundle-utils-7.3.0.tgz",
"integrity": "sha512-lcnfsLA5Dyd3TbvfoLS0ejLr1vAJYyT6VRYtE4LGNexy1ZD/GEcbXrC33fI9oQp7t2hDlHbCn2o4BBVgXaJFqg==",
"version": "7.4.0",
"resolved": "https://registry.npmjs.org/@intlify/bundle-utils/-/bundle-utils-7.4.0.tgz",
"integrity": "sha512-AQfjBe2HUxzyN8ignIk3WhhSuVcSuirgzOzkd17nb337rCbI4Gv/t1R60UUyIqFoFdviLb/wLcDUzTD/xXjv9w==",
"dev": true,
"dependencies": {
"@intlify/message-compiler": "^9.4.0",
@ -420,12 +420,12 @@
}
},
"node_modules/@intlify/core-base": {
"version": "9.4.1",
"resolved": "https://registry.npmjs.org/@intlify/core-base/-/core-base-9.4.1.tgz",
"integrity": "sha512-WIwx+elsZbxSMxRG5+LC+utRohFvmZMoDevfKOfnYMLbpCjCSavqTfHJAtfsY6ruowzqXeKkeLhRHbYbjoJx5g==",
"version": "9.5.0",
"resolved": "https://registry.npmjs.org/@intlify/core-base/-/core-base-9.5.0.tgz",
"integrity": "sha512-y3ufM1RJbI/DSmJf3lYs9ACq3S/iRvaSsE3rPIk0MGH7fp+JxU6rdryv/EYcwfcr3Y1aHFlCBir6S391hRZ57w==",
"dependencies": {
"@intlify/message-compiler": "9.4.1",
"@intlify/shared": "9.4.1"
"@intlify/message-compiler": "9.5.0",
"@intlify/shared": "9.5.0"
},
"engines": {
"node": ">= 16"
@ -435,11 +435,11 @@
}
},
"node_modules/@intlify/message-compiler": {
"version": "9.4.1",
"resolved": "https://registry.npmjs.org/@intlify/message-compiler/-/message-compiler-9.4.1.tgz",
"integrity": "sha512-aN2N+dUx320108QhH51Ycd2LEpZ+NKbzyQ2kjjhqMcxhHdxtOnkgdx+MDBhOy/CObwBmhC3Nygzc6hNlfKvPNw==",
"version": "9.5.0",
"resolved": "https://registry.npmjs.org/@intlify/message-compiler/-/message-compiler-9.5.0.tgz",
"integrity": "sha512-CAhVNfEZcOVFg0/5MNyt+OFjvs4J/ARjCj2b+54/FvFP0EDJI5lIqMTSDBE7k0atMROSP0SvWCkwu/AZ5xkK1g==",
"dependencies": {
"@intlify/shared": "9.4.1",
"@intlify/shared": "9.5.0",
"source-map-js": "^1.0.2"
},
"engines": {
@ -450,9 +450,9 @@
}
},
"node_modules/@intlify/shared": {
"version": "9.4.1",
"resolved": "https://registry.npmjs.org/@intlify/shared/-/shared-9.4.1.tgz",
"integrity": "sha512-A51elBmZWf1FS80inf/32diO9DeXoqg9GR9aUDHFcfHoNDuT46Q+fpPOdj8jiJnSHSBh8E1E+6qWRhAZXdK3Ng==",
"version": "9.5.0",
"resolved": "https://registry.npmjs.org/@intlify/shared/-/shared-9.5.0.tgz",
"integrity": "sha512-tAxV14LMXZDZbu32XzLMTsowNlgJNmLwWHYzvMUl6L8gvQeoYiZONjY7AUsqZW8TOZDX9lfvF6adPkk9FSRdDA==",
"engines": {
"node": ">= 16"
},
@ -461,12 +461,12 @@
}
},
"node_modules/@intlify/unplugin-vue-i18n": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/@intlify/unplugin-vue-i18n/-/unplugin-vue-i18n-1.2.0.tgz",
"integrity": "sha512-AzjlMZKj9DG10ICDR2VWjfJudHJ1XK2GNSHxw+VmOUYpUm4S0L/a7OAdvgnuY7S4plk1VnPdT4YilpZk+uQcqg==",
"version": "1.4.0",
"resolved": "https://registry.npmjs.org/@intlify/unplugin-vue-i18n/-/unplugin-vue-i18n-1.4.0.tgz",
"integrity": "sha512-RGDchCRBlDTyVVFgPA1C1XC1uD4xYN81Ma+3EnU6GQ8pBEreraX/PWdPXXzOB6k9GWCQHuqii3atYXhcH3rpSg==",
"dev": true,
"dependencies": {
"@intlify/bundle-utils": "^7.3.0",
"@intlify/bundle-utils": "^7.4.0",
"@intlify/shared": "^9.4.0",
"@rollup/pluginutils": "^5.0.2",
"@vue/compiler-sfc": "^3.2.47",
@ -1286,9 +1286,9 @@
}
},
"node_modules/magic-string": {
"version": "0.30.3",
"resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.30.3.tgz",
"integrity": "sha512-B7xGbll2fG/VjP+SWg4sX3JynwIU0mjoTc6MPpKNuIvftk6u6vqhDnk1R80b8C2GBR6ywqy+1DcKBrevBg+bmw==",
"version": "0.30.4",
"resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.30.4.tgz",
"integrity": "sha512-Q/TKtsC5BPm0kGqgBIF9oXAs/xEf2vRKiIB4wCRQTJOQIByZ1d+NnUOotvJOvNpi5RNIgVOMC3pOuaP1ZTDlVg==",
"dependencies": {
"@jridgewell/sourcemap-codec": "^1.4.15"
},
@ -1397,9 +1397,9 @@
}
},
"node_modules/postcss": {
"version": "8.4.30",
"resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.30.tgz",
"integrity": "sha512-7ZEao1g4kd68l97aWG/etQKPKq07us0ieSZ2TnFDk11i0ZfDW2AwKHYU8qv4MZKqN2fdBfg+7q0ES06UA73C1g==",
"version": "8.4.31",
"resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.31.tgz",
"integrity": "sha512-PS08Iboia9mts/2ygV3eLpY5ghnUcfLV/EXTOW1E2qYxJKGGBUtNjN76FYHnMs36RmARn41bC0AZmn+rR0OVpQ==",
"funding": [
{
"type": "opencollective",
@ -1478,9 +1478,9 @@
}
},
"node_modules/rollup": {
"version": "3.29.2",
"resolved": "https://registry.npmjs.org/rollup/-/rollup-3.29.2.tgz",
"integrity": "sha512-CJouHoZ27v6siztc21eEQGo0kIcE5D1gVPA571ez0mMYb25LGYGKnVNXpEj5MGlepmDWGXNjDB5q7uNiPHC11A==",
"version": "3.29.4",
"resolved": "https://registry.npmjs.org/rollup/-/rollup-3.29.4.tgz",
"integrity": "sha512-oWzmBZwvYrU0iJHtDmhsm662rC15FRXmcjCk1xD771dFDx5jJ02ufAQQTn0etB2emNk4J9EZg/yWKpsn9BWGRw==",
"dev": true,
"bin": {
"rollup": "dist/bin/rollup"
@ -1592,9 +1592,9 @@
}
},
"node_modules/ufo": {
"version": "1.3.0",
"resolved": "https://registry.npmjs.org/ufo/-/ufo-1.3.0.tgz",
"integrity": "sha512-bRn3CsoojyNStCZe0BG0Mt4Nr/4KF+rhFlnNXybgqt5pXHNFRlqinSoQaTrGyzE4X8aHplSb+TorH+COin9Yxw==",
"version": "1.3.1",
"resolved": "https://registry.npmjs.org/ufo/-/ufo-1.3.1.tgz",
"integrity": "sha512-uY/99gMLIOlJPwATcMVYfqDSxUR9//AUcgZMzwfSTJPDKzA1S8mX4VLqa+fiAtveraQUBCz4FFcwVZBGbwBXIw==",
"dev": true
},
"node_modules/unplugin": {
@ -1685,12 +1685,12 @@
}
},
"node_modules/vue-i18n": {
"version": "9.4.1",
"resolved": "https://registry.npmjs.org/vue-i18n/-/vue-i18n-9.4.1.tgz",
"integrity": "sha512-vnQyYE9LBuNOqPpETIcCaGnAyLEqfeIvDcyZ9T+WBCWFTqWw1J8FuF1jfeDwpHBi5JKgAwgXyq1mt8jp/x/GPA==",
"version": "9.5.0",
"resolved": "https://registry.npmjs.org/vue-i18n/-/vue-i18n-9.5.0.tgz",
"integrity": "sha512-NiI3Ph1qMstNf7uhYh8trQBOBFLxeJgcOxBq51pCcZ28Vs18Y7BDS58r8HGDKCYgXdLUYqPDXdKatIF4bvBVZg==",
"dependencies": {
"@intlify/core-base": "9.4.1",
"@intlify/shared": "9.4.1",
"@intlify/core-base": "9.5.0",
"@intlify/shared": "9.5.0",
"@vue/devtools-api": "^6.5.0"
},
"engines": {

View file

@ -23,8 +23,12 @@ const setGlobalAttribute = (attrName, storageName, defaultValue, allowedValues)
'defaultValue': defaultValue,
};
};
const getDefaultColorMode = () => {
const darkMediaQuery = window.matchMedia('(prefers-color-scheme: dark)');
return darkMediaQuery.matches ? 'dark' : 'light';
};
const locale = setGlobalAttribute('lang', 'sake-locale', getDefaultLocale(), allowedLocales);
const colorMode = setGlobalAttribute('data-bs-theme', 'sake-color-mode', 'light', allowedColorModes);
const colorMode = setGlobalAttribute('data-bs-theme', 'sake-color-mode', getDefaultColorMode(), allowedColorModes);
const i18n = createI18n({
legacy: false,