@iobroker/adapter-react-v5 7.7.4 → 8.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (56) hide show
  1. package/LICENSE +22 -22
  2. package/README.md +3 -3
  3. package/build/AdminConnection.js.map +1 -1
  4. package/build/Components/404.js +13 -13
  5. package/build/Components/404.js.map +1 -1
  6. package/build/Components/ColorPicker.js.map +1 -1
  7. package/build/Components/CopyToClipboard.js.map +1 -1
  8. package/build/Components/Icon.js.map +1 -1
  9. package/build/Components/IobUri.d.ts +1 -1
  10. package/build/Components/IobUri.js.map +1 -1
  11. package/build/Components/Loader.js +223 -223
  12. package/build/Components/Loader.js.map +1 -1
  13. package/build/Components/Loaders/MV.js.map +1 -1
  14. package/build/Components/Loaders/PT.js +103 -103
  15. package/build/Components/Loaders/PT.js.map +1 -1
  16. package/build/Components/Loaders/Vendor.js +7 -7
  17. package/build/Components/Loaders/Vendor.js.map +1 -1
  18. package/build/Components/MDUtils.js.map +1 -1
  19. package/build/Components/ObjectBrowser.d.ts +2 -1
  20. package/build/Components/ObjectBrowser.js +2 -2
  21. package/build/Components/ObjectBrowser.js.map +1 -1
  22. package/build/Components/Router.js.map +1 -1
  23. package/build/Components/SaveCloseButtons.js.map +1 -1
  24. package/build/Components/SimpleCron/cronText.js.map +1 -1
  25. package/build/Components/SimpleCron/index.js.map +1 -1
  26. package/build/Components/TabContainer.js.map +1 -1
  27. package/build/Components/TabContent.js.map +1 -1
  28. package/build/Components/TabHeader.js.map +1 -1
  29. package/build/Components/TableResize.js.map +1 -1
  30. package/build/Components/TreeTable.js.map +1 -1
  31. package/build/Components/UploadImage.js +305 -305
  32. package/build/Components/UploadImage.js.map +1 -1
  33. package/build/Connection.js.map +1 -1
  34. package/build/Dialogs/ComplexCron.js.map +1 -1
  35. package/build/Dialogs/Confirm.js.map +1 -1
  36. package/build/Dialogs/Cron.js.map +1 -1
  37. package/build/Dialogs/Error.js.map +1 -1
  38. package/build/Dialogs/Message.js.map +1 -1
  39. package/build/Dialogs/SimpleCron.js.map +1 -1
  40. package/build/Dialogs/TextInput.js.map +1 -1
  41. package/build/Prompt.js +7 -7
  42. package/build/Prompt.js.map +1 -1
  43. package/build/assets/devices/parseNames.js.map +1 -1
  44. package/build/assets/devices.json +1 -1
  45. package/build/assets/lamp_ceiling.svg +8 -8
  46. package/build/assets/lamp_table.svg +7 -7
  47. package/build/assets/no_icon.svg +9 -9
  48. package/build/assets/rooms/parseNames.js.map +1 -1
  49. package/build/assets/rooms.json +1 -1
  50. package/build/dictionary.js.map +1 -1
  51. package/build/globals.d.ts +19 -0
  52. package/build/i18n.js.map +1 -1
  53. package/build/index.css +56 -56
  54. package/index.css +56 -56
  55. package/package.json +84 -82
  56. package/tasksExample.js +91 -91
@@ -1 +1 @@
1
- {"version":3,"file":"dictionary.js","sourceRoot":"./src/","sources":["dictionary.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,gBAAgB,CAAC;AACpC,OAAO,MAAM,MAAM,gBAAgB,CAAC;AACpC,OAAO,MAAM,MAAM,gBAAgB,CAAC;AACpC,OAAO,MAAM,MAAM,gBAAgB,CAAC;AACpC,OAAO,MAAM,MAAM,gBAAgB,CAAC;AACpC,OAAO,MAAM,MAAM,gBAAgB,CAAC;AACpC,OAAO,MAAM,MAAM,gBAAgB,CAAC;AACpC,OAAO,MAAM,MAAM,gBAAgB,CAAC;AACpC,OAAO,MAAM,MAAM,gBAAgB,CAAC;AACpC,OAAO,MAAM,MAAM,gBAAgB,CAAC;AACpC,OAAO,QAAQ,MAAM,mBAAmB,CAAC;AAEzC,MAAM,CAAC,MAAM,UAAU,GAAuD;IAC1E,EAAE,EAAE,MAAM;IACV,EAAE,EAAE,MAAM;IACV,EAAE,EAAE,MAAM;IACV,EAAE,EAAE,MAAM;IACV,EAAE,EAAE,MAAM;IACV,EAAE,EAAE,MAAM;IACV,EAAE,EAAE,MAAM;IACV,EAAE,EAAE,MAAM;IACV,EAAE,EAAE,MAAM;IACV,EAAE,EAAE,MAAM;IACV,OAAO,EAAE,QAAQ;CACpB,CAAC","sourcesContent":["import langEn from './i18n/en.json';\nimport langDe from './i18n/de.json';\nimport langRu from './i18n/ru.json';\nimport langPt from './i18n/pt.json';\nimport langNl from './i18n/nl.json';\nimport langFr from './i18n/fr.json';\nimport langIt from './i18n/it.json';\nimport langEs from './i18n/es.json';\nimport langPl from './i18n/pl.json';\nimport langUk from './i18n/uk.json';\nimport langZhCn from './i18n/zh-cn.json';\n\nexport const dictionary: Record<ioBroker.Languages, Record<string, string>> = {\n en: langEn,\n de: langDe,\n ru: langRu,\n pt: langPt,\n nl: langNl,\n fr: langFr,\n it: langIt,\n es: langEs,\n pl: langPl,\n uk: langUk,\n 'zh-cn': langZhCn,\n};\n"]}
1
+ {"version":3,"file":"dictionary.js","sourceRoot":"./src/","sources":["dictionary.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,gBAAgB,CAAC;AACpC,OAAO,MAAM,MAAM,gBAAgB,CAAC;AACpC,OAAO,MAAM,MAAM,gBAAgB,CAAC;AACpC,OAAO,MAAM,MAAM,gBAAgB,CAAC;AACpC,OAAO,MAAM,MAAM,gBAAgB,CAAC;AACpC,OAAO,MAAM,MAAM,gBAAgB,CAAC;AACpC,OAAO,MAAM,MAAM,gBAAgB,CAAC;AACpC,OAAO,MAAM,MAAM,gBAAgB,CAAC;AACpC,OAAO,MAAM,MAAM,gBAAgB,CAAC;AACpC,OAAO,MAAM,MAAM,gBAAgB,CAAC;AACpC,OAAO,QAAQ,MAAM,mBAAmB,CAAC;AAEzC,MAAM,CAAC,MAAM,UAAU,GAAuD;IAC1E,EAAE,EAAE,MAAM;IACV,EAAE,EAAE,MAAM;IACV,EAAE,EAAE,MAAM;IACV,EAAE,EAAE,MAAM;IACV,EAAE,EAAE,MAAM;IACV,EAAE,EAAE,MAAM;IACV,EAAE,EAAE,MAAM;IACV,EAAE,EAAE,MAAM;IACV,EAAE,EAAE,MAAM;IACV,EAAE,EAAE,MAAM;IACV,OAAO,EAAE,QAAQ;CACpB,CAAC","sourcesContent":["import langEn from './i18n/en.json';\r\nimport langDe from './i18n/de.json';\r\nimport langRu from './i18n/ru.json';\r\nimport langPt from './i18n/pt.json';\r\nimport langNl from './i18n/nl.json';\r\nimport langFr from './i18n/fr.json';\r\nimport langIt from './i18n/it.json';\r\nimport langEs from './i18n/es.json';\r\nimport langPl from './i18n/pl.json';\r\nimport langUk from './i18n/uk.json';\r\nimport langZhCn from './i18n/zh-cn.json';\r\n\r\nexport const dictionary: Record<ioBroker.Languages, Record<string, string>> = {\r\n en: langEn,\r\n de: langDe,\r\n ru: langRu,\r\n pt: langPt,\r\n nl: langNl,\r\n fr: langFr,\r\n it: langIt,\r\n es: langEs,\r\n pl: langPl,\r\n uk: langUk,\r\n 'zh-cn': langZhCn,\r\n};\r\n"]}
@@ -0,0 +1,19 @@
1
+ declare global {
2
+ interface Window {
3
+ CryptoJS: any;
4
+ _localStorage?: Storage;
5
+ _sessionStorage?: Storage;
6
+ }
7
+
8
+ declare module '*.svg';
9
+ declare module '*.png';
10
+ declare module '*.jpg';
11
+
12
+ declare module '@mui/material/Button' {
13
+ interface ButtonPropsColorOverrides {
14
+ grey: true;
15
+ }
16
+ }
17
+ }
18
+
19
+ export {};
package/build/i18n.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"i18n.js","sourceRoot":"./src/","sources":["i18n.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAsBH;;GAEG;AACH,MAAM,OAAO,IAAI;IACb,qDAAqD;IACrD,MAAM,CAAC,YAAY,GAAmB,EAAE,CAAC;IAEzC,uDAAuD;IACvD,MAAM,CAAC,mBAAmB,GAAa,EAAE,CAAC;IAE1C,wCAAwC;IACxC,MAAM,CAAC,IAAI,GAAuB,MAAM,CAAC,OAAO,IAAI,IAAI,CAAC;IAEzD,MAAM,CAAC,eAAe,GAAY,KAAK,CAAC;IAExC;;;;OAIG;IACH,MAAM,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,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;QACjD,CAAC;IACL,CAAC;IAED;;;;;OAKG;IACH,MAAM,CAAC,cAAc,CAAC,OAAgB;QAClC,IAAI,CAAC,eAAe,GAAG,CAAC,CAAC,OAAO,CAAC;IACrC,CAAC;;AAGL,0BAA0B;AAC1B,MAAM,CAAC,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC;AAChC,MAAM,CAAC,kBAAkB,GAAG,IAAI,CAAC,cAAc,CAAC;AAEhD;;;;;;;;EAQE","sourcesContent":["/**\n * Copyright 2018-2024 Denis Haev (bluefox) <dogafox@gmail.com>\n *\n * MIT License\n *\n */\n\ndeclare global {\n interface Window {\n sysLang: ioBroker.Languages;\n i18nShow: (filter: string | RegExp) => void;\n i18nDisableWarning: (disable: boolean) => void;\n }\n}\n\ntype I18nWordDictionary = Record<ioBroker.Languages, string>;\n\ntype I18nWordsDictionary = Record<string, I18nWordDictionary>;\n\ntype I18nOneLanguageDictionary = Record<string, string>;\n\ntype I18nDictionary = {\n [lang in ioBroker.Languages]?: I18nOneLanguageDictionary;\n};\n\ntype I18nWordsWithPrefix = I18nDictionary & { prefix?: string };\n\n/**\n * Translation string management.\n */\nexport class I18n {\n /** List of all languages with their translations. */\n static translations: I18nDictionary = {};\n\n /** List of unknown translations during development. */\n static unknownTranslations: string[] = [];\n\n /** The currently displayed language. */\n static lang: ioBroker.Languages = window.sysLang || 'en';\n\n static _disableWarning: boolean = false;\n\n /**\n * Set the language to display\n *\n * @param lang The default language for translations.\n */\n static setLanguage(lang: ioBroker.Languages): void {\n if (lang) {\n I18n.lang = lang;\n }\n }\n\n /**\n * Add translations\n * User can provide two types of structures:\n * - {\"word1\": \"translated word1\", \"word2\": \"translated word2\"}, but in this case the lang must be provided\n * - {\"word1\": {\"en\": \"translated en word1\", \"de\": \"translated de word1\"}, \"word2\": {\"en\": \"translated en word2\", \"de\": \"translated de word2\"}}, but no lang must be provided\n *\n * @param words additional words for specific language\n * @param lang language for the words\n */\n static extendTranslations(\n words: I18nWordsWithPrefix | I18nOneLanguageDictionary | I18nWordsDictionary,\n lang?: ioBroker.Languages,\n ): void {\n // automatically extend all languages with prefix\n if ((words as I18nWordsWithPrefix).prefix) {\n const wordsWithPrefix = words as I18nWordsWithPrefix;\n if (typeof wordsWithPrefix.prefix === 'string') {\n const prefix = wordsWithPrefix.prefix;\n delete wordsWithPrefix.prefix;\n Object.keys(wordsWithPrefix).forEach(key => {\n const _lang = key as ioBroker.Languages;\n const _words: I18nOneLanguageDictionary = {};\n const wordsOfOneLanguage = wordsWithPrefix[_lang];\n Object.keys(wordsOfOneLanguage as Record<string, string>).forEach(word => {\n if (!word) {\n return;\n }\n if (wordsOfOneLanguage) {\n if (!word.startsWith(prefix)) {\n _words[`${prefix}${word}`] = wordsOfOneLanguage[word];\n } else {\n _words[word] = wordsOfOneLanguage[word];\n }\n }\n });\n words[_lang] = _words;\n });\n } else {\n console.warn('Found prefix in translations, but it is not a string');\n }\n }\n\n try {\n if (!lang) {\n // if it is a dictionary with all/many languages\n if (words.en && words.de && words.ru) {\n Object.keys(words).forEach(key => {\n const _lang = key as ioBroker.Languages;\n I18n.translations[_lang] = I18n.translations[_lang] || {};\n const wordsOfOneLang: I18nOneLanguageDictionary | undefined = I18n.translations[_lang];\n Object.assign(wordsOfOneLang as Record<string, string>, words[_lang]);\n });\n } else {\n // It could be vice versa: words.word1 = {en: 'translated word1', de: 'übersetztes Wort2'}\n Object.keys(words).forEach(word => {\n const _word: I18nWordDictionary = (words as I18nWordsDictionary)[word];\n Object.keys(_word).forEach(key => {\n const _lang = key as ioBroker.Languages;\n const languageDictionary: I18nOneLanguageDictionary | undefined = I18n.translations[_lang];\n if (!languageDictionary) {\n console.warn(`Used unknown language: ${_lang}`);\n } else if (!languageDictionary[word]) {\n languageDictionary[word] = _word[_lang];\n } else if (languageDictionary[word] !== _word[_lang]) {\n console.warn(\n `Translation for word \"${word}\" in \"${_lang}\" was ignored: existing = \"${languageDictionary[word]}\", new = ${_word[_lang]}`,\n );\n }\n });\n });\n }\n } else {\n // translations for one language\n if (!I18n.translations[lang]) {\n console.warn(`Used unknown language: ${lang}`);\n }\n I18n.translations[lang] = I18n.translations[lang] || {};\n const languageDictionary: I18nOneLanguageDictionary | undefined = I18n.translations[lang];\n if (languageDictionary) {\n Object.keys(words).forEach(word => {\n if (!languageDictionary[word]) {\n languageDictionary[word] = (words as I18nOneLanguageDictionary)[word];\n } else if (languageDictionary[word] !== (words as I18nOneLanguageDictionary)[word]) {\n console.warn(\n `Translation for word \"${word}\" in \"${lang}\" was ignored: existing = \"${languageDictionary[word]}\", new = ${(words as I18nOneLanguageDictionary)[word]}`,\n );\n }\n });\n }\n }\n } catch (e: any) {\n console.error(`Cannot apply translations: ${e}`);\n }\n }\n\n /**\n * Sets all translations (in all languages).\n *\n * @param translations The translations to add.\n */\n static setTranslations(translations: I18nDictionary): void {\n if (translations) {\n I18n.translations = translations;\n }\n }\n\n /**\n * Get the currently chosen language.\n *\n * @returns The current language.\n */\n static getLanguage(): ioBroker.Languages {\n return I18n.lang;\n }\n\n /**\n * Translate the given string to the selected language\n *\n * @param word The (key) word to look up the string.\n * @param args Optional arguments which will replace the first (second, third, ...) occurrences of %s\n */\n static t(word: string, ...args: any[]): string {\n const translation = I18n.translations[I18n.lang];\n if (translation) {\n const w = translation[word];\n if (w) {\n word = w;\n } else {\n if (!I18n.unknownTranslations.includes(word)) {\n I18n.unknownTranslations.push(word);\n !I18n._disableWarning && console.log(`Translate: ${word}`);\n }\n // fallback to english\n if (I18n.lang !== 'en' && I18n.translations.en) {\n const wordEn = I18n.translations.en[word];\n if (wordEn) {\n word = wordEn;\n }\n }\n }\n }\n for (const arg of args) {\n word = word.replace('%s', arg);\n }\n return word;\n }\n\n /**\n * Show non-translated words\n * Required during development\n *\n * @param filter The filter to apply to the list of non-translated words.\n */\n static i18nShow(filter?: string | RegExp): void {\n /** List words with their translations. */\n const result: Record<string, string> = {};\n if (!filter) {\n I18n.unknownTranslations.forEach(word => (result[word] = word));\n console.log(JSON.stringify(result, null, 2));\n } else if (typeof filter === 'string') {\n I18n.unknownTranslations.forEach(word => {\n if (word.startsWith(filter)) {\n result[word] = word.replace(filter, '');\n }\n });\n console.log(JSON.stringify(result, null, 2));\n } else if (typeof filter === 'object') {\n I18n.unknownTranslations.forEach(word => {\n if (filter.test(word)) {\n result[word] = word;\n }\n });\n console.log(JSON.stringify(result, null, 2));\n }\n }\n\n /**\n * Disable warning about non-translated words\n * Required during development\n *\n * @param disable Whether to disable the warning\n */\n static disableWarning(disable: boolean): void {\n I18n._disableWarning = !!disable;\n }\n}\n\n// install global handlers\nwindow.i18nShow = I18n.i18nShow;\nwindow.i18nDisableWarning = I18n.disableWarning;\n\n/*\nI18n.translations = {\n 'en': require('./i18n/en'),\n 'ru': require('./i18n/ru'),\n 'de': require('./i18n/de'),\n};\nI18n.fallbacks = true;\nI18n.t = function () {};\n*/\n"]}
1
+ {"version":3,"file":"i18n.js","sourceRoot":"./src/","sources":["i18n.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAsBH;;GAEG;AACH,MAAM,OAAO,IAAI;IACb,qDAAqD;IACrD,MAAM,CAAC,YAAY,GAAmB,EAAE,CAAC;IAEzC,uDAAuD;IACvD,MAAM,CAAC,mBAAmB,GAAa,EAAE,CAAC;IAE1C,wCAAwC;IACxC,MAAM,CAAC,IAAI,GAAuB,MAAM,CAAC,OAAO,IAAI,IAAI,CAAC;IAEzD,MAAM,CAAC,eAAe,GAAY,KAAK,CAAC;IAExC;;;;OAIG;IACH,MAAM,CAAC,WAAW,CAAC,IAAwB;QACvC,IAAI,IAAI,EAAE,CAAC;YACP,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACrB,CAAC;IACL,CAAC;IAED;;;;;;;;OAQG;IACH,MAAM,CAAC,kBAAkB,CACrB,KAA4E,EAC5E,IAAyB;QAEzB,iDAAiD;QACjD,I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IACrC,CAAC;;AAGL,0BAA0B;AAC1B,MAAM,CAAC,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC;AAChC,MAAM,CAAC,kBAAkB,GAAG,IAAI,CAAC,cAAc,CAAC;AAEhD;;;;;;;;EAQE","sourcesContent":["/**\r\n * Copyright 2018-2024 Denis Haev (bluefox) <dogafox@gmail.com>\r\n *\r\n * MIT License\r\n *\r\n */\r\n\r\ndeclare global {\r\n interface Window {\r\n sysLang: ioBroker.Languages;\r\n i18nShow: (filter: string | RegExp) => void;\r\n i18nDisableWarning: (disable: boolean) => void;\r\n }\r\n}\r\n\r\ntype I18nWordDictionary = Record<ioBroker.Languages, string>;\r\n\r\ntype I18nWordsDictionary = Record<string, I18nWordDictionary>;\r\n\r\ntype I18nOneLanguageDictionary = Record<string, string>;\r\n\r\ntype I18nDictionary = {\r\n [lang in ioBroker.Languages]?: I18nOneLanguageDictionary;\r\n};\r\n\r\ntype I18nWordsWithPrefix = I18nDictionary & { prefix?: string };\r\n\r\n/**\r\n * Translation string management.\r\n */\r\nexport class I18n {\r\n /** List of all languages with their translations. */\r\n static translations: I18nDictionary = {};\r\n\r\n /** List of unknown translations during development. */\r\n static unknownTranslations: string[] = [];\r\n\r\n /** The currently displayed language. */\r\n static lang: ioBroker.Languages = window.sysLang || 'en';\r\n\r\n static _disableWarning: boolean = false;\r\n\r\n /**\r\n * Set the language to display\r\n *\r\n * @param lang The default language for translations.\r\n */\r\n static setLanguage(lang: ioBroker.Languages): void {\r\n if (lang) {\r\n I18n.lang = lang;\r\n }\r\n }\r\n\r\n /**\r\n * Add translations\r\n * User can provide two types of structures:\r\n * - {\"word1\": \"translated word1\", \"word2\": \"translated word2\"}, but in this case the lang must be provided\r\n * - {\"word1\": {\"en\": \"translated en word1\", \"de\": \"translated de word1\"}, \"word2\": {\"en\": \"translated en word2\", \"de\": \"translated de word2\"}}, but no lang must be provided\r\n *\r\n * @param words additional words for specific language\r\n * @param lang language for the words\r\n */\r\n static extendTranslations(\r\n words: I18nWordsWithPrefix | I18nOneLanguageDictionary | I18nWordsDictionary,\r\n lang?: ioBroker.Languages,\r\n ): void {\r\n // automatically extend all languages with prefix\r\n if ((words as I18nWordsWithPrefix).prefix) {\r\n const wordsWithPrefix = words as I18nWordsWithPrefix;\r\n if (typeof wordsWithPrefix.prefix === 'string') {\r\n const prefix = wordsWithPrefix.prefix;\r\n delete wordsWithPrefix.prefix;\r\n Object.keys(wordsWithPrefix).forEach(key => {\r\n const _lang = key as ioBroker.Languages;\r\n const _words: I18nOneLanguageDictionary = {};\r\n const wordsOfOneLanguage = wordsWithPrefix[_lang];\r\n Object.keys(wordsOfOneLanguage as Record<string, string>).forEach(word => {\r\n if (!word) {\r\n return;\r\n }\r\n if (wordsOfOneLanguage) {\r\n if (!word.startsWith(prefix)) {\r\n _words[`${prefix}${word}`] = wordsOfOneLanguage[word];\r\n } else {\r\n _words[word] = wordsOfOneLanguage[word];\r\n }\r\n }\r\n });\r\n words[_lang] = _words;\r\n });\r\n } else {\r\n console.warn('Found prefix in translations, but it is not a string');\r\n }\r\n }\r\n\r\n try {\r\n if (!lang) {\r\n // if it is a dictionary with all/many languages\r\n if (words.en && words.de && words.ru) {\r\n Object.keys(words).forEach(key => {\r\n const _lang = key as ioBroker.Languages;\r\n I18n.translations[_lang] = I18n.translations[_lang] || {};\r\n const wordsOfOneLang: I18nOneLanguageDictionary | undefined = I18n.translations[_lang];\r\n Object.assign(wordsOfOneLang as Record<string, string>, words[_lang]);\r\n });\r\n } else {\r\n // It could be vice versa: words.word1 = {en: 'translated word1', de: 'übersetztes Wort2'}\r\n Object.keys(words).forEach(word => {\r\n const _word: I18nWordDictionary = (words as I18nWordsDictionary)[word];\r\n Object.keys(_word).forEach(key => {\r\n const _lang = key as ioBroker.Languages;\r\n const languageDictionary: I18nOneLanguageDictionary | undefined = I18n.translations[_lang];\r\n if (!languageDictionary) {\r\n console.warn(`Used unknown language: ${_lang}`);\r\n } else if (!languageDictionary[word]) {\r\n languageDictionary[word] = _word[_lang];\r\n } else if (languageDictionary[word] !== _word[_lang]) {\r\n console.warn(\r\n `Translation for word \"${word}\" in \"${_lang}\" was ignored: existing = \"${languageDictionary[word]}\", new = ${_word[_lang]}`,\r\n );\r\n }\r\n });\r\n });\r\n }\r\n } else {\r\n // translations for one language\r\n if (!I18n.translations[lang]) {\r\n console.warn(`Used unknown language: ${lang}`);\r\n }\r\n I18n.translations[lang] = I18n.translations[lang] || {};\r\n const languageDictionary: I18nOneLanguageDictionary | undefined = I18n.translations[lang];\r\n if (languageDictionary) {\r\n Object.keys(words).forEach(word => {\r\n if (!languageDictionary[word]) {\r\n languageDictionary[word] = (words as I18nOneLanguageDictionary)[word];\r\n } else if (languageDictionary[word] !== (words as I18nOneLanguageDictionary)[word]) {\r\n console.warn(\r\n `Translation for word \"${word}\" in \"${lang}\" was ignored: existing = \"${languageDictionary[word]}\", new = ${(words as I18nOneLanguageDictionary)[word]}`,\r\n );\r\n }\r\n });\r\n }\r\n }\r\n } catch (e: any) {\r\n console.error(`Cannot apply translations: ${e}`);\r\n }\r\n }\r\n\r\n /**\r\n * Sets all translations (in all languages).\r\n *\r\n * @param translations The translations to add.\r\n */\r\n static setTranslations(translations: I18nDictionary): void {\r\n if (translations) {\r\n I18n.translations = translations;\r\n }\r\n }\r\n\r\n /**\r\n * Get the currently chosen language.\r\n *\r\n * @returns The current language.\r\n */\r\n static getLanguage(): ioBroker.Languages {\r\n return I18n.lang;\r\n }\r\n\r\n /**\r\n * Translate the given string to the selected language\r\n *\r\n * @param word The (key) word to look up the string.\r\n * @param args Optional arguments which will replace the first (second, third, ...) occurrences of %s\r\n */\r\n static t(word: string, ...args: any[]): string {\r\n const translation = I18n.translations[I18n.lang];\r\n if (translation) {\r\n const w = translation[word];\r\n if (w) {\r\n word = w;\r\n } else {\r\n if (!I18n.unknownTranslations.includes(word)) {\r\n I18n.unknownTranslations.push(word);\r\n !I18n._disableWarning && console.log(`Translate: ${word}`);\r\n }\r\n // fallback to english\r\n if (I18n.lang !== 'en' && I18n.translations.en) {\r\n const wordEn = I18n.translations.en[word];\r\n if (wordEn) {\r\n word = wordEn;\r\n }\r\n }\r\n }\r\n }\r\n for (const arg of args) {\r\n word = word.replace('%s', arg);\r\n }\r\n return word;\r\n }\r\n\r\n /**\r\n * Show non-translated words\r\n * Required during development\r\n *\r\n * @param filter The filter to apply to the list of non-translated words.\r\n */\r\n static i18nShow(filter?: string | RegExp): void {\r\n /** List words with their translations. */\r\n const result: Record<string, string> = {};\r\n if (!filter) {\r\n I18n.unknownTranslations.forEach(word => (result[word] = word));\r\n console.log(JSON.stringify(result, null, 2));\r\n } else if (typeof filter === 'string') {\r\n I18n.unknownTranslations.forEach(word => {\r\n if (word.startsWith(filter)) {\r\n result[word] = word.replace(filter, '');\r\n }\r\n });\r\n console.log(JSON.stringify(result, null, 2));\r\n } else if (typeof filter === 'object') {\r\n I18n.unknownTranslations.forEach(word => {\r\n if (filter.test(word)) {\r\n result[word] = word;\r\n }\r\n });\r\n console.log(JSON.stringify(result, null, 2));\r\n }\r\n }\r\n\r\n /**\r\n * Disable warning about non-translated words\r\n * Required during development\r\n *\r\n * @param disable Whether to disable the warning\r\n */\r\n static disableWarning(disable: boolean): void {\r\n I18n._disableWarning = !!disable;\r\n }\r\n}\r\n\r\n// install global handlers\r\nwindow.i18nShow = I18n.i18nShow;\r\nwindow.i18nDisableWarning = I18n.disableWarning;\r\n\r\n/*\r\nI18n.translations = {\r\n 'en': require('./i18n/en'),\r\n 'ru': require('./i18n/ru'),\r\n 'de': require('./i18n/de'),\r\n};\r\nI18n.fallbacks = true;\r\nI18n.t = function () {};\r\n*/\r\n"]}
package/build/index.css CHANGED
@@ -1,56 +1,56 @@
1
- /**
2
- * Copyright 2018-2023 Denis Haev (bluefox) <dogafox@gmail.com>
3
- *
4
- * MIT License
5
- *
6
- **/
7
-
8
- html {
9
- height: 100%;
10
- }
11
-
12
- body {
13
- margin: 0;
14
- padding: 0;
15
- font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans',
16
- 'Droid Sans', 'Helvetica Neue', sans-serif;
17
- -webkit-font-smoothing: antialiased;
18
- -moz-osx-font-smoothing: grayscale;
19
- width: 100%;
20
- height: 100%;
21
- overflow: hidden;
22
- }
23
-
24
- /* scrollbar */
25
- ::-webkit-scrollbar-track {
26
- background-color: #ccc;
27
- border-radius: 5px;
28
- }
29
-
30
- ::-webkit-scrollbar {
31
- width: 5px;
32
- height: 5px;
33
- background-color: #ccc;
34
- }
35
-
36
- ::-webkit-scrollbar-thumb {
37
- background-color: #575757;
38
- border-radius: 5px;
39
- }
40
-
41
- #root {
42
- height: 100%;
43
- }
44
-
45
- .App {
46
- height: 100%;
47
- }
48
-
49
- @keyframes glow {
50
- from {
51
- background-color: initial;
52
- }
53
- to {
54
- background-color: #58c458;
55
- }
56
- }
1
+ /**
2
+ * Copyright 2018-2023 Denis Haev (bluefox) <dogafox@gmail.com>
3
+ *
4
+ * MIT License
5
+ *
6
+ **/
7
+
8
+ html {
9
+ height: 100%;
10
+ }
11
+
12
+ body {
13
+ margin: 0;
14
+ padding: 0;
15
+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans',
16
+ 'Droid Sans', 'Helvetica Neue', sans-serif;
17
+ -webkit-font-smoothing: antialiased;
18
+ -moz-osx-font-smoothing: grayscale;
19
+ width: 100%;
20
+ height: 100%;
21
+ overflow: hidden;
22
+ }
23
+
24
+ /* scrollbar */
25
+ ::-webkit-scrollbar-track {
26
+ background-color: #ccc;
27
+ border-radius: 5px;
28
+ }
29
+
30
+ ::-webkit-scrollbar {
31
+ width: 5px;
32
+ height: 5px;
33
+ background-color: #ccc;
34
+ }
35
+
36
+ ::-webkit-scrollbar-thumb {
37
+ background-color: #575757;
38
+ border-radius: 5px;
39
+ }
40
+
41
+ #root {
42
+ height: 100%;
43
+ }
44
+
45
+ .App {
46
+ height: 100%;
47
+ }
48
+
49
+ @keyframes glow {
50
+ from {
51
+ background-color: initial;
52
+ }
53
+ to {
54
+ background-color: #58c458;
55
+ }
56
+ }
package/index.css CHANGED
@@ -1,56 +1,56 @@
1
- /**
2
- * Copyright 2018-2023 Denis Haev (bluefox) <dogafox@gmail.com>
3
- *
4
- * MIT License
5
- *
6
- **/
7
-
8
- html {
9
- height: 100%;
10
- }
11
-
12
- body {
13
- margin: 0;
14
- padding: 0;
15
- font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans',
16
- 'Droid Sans', 'Helvetica Neue', sans-serif;
17
- -webkit-font-smoothing: antialiased;
18
- -moz-osx-font-smoothing: grayscale;
19
- width: 100%;
20
- height: 100%;
21
- overflow: hidden;
22
- }
23
-
24
- /* scrollbar */
25
- ::-webkit-scrollbar-track {
26
- background-color: #ccc;
27
- border-radius: 5px;
28
- }
29
-
30
- ::-webkit-scrollbar {
31
- width: 5px;
32
- height: 5px;
33
- background-color: #ccc;
34
- }
35
-
36
- ::-webkit-scrollbar-thumb {
37
- background-color: #575757;
38
- border-radius: 5px;
39
- }
40
-
41
- #root {
42
- height: 100%;
43
- }
44
-
45
- .App {
46
- height: 100%;
47
- }
48
-
49
- @keyframes glow {
50
- from {
51
- background-color: initial;
52
- }
53
- to {
54
- background-color: #58c458;
55
- }
56
- }
1
+ /**
2
+ * Copyright 2018-2023 Denis Haev (bluefox) <dogafox@gmail.com>
3
+ *
4
+ * MIT License
5
+ *
6
+ **/
7
+
8
+ html {
9
+ height: 100%;
10
+ }
11
+
12
+ body {
13
+ margin: 0;
14
+ padding: 0;
15
+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans',
16
+ 'Droid Sans', 'Helvetica Neue', sans-serif;
17
+ -webkit-font-smoothing: antialiased;
18
+ -moz-osx-font-smoothing: grayscale;
19
+ width: 100%;
20
+ height: 100%;
21
+ overflow: hidden;
22
+ }
23
+
24
+ /* scrollbar */
25
+ ::-webkit-scrollbar-track {
26
+ background-color: #ccc;
27
+ border-radius: 5px;
28
+ }
29
+
30
+ ::-webkit-scrollbar {
31
+ width: 5px;
32
+ height: 5px;
33
+ background-color: #ccc;
34
+ }
35
+
36
+ ::-webkit-scrollbar-thumb {
37
+ background-color: #575757;
38
+ border-radius: 5px;
39
+ }
40
+
41
+ #root {
42
+ height: 100%;
43
+ }
44
+
45
+ .App {
46
+ height: 100%;
47
+ }
48
+
49
+ @keyframes glow {
50
+ from {
51
+ background-color: initial;
52
+ }
53
+ to {
54
+ background-color: #58c458;
55
+ }
56
+ }
package/package.json CHANGED
@@ -1,84 +1,86 @@
1
1
  {
2
- "name": "@iobroker/adapter-react-v5",
3
- "version": "7.7.4",
4
- "description": "React components to develop ioBroker interfaces with react.",
5
- "author": {
6
- "name": "bluefox",
7
- "email": "dogafox@gmail.com"
8
- },
9
- "scripts": {
10
- "prepublishOnly": "npm run build",
11
- "build:ts": "tsc -p tsconfig.build.json",
12
- "build": "node tasks --0-clean && node tasks --2-copy && node tasks --3-patchReadme && npm run build:ts",
13
- "release": "release-script --noPush --yes --lf",
14
- "release-patch": "release-script patch --yes --lf",
15
- "release-minor": "release-script minor --yes --lf",
16
- "release-major": "release-script major --yes --lf",
17
- "update-packages": "npx -y npm-check-updates --upgrade",
18
- "0-clean": "node tasks --0-clean",
19
- "1-build": "tsc -p tsconfig.build.json",
20
- "2-copy": "node tasks --2-copy",
21
- "3-patchReadme": "node tasks --3-patchReadme",
22
- "npm": "npm i -f",
23
- "lint": "eslint -c eslint.config.mjs src",
24
- "test": "ts-node ../jsonConfig/test/testSchema.ts"
25
- },
26
- "repository": {
27
- "type": "git",
28
- "url": "git+https://github.com/ioBroker/adapter-react-v5.git"
29
- },
30
- "publishConfig": {
31
- "access": "public"
32
- },
33
- "main": "./build/index.js",
34
- "types": "./build/index.d.ts",
35
- "keywords": [
36
- "iobroker",
37
- "adapter",
38
- "iot"
39
- ],
40
- "files": [
41
- "build/",
42
- "i18n/",
43
- "index.css",
44
- "LICENSE",
45
- "tasksExample.js",
46
- "craco-module-federation.js",
47
- "modulefederation.admin.config.d.ts",
48
- "modulefederation.admin.config.js"
49
- ],
50
- "license": "MIT",
51
- "bugs": {
52
- "url": "https://github.com/ioBroker/iobroker.admin/issues"
53
- },
54
- "homepage": "https://github.com/ioBroker/iobroker.admin#readme",
55
- "dependencies": {
56
- "@emotion/react": "^11.14.0",
57
- "@emotion/styled": "^11.14.1",
58
- "@iobroker/js-controller-common": "^7.0.7",
59
- "@iobroker/js-controller-common-db": "^7.0.7",
60
- "@iobroker/socket-client": "5.0.2",
61
- "@iobroker/type-detector": "^4.5.1",
62
- "@iobroker/types": "^7.0.7",
63
- "@mui/icons-material": "^6.5.0",
64
- "@mui/material": "^6.5.0",
65
- "@sentry/browser": "^10.8.0",
66
- "cronstrue": "^2.61.0",
67
- "file-selector": "^2.1.2",
68
- "react-color": "^2.19.3",
69
- "react-colorful": "^5.6.1",
70
- "react-cropper": "^2.3.3",
71
- "react-dropzone": "^14.3.8",
72
- "react-icons": "^5.4.0",
73
- "react-inlinesvg": "^4.2.0"
74
- },
75
- "devDependencies": {
76
- "@types/node": "^22.15.30",
77
- "@types/react": "^18.3.23",
78
- "@types/react-color": "^3.0.13",
79
- "ajv": "^8.17.1",
80
- "ts-node": "^10.9.2",
81
- "typescript": "~5.8.3"
82
- },
83
- "gitHead": "7b7abb99a3143d9cd596ef842455d881528be359"
2
+ "name": "@iobroker/adapter-react-v5",
3
+ "version": "8.0.3",
4
+ "description": "React components to develop ioBroker interfaces with react.",
5
+ "author": {
6
+ "name": "bluefox",
7
+ "email": "dogafox@gmail.com"
8
+ },
9
+ "scripts": {
10
+ "prepublishOnly": "npm run build",
11
+ "build:ts": "tsc -p tsconfig.build.json",
12
+ "build": "node tasks --0-clean && node tasks --2-copy && node tasks --3-patchReadme && npm run build:ts",
13
+ "release": "release-script --noPush --yes --lf",
14
+ "release-patch": "release-script patch --yes --lf",
15
+ "release-minor": "release-script minor --yes --lf",
16
+ "release-major": "release-script major --yes --lf",
17
+ "update-packages": "npx -y npm-check-updates --upgrade",
18
+ "0-clean": "node tasks --0-clean",
19
+ "1-build": "tsc -p tsconfig.build.json",
20
+ "2-copy": "node tasks --2-copy",
21
+ "3-patchReadme": "node tasks --3-patchReadme",
22
+ "npm": "npm i -f",
23
+ "lint": "eslint -c eslint.config.mjs src"
24
+ },
25
+ "repository": {
26
+ "type": "git",
27
+ "url": "git+https://github.com/ioBroker/adapter-react-v5.git"
28
+ },
29
+ "publishConfig": {
30
+ "access": "public"
31
+ },
32
+ "main": "./build/index.js",
33
+ "types": "./build/index.d.ts",
34
+ "keywords": [
35
+ "iobroker",
36
+ "adapter",
37
+ "iot"
38
+ ],
39
+ "files": [
40
+ "build/",
41
+ "i18n/",
42
+ "index.css",
43
+ "LICENSE",
44
+ "tasksExample.js",
45
+ "craco-module-federation.js",
46
+ "modulefederation.admin.config.d.ts",
47
+ "modulefederation.admin.config.js"
48
+ ],
49
+ "license": "MIT",
50
+ "bugs": {
51
+ "url": "https://github.com/ioBroker/adapter-react-v5/issues"
52
+ },
53
+ "homepage": "https://github.com/ioBroker/adapter-react-v5#readme",
54
+ "dependencies": {
55
+ "@emotion/react": "^11.14.0",
56
+ "@emotion/styled": "^11.14.1",
57
+ "@iobroker/js-controller-common": "^7.0.8-alpha.7-20250928-40cb80c18",
58
+ "@iobroker/js-controller-common-db": "^7.0.8-alpha.7-20250928-40cb80c18",
59
+ "@iobroker/socket-client": "5.0.2",
60
+ "@iobroker/type-detector": "^4.5.1",
61
+ "@iobroker/types": "^7.0.8-alpha.7-20250928-40cb80c18",
62
+ "@mui/icons-material": "^6.5.0",
63
+ "@mui/material": "^6.5.0",
64
+ "@sentry/browser": "^10.8.0",
65
+ "cronstrue": "^2.61.0",
66
+ "file-selector": "^2.1.2",
67
+ "react-color": "^2.19.3",
68
+ "react-colorful": "^5.6.1",
69
+ "react-cropper": "^2.3.3",
70
+ "react-dropzone": "^14.3.8",
71
+ "react-icons": "^5.4.0",
72
+ "react-inlinesvg": "^4.2.0"
73
+ },
74
+ "devDependencies": {
75
+ "@alcalzone/release-script": "^5.0.0",
76
+ "@alcalzone/release-script-plugin-license": "^4.0.0",
77
+ "@iobroker/build-tools": "^2.0.15",
78
+ "@iobroker/eslint-config": "^2.2.0",
79
+ "@types/node": "^22.15.30",
80
+ "@types/react": "^18.3.23",
81
+ "@types/react-color": "^3.0.13",
82
+ "ajv": "^8.17.1",
83
+ "ts-node": "^10.9.2",
84
+ "typescript": "~5.9.3"
85
+ }
84
86
  }