mirror of
https://github.com/sharevb/it-tools.git
synced 2026-11-23 14:21:04 +03:00
Compare commits
14
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c70c602682 | ||
|
|
d1aca6acaf | ||
|
|
1c35ac3704 | ||
|
|
72517002f3 | ||
|
|
f5c4ab19bc | ||
|
|
67094980c9 | ||
|
|
87984e2081 | ||
|
|
318fb6efb9 | ||
|
|
f1a5489e21 | ||
|
|
e1b4f9aafe | ||
|
|
76a19d218d | ||
|
|
b430baef40 | ||
|
|
dd4b7e687b | ||
|
|
30144aa3f5 |
No files matched your search
Binary file not shown.
|
After Width: | Height: | Size: 39 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 39 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 7.8 KiB |
@@ -1,4 +1,8 @@
|
||||

|
||||
<picture>
|
||||
<source srcset="./.github/logo-dark.png" media="(prefers-color-scheme: light)">
|
||||
<source srcset="./.github/logo-white.png" media="(prefers-color-scheme: dark)">
|
||||
<img src="./.github/logo-dark.png" alt="logo">
|
||||
</picture>
|
||||
|
||||
Useful tools for developer and people working in IT. [Have a look !](https://it-tools.tech).
|
||||
|
||||
@@ -113,7 +117,7 @@ Big thanks to all the people who have already contributed!
|
||||
|
||||
## Credits
|
||||
|
||||
Coded with ❤️ by [Corentin Thomasset](//corentin-thomasset.fr).
|
||||
Coded with ❤️ by [Corentin Thomasset](https://corentin.tech?utm_source=it-tools&utm_medium=readme).
|
||||
|
||||
This project is continuously deployed using [vercel.com](https://vercel.com).
|
||||
|
||||
|
||||
Vendored
+21
-5
@@ -11,8 +11,9 @@ declare module '@vue/runtime-core' {
|
||||
export interface GlobalComponents {
|
||||
'404.page': typeof import('./src/pages/404.page.vue')['default']
|
||||
About: typeof import('./src/pages/About.vue')['default']
|
||||
AngleConverter: typeof import('./src/tools/angle-converter/angle-converter.vue')['default']
|
||||
App: typeof import('./src/App.vue')['default']
|
||||
AsciiTextDrawer: typeof import('./src/tools/ascii-text-drawer/ascii-text-drawer.vue')['default']
|
||||
AreaConverter: typeof import('./src/tools/area-converter/area-converter.vue')['default']
|
||||
'Base.layout': typeof import('./src/layouts/base.layout.vue')['default']
|
||||
Base64FileConverter: typeof import('./src/tools/base64-file-converter/base64-file-converter.vue')['default']
|
||||
Base64StringConverter: typeof import('./src/tools/base64-string-converter/base64-string-converter.vue')['default']
|
||||
@@ -72,12 +73,15 @@ declare module '@vue/runtime-core' {
|
||||
DockerRunToDockerComposeConverter: typeof import('./src/tools/docker-run-to-docker-compose-converter/docker-run-to-docker-compose-converter.vue')['default']
|
||||
DynamicValues: typeof import('./src/tools/benchmark-builder/dynamic-values.vue')['default']
|
||||
Editor: typeof import('./src/tools/html-wysiwyg-editor/editor/editor.vue')['default']
|
||||
EmailNormalizer: typeof import('./src/tools/email-normalizer/email-normalizer.vue')['default']
|
||||
EmojiCard: typeof import('./src/tools/emoji-picker/emoji-card.vue')['default']
|
||||
EmojiGrid: typeof import('./src/tools/emoji-picker/emoji-grid.vue')['default']
|
||||
EmojiPicker: typeof import('./src/tools/emoji-picker/emoji-picker.vue')['default']
|
||||
Encryption: typeof import('./src/tools/encryption/encryption.vue')['default']
|
||||
EnergyConverter: typeof import('./src/tools/energy-converter/energy-converter.vue')['default']
|
||||
EtaCalculator: typeof import('./src/tools/eta-calculator/eta-calculator.vue')['default']
|
||||
FavoriteButton: typeof import('./src/components/FavoriteButton.vue')['default']
|
||||
ForceConverter: typeof import('./src/tools/force-converter/force-converter.vue')['default']
|
||||
FormatTransformer: typeof import('./src/components/FormatTransformer.vue')['default']
|
||||
GitMemo: typeof import('./src/tools/git-memo/git-memo.vue')['default']
|
||||
'GitMemo.content': typeof import('./src/tools/git-memo/git-memo.content.md')['default']
|
||||
@@ -109,17 +113,20 @@ declare module '@vue/runtime-core' {
|
||||
JsonDiff: typeof import('./src/tools/json-diff/json-diff.vue')['default']
|
||||
JsonMinify: typeof import('./src/tools/json-minify/json-minify.vue')['default']
|
||||
JsonToCsv: typeof import('./src/tools/json-to-csv/json-to-csv.vue')['default']
|
||||
JsonToPhpArray: typeof import('./src/tools/json-to-php-array/json-to-php-array.vue')['default']
|
||||
JsonToToml: typeof import('./src/tools/json-to-toml/json-to-toml.vue')['default']
|
||||
JsonToXml: typeof import('./src/tools/json-to-xml/json-to-xml.vue')['default']
|
||||
JsonToYaml: typeof import('./src/tools/json-to-yaml-converter/json-to-yaml.vue')['default']
|
||||
JsonViewer: typeof import('./src/tools/json-viewer/json-viewer.vue')['default']
|
||||
JwtParser: typeof import('./src/tools/jwt-parser/jwt-parser.vue')['default']
|
||||
KeycodeInfo: typeof import('./src/tools/keycode-info/keycode-info.vue')['default']
|
||||
LengthConverter: typeof import('./src/tools/length-converter/length-converter.vue')['default']
|
||||
ListConverter: typeof import('./src/tools/list-converter/list-converter.vue')['default']
|
||||
LocaleSelector: typeof import('./src/modules/i18n/components/locale-selector.vue')['default']
|
||||
LoremIpsumGenerator: typeof import('./src/tools/lorem-ipsum-generator/lorem-ipsum-generator.vue')['default']
|
||||
MacAddressGenerator: typeof import('./src/tools/mac-address-generator/mac-address-generator.vue')['default']
|
||||
MacAddressLookup: typeof import('./src/tools/mac-address-lookup/mac-address-lookup.vue')['default']
|
||||
ManyUnitsConverter: typeof import('./src/tools/many-units-converter/many-units-converter.vue')['default']
|
||||
MassConverter: typeof import('./src/tools/mass-converter/mass-converter.vue')['default']
|
||||
MathEvaluator: typeof import('./src/tools/math-evaluator/math-evaluator.vue')['default']
|
||||
MenuBar: typeof import('./src/tools/html-wysiwyg-editor/editor/menu-bar.vue')['default']
|
||||
MenuBarItem: typeof import('./src/tools/html-wysiwyg-editor/editor/menu-bar-item.vue')['default']
|
||||
@@ -128,9 +135,10 @@ declare module '@vue/runtime-core' {
|
||||
MetaTagGenerator: typeof import('./src/tools/meta-tag-generator/meta-tag-generator.vue')['default']
|
||||
MimeTypes: typeof import('./src/tools/mime-types/mime-types.vue')['default']
|
||||
NavbarButtons: typeof import('./src/components/NavbarButtons.vue')['default']
|
||||
NCode: typeof import('naive-ui')['NCode']
|
||||
NCheckbox: typeof import('naive-ui')['NCheckbox']
|
||||
NCollapseTransition: typeof import('naive-ui')['NCollapseTransition']
|
||||
NConfigProvider: typeof import('naive-ui')['NConfigProvider']
|
||||
NDivider: typeof import('naive-ui')['NDivider']
|
||||
NEllipsis: typeof import('naive-ui')['NEllipsis']
|
||||
NH1: typeof import('naive-ui')['NH1']
|
||||
NH3: typeof import('naive-ui')['NH3']
|
||||
@@ -138,7 +146,8 @@ declare module '@vue/runtime-core' {
|
||||
NLayout: typeof import('naive-ui')['NLayout']
|
||||
NLayoutSider: typeof import('naive-ui')['NLayoutSider']
|
||||
NMenu: typeof import('naive-ui')['NMenu']
|
||||
NScrollbar: typeof import('naive-ui')['NScrollbar']
|
||||
NSpace: typeof import('naive-ui')['NSpace']
|
||||
NTable: typeof import('naive-ui')['NTable']
|
||||
NumeronymGenerator: typeof import('./src/tools/numeronym-generator/numeronym-generator.vue')['default']
|
||||
OtpCodeGeneratorAndValidator: typeof import('./src/tools/otp-code-generator-and-validator/otp-code-generator-and-validator.vue')['default']
|
||||
PasswordStrengthAnalyser: typeof import('./src/tools/password-strength-analyser/password-strength-analyser.vue')['default']
|
||||
@@ -146,9 +155,13 @@ declare module '@vue/runtime-core' {
|
||||
PdfSignatureDetails: typeof import('./src/tools/pdf-signature-checker/components/pdf-signature-details.vue')['default']
|
||||
PercentageCalculator: typeof import('./src/tools/percentage-calculator/percentage-calculator.vue')['default']
|
||||
PhoneParserAndFormatter: typeof import('./src/tools/phone-parser-and-formatter/phone-parser-and-formatter.vue')['default']
|
||||
PhpArrayToJson: typeof import('./src/tools/php-array-to-json/php-array-to-json.vue')['default']
|
||||
PowerConverter: typeof import('./src/tools/power-converter/power-converter.vue')['default']
|
||||
PressureConverter: typeof import('./src/tools/pressure-converter/pressure-converter.vue')['default']
|
||||
QrCodeGenerator: typeof import('./src/tools/qr-code-generator/qr-code-generator.vue')['default']
|
||||
RandomPortGenerator: typeof import('./src/tools/random-port-generator/random-port-generator.vue')['default']
|
||||
RegexMemo: typeof import('./src/tools/regex-memo/regex-memo.vue')['default']
|
||||
'RegexMemo.content': typeof import('./src/tools/regex-memo/regex-memo.content.md')['default']
|
||||
RegexTester: typeof import('./src/tools/regex-tester/regex-tester.vue')['default']
|
||||
ResultRow: typeof import('./src/tools/ipv4-range-expander/result-row.vue')['default']
|
||||
RomanNumeralConverter: typeof import('./src/tools/roman-numeral-converter/roman-numeral-converter.vue')['default']
|
||||
RouterLink: typeof import('vue-router')['RouterLink']
|
||||
@@ -174,13 +187,16 @@ declare module '@vue/runtime-core' {
|
||||
'Tool.layout': typeof import('./src/layouts/tool.layout.vue')['default']
|
||||
ToolCard: typeof import('./src/components/ToolCard.vue')['default']
|
||||
UlidGenerator: typeof import('./src/tools/ulid-generator/ulid-generator.vue')['default']
|
||||
UnitsConverter: typeof import('./src/components/UnitsConverter.vue')['default']
|
||||
UrlEncoder: typeof import('./src/tools/url-encoder/url-encoder.vue')['default']
|
||||
UrlParser: typeof import('./src/tools/url-parser/url-parser.vue')['default']
|
||||
UserAgentParser: typeof import('./src/tools/user-agent-parser/user-agent-parser.vue')['default']
|
||||
UserAgentResultCards: typeof import('./src/tools/user-agent-parser/user-agent-result-cards.vue')['default']
|
||||
UuidGenerator: typeof import('./src/tools/uuid-generator/uuid-generator.vue')['default']
|
||||
VolumeConverter: typeof import('./src/tools/volume-converter/volume-converter.vue')['default']
|
||||
WifiQrCodeGenerator: typeof import('./src/tools/wifi-qr-code-generator/wifi-qr-code-generator.vue')['default']
|
||||
XmlFormatter: typeof import('./src/tools/xml-formatter/xml-formatter.vue')['default']
|
||||
XmlToJson: typeof import('./src/tools/xml-to-json/xml-to-json.vue')['default']
|
||||
YamlToJson: typeof import('./src/tools/yaml-to-json-converter/yaml-to-json.vue')['default']
|
||||
YamlToToml: typeof import('./src/tools/yaml-to-toml/yaml-to-toml.vue')['default']
|
||||
YamlViewer: typeof import('./src/tools/yaml-viewer/yaml-viewer.vue')['default']
|
||||
|
||||
+1
-1
@@ -38,7 +38,7 @@ about:
|
||||
# Über IT-Tools
|
||||
|
||||
Diese wunderbare Website, erstellt mit ❤ von [Corentin
|
||||
Thomasset](https://github.com/CorentinTh), sammelt nützliche Tools für
|
||||
Thomasset](https://corentin.tech?utm_source=it-tools&utm_medium=about), sammelt nützliche Tools für
|
||||
Entwickler und Menschen, die in der IT arbeiten. Wenn du sie nützlich
|
||||
findest, teile sie gerne mit Personen, von denen du denkst, dass sie sie
|
||||
ebenfalls nützlich finden könnten, und vergiss nicht, sie in deiner
|
||||
|
||||
+1
-1
@@ -30,7 +30,7 @@ about:
|
||||
content: >
|
||||
# About IT-Tools
|
||||
|
||||
This wonderful website, made with ❤ by [Corentin Thomasset](https://github.com/CorentinTh) , aggregates useful tools for developer and people working in IT. If you find it useful, please feel free to share it to people you think may find it useful too and don't forget to bookmark it in your shortcut bar!
|
||||
This wonderful website, made with ❤ by [Corentin Thomasset](https://corentin.tech?utm_source=it-tools&utm_medium=about) , aggregates useful tools for developer and people working in IT. If you find it useful, please feel free to share it to people you think may find it useful too and don't forget to bookmark it in your shortcut bar!
|
||||
|
||||
IT Tools is open-source (under the MIT license) and free, and will always be, but it costs me money to host and renew the domain name. If you want to support my work, and encourage me to add more tools, please consider supporting by [sponsoring me](https://www.buymeacoffee.com/cthmsst).
|
||||
|
||||
|
||||
+3
-3
@@ -30,7 +30,7 @@ about:
|
||||
content: >
|
||||
# Sobre IT-Tools
|
||||
|
||||
Este maravilloso sitio web, hecho con ❤ por [Corentin Thomasset](https://github.com/CorentinTh) , agrega herramientas útiles para desarrolladores y personas que trabajan en IT. Si lo encuentra útil, no dude en compartirlo con las personas que crea que también pueden encontrarlo útil y ¡no olvide marcarlo como favorito en su barra de accesos directos!
|
||||
Este maravilloso sitio web, hecho con ❤ por [Corentin Thomasset](https://corentin.tech?utm_source=it-tools&utm_medium=about) , agrega herramientas útiles para desarrolladores y personas que trabajan en IT. Si lo encuentra útil, no dude en compartirlo con las personas que crea que también pueden encontrarlo útil y ¡no olvide marcarlo como favorito en su barra de accesos directos!
|
||||
|
||||
IT Tools es de código abierto (under the MIT license) y gratis, y siempre lo será, pero me cuesta dinero alojar y renovar el nombre de dominio. Si desea apoyar mi trabajo y animarme a agregar más herramientas, considere apoyarme a través de[sponsoring me](https://www.buymeacoffee.com/cthmsst).
|
||||
|
||||
@@ -39,7 +39,7 @@ about:
|
||||
IT Tools está creado en Vue.js (Vue 3) con la biblioteca de componentes Naive UI y Vercel lo aloja y lo implementa continuamente. En algunas herramientas se utilizan bibliotecas de código abierto de terceros; puede encontrar la lista completa en [package.json](https://github.com/CorentinTh/it-tools/blob/main/package.json) archivo del repositorio.
|
||||
|
||||
## ¿Encontraste un error? ¿Falta una herramienta?
|
||||
|
||||
|
||||
Si necesita una herramienta que actualmente no está presente aquí y cree que puede ser útil, puede enviar una solicitud de función en el [issues section](https://github.com/CorentinTh/it-tools/issues/new/choose) en el repositorio de GitHub.
|
||||
|
||||
Y si encontró un error o algo no funciona como se esperaba, presente un reporte de error en el [issues section](https://github.com/CorentinTh/it-tools/issues/new/choose) en el repositorio de GitHub.
|
||||
@@ -68,4 +68,4 @@ tools:
|
||||
math: Math
|
||||
measurement: Measurement
|
||||
text: Text
|
||||
data: Data
|
||||
data: Data
|
||||
+1
-1
@@ -29,7 +29,7 @@ about:
|
||||
content: >
|
||||
# À propos de IT-Tools
|
||||
|
||||
Ce merveilleux site, fait avec ❤ par [Corentin Thomasset](https://github.com/CorentinTh), regroupe des outils utiles pour les développeurs et les personnes travaillant dans l'informatique. Si vous le trouvez utile, n'hésitez pas à le partager et n'oubliez pas de le mettre dans vos favoris !
|
||||
Ce merveilleux site, fait avec ❤ par [Corentin Thomasset](https://corentin.tech?utm_source=it-tools&utm_medium=about), regroupe des outils utiles pour les développeurs et les personnes travaillant dans l'informatique. Si vous le trouvez utile, n'hésitez pas à le partager et n'oubliez pas de le mettre dans vos favoris !
|
||||
|
||||
IT Tools est open-source (sous licence MIT) et gratuit, et le restera toujours, mais cela me coûte de l'argent pour l'héberger et renouveler le nom de domaine. Si vous voulez soutenir mon travail, et m'encourager à ajouter plus d'outils, n'hésitez pas à me [soutenir](https://www.buymeacoffee.com/cthmsst).
|
||||
|
||||
|
||||
+1
-1
@@ -30,7 +30,7 @@ about:
|
||||
content: >
|
||||
# Sobre o IT-Tools
|
||||
|
||||
Este site maravilhoso, feito com ❤ por [Corentin Thomasset](https://github.com/CorentinTh), junta ferramentas úteis para desenvolvedores e outras pessoas que trabalham com TI. Se você achar o site útil, fique à vontade para compartilhar com quem também possa gostar e não esqueça de salvar o bookmark na sua barra de atalhos!
|
||||
Este site maravilhoso, feito com ❤ por [Corentin Thomasset](https://corentin.tech?utm_source=it-tools&utm_medium=about), junta ferramentas úteis para desenvolvedores e outras pessoas que trabalham com TI. Se você achar o site útil, fique à vontade para compartilhar com quem também possa gostar e não esqueça de salvar o bookmark na sua barra de atalhos!
|
||||
|
||||
O IT Tools é código aberto (sob a licença MIT), é gratuito, e sempre será, mas custa dinheiro para hospedar e renovar o domínio. Se quiser apoiar meu trabalho e me encorajar a adicionar mais ferramentas, por favor considere [ser patrocinador](https://www.buymeacoffee.com/cthmsst).
|
||||
|
||||
|
||||
+1
-1
@@ -30,7 +30,7 @@ about:
|
||||
content: >
|
||||
# Про IT-Tools
|
||||
|
||||
Цей чудовий вебсайт, створений з ❤ [Corentin Thomasset](https://github.com/CorentinTh), агрегує корисні інструменти для розробників і людей, які працюють в сфері IT. Якщо вам це корисно, будь ласка, поділіться цим з людьми, які, на вашу думку, також можуть знайти його корисним, і не забудьте додати його до закладок у вашій панелі швидкого доступу!
|
||||
Цей чудовий вебсайт, створений з ❤ [Corentin Thomasset](https://corentin.tech?utm_source=it-tools&utm_medium=about), агрегує корисні інструменти для розробників і людей, які працюють в сфері IT. Якщо вам це корисно, будь ласка, поділіться цим з людьми, які, на вашу думку, також можуть знайти його корисним, і не забудьте додати його до закладок у вашій панелі швидкого доступу!
|
||||
|
||||
IT Tools є відкритим програмним забезпеченням (під ліцензією MIT) і безкоштовним, і завжди буде таким, але мені коштує гроші для хостингу і продовження доменного імені. Якщо ви хочете підтримати мою роботу і підтримати мене у додаванні нових інструментів, розгляньте можливість підтримки, [спонсоруючи мене](https://www.buymeacoffee.com/cthmsst).
|
||||
|
||||
|
||||
+1
-1
@@ -30,7 +30,7 @@ about:
|
||||
content: >
|
||||
# Về IT-Tools
|
||||
|
||||
Website tuyệt vời này, được tạo ra bằng ❤ bởi [Corentin Thomasset](https://github.com/CorentinTh), tổng hợp các công cụ hữu ích cho nhà phát triển và những người làm việc trong lĩnh vực IT. Nếu bạn thấy nó hữu ích, xin đừng ngần ngại chia sẻ cho những người mà bạn nghĩ sẽ thấy nó hữu ích và đừng quên đánh dấu nó trong thanh lối tắt của bạn!
|
||||
Website tuyệt vời này, được tạo ra bằng ❤ bởi [Corentin Thomasset](https://corentin.tech?utm_source=it-tools&utm_medium=about), tổng hợp các công cụ hữu ích cho nhà phát triển và những người làm việc trong lĩnh vực IT. Nếu bạn thấy nó hữu ích, xin đừng ngần ngại chia sẻ cho những người mà bạn nghĩ sẽ thấy nó hữu ích và đừng quên đánh dấu nó trong thanh lối tắt của bạn!
|
||||
|
||||
IT Tools là mã nguồn mở (dưới giấy phép MIT) và miễn phí, và sẽ luôn như vậy, nhưng tôi phải trả tiền để lưu trữ và gia hạn tên miền. Nếu bạn muốn hỗ trợ công việc của tôi, và khích lệ tôi thêm nhiều công cụ hơn, hãy xem xét hỗ trợ bằng cách [tài trợ cho tôi](https://www.buymeacoffee.com/cthmsst).
|
||||
|
||||
|
||||
+1
-1
@@ -30,7 +30,7 @@ about:
|
||||
content: >
|
||||
# 关于 IT-Tools
|
||||
|
||||
IT-Tools 由 [Corentin Thomasset](https://github.com/CorentinTh) 用 ❤ 开发,汇集了对开发人员和 IT 从业者有用的工具。如果对您有帮助,请将其分享给您的朋友,并且添加到收藏夹中!
|
||||
IT-Tools 由 [Corentin Thomasset](https://corentin.tech?utm_source=it-tools&utm_medium=about) 用 ❤ 开发,汇集了对开发人员和 IT 从业者有用的工具。如果对您有帮助,请将其分享给您的朋友,并且添加到收藏夹中!
|
||||
|
||||
IT-Tools 永久免费且开源(MIT 许可证),但需要资金用于托管和续订域名。如果您想支持我的工作,并鼓励我添加更多工具,请考虑通过 [赞助我](https://www.buymeacoffee.com/cthmsst) 进行支持。
|
||||
|
||||
|
||||
+16
-8
@@ -1,7 +1,14 @@
|
||||
{
|
||||
"name": "it-tools",
|
||||
"version": "2024.5.13-a0bc346",
|
||||
"packageManager": "pnpm@8.15.3",
|
||||
"description": "Collection of handy online tools for developers, with great UX. ",
|
||||
"author": "Corentin Th <corentin.thomasset74+it-tools@gmail.com> (https://corentin.tech)",
|
||||
"license": "GNU GPLv3",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/CorentinTh/it-tools"
|
||||
},
|
||||
"keywords": [
|
||||
"productivity",
|
||||
"converter",
|
||||
@@ -13,12 +20,6 @@
|
||||
"developer-tools",
|
||||
"developer-productivity"
|
||||
],
|
||||
"author": "Corentin Th <corentin.thomasset74+it-tools@gmail.com> (https://github.com/CorentinTh)",
|
||||
"license": "GNU GPLv3",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/CorentinTh/it-tools"
|
||||
},
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
"build": "vue-tsc --noEmit && NODE_OPTIONS=--max_old_space_size=4096 vite build",
|
||||
@@ -37,11 +38,13 @@
|
||||
"dependencies": {
|
||||
"@it-tools/bip39": "^0.0.4",
|
||||
"@it-tools/oggen": "^1.3.0",
|
||||
"@regexper/render": "^1.0.0",
|
||||
"@sindresorhus/slugify": "^2.2.1",
|
||||
"@tiptap/pm": "2.1.6",
|
||||
"@tiptap/starter-kit": "2.1.6",
|
||||
"@tiptap/vue-3": "2.0.3",
|
||||
"@types/figlet": "^1.5.8",
|
||||
"@types/markdown-it": "^13.0.7",
|
||||
"@vicons/material": "^0.12.0",
|
||||
"@vicons/tabler": "^0.12.0",
|
||||
"@vueuse/core": "^10.3.0",
|
||||
@@ -51,12 +54,14 @@
|
||||
"change-case": "^4.1.2",
|
||||
"colord": "^2.9.3",
|
||||
"composerize-ts": "^0.6.2",
|
||||
"convert": "^5.4.1",
|
||||
"country-code-lookup": "^0.1.0",
|
||||
"cron-validator": "^1.3.1",
|
||||
"cronstrue": "^2.26.0",
|
||||
"crypto-js": "^4.1.1",
|
||||
"date-fns": "^2.29.3",
|
||||
"dompurify": "^3.0.6",
|
||||
"email-normalizer": "^1.0.0",
|
||||
"emojilib": "^3.0.10",
|
||||
"figlet": "^1.7.0",
|
||||
"figue": "^1.2.0",
|
||||
@@ -64,11 +69,12 @@
|
||||
"highlight.js": "^11.7.0",
|
||||
"iarna-toml-esm": "^3.0.5",
|
||||
"ibantools": "^4.3.3",
|
||||
"js-base64": "^3.7.6",
|
||||
"json5": "^2.2.3",
|
||||
"jsonar-mod": "^1.9.0",
|
||||
"jwt-decode": "^3.1.2",
|
||||
"libphonenumber-js": "^1.10.28",
|
||||
"lodash": "^4.17.21",
|
||||
"markdown-it": "^14.0.0",
|
||||
"marked": "^10.0.0",
|
||||
"mathjs": "^11.9.1",
|
||||
"mime-types": "^2.1.35",
|
||||
@@ -81,18 +87,20 @@
|
||||
"pinia": "^2.0.34",
|
||||
"plausible-tracker": "^0.3.8",
|
||||
"qrcode": "^1.5.1",
|
||||
"randexp": "^0.5.3",
|
||||
"sql-formatter": "^13.0.0",
|
||||
"ua-parser-js": "^1.0.35",
|
||||
"ulid": "^2.3.0",
|
||||
"unicode-emoji-json": "^0.4.0",
|
||||
"unplugin-auto-import": "^0.16.4",
|
||||
"uuid": "^9.0.0",
|
||||
"vite-plugin-node-polyfills": "^0.21.0",
|
||||
"vue": "^3.3.4",
|
||||
"vue-i18n": "^9.9.1",
|
||||
"vue-router": "^4.1.6",
|
||||
"vue-shadow-dom": "^4.2.0",
|
||||
"vue-tsc": "^1.8.1",
|
||||
"xml-formatter": "^3.3.2",
|
||||
"xml-js": "^1.6.11",
|
||||
"yaml": "^2.2.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
||||
Generated
+213
-662
File diff suppressed because it is too large.
Load diff
@@ -48,7 +48,7 @@ const output = computed(() => transformer.value(input.value));
|
||||
monospace
|
||||
/>
|
||||
|
||||
<div>
|
||||
<div overflow-auto>
|
||||
<div mb-5px>
|
||||
{{ outputLabel }}
|
||||
</div>
|
||||
|
||||
@@ -7,6 +7,7 @@ import sqlHljs from 'highlight.js/lib/languages/sql';
|
||||
import xmlHljs from 'highlight.js/lib/languages/xml';
|
||||
import yamlHljs from 'highlight.js/lib/languages/yaml';
|
||||
import iniHljs from 'highlight.js/lib/languages/ini';
|
||||
import markdownHljs from 'highlight.js/lib/languages/markdown';
|
||||
import { useCopy } from '@/composable/copy';
|
||||
|
||||
const props = withDefaults(
|
||||
@@ -30,6 +31,7 @@ hljs.registerLanguage('html', xmlHljs);
|
||||
hljs.registerLanguage('xml', xmlHljs);
|
||||
hljs.registerLanguage('yaml', yamlHljs);
|
||||
hljs.registerLanguage('toml', iniHljs);
|
||||
hljs.registerLanguage('markdown', markdownHljs);
|
||||
|
||||
const { value, language, followHeightOf, copyPlacement, copyMessage } = toRefs(props);
|
||||
const { height } = followHeightOf.value ? useElementSize(followHeightOf) : { height: ref(null) };
|
||||
|
||||
@@ -0,0 +1,71 @@
|
||||
<script setup lang="ts">
|
||||
import _ from 'lodash';
|
||||
import convert, { type Unit } from 'convert';
|
||||
|
||||
const props = withDefaults(defineProps<{
|
||||
supportedUnits: { [key: string]: string }
|
||||
defaultUnit: string
|
||||
labelWidth?: string
|
||||
unitMinWidth?: string
|
||||
}>(), {
|
||||
labelWidth: '150px',
|
||||
unitMinWidth: '50px',
|
||||
});
|
||||
const { supportedUnits, defaultUnit, labelWidth, unitMinWidth } = toRefs(props);
|
||||
const units = reactive<
|
||||
Record<
|
||||
string,
|
||||
{ title: string; unit: string; ref: number }
|
||||
>
|
||||
>(Object.entries(supportedUnits.value).map(([key, label]) => ({
|
||||
title: label,
|
||||
unit: key,
|
||||
ref: 1,
|
||||
})).reduce((prev, current) => ({
|
||||
...prev,
|
||||
[current.unit]: current,
|
||||
}), {}));
|
||||
|
||||
function update(key: string) {
|
||||
if (!units[key]) {
|
||||
return;
|
||||
}
|
||||
const { ref: value } = units[key];
|
||||
|
||||
const converter = convert(value, key as Unit);
|
||||
|
||||
_.chain(units)
|
||||
.omit(key)
|
||||
.forEach(({ unit }) => {
|
||||
try {
|
||||
units[unit].ref = converter.to(unit as Unit);
|
||||
}
|
||||
catch (e: any) {
|
||||
units[unit].ref = 0;
|
||||
}
|
||||
})
|
||||
.value();
|
||||
}
|
||||
|
||||
update(defaultUnit.value);
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div>
|
||||
<n-input-group v-for="[key, { title, unit }] in Object.entries(units)" :key="key" mb-3 w-full>
|
||||
<n-input-group-label :style="{ width: labelWidth }">
|
||||
{{ title }}
|
||||
</n-input-group-label>
|
||||
|
||||
<n-input-number
|
||||
v-model:value="units[key].ref"
|
||||
style="flex: 1"
|
||||
@update:value="() => update(key)"
|
||||
/>
|
||||
|
||||
<n-input-group-label :style="{ minWidth: unitMinWidth }">
|
||||
{{ unit }}
|
||||
</n-input-group-label>
|
||||
</n-input-group>
|
||||
</div>
|
||||
</template>
|
||||
@@ -0,0 +1,21 @@
|
||||
import _ from 'lodash';
|
||||
|
||||
function useDebouncedRef<T>(initialValue: T, delay: number, immediate: boolean = false) {
|
||||
const state = ref(initialValue);
|
||||
const debouncedRef = customRef((track, trigger) => ({
|
||||
get() {
|
||||
track();
|
||||
return state.value;
|
||||
},
|
||||
set: _.debounce(
|
||||
(value) => {
|
||||
state.value = value;
|
||||
trigger();
|
||||
},
|
||||
delay,
|
||||
{ leading: immediate },
|
||||
),
|
||||
}));
|
||||
return debouncedRef;
|
||||
}
|
||||
export default useDebouncedRef;
|
||||
@@ -1,8 +1,13 @@
|
||||
import { extension as getExtensionFromMime } from 'mime-types';
|
||||
import { extension as getExtensionFromMimeType, extension as getMimeTypeFromExtension } from 'mime-types';
|
||||
import type { Ref } from 'vue';
|
||||
import _ from 'lodash';
|
||||
|
||||
export { getMimeTypeFromBase64, useDownloadFileFromBase64 };
|
||||
export {
|
||||
getMimeTypeFromBase64,
|
||||
getMimeTypeFromExtension, getExtensionFromMimeType,
|
||||
useDownloadFileFromBase64, useDownloadFileFromBase64Refs,
|
||||
previewImageFromBase64,
|
||||
};
|
||||
|
||||
const commonMimeTypesSignatures = {
|
||||
'JVBERi0': 'application/pdf',
|
||||
@@ -36,30 +41,78 @@ function getFileExtensionFromMimeType({
|
||||
defaultExtension?: string
|
||||
}) {
|
||||
if (mimeType) {
|
||||
return getExtensionFromMime(mimeType) ?? defaultExtension;
|
||||
return getExtensionFromMimeType(mimeType) ?? defaultExtension;
|
||||
}
|
||||
|
||||
return defaultExtension;
|
||||
}
|
||||
|
||||
function useDownloadFileFromBase64({ source, filename }: { source: Ref<string>; filename?: string }) {
|
||||
function downloadFromBase64({ sourceValue, filename, extension, fileMimeType }:
|
||||
{ sourceValue: string; filename?: string; extension?: string; fileMimeType?: string }) {
|
||||
if (sourceValue === '') {
|
||||
throw new Error('Base64 string is empty');
|
||||
}
|
||||
|
||||
const defaultExtension = extension ?? 'txt';
|
||||
const { mimeType } = getMimeTypeFromBase64({ base64String: sourceValue });
|
||||
let base64String = sourceValue;
|
||||
if (!mimeType) {
|
||||
const targetMimeType = fileMimeType ?? getMimeTypeFromExtension(defaultExtension);
|
||||
base64String = `data:${targetMimeType};base64,${sourceValue}`;
|
||||
}
|
||||
|
||||
const cleanExtension = extension ?? getFileExtensionFromMimeType(
|
||||
{ mimeType, defaultExtension });
|
||||
let cleanFileName = filename ?? `file.${cleanExtension}`;
|
||||
if (extension && !cleanFileName.endsWith(`.${extension}`)) {
|
||||
cleanFileName = `${cleanFileName}.${cleanExtension}`;
|
||||
}
|
||||
|
||||
const a = document.createElement('a');
|
||||
a.href = base64String;
|
||||
a.download = cleanFileName;
|
||||
a.click();
|
||||
}
|
||||
|
||||
function useDownloadFileFromBase64(
|
||||
{ source, filename, extension, fileMimeType }:
|
||||
{ source: Ref<string>; filename?: string; extension?: string; fileMimeType?: string }) {
|
||||
return {
|
||||
download() {
|
||||
if (source.value === '') {
|
||||
throw new Error('Base64 string is empty');
|
||||
}
|
||||
|
||||
const { mimeType } = getMimeTypeFromBase64({ base64String: source.value });
|
||||
const base64String = mimeType
|
||||
? source.value
|
||||
: `data:text/plain;base64,${source.value}`;
|
||||
|
||||
const cleanFileName = filename ?? `file.${getFileExtensionFromMimeType({ mimeType })}`;
|
||||
|
||||
const a = document.createElement('a');
|
||||
a.href = base64String;
|
||||
a.download = cleanFileName;
|
||||
a.click();
|
||||
downloadFromBase64({ sourceValue: source.value, filename, extension, fileMimeType });
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
function useDownloadFileFromBase64Refs(
|
||||
{ source, filename, extension }:
|
||||
{ source: Ref<string>; filename?: Ref<string>; extension?: Ref<string> }) {
|
||||
return {
|
||||
download() {
|
||||
downloadFromBase64({ sourceValue: source.value, filename: filename?.value, extension: extension?.value });
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
function previewImageFromBase64(base64String: string): HTMLImageElement {
|
||||
if (base64String === '') {
|
||||
throw new Error('Base64 string is empty');
|
||||
}
|
||||
|
||||
const img = document.createElement('img');
|
||||
img.src = base64String;
|
||||
|
||||
const container = document.createElement('div');
|
||||
container.appendChild(img);
|
||||
|
||||
const previewContainer = document.getElementById('previewContainer');
|
||||
if (previewContainer) {
|
||||
previewContainer.innerHTML = '';
|
||||
previewContainer.appendChild(container);
|
||||
}
|
||||
else {
|
||||
throw new Error('Preview container element not found');
|
||||
}
|
||||
|
||||
return img;
|
||||
}
|
||||
@@ -1,7 +1,8 @@
|
||||
import { useRouteQuery } from '@vueuse/router';
|
||||
import { computed } from 'vue';
|
||||
import { useStorage } from '@vueuse/core';
|
||||
|
||||
export { useQueryParam };
|
||||
export { useQueryParam, useQueryParamOrStorage };
|
||||
|
||||
const transformers = {
|
||||
number: {
|
||||
@@ -16,6 +17,12 @@ const transformers = {
|
||||
fromQuery: (value: string) => value.toLowerCase() === 'true',
|
||||
toQuery: (value: boolean) => (value ? 'true' : 'false'),
|
||||
},
|
||||
object: {
|
||||
fromQuery: (value: string) => {
|
||||
return JSON.parse(value);
|
||||
},
|
||||
toQuery: (value: object) => JSON.stringify(value),
|
||||
},
|
||||
};
|
||||
|
||||
function useQueryParam<T>({ name, defaultValue }: { name: string; defaultValue: T }) {
|
||||
@@ -33,3 +40,27 @@ function useQueryParam<T>({ name, defaultValue }: { name: string; defaultValue:
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
function useQueryParamOrStorage<T>({ name, storageName, defaultValue }: { name: string; storageName: string; defaultValue: T }) {
|
||||
const type = typeof defaultValue;
|
||||
const transformer = transformers[type as keyof typeof transformers] ?? transformers.string;
|
||||
|
||||
const storageRef = useStorage(storageName, defaultValue);
|
||||
const proxyDefaultValue = transformer.toQuery(defaultValue as never);
|
||||
const proxy = useRouteQuery(name, proxyDefaultValue);
|
||||
|
||||
const r = ref(defaultValue);
|
||||
|
||||
watch(r,
|
||||
(value) => {
|
||||
proxy.value = transformer.toQuery(value as never);
|
||||
storageRef.value = value as never;
|
||||
},
|
||||
{ deep: true });
|
||||
|
||||
r.value = (proxy.value && proxy.value !== proxyDefaultValue
|
||||
? transformer.fromQuery(proxy.value) as unknown as T
|
||||
: storageRef.value as T) as never;
|
||||
|
||||
return r;
|
||||
}
|
||||
@@ -3,9 +3,11 @@ import _ from 'lodash';
|
||||
import { type Ref, reactive, watch } from 'vue';
|
||||
|
||||
type ValidatorReturnType = unknown;
|
||||
type GetErrorMessageReturnType = string;
|
||||
|
||||
export interface UseValidationRule<T> {
|
||||
validator: (value: T) => ValidatorReturnType
|
||||
getErrorMessage?: (value: T) => GetErrorMessageReturnType
|
||||
message: string
|
||||
}
|
||||
|
||||
@@ -24,6 +26,15 @@ export function isFalsyOrHasThrown(cb: () => ValidatorReturnType): boolean {
|
||||
}
|
||||
}
|
||||
|
||||
export function getErrorMessageOrThrown(cb: () => GetErrorMessageReturnType): string {
|
||||
try {
|
||||
return cb() || '';
|
||||
}
|
||||
catch (e: any) {
|
||||
return e.toString();
|
||||
}
|
||||
}
|
||||
|
||||
export interface ValidationAttrs {
|
||||
feedback: string
|
||||
validationStatus: string | undefined
|
||||
@@ -61,7 +72,13 @@ export function useValidation<T>({
|
||||
|
||||
for (const rule of get(rules)) {
|
||||
if (isFalsyOrHasThrown(() => rule.validator(source.value))) {
|
||||
state.message = rule.message;
|
||||
if (rule.getErrorMessage) {
|
||||
const getErrorMessage = rule.getErrorMessage;
|
||||
state.message = rule.message.replace('{0}', getErrorMessageOrThrown(() => getErrorMessage(source.value)));
|
||||
}
|
||||
else {
|
||||
state.message = rule.message;
|
||||
}
|
||||
state.status = 'error';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -81,7 +81,7 @@ const tools = computed<ToolCategory[]>(() => [
|
||||
</div>
|
||||
<div>
|
||||
© {{ new Date().getFullYear() }}
|
||||
<c-link target="_blank" rel="noopener" href="https://github.com/CorentinTh">
|
||||
<c-link target="_blank" rel="noopener" href="https://corentin.tech?utm_source=it-tools&utm_medium=footer">
|
||||
Corentin Thomasset
|
||||
</c-link>
|
||||
</div>
|
||||
|
||||
@@ -3,6 +3,7 @@ import { createPinia } from 'pinia';
|
||||
import { createHead } from '@vueuse/head';
|
||||
|
||||
import { registerSW } from 'virtual:pwa-register';
|
||||
import shadow from 'vue-shadow-dom';
|
||||
import { plausible } from './plugins/plausible.plugin';
|
||||
|
||||
import 'virtual:uno.css';
|
||||
@@ -23,5 +24,6 @@ app.use(i18nPlugin);
|
||||
app.use(router);
|
||||
app.use(naive);
|
||||
app.use(plausible);
|
||||
app.use(shadow);
|
||||
|
||||
app.mount('#app');
|
||||
@@ -0,0 +1,16 @@
|
||||
<script setup lang="ts">
|
||||
import UnitsConverter from '@/components/UnitsConverter.vue';
|
||||
|
||||
const supportedUnits = {
|
||||
deg: 'degree (°)',
|
||||
rad: 'radian',
|
||||
turn: 'turn',
|
||||
gradian: 'gradian',
|
||||
grad: 'grad',
|
||||
gon: 'gon',
|
||||
};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<UnitsConverter default-unit="deg" :supported-units="supportedUnits" label-width="150px" />
|
||||
</template>
|
||||
@@ -0,0 +1,12 @@
|
||||
import { Angle } from '@vicons/tabler';
|
||||
import { defineTool } from '../tool';
|
||||
|
||||
export const tool = defineTool({
|
||||
name: 'Angle Units Converter',
|
||||
path: '/angle-converter',
|
||||
description: 'Convert values between angle units',
|
||||
keywords: ['angle', 'converter'],
|
||||
component: () => import('./angle-converter.vue'),
|
||||
icon: Angle,
|
||||
createdAt: new Date('2024-08-15'),
|
||||
});
|
||||
@@ -0,0 +1,35 @@
|
||||
<script setup lang="ts">
|
||||
import UnitsConverter from '@/components/UnitsConverter.vue';
|
||||
|
||||
const supportedUnits = {
|
||||
'm²': 'square meter',
|
||||
'Pm²': 'square petameter',
|
||||
'Tm²': 'square terameter',
|
||||
'Gm²': 'square gigameter',
|
||||
'Mm²': 'square megameter',
|
||||
'km²': 'square kilometer',
|
||||
'hm²': 'square hectometer',
|
||||
'dam²': 'square decameter',
|
||||
'dm²': 'square decimeter',
|
||||
'cm²': 'square centimeter',
|
||||
'mm²': 'square millimeter',
|
||||
'μm²': 'square micrometer',
|
||||
'nm²': 'square nanometer',
|
||||
'pm²': 'square picometer',
|
||||
'fm²': 'square femtometer',
|
||||
'ac': 'acre',
|
||||
'ca': 'centiare',
|
||||
'da': 'deciare',
|
||||
'are': 'are',
|
||||
'daa': 'decare',
|
||||
'ha': 'hectare',
|
||||
'ft²': 'square foot (/ft2/sq ft)',
|
||||
'in²': 'square inch (/in2/sq in)',
|
||||
'yd²': 'square yard (yd2/sq yd)',
|
||||
'mi²': 'square mile (mi2/sq mi)',
|
||||
};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<UnitsConverter default-unit="m²" :supported-units="supportedUnits" label-width="150px" />
|
||||
</template>
|
||||
@@ -0,0 +1,12 @@
|
||||
import { SquaresDiagonal } from '@vicons/tabler';
|
||||
import { defineTool } from '../tool';
|
||||
|
||||
export const tool = defineTool({
|
||||
name: 'Area Units Converter',
|
||||
path: '/area-converter',
|
||||
description: 'Convert values between area units',
|
||||
keywords: ['area', 'converter'],
|
||||
component: () => import('./area-converter.vue'),
|
||||
icon: SquaresDiagonal,
|
||||
createdAt: new Date('2024-08-15'),
|
||||
});
|
||||
@@ -2,12 +2,19 @@
|
||||
import { useBase64 } from '@vueuse/core';
|
||||
import type { Ref } from 'vue';
|
||||
import { useCopy } from '@/composable/copy';
|
||||
import { useDownloadFileFromBase64 } from '@/composable/downloadBase64';
|
||||
import { getExtensionFromMimeType, getMimeTypeFromBase64, previewImageFromBase64, useDownloadFileFromBase64Refs } from '@/composable/downloadBase64';
|
||||
import { useValidation } from '@/composable/validation';
|
||||
import { isValidBase64 } from '@/utils/base64';
|
||||
|
||||
const fileName = ref('file');
|
||||
const fileExtension = ref('');
|
||||
const base64Input = ref('');
|
||||
const { download } = useDownloadFileFromBase64({ source: base64Input });
|
||||
const { download } = useDownloadFileFromBase64Refs(
|
||||
{
|
||||
source: base64Input,
|
||||
filename: fileName,
|
||||
extension: fileExtension,
|
||||
});
|
||||
const base64InputValidation = useValidation({
|
||||
source: base64Input,
|
||||
rules: [
|
||||
@@ -18,6 +25,35 @@ const base64InputValidation = useValidation({
|
||||
],
|
||||
});
|
||||
|
||||
watch(
|
||||
base64Input,
|
||||
(newValue, _) => {
|
||||
const { mimeType } = getMimeTypeFromBase64({ base64String: newValue });
|
||||
if (mimeType) {
|
||||
fileExtension.value = getExtensionFromMimeType(mimeType) || fileExtension.value;
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
function previewImage() {
|
||||
if (!base64InputValidation.isValid) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
const image = previewImageFromBase64(base64Input.value);
|
||||
image.style.maxWidth = '100%';
|
||||
image.style.maxHeight = '400px';
|
||||
const previewContainer = document.getElementById('previewContainer');
|
||||
if (previewContainer) {
|
||||
previewContainer.innerHTML = '';
|
||||
previewContainer.appendChild(image);
|
||||
}
|
||||
}
|
||||
catch (_) {
|
||||
//
|
||||
}
|
||||
}
|
||||
|
||||
function downloadFile() {
|
||||
if (!base64InputValidation.isValid) {
|
||||
return;
|
||||
@@ -44,6 +80,24 @@ async function onUpload(file: File) {
|
||||
|
||||
<template>
|
||||
<c-card title="Base64 to file">
|
||||
<n-grid cols="3" x-gap="12">
|
||||
<n-gi span="2">
|
||||
<c-input-text
|
||||
v-model:value="fileName"
|
||||
label="File Name"
|
||||
placeholder="Download filename"
|
||||
mb-2
|
||||
/>
|
||||
</n-gi>
|
||||
<n-gi>
|
||||
<c-input-text
|
||||
v-model:value="fileExtension"
|
||||
label="Extension"
|
||||
placeholder="Extension"
|
||||
mb-2
|
||||
/>
|
||||
</n-gi>
|
||||
</n-grid>
|
||||
<c-input-text
|
||||
v-model:value="base64Input"
|
||||
multiline
|
||||
@@ -53,7 +107,14 @@ async function onUpload(file: File) {
|
||||
mb-2
|
||||
/>
|
||||
|
||||
<div flex justify-center>
|
||||
<div flex justify-center py-2>
|
||||
<div id="previewContainer" />
|
||||
</div>
|
||||
|
||||
<div flex justify-center gap-3>
|
||||
<c-button :disabled="base64Input === '' || !base64InputValidation.isValid" @click="previewImage()">
|
||||
Preview image
|
||||
</c-button>
|
||||
<c-button :disabled="base64Input === '' || !base64InputValidation.isValid" @click="downloadFile()">
|
||||
Download file
|
||||
</c-button>
|
||||
|
||||
@@ -0,0 +1,65 @@
|
||||
<script setup lang="ts">
|
||||
import { normalizeEmail } from 'email-normalizer';
|
||||
import { withDefaultOnError } from '@/utils/defaults';
|
||||
import { useCopy } from '@/composable/copy';
|
||||
|
||||
const emails = ref('');
|
||||
const normalizedEmails = computed(() => {
|
||||
if (!emails.value) {
|
||||
return '';
|
||||
}
|
||||
|
||||
return emails.value
|
||||
.split('\n')
|
||||
.map((email) => {
|
||||
return withDefaultOnError(() => normalizeEmail({ email }), `Unable to parse email: ${email}`);
|
||||
})
|
||||
.join('\n');
|
||||
});
|
||||
|
||||
const { copy } = useCopy({ source: normalizedEmails, text: 'Normalized emails copied to the clipboard', createToast: true });
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div>
|
||||
<div class="mb-2">
|
||||
Raw emails to normalize:
|
||||
</div>
|
||||
<c-input-text
|
||||
v-model:value="emails"
|
||||
placeholder="Put your emails here (one per line)..."
|
||||
rows="3"
|
||||
multiline
|
||||
autocomplete="off"
|
||||
autocorrect="off"
|
||||
autocapitalize="off"
|
||||
spellcheck="false"
|
||||
autofocus
|
||||
monospace
|
||||
/>
|
||||
|
||||
<div class="mb-2 mt-4">
|
||||
Normalized emails:
|
||||
</div>
|
||||
<c-input-text
|
||||
:value="normalizedEmails"
|
||||
placeholder="Normalized emails will appear here..."
|
||||
rows="3"
|
||||
autocomplete="off"
|
||||
autocorrect="off"
|
||||
autocapitalize="off"
|
||||
spellcheck="false"
|
||||
multiline
|
||||
readonly
|
||||
monospace
|
||||
/>
|
||||
<div class="mt-4 flex justify-center gap-2">
|
||||
<c-button @click="emails = ''">
|
||||
Clear emails
|
||||
</c-button>
|
||||
<c-button :disabled="!normalizedEmails" @click="copy()">
|
||||
Copy normalized emails
|
||||
</c-button>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@@ -0,0 +1,12 @@
|
||||
import { Mail } from '@vicons/tabler';
|
||||
import { defineTool } from '../tool';
|
||||
|
||||
export const tool = defineTool({
|
||||
name: 'Email normalizer',
|
||||
path: '/email-normalizer',
|
||||
description: 'Normalize email addresses to a standard format for easier comparison. Useful for deduplication and data cleaning.',
|
||||
keywords: ['email', 'normalizer'],
|
||||
component: () => import('./email-normalizer.vue'),
|
||||
icon: Mail,
|
||||
createdAt: new Date('2024-08-15'),
|
||||
});
|
||||
@@ -4,6 +4,7 @@ import emojiKeywords from 'emojilib';
|
||||
import _ from 'lodash';
|
||||
import type { EmojiInfo } from './emoji.types';
|
||||
import { useFuzzySearch } from '@/composable/fuzzySearch';
|
||||
import useDebouncedRef from '@/composable/debouncedref';
|
||||
|
||||
const escapeUnicode = ({ emoji }: { emoji: string }) => emoji.split('').map(unit => `\\u${unit.charCodeAt(0).toString(16).padStart(4, '0')}`).join('');
|
||||
const getEmojiCodePoints = ({ emoji }: { emoji: string }) => emoji.codePointAt(0) ? `0x${emoji.codePointAt(0)?.toString(16)}` : undefined;
|
||||
@@ -23,7 +24,7 @@ const emojisGroups: { emojiInfos: EmojiInfo[]; group: string }[] = _
|
||||
.map((emojiInfos, group) => ({ group, emojiInfos }))
|
||||
.value();
|
||||
|
||||
const searchQuery = ref('');
|
||||
const searchQuery = useDebouncedRef('', 500);
|
||||
|
||||
const { searchResult } = useFuzzySearch({
|
||||
search: searchQuery,
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
<script setup lang="ts">
|
||||
import UnitsConverter from '@/components/UnitsConverter.vue';
|
||||
|
||||
const supportedUnits = {
|
||||
J: 'joule',
|
||||
PJ: 'petajoule',
|
||||
TJ: 'terajoule',
|
||||
GJ: 'gigajoule',
|
||||
MJ: 'megajoule',
|
||||
kJ: 'kilojoule',
|
||||
hJ: 'hectojoule',
|
||||
daJ: 'decajoule',
|
||||
dJ: 'decijoule',
|
||||
cJ: 'centijoule',
|
||||
mJ: 'millijoule',
|
||||
µJ: 'microjoule',
|
||||
nJ: 'nanojoule',
|
||||
pJ: 'picojoule',
|
||||
fJ: 'femtojoule',
|
||||
Wh: 'watt-hour',
|
||||
PWh: 'petawatt-hour',
|
||||
TWh: 'terawatt-hour',
|
||||
GWh: 'gigawatt-hour',
|
||||
MWh: 'megawatt-hour',
|
||||
kWh: 'kilowatt-hour',
|
||||
hWh: 'hectowatt-hour',
|
||||
daWh: 'decawatt-hour',
|
||||
dWh: 'deciwatt-hour',
|
||||
cWh: 'centiwatt-hour',
|
||||
mWh: 'milliwatt-hour',
|
||||
µWh: 'microwatt-hour',
|
||||
nWh: 'nanowatt-hour',
|
||||
pWh: 'picowatt-hour',
|
||||
fWh: 'femtowatt-hour',
|
||||
};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<UnitsConverter default-unit="J" :supported-units="supportedUnits" label-width="150px" />
|
||||
</template>
|
||||
@@ -0,0 +1,12 @@
|
||||
import { Power } from '@vicons/tabler';
|
||||
import { defineTool } from '../tool';
|
||||
|
||||
export const tool = defineTool({
|
||||
name: 'Energy Units Converter',
|
||||
path: '/energy-converter',
|
||||
description: 'Convert values between energy units',
|
||||
keywords: ['energy', 'converter'],
|
||||
component: () => import('./energy-converter.vue'),
|
||||
icon: Power,
|
||||
createdAt: new Date('2024-08-15'),
|
||||
});
|
||||
@@ -0,0 +1,38 @@
|
||||
<script setup lang="ts">
|
||||
import UnitsConverter from '@/components/UnitsConverter.vue';
|
||||
|
||||
const supportedUnits = {
|
||||
'N': 'newton',
|
||||
'PN': 'petanewton',
|
||||
'TN': 'teranewton',
|
||||
'GN': 'giganewton',
|
||||
'MN': 'meganewton',
|
||||
'kN': 'kilonewton',
|
||||
'hN': 'hectonewton',
|
||||
'daN': 'decanewton',
|
||||
'dN': 'decinewton',
|
||||
'cN': 'centinewton',
|
||||
'mN': 'millinewton',
|
||||
'µN': 'micronewton',
|
||||
'nN': 'nanonewton',
|
||||
'pN': 'piconewton',
|
||||
'fN': 'femtonewton',
|
||||
'dyn': 'dyne',
|
||||
'lbf': 'pound of force',
|
||||
'kip': 'kip',
|
||||
'klb': 'klb',
|
||||
'kipf': 'kipf',
|
||||
'klbf': 'klbf',
|
||||
'pdl': 'poundal',
|
||||
'kgf': 'kilogram-force',
|
||||
'kp': 'kilopond',
|
||||
'Mp': 'megapond',
|
||||
'tf': 'tonne-force',
|
||||
'metric tf': 'metric ton-force',
|
||||
'megagram-force': 'megagram-force',
|
||||
};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<UnitsConverter default-unit="N" :supported-units="supportedUnits" label-width="150px" />
|
||||
</template>
|
||||
@@ -0,0 +1,12 @@
|
||||
import { Power } from '@vicons/tabler';
|
||||
import { defineTool } from '../tool';
|
||||
|
||||
export const tool = defineTool({
|
||||
name: 'Force Units Converter',
|
||||
path: '/force-converter',
|
||||
description: 'Convert values between force units',
|
||||
keywords: ['force', 'converter'],
|
||||
component: () => import('./force-converter.vue'),
|
||||
icon: Power,
|
||||
createdAt: new Date('2024-08-15'),
|
||||
});
|
||||
+42
-6
@@ -1,13 +1,25 @@
|
||||
import { tool as base64FileConverter } from './base64-file-converter';
|
||||
import { tool as base64StringConverter } from './base64-string-converter';
|
||||
import { tool as basicAuthGenerator } from './basic-auth-generator';
|
||||
import { tool as jsonToPhpArray } from './json-to-php-array';
|
||||
import { tool as phpArrayToJson } from './php-array-to-json';
|
||||
import { tool as volumeConverter } from './volume-converter';
|
||||
import { tool as pressureConverter } from './pressure-converter';
|
||||
import { tool as massConverter } from './mass-converter';
|
||||
import { tool as lengthConverter } from './length-converter';
|
||||
import { tool as forceConverter } from './force-converter';
|
||||
import { tool as energyConverter } from './energy-converter';
|
||||
import { tool as areaConverter } from './area-converter';
|
||||
import { tool as angleConverter } from './angle-converter';
|
||||
import { tool as emailNormalizer } from './email-normalizer';
|
||||
|
||||
import { tool as asciiTextDrawer } from './ascii-text-drawer';
|
||||
|
||||
import { tool as textToUnicode } from './text-to-unicode';
|
||||
import { tool as safelinkDecoder } from './safelink-decoder';
|
||||
import { tool as xmlToJson } from './xml-to-json';
|
||||
import { tool as jsonToXml } from './json-to-xml';
|
||||
import { tool as regexTester } from './regex-tester';
|
||||
import { tool as regexMemo } from './regex-memo';
|
||||
import { tool as markdownToHtml } from './markdown-to-html';
|
||||
import { tool as pdfSignatureChecker } from './pdf-signature-checker';
|
||||
import { tool as numeronymGenerator } from './numeronym-generator';
|
||||
import { tool as macAddressGenerator } from './mac-address-generator';
|
||||
@@ -82,6 +94,8 @@ import { tool as urlParser } from './url-parser';
|
||||
import { tool as uuidGenerator } from './uuid-generator';
|
||||
import { tool as macAddressLookup } from './mac-address-lookup';
|
||||
import { tool as xmlFormatter } from './xml-formatter';
|
||||
import { tool as manyUnitsConverter } from './many-units-converter';
|
||||
import { tool as powerConverter } from './power-converter';
|
||||
import { tool as yamlViewer } from './yaml-viewer';
|
||||
|
||||
export const toolsByCategory: ToolCategory[] = [
|
||||
@@ -109,6 +123,9 @@ export const toolsByCategory: ToolCategory[] = [
|
||||
listConverter,
|
||||
tomlToJson,
|
||||
tomlToYaml,
|
||||
xmlToJson,
|
||||
jsonToXml,
|
||||
markdownToHtml,
|
||||
],
|
||||
},
|
||||
{
|
||||
@@ -130,8 +147,6 @@ export const toolsByCategory: ToolCategory[] = [
|
||||
httpStatusCodes,
|
||||
jsonDiff,
|
||||
safelinkDecoder,
|
||||
jsonToPhpArray,
|
||||
phpArrayToJson,
|
||||
],
|
||||
},
|
||||
{
|
||||
@@ -152,6 +167,9 @@ export const toolsByCategory: ToolCategory[] = [
|
||||
dockerRunToDockerComposeConverter,
|
||||
xmlFormatter,
|
||||
yamlViewer,
|
||||
emailNormalizer,
|
||||
regexTester,
|
||||
regexMemo,
|
||||
],
|
||||
},
|
||||
{
|
||||
@@ -160,11 +178,29 @@ export const toolsByCategory: ToolCategory[] = [
|
||||
},
|
||||
{
|
||||
name: 'Math',
|
||||
components: [mathEvaluator, etaCalculator, percentageCalculator],
|
||||
components: [
|
||||
mathEvaluator,
|
||||
etaCalculator,
|
||||
percentageCalculator,
|
||||
angleConverter,
|
||||
],
|
||||
},
|
||||
{
|
||||
name: 'Measurement',
|
||||
components: [chronometer, temperatureConverter, benchmarkBuilder],
|
||||
components: [
|
||||
chronometer,
|
||||
manyUnitsConverter,
|
||||
temperatureConverter,
|
||||
pressureConverter,
|
||||
massConverter,
|
||||
lengthConverter,
|
||||
areaConverter,
|
||||
volumeConverter,
|
||||
forceConverter,
|
||||
energyConverter,
|
||||
powerConverter,
|
||||
benchmarkBuilder,
|
||||
],
|
||||
},
|
||||
{
|
||||
name: 'Text',
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
import { BrandPhp } from '@vicons/tabler';
|
||||
import { defineTool } from '../tool';
|
||||
|
||||
export const tool = defineTool({
|
||||
name: 'Json to PHP-Array',
|
||||
path: '/json-to-php-array',
|
||||
description: 'Convert JSON to PHP Array',
|
||||
keywords: ['json', 'php', 'array'],
|
||||
component: () => import('./json-to-php-array.vue'),
|
||||
icon: BrandPhp,
|
||||
createdAt: new Date('2024-05-11'),
|
||||
});
|
||||
-4
@@ -1,4 +0,0 @@
|
||||
declare module 'jsonar-mod' {
|
||||
export function arrify(json: any, options?: { prettify?: boolean}): string
|
||||
export function parse(php: string): object
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
import { Braces } from '@vicons/tabler';
|
||||
import { defineTool } from '../tool';
|
||||
|
||||
export const tool = defineTool({
|
||||
name: 'JSON to XML',
|
||||
path: '/json-to-xml',
|
||||
description: 'Convert JSON to XML',
|
||||
keywords: ['json', 'xml'],
|
||||
component: () => import('./json-to-xml.vue'),
|
||||
icon: Braces,
|
||||
createdAt: new Date('2024-08-09'),
|
||||
});
|
||||
+12
-16
@@ -1,24 +1,19 @@
|
||||
<script setup lang="ts">
|
||||
import jsonar from 'jsonar-mod';
|
||||
import convert from 'xml-js';
|
||||
import JSON5 from 'json5';
|
||||
import type { UseValidationRule } from '@/composable/validation';
|
||||
import { withDefaultOnError } from '@/utils/defaults';
|
||||
import type { UseValidationRule } from '@/composable/validation';
|
||||
|
||||
const defaultValue = `{
|
||||
a:"b",
|
||||
arr: [1, "2"],
|
||||
nested: {
|
||||
c:12,
|
||||
d: "az"
|
||||
}
|
||||
}`;
|
||||
const defaultValue = '{"a":{"_attributes":{"x":"1.234","y":"It\'s"}}}';
|
||||
function transformer(value: string) {
|
||||
return withDefaultOnError(() => jsonar.arrify(JSON5.parse(value), { prettify: true }), '');
|
||||
return withDefaultOnError(() => {
|
||||
return convert.js2xml(JSON5.parse(value), { compact: true });
|
||||
}, '');
|
||||
}
|
||||
|
||||
const rules: UseValidationRule<string>[] = [
|
||||
{
|
||||
validator: (v: string) => JSON5.parse(v),
|
||||
validator: (v: string) => v === '' || JSON5.parse(v),
|
||||
message: 'Provided JSON is not valid.',
|
||||
},
|
||||
];
|
||||
@@ -26,11 +21,12 @@ const rules: UseValidationRule<string>[] = [
|
||||
|
||||
<template>
|
||||
<format-transformer
|
||||
input-label="Your JSON"
|
||||
input-label="Your JSON content"
|
||||
:input-default="defaultValue"
|
||||
input-placeholder="Paste your JSON here..."
|
||||
output-label="PHP Array version"
|
||||
:input-validation-rules="rules"
|
||||
input-placeholder="Paste your JSON content here..."
|
||||
output-label="Converted XML"
|
||||
output-language="xml"
|
||||
:transformer="transformer"
|
||||
:input-validation-rules="rules"
|
||||
/>
|
||||
</template>
|
||||
@@ -39,7 +39,7 @@ const validation = useValidation({
|
||||
{{ section.title }}
|
||||
</th>
|
||||
<tr v-for="{ claim, claimDescription, friendlyValue, value } in decodedJWT[section.key]" :key="claim + value">
|
||||
<td class="claims">
|
||||
<td class="claims" style="vertical-align: top;">
|
||||
<span font-bold>
|
||||
{{ claim }}
|
||||
</span>
|
||||
@@ -47,7 +47,7 @@ const validation = useValidation({
|
||||
({{ claimDescription }})
|
||||
</span>
|
||||
</td>
|
||||
<td>
|
||||
<td style="word-wrap: break-word;word-break: break-all;">
|
||||
<span>{{ value }}</span>
|
||||
<span v-if="friendlyValue" ml-2 op-70>
|
||||
({{ friendlyValue }})
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
import { SquareHalf } from '@vicons/tabler';
|
||||
import { defineTool } from '../tool';
|
||||
|
||||
export const tool = defineTool({
|
||||
name: 'Length Units Converter',
|
||||
path: '/length-converter',
|
||||
description: 'Convert values from length units',
|
||||
keywords: ['length', 'converter'],
|
||||
component: () => import('./length-converter.vue'),
|
||||
icon: SquareHalf,
|
||||
createdAt: new Date('2024-08-15'),
|
||||
});
|
||||
@@ -0,0 +1,32 @@
|
||||
<script setup lang="ts">
|
||||
import UnitsConverter from '@/components/UnitsConverter.vue';
|
||||
|
||||
const supportedUnits = {
|
||||
m: 'meter',
|
||||
Pm: 'petameter',
|
||||
Tm: 'terameter',
|
||||
Gm: 'gigameter',
|
||||
Mm: 'megameter',
|
||||
km: 'kilometer',
|
||||
hm: 'hectometer',
|
||||
dam: 'decameter',
|
||||
dm: 'decimeter',
|
||||
cm: 'centimeter',
|
||||
mm: 'millimeter',
|
||||
µm: 'micrometer',
|
||||
nm: 'nanometer',
|
||||
pm: 'picometer',
|
||||
fm: 'femtometer',
|
||||
ft: 'foot (ft/\')',
|
||||
in: 'inch (")',
|
||||
yd: 'yard',
|
||||
mi: 'mile',
|
||||
nmi: 'nautical mile (M/NM)',
|
||||
ly: 'light-year',
|
||||
pc: 'pica',
|
||||
};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<UnitsConverter default-unit="m" :supported-units="supportedUnits" label-width="150px" />
|
||||
</template>
|
||||
@@ -2,6 +2,7 @@
|
||||
import { generateLoremIpsum } from './lorem-ipsum-generator.service';
|
||||
import { useCopy } from '@/composable/copy';
|
||||
import { randIntFromInterval } from '@/utils/random';
|
||||
import { computedRefreshable } from '@/composable/computedRefreshable';
|
||||
|
||||
const paragraphs = ref(1);
|
||||
const sentences = ref([3, 8]);
|
||||
@@ -9,7 +10,7 @@ const words = ref([8, 15]);
|
||||
const startWithLoremIpsum = ref(true);
|
||||
const asHTML = ref(false);
|
||||
|
||||
const loremIpsumText = computed(() =>
|
||||
const [loremIpsumText, refreshLoremIpsum] = computedRefreshable(() =>
|
||||
generateLoremIpsum({
|
||||
paragraphCount: paragraphs.value,
|
||||
asHTML: asHTML.value,
|
||||
@@ -18,6 +19,7 @@ const loremIpsumText = computed(() =>
|
||||
startWithLoremIpsum: startWithLoremIpsum.value,
|
||||
}),
|
||||
);
|
||||
|
||||
const { copy } = useCopy({ source: loremIpsumText, text: 'Lorem ipsum copied to the clipboard' });
|
||||
</script>
|
||||
|
||||
@@ -41,10 +43,13 @@ const { copy } = useCopy({ source: loremIpsumText, text: 'Lorem ipsum copied to
|
||||
|
||||
<c-input-text :value="loremIpsumText" multiline placeholder="Your lorem ipsum..." readonly mt-5 rows="5" />
|
||||
|
||||
<div mt-5 flex justify-center>
|
||||
<div mt-5 flex justify-center gap-3>
|
||||
<c-button autofocus @click="copy()">
|
||||
Copy
|
||||
</c-button>
|
||||
<c-button @click="refreshLoremIpsum">
|
||||
Refresh
|
||||
</c-button>
|
||||
</div>
|
||||
</c-card>
|
||||
</template>
|
||||
@@ -0,0 +1,14 @@
|
||||
[
|
||||
"radian", "radians", "rad", "rads", "r", "turn", "turns", "degree", "degrees", "deg", "degs", "°", "gradian", "gradians", "gon", "gons", "grad", "grads", "grade", "grades",
|
||||
"square meter", "square meters", "square metre", "square metres", "m²", "m2", "square petameter", "square petametre", "square petameters", "square petametres", "Pm²", "Pm2", "square terameter", "square terametre", "square terameters", "square terametres", "Tm²", "Tm2", "square gigameter", "square gigametre", "square gigameters", "square gigametres", "Gm²", "Gm2", "square megameter", "square megametre", "square megameters", "square megametres", "Mm²", "Mm2", "square kilometer", "square kilometre", "square kilometers", "square kilometres", "km²", "km2", "square hectometer", "square hectometre", "square hectometers", "square hectometres", "hm²", "hm2", "square decameter", "square decametre", "square decameters", "square decametres", "dam²", "dam2", "square decimeter", "square decimetre", "square decimeters", "square decimetres", "dm²", "dm2", "square centimeter", "square centimetre", "square centimeters", "square centimetres", "cm²", "cm2", "square millimeter", "square millimetre", "square millimeters", "square millimetres", "mm²", "mm2", "square micrometer", "square micrometre", "square micrometers", "square micrometres", "μm²", "µm²", "μm2", "µm2", "square nanometer", "square nanometre", "square nanometers", "square nanometres", "nm²", "nm2", "square picometer", "square picometre", "square picometers", "square picometres", "pm²", "pm2", "square femtometer", "square femtometre", "square femtometers", "square femtometres", "fm²", "fm2", "acre", "acres", "ac", "centiare", "centiares", "ca", "deciare", "deciares", "da", "are", "ares", "decare", "decares", "daa", "hectare", "hectares", "ha", "square foot", "square feet", "sq ft", "ft²", "ft2", "square inch", "square inches", "sq in", "in²", "in2", "square yard", "square yards", "sq yd", "yd²", "yd2", "square mile", "square miles", "sq mi", "mi²", "mi2",
|
||||
"bit", "bits", "b", "pebibit", "pebibits", "Pib", "tebibit", "tebibits", "Tib", "gibibit", "gibibits", "Gib", "mebibit", "mebibits", "Mib", "kibibit", "kibibits", "Kib", "Kb", "KB", "petabit", "petabits", "Pb", "terabit", "terabits", "Tb", "gigabit", "gigabits", "Gb", "megabit", "megabits", "Mb", "kilobit", "kilobits", "kb", "hectobit", "hectobits", "hb", "decabit", "decabits", "dab", "decibit", "decibits", "db", "centibit", "centibits", "cb", "millibit", "millibits", "mb", "microbit", "microbits", "μb", "µb", "nanobit", "nanobits", "nb", "picobit", "picobits", "pb", "femtobit", "femtobits", "fb", "nibble", "nibbles", "semioctet", "semioctets", "halfbyte", "halfbytes", "byte", "bytes", "octect", "octects", "B", "pebibyte", "pebibytes", "PiB", "tebibyte", "tebibytes", "TiB", "gibibyte", "gibibytes", "GiB", "mebibyte", "mebibytes", "MiB", "kibibyte", "kibibytes", "KiB", "petabyte", "petabytes", "PB", "terabyte", "terabytes", "TB", "gigabyte", "gigabytes", "GB", "megabyte", "megabytes", "MB", "kilobyte", "kilobytes", "kB", "hectobyte", "hectobytes", "hB", "decabyte", "decabytes", "daB", "decibyte", "decibytes", "dB", "centibyte", "centibytes", "cB", "millibyte", "millibytes", "mB", "microbyte", "microbytes", "μB", "µB", "nanobyte", "nanobytes", "nB", "picobyte", "picobytes", "pB", "femtobyte", "femtobytes", "fB", "hextet", "hextets",
|
||||
"joule", "joules", "J", "petajoule", "petajoules", "PJ", "terajoule", "terajoules", "TJ", "gigajoule", "gigajoules", "GJ", "megajoule", "megajoules", "MJ", "kilojoule", "kilojoules", "kJ", "hectojoule", "hectojoules", "hJ", "decajoule", "decajoules", "daJ", "decijoule", "decijoules", "dJ", "centijoule", "centijoules", "cJ", "millijoule", "millijoules", "mJ", "microjoule", "microjoules", "μJ", "µJ", "nanojoule", "nanojoules", "nJ", "picojoule", "picojoules", "pJ", "femtojoule", "femtojoules", "fJ", "watt-hour", "W⋅h", "W h", "Wh", "petawatt-hour", "petawatt-hours", "PW⋅h", "PW h", "PWh", "terawatt-hour", "terawatt-hours", "TW⋅h", "TW h", "TWh", "gigawatt-hour", "gigawatt-hours", "GW⋅h", "GW h", "GWh", "megawatt-hour", "megawatt-hours", "MW⋅h", "MW h", "MWh", "kilowatt-hour", "kilowatt-hours", "kW⋅h", "kW h", "kWh", "hectowatt-hour", "hectowatt-hours", "hW⋅h", "hW h", "hWh", "decawatt-hour", "decawatt-hours", "daW⋅h", "daW h", "daWh", "deciwatt-hour", "deciwatt-hours", "dW⋅h", "dW h", "dWh", "centiwatt-hour", "centiwatt-hours", "cW⋅h", "cW h", "cWh", "milliwatt-hour", "milliwatt-hours", "mW⋅h", "mW h", "mWh", "microwatt-hour", "microwatt-hours", "μW⋅h", "µW⋅h", "μW h", "µW h", "μWh", "µWh", "nanowatt-hour", "nanowatt-hours", "nW⋅h", "nW h", "nWh", "picowatt-hour", "picowatt-hours", "pW⋅h", "pW h", "pWh", "femtowatt-hour", "femtowatt-hours", "fW⋅h", "fW h", "fWh",
|
||||
"newton", "newtons", "N", "petanewton", "petanewtons", "PN", "teranewton", "teranewtons", "TN", "giganewton", "giganewtons", "GN", "meganewton", "meganewtons", "MN", "kilonewton", "kilonewtons", "kN", "hectonewton", "hectonewtons", "hN", "decanewton", "decanewtons", "daN", "decinewton", "decinewtons", "dN", "centinewton", "centinewtons", "cN", "millinewton", "millinewtons", "mN", "micronewton", "micronewtons", "μN", "µN", "nanonewton", "nanonewtons", "nN", "piconewton", "piconewtons", "pN", "femtonewton", "femtonewtons", "fN", "dyne", "dynes", "dyn", "pound of force", "pound-force", "lbf", "kip", "klb", "kipf", "klbf", "poundal", "poundals", "pdl", "kilogram-force", "kilopond", "kiloponds", "kgf", "kp", "tonne-force", "metric ton-force", "megagram-force", "megapond", "tf", "Mp",
|
||||
"meter", "meters", "metre", "metres", "m", "petameter", "petametre", "petameters", "petametres", "Pm", "terameter", "terametre", "terameters", "terametres", "Tm", "gigameter", "gigametre", "gigameters", "gigametres", "Gm", "megameter", "megametre", "megameters", "megametres", "Mm", "kilometer", "kilometre", "kilometers", "kilometres", "km", "hectometer", "hectometre", "hectometers", "hectometres", "hm", "decameter", "decametre", "decameters", "decametres", "dam", "decimeter", "decimetre", "decimeters", "decimetres", "dm", "centimeter", "centimetre", "centimeters", "centimetres", "cm", "millimeter", "millimetre", "millimeters", "millimetres", "mm", "micrometer", "micrometre", "micrometers", "micrometres", "μm", "µm", "nanometer", "nanometre", "nanometers", "nanometres", "nm", "picometer", "picometre", "picometers", "picometres", "pm", "femtometer", "femtometre", "femtometers", "femtometres", "fm", "foot", "feet", "ft", "\"", "US survey foot", "US survey feet", "U.S. survey foot", "U.S. survey feet", "inch", "inches", "in", "\"", "yard", "yards", "yd", "mile", "miles", "mi", "nautical mile", "nautical miles", "M", "NM", "nmi", "light-year", "light-years", "ly", "pica", "picas", "pc", "point", "points",
|
||||
"gram", "grams", "g", "petagram", "petagrams", "Pg", "teragram", "teragrams", "Tg", "gigagram", "gigagrams", "Gg", "megagram", "megagrams", "Mg", "kilogram", "kilograms", "kg", "hectogram", "hectograms", "hg", "decagram", "decagrams", "dag", "decigram", "decigrams", "dg", "centigram", "centigrams", "cg", "milligram", "milligrams", "mg", "microgram", "micrograms", "μg", "µg", "nanogram", "nanograms", "ng", "picogram", "picograms", "pg", "femtogram", "femtograms", "fg", "tonne", "tonnes", "metric ton", "metric tons", "t", "kilotonne", "kilotonnes", "kt", "megatonne", "megatonnes", "Mt", "gigatonne", "gigatonnes", "Gt", "pound", "pounds", "lb", "stone", "stones", "st", "ounce", "ounces", "oz", "short ton", "short tons", "US ton", "US tons", "long ton", "long tons", "imperial ton", "imperial tons", "displacement ton", "displacement tons",
|
||||
"watt", "watts", "W", "petawatt", "petawatts", "PW", "terawatt", "terawatts", "TW", "gigawatt", "gigawatts", "GW", "megawatt", "megawatts", "MW", "kilowatt", "kilowatts", "kW", "hectowatt", "hectowatts", "hW", "decawatt", "decawatts", "daW", "deciwatt", "deciwatts", "dW", "centiwatt", "centiwatts", "cW", "milliwatt", "milliwatts", "mW", "microwatt", "microwatts", "μW", "µW", "nanowatt", "nanowatts", "nW", "picowatt", "picowatts", "pW", "femtowatt", "femtowatts", "fW", "horsepower", "mechanical horsepower", "hp",
|
||||
"pascal", "pascals", "Pa", "petapascal", "petapascals", "PPa", "terapascal", "terapascals", "TPa", "gigapascal", "gigapascals", "GPa", "megapascal", "megapascals", "MPa", "kilopascal", "kilopascals", "kPa", "hectopascal", "hectopascals", "hPa", "decapascal", "decapascals", "daPa", "decipascal", "decipascals", "dPa", "centipascal", "centipascals", "cPa", "millipascal", "millipascals", "mPa", "micropascal", "micropascals", "μPa", "µPa", "nanopascal", "nanopascals", "nPa", "picopascal", "picopascals", "pPa", "femtopascal", "femtopascals", "fPa", "bar", "bars", "petabar", "petabars", "Pbar", "terabar", "terabars", "Tbar", "gigabar", "gigabars", "Gbar", "megabar", "megabars", "Mbar", "kilobar", "kilobars", "kbar", "hectobar", "hectobars", "hbar", "decabar", "decabars", "dabar", "decibar", "decibars", "dbar", "centibar", "centibars", "cbar", "millibar", "millibars", "mbar", "microbar", "microbars", "μbar", "µbar", "nanobar", "nanobars", "nbar", "picobar", "picobars", "pbar", "femtobar", "femtobars", "fbar", "torr", "torrs", "Torr", "millitorr", "mTorr", "atmosphere", "atmospheres", "atm", "pound per square inch", "pounds per square inch", "psi", "lbf/in2", "lbf/in²",
|
||||
"kelvin", "kelvins", "K", "petakelvin", "petakelvins", "PK", "terakelvin", "terakelvins", "TK", "gigakelvin", "gigakelvins", "GK", "megakelvin", "megakelvins", "MK", "kilokelvin", "kilokelvins", "kK", "hectokelvin", "hectokelvins", "hK", "decakelvin", "decakelvins", "daK", "decikelvin", "decikelvins", "dK", "centikelvin", "centikelvins", "cK", "millikelvin", "millikelvins", "mK", "microkelvin", "microkelvins", "μK", "µK", "nanokelvin", "nanokelvins", "nK", "picokelvin", "picokelvins", "pK", "femtokelvin", "femtokelvins", "fK", "fahrenheit", "F", "celsius", "C", "rankine", "R",
|
||||
"second", "seconds", "s", "petasecond", "petaseconds", "Ps", "terasecond", "teraseconds", "Ts", "gigasecond", "gigaseconds", "Gs", "megasecond", "megaseconds", "Ms", "kilosecond", "kiloseconds", "ks", "hectosecond", "hectoseconds", "hs", "decasecond", "decaseconds", "das", "decisecond", "deciseconds", "ds", "centisecond", "centiseconds", "cs", "millisecond", "milliseconds", "ms", "microsecond", "microseconds", "μs", "µs", "nanosecond", "nanoseconds", "ns", "picosecond", "picoseconds", "ps", "femtosecond", "femtoseconds", "fs", "minute", "minutes", "min", "hour", "hours", "h", "milliday", "millidays", "md", "day", "days", "d", "week", "weeks", "wk", "fortnight", "fortnights", "fn", "month", "months", "mo", "year", "years", "a", "y", "yr", "decade", "decades", "dec", "century", "centuries", "millennium", "millennia", "moment", "moments", "shake", "shakes", "time unit", "TU", "svedberg", "svedbergs", "S",
|
||||
"cubic meter", "cubic meters", "cubic metre", "cubic metres", "stere", "steres", "m³", "m3", "cubic petameter", "cubic petameters", "Pm3", "Pm³", "cubic terameter", "cubic terameters", "Tm3", "Tm³", "cubic gigameter", "cubic gigameters", "Gm3", "Gm³", "cubic megameter", "cubic megameters", "Mm3", "Mm³", "cubic kilometer", "cubic kilometers", "km3", "km³", "cubic hectometer", "cubic hectometers", "hm3", "hm³", "cubic decameter", "cubic decameters", "dam3", "dam³", "cubic decimeter", "cubic decimeters", "dm3", "dm³", "cubic centimeter", "cubic centimeters", "cm3", "cm³", "cubic millimeter", "cubic millimeters", "mm3", "mm³", "cubic micrometer", "cubic micrometers", "μm3", "µm3", "μm³", "µm³", "cubic nanometer", "cubic nanometers", "nm3", "nm³", "cubic picometer", "cubic picometers", "pm3", "pm³", "cubic femtometer", "cubic femtometers", "fm3", "fm³", "liter", "liters", "litre", "litres", "l", "L", "petaliter", "petaliters", "petalitre", "petalitres", "Pl", "PL", "teraliter", "teraliters", "teralitre", "teralitres", "Tl", "TL", "gigaliter", "gigaliters", "gigalitre", "gigalitres", "Gl", "GL", "megaliter", "megaliters", "megalitre", "megalitres", "Ml", "ML", "kiloliter", "kiloliters", "kilolitre", "kilolitres", "kl", "kL", "hectoliter", "hectoliters", "hectolitre", "hectolitres", "hl", "hL", "decaliter", "decaliters", "decalitre", "decalitres", "dal", "daL", "deciliter", "deciliters", "decilitre", "decilitres", "dl", "dL", "centiliter", "centiliters", "centilitre", "centilitres", "cl", "cL", "milliliter", "milliliters", "millilitre", "millilitres", "ml", "mL", "microliter", "microliters", "microlitre", "microlitres", "μl", "µl", "μL", "µL", "nanoliter", "nanoliters", "nanolitre", "nanolitres", "nl", "nL", "picoliter", "picoliters", "picolitre", "picolitres", "pl", "pL", "femtoliter", "femtoliters", "femtolitre", "femtolitres", "fl", "fL", "cubic mile", "cubic miles", "cu mi", "mi3", "mi³", "acre-foot", "acre-feet", "ac⋅ft", "ac ft", "cubic yard", "cubic yards", "cu yd", "yd3", "yd³", "cubic foot", "cubic feet", "cu ft", "ft3", "ft³", "board foot", "board feet", "cubic inch", "cubic inches", "cu in", "in3", "in³", "measurement ton", "measurement tons", "MTON", "imperial barrel", "imperial barrels", "imp bbl", "imperial bushel", "imperial bushels", "imp bsh", "imp bu", "imperial peck", "imperial pecks", "pk", "imp pk", "imperial gallon", "imperial gallons", "imp gal", "imperial quart", "imperial quarts", "imp qt", "imperial pint", "imperial pints", "imp pt", "imperial fluid ounce", "imperial fluid ounces", "imp fl oz", "teaspoon", "teaspoons", "US teaspoon", "US teaspoons", "tsp", "tablespoon", "tablespoons", "US tablespoon", "US tablespoons", "tbsp", "US fluid ounce", "US fluid ounces", "fl oz", "fl. oz.", "oz. fl.", "cup", "cups", "c", "US legal cup", "US legal cups", "US lc", "pint", "pints", "US liquid pint", "US liquid pints", "pt", "p", "quart", "quarts", "US liquid quart", "US liquid quarts", "qt", "gallon", "gallons", "US liquid gallon", "US liquid gallons", "gal", "US bushel", "US bushels", "US bsh", "US bu", "US peck", "US pk", "US dry gallon", "US dry gal", "US dry barrel", "US dry barrels", "US dry bbl", "US dry quart", "US dry qt", "US dry pint", "US dry pt"
|
||||
]
|
||||
@@ -0,0 +1,32 @@
|
||||
import { Calculator } from '@vicons/tabler';
|
||||
import { defineTool } from '../tool';
|
||||
|
||||
export const tool = defineTool({
|
||||
name: 'Many Units Converter',
|
||||
path: '/many-units-converter',
|
||||
description: 'Convert all kind of units',
|
||||
keywords: [
|
||||
'units',
|
||||
'uom',
|
||||
'metric',
|
||||
'imperial',
|
||||
'measurement',
|
||||
'mass',
|
||||
'weight',
|
||||
'angle',
|
||||
'area',
|
||||
'data',
|
||||
'energy',
|
||||
'force',
|
||||
'length',
|
||||
'mass',
|
||||
'power',
|
||||
'pressure',
|
||||
'temperature',
|
||||
'time',
|
||||
'volume',
|
||||
'converter'],
|
||||
component: () => import('./many-units-converter.vue'),
|
||||
icon: Calculator,
|
||||
createdAt: new Date('2024-08-15'),
|
||||
});
|
||||
@@ -0,0 +1,64 @@
|
||||
<script setup lang="ts">
|
||||
import _ from 'lodash';
|
||||
import { type Unit, convertMany } from 'convert';
|
||||
import allUnits from './allunits.json';
|
||||
|
||||
const allUnitsSorted = _.uniq(allUnits).sort();
|
||||
|
||||
const inputExpression = ref('');
|
||||
const outputUnit = ref('');
|
||||
const result = computed(() => {
|
||||
try {
|
||||
const best = convertMany(inputExpression.value).to('best');
|
||||
try {
|
||||
return {
|
||||
best,
|
||||
selected: outputUnit.value
|
||||
? convertMany(inputExpression.value).to(outputUnit.value as Unit)
|
||||
: '',
|
||||
};
|
||||
}
|
||||
catch (e: any) {
|
||||
return {
|
||||
best,
|
||||
error: e.toString(),
|
||||
};
|
||||
}
|
||||
}
|
||||
catch (e: any) {
|
||||
return {
|
||||
error: e.toString(),
|
||||
};
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div>
|
||||
<c-input-text
|
||||
v-model:value="inputExpression"
|
||||
label="Units expression"
|
||||
placeholder="Please enter an unit expression, ie '1d 2m'"
|
||||
mb-2
|
||||
/>
|
||||
<c-select
|
||||
v-model:value="outputUnit"
|
||||
label-position="left"
|
||||
label-width="100px"
|
||||
label="Target Unit:"
|
||||
:options="allUnitsSorted"
|
||||
placeholder="Select the target unit"
|
||||
searchable
|
||||
/>
|
||||
|
||||
<n-divider />
|
||||
|
||||
<c-card v-if="result.best" title="Result" mb-2>
|
||||
<input-copyable label="Best Target Unit" :value="result.best" mb-1 />
|
||||
<input-copyable v-if="result.selected" :label="`Selected Target Unit (${outputUnit})`" :value="result.selected" />
|
||||
</c-card>
|
||||
<c-alert v-if="result.error && inputExpression">
|
||||
{{ result.error }}
|
||||
</c-alert>
|
||||
</div>
|
||||
</template>
|
||||
@@ -0,0 +1,12 @@
|
||||
import { Markdown } from '@vicons/tabler';
|
||||
import { defineTool } from '../tool';
|
||||
|
||||
export const tool = defineTool({
|
||||
name: 'Markdown to HTML',
|
||||
path: '/markdown-to-html',
|
||||
description: 'Convert Markdown to Html and allow to print (as PDF)',
|
||||
keywords: ['markdown', 'html', 'converter', 'pdf'],
|
||||
component: () => import('./markdown-to-html.vue'),
|
||||
icon: Markdown,
|
||||
createdAt: new Date('2024-08-25'),
|
||||
});
|
||||
@@ -0,0 +1,44 @@
|
||||
<script setup lang="ts">
|
||||
import markdownit from 'markdown-it';
|
||||
import TextareaCopyable from '@/components/TextareaCopyable.vue';
|
||||
|
||||
const inputMarkdown = ref('');
|
||||
const outputHtml = computed(() => {
|
||||
const md = markdownit();
|
||||
return md.render(inputMarkdown.value);
|
||||
});
|
||||
|
||||
function printHtml() {
|
||||
const w = window.open();
|
||||
if (w === null) {
|
||||
return;
|
||||
}
|
||||
w.document.body.innerHTML = outputHtml.value;
|
||||
w.print();
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div>
|
||||
<c-input-text
|
||||
v-model:value="inputMarkdown"
|
||||
multiline raw-text
|
||||
placeholder="Your Markdown content..."
|
||||
rows="8"
|
||||
autofocus
|
||||
label="Your Markdown to convert:"
|
||||
/>
|
||||
|
||||
<n-divider />
|
||||
|
||||
<n-form-item label="Output HTML:">
|
||||
<TextareaCopyable :value="outputHtml" :word-wrap="true" language="html" />
|
||||
</n-form-item>
|
||||
|
||||
<div flex justify-center>
|
||||
<n-button @click="printHtml">
|
||||
Print as PDF
|
||||
</n-button>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@@ -0,0 +1,12 @@
|
||||
import { Atom } from '@vicons/tabler';
|
||||
import { defineTool } from '../tool';
|
||||
|
||||
export const tool = defineTool({
|
||||
name: 'Mass Units Converter',
|
||||
path: '/mass-converter',
|
||||
description: 'Convert values between mass units',
|
||||
keywords: ['mass', 'converter'],
|
||||
component: () => import('./mass-converter.vue'),
|
||||
icon: Atom,
|
||||
createdAt: new Date('2024-08-15'),
|
||||
});
|
||||
@@ -0,0 +1,38 @@
|
||||
<script setup lang="ts">
|
||||
import UnitsConverter from '@/components/UnitsConverter.vue';
|
||||
|
||||
const supportedUnits = {
|
||||
'g': 'gram',
|
||||
'Pg': 'petagram',
|
||||
'Tg': 'teragram',
|
||||
'Gg': 'gigagram',
|
||||
'Mg': 'megagram',
|
||||
'kg': 'kilogram',
|
||||
'hg': 'hectogram',
|
||||
'dag': 'decagram',
|
||||
'dg': 'decigram',
|
||||
'cg': 'centigram',
|
||||
'mg': 'milligram',
|
||||
'μg': 'microgram',
|
||||
'ng': 'nanogram',
|
||||
'pg': 'picogram',
|
||||
'fg': 'femtogram',
|
||||
'tonne': 'tonne',
|
||||
't': 'metric ton',
|
||||
'kt': 'kilotonne',
|
||||
'Mt': 'megatonne',
|
||||
'Gt': 'gigatonne',
|
||||
'lb': 'pound',
|
||||
'st': 'stone',
|
||||
'oz': 'ounce',
|
||||
'short ton': 'short ton',
|
||||
'US ton': 'US ton',
|
||||
'long ton': 'long ton',
|
||||
'imperial ton': 'imperial ton',
|
||||
'displacement ton': 'displacement ton',
|
||||
};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<UnitsConverter default-unit="g" :supported-units="supportedUnits" label-width="150px" />
|
||||
</template>
|
||||
@@ -1,12 +0,0 @@
|
||||
import { BrandPhp } from '@vicons/tabler';
|
||||
import { defineTool } from '../tool';
|
||||
|
||||
export const tool = defineTool({
|
||||
name: 'PHP-Array to JSON',
|
||||
path: '/php-array-to-json',
|
||||
description: 'Convert PHP Array to JSON',
|
||||
keywords: ['php', 'array', 'json'],
|
||||
component: () => import('./php-array-to-json.vue'),
|
||||
icon: BrandPhp,
|
||||
createdAt: new Date('2024-05-11'),
|
||||
});
|
||||
@@ -1,39 +0,0 @@
|
||||
<script setup lang="ts">
|
||||
import jsonar from 'jsonar-mod';
|
||||
import type { UseValidationRule } from '@/composable/validation';
|
||||
import { withDefaultOnError } from '@/utils/defaults';
|
||||
|
||||
const defaultValue = `array(
|
||||
"a" => "b",
|
||||
"arr" => array(
|
||||
1,
|
||||
"2"
|
||||
),
|
||||
"nested" => array(
|
||||
"c" => 12,
|
||||
"d" => "az"
|
||||
)
|
||||
);`;
|
||||
function transformer(value: string) {
|
||||
return withDefaultOnError(() => JSON.stringify(jsonar.parse(value), null, 2), '');
|
||||
}
|
||||
|
||||
const rules: UseValidationRule<string>[] = [
|
||||
{
|
||||
validator: (v: string) => v === '' || jsonar.parse(v),
|
||||
message: 'Provided PHP Array is not valid.',
|
||||
},
|
||||
];
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<format-transformer
|
||||
input-label="Your PHP Array"
|
||||
:input-default="defaultValue"
|
||||
input-placeholder="Paste your PHP Array here..."
|
||||
output-label="JSON version"
|
||||
output-language="json"
|
||||
:input-validation-rules="rules"
|
||||
:transformer="transformer"
|
||||
/>
|
||||
</template>
|
||||
@@ -0,0 +1,12 @@
|
||||
import { Power } from '@vicons/tabler';
|
||||
import { defineTool } from '../tool';
|
||||
|
||||
export const tool = defineTool({
|
||||
name: 'Power Converter',
|
||||
path: '/power-converter',
|
||||
description: 'Convert values between power units',
|
||||
keywords: ['power', 'converter'],
|
||||
component: () => import('./power-converter.vue'),
|
||||
icon: Power,
|
||||
createdAt: new Date('2024-08-15'),
|
||||
});
|
||||
@@ -0,0 +1,27 @@
|
||||
<script setup lang="ts">
|
||||
import UnitsConverter from '@/components/UnitsConverter.vue';
|
||||
|
||||
const supportedUnits = {
|
||||
W: 'watt',
|
||||
PW: 'petawatt',
|
||||
TW: 'terawatt',
|
||||
GW: 'gigawatt',
|
||||
MW: 'megawatt',
|
||||
kW: 'kilowatt',
|
||||
hW: 'hectowatt',
|
||||
daW: 'decawatt',
|
||||
dW: 'deciwatt',
|
||||
cW: 'centiwatt',
|
||||
mW: 'milliwatt',
|
||||
μW: 'microwatt',
|
||||
nW: 'nanowatt',
|
||||
pW: 'picowatt',
|
||||
fW: 'femtowatt',
|
||||
horsepower: 'horsepower',
|
||||
hp: 'mechanical horsepower',
|
||||
}; ;
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<UnitsConverter default-unit="W" :supported-units="supportedUnits" label-width="150px" />
|
||||
</template>
|
||||
@@ -0,0 +1,12 @@
|
||||
import { Atom } from '@vicons/tabler';
|
||||
import { defineTool } from '../tool';
|
||||
|
||||
export const tool = defineTool({
|
||||
name: 'Pressure Units Converter',
|
||||
path: '/pressure-converter',
|
||||
description: 'Convert values between pressure units',
|
||||
keywords: ['pressure', 'converter'],
|
||||
component: () => import('./pressure-converter.vue'),
|
||||
icon: Atom,
|
||||
createdAt: new Date('2024-08-15'),
|
||||
});
|
||||
@@ -0,0 +1,45 @@
|
||||
<script setup lang="ts">
|
||||
import UnitsConverter from '@/components/UnitsConverter.vue';
|
||||
|
||||
const supportedUnits = {
|
||||
'Pa': 'pascal',
|
||||
'PPa': 'pettapascal',
|
||||
'TPa': 'terapascal',
|
||||
'GPa': 'gigapascal',
|
||||
'MPa': 'megapascal',
|
||||
'kPa': 'kilopascal',
|
||||
'hPa': 'hectopascal',
|
||||
'daPa': 'decapascal',
|
||||
'dPa': 'decipascal',
|
||||
'cPa': 'centipascal',
|
||||
'mPa': 'millipascal',
|
||||
'μPa': 'micropascal',
|
||||
'nPa': 'nanopascal',
|
||||
'pPa': 'picopascal',
|
||||
'fPa': 'femtopascal',
|
||||
'bar': 'bar',
|
||||
'Pbar': 'petabar',
|
||||
'Tbar': 'terabar',
|
||||
'Gbar': 'gigabar',
|
||||
'Mbar': 'megabar',
|
||||
'kbar': 'kilobar',
|
||||
'hbar': 'hectobar',
|
||||
'dabar': 'decabar',
|
||||
'dbar': 'decibar',
|
||||
'cbar': 'centibar',
|
||||
'mbar': 'millibar',
|
||||
'μbar': 'microbar',
|
||||
'nbar': 'nanobar',
|
||||
'pbar': 'picobar',
|
||||
'fbar': 'femtobar',
|
||||
'Torr': 'torr',
|
||||
'mTorr': 'millitorr',
|
||||
'atm': 'atmosphere',
|
||||
'psi': 'pound per square inch',
|
||||
'lbf/in2': 'lbf/in2',
|
||||
};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<UnitsConverter default-unit="Pa" :supported-units="supportedUnits" label-width="150px" />
|
||||
</template>
|
||||
@@ -0,0 +1,12 @@
|
||||
import { BrandJavascript } from '@vicons/tabler';
|
||||
import { defineTool } from '../tool';
|
||||
|
||||
export const tool = defineTool({
|
||||
name: 'Regex cheatsheet',
|
||||
path: '/regex-memo',
|
||||
description: 'Javascript Regex/Regular Expression cheatsheet',
|
||||
keywords: ['regex', 'regular', 'expression', 'javascript', 'memo', 'cheatsheet'],
|
||||
component: () => import('./regex-memo.vue'),
|
||||
icon: BrandJavascript,
|
||||
createdAt: new Date('2024-09-20'),
|
||||
});
|
||||
@@ -0,0 +1,121 @@
|
||||
### Normal characters
|
||||
|
||||
Expression | Description
|
||||
:--|:--
|
||||
`.` or `[^\n\r]` | any character *excluding* a newline or carriage return
|
||||
`[A-Za-z]` | alphabet
|
||||
`[a-z]` | lowercase alphabet
|
||||
`[A-Z]` | uppercase alphabet
|
||||
`\d` or `[0-9]` | digit
|
||||
`\D` or `[^0-9]` | non-digit
|
||||
`_` | underscore
|
||||
`\w` or `[A-Za-z0-9_]` | alphabet, digit or underscore
|
||||
`\W` or `[^A-Za-z0-9_]` | inverse of `\w`
|
||||
`\S` | inverse of `\s`
|
||||
|
||||
### Whitespace characters
|
||||
|
||||
Expression | Description
|
||||
:--|:--
|
||||
` ` | space
|
||||
`\t` | tab
|
||||
`\n` | newline
|
||||
`\r` | carriage return
|
||||
`\s` | space, tab, newline or carriage return
|
||||
|
||||
### Character set
|
||||
|
||||
Expression | Description
|
||||
:--|:--
|
||||
`[xyz]` | either `x`, `y` or `z`
|
||||
`[^xyz]` | neither `x`, `y` nor `z`
|
||||
`[1-3]` | either `1`, `2` or `3`
|
||||
`[^1-3]` | neither `1`, `2` nor `3`
|
||||
|
||||
- Think of a character set as an `OR` operation on the single characters that are enclosed between the square brackets.
|
||||
- Use `^` after the opening `[` to “negate” the character set.
|
||||
- Within a character set, `.` means a literal period.
|
||||
|
||||
### Characters that require escaping
|
||||
|
||||
#### Outside a character set
|
||||
|
||||
Expression | Description
|
||||
:--|:--
|
||||
`\.` | period
|
||||
`\^` | caret
|
||||
`\$` | dollar sign
|
||||
`\|` | pipe
|
||||
`\\` | back slash
|
||||
`\/` | forward slash
|
||||
`\(` | opening bracket
|
||||
`\)` | closing bracket
|
||||
`\[` | opening square bracket
|
||||
`\]` | closing square bracket
|
||||
`\{` | opening curly bracket
|
||||
`\}` | closing curly bracket
|
||||
|
||||
#### Inside a character set
|
||||
|
||||
Expression | Description
|
||||
:--|:--
|
||||
`\\` | back slash
|
||||
`\]` | closing square bracket
|
||||
|
||||
- A `^` must be escaped only if it occurs immediately after the opening `[` of the character set.
|
||||
- A `-` must be escaped only if it occurs between two alphabets or two digits.
|
||||
|
||||
### Quantifiers
|
||||
|
||||
Expression | Description
|
||||
:--|:--
|
||||
`{2}` | exactly 2
|
||||
`{2,}` | at least 2
|
||||
`{2,7}` | at least 2 but no more than 7
|
||||
`*` | 0 or more
|
||||
`+` | 1 or more
|
||||
`?` | exactly 0 or 1
|
||||
|
||||
- The quantifier goes *after* the expression to be quantified.
|
||||
|
||||
### Boundaries
|
||||
|
||||
Expression | Description
|
||||
:--|:--
|
||||
`^` | start of string
|
||||
`$` | end of string
|
||||
`\b` | word boundary
|
||||
|
||||
- How word boundary matching works:
|
||||
- At the beginning of the string if the first character is `\w`.
|
||||
- Between two adjacent characters within the string, if the first character is `\w` and the second character is `\W`.
|
||||
- At the end of the string if the last character is `\w`.
|
||||
|
||||
### Matching
|
||||
|
||||
Expression | Description
|
||||
:--|:--
|
||||
`foo\|bar` | match either `foo` or `bar`
|
||||
`foo(?=bar)` | match `foo` if it’s before `bar`
|
||||
`foo(?!bar)` | match `foo` if it’s *not* before `bar`
|
||||
`(?<=bar)foo` | match `foo` if it’s after `bar`
|
||||
`(?<!bar)foo` | match `foo` if it’s *not* after `bar`
|
||||
|
||||
### Grouping and capturing
|
||||
|
||||
Expression | Description
|
||||
:--|:--
|
||||
`(foo)` | capturing group; match and capture `foo`
|
||||
`(?:foo)` | non-capturing group; match `foo` but *without* capturing `foo`
|
||||
`(foo)bar\1` | `\1` is a backreference to the 1st capturing group; match `foobarfoo`
|
||||
|
||||
- Capturing groups are only relevant in the following methods:
|
||||
- `string.match(regexp)`
|
||||
- `string.matchAll(regexp)`
|
||||
- `string.replace(regexp, callback)`
|
||||
- `\N` is a backreference to the `Nth` capturing group. Capturing groups are numbered starting from 1.
|
||||
|
||||
## References and tools
|
||||
|
||||
- [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions)
|
||||
- [RegExplained](https://leaverou.github.io/regexplained/)
|
||||
@@ -0,0 +1,32 @@
|
||||
<script setup lang="ts">
|
||||
import { useThemeVars } from 'naive-ui';
|
||||
import Memo from './regex-memo.content.md';
|
||||
|
||||
const themeVars = useThemeVars();
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div>
|
||||
<Memo />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style lang="less" scoped>
|
||||
::v-deep(pre) {
|
||||
margin: 0;
|
||||
padding: 15px 22px;
|
||||
background-color: v-bind('themeVars.cardColor');
|
||||
border-radius: 4px;
|
||||
overflow: auto;
|
||||
}
|
||||
::v-deep(table) {
|
||||
border-collapse: collapse;
|
||||
}
|
||||
::v-deep(table), ::v-deep(td), ::v-deep(th) {
|
||||
border: 1px solid v-bind('themeVars.textColor1');
|
||||
padding: 5px;
|
||||
}
|
||||
::v-deep(a) {
|
||||
color: v-bind('themeVars.textColor1');
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,12 @@
|
||||
import { Language } from '@vicons/tabler';
|
||||
import { defineTool } from '../tool';
|
||||
|
||||
export const tool = defineTool({
|
||||
name: 'Regex Tester',
|
||||
path: '/regex-tester',
|
||||
description: 'Test your regular expressions with sample text.',
|
||||
keywords: ['regex', 'tester', 'sample', 'expression'],
|
||||
component: () => import('./regex-tester.vue'),
|
||||
icon: Language,
|
||||
createdAt: new Date('2024-09-20'),
|
||||
});
|
||||
@@ -0,0 +1,106 @@
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import { matchRegex } from './regex-tester.service';
|
||||
|
||||
const regexesData = [
|
||||
{
|
||||
regex: '',
|
||||
text: '',
|
||||
flags: '',
|
||||
result: [],
|
||||
},
|
||||
{
|
||||
regex: '.*',
|
||||
text: '',
|
||||
flags: '',
|
||||
result: [],
|
||||
},
|
||||
{
|
||||
regex: '',
|
||||
text: 'aaa',
|
||||
flags: '',
|
||||
result: [],
|
||||
},
|
||||
{
|
||||
regex: 'a',
|
||||
text: 'baaa',
|
||||
flags: '',
|
||||
result: [
|
||||
{
|
||||
captures: [],
|
||||
groups: [],
|
||||
index: 1,
|
||||
value: 'a',
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
regex: '(.)(?<g>r)',
|
||||
text: 'azertyr',
|
||||
flags: 'g',
|
||||
result: [
|
||||
{
|
||||
captures: [
|
||||
{
|
||||
end: 3,
|
||||
name: '1',
|
||||
start: 2,
|
||||
value: 'e',
|
||||
},
|
||||
{
|
||||
end: 4,
|
||||
name: '2',
|
||||
start: 3,
|
||||
value: 'r',
|
||||
},
|
||||
],
|
||||
groups: [
|
||||
{
|
||||
end: 4,
|
||||
name: 'g',
|
||||
start: 3,
|
||||
value: 'r',
|
||||
},
|
||||
],
|
||||
index: 2,
|
||||
value: 'er',
|
||||
},
|
||||
{
|
||||
captures: [
|
||||
{
|
||||
end: 6,
|
||||
name: '1',
|
||||
start: 5,
|
||||
value: 'y',
|
||||
},
|
||||
{
|
||||
end: 7,
|
||||
name: '2',
|
||||
start: 6,
|
||||
value: 'r',
|
||||
},
|
||||
],
|
||||
groups: [
|
||||
{
|
||||
end: 7,
|
||||
name: 'g',
|
||||
start: 6,
|
||||
value: 'r',
|
||||
},
|
||||
],
|
||||
index: 5,
|
||||
value: 'yr',
|
||||
},
|
||||
],
|
||||
},
|
||||
];
|
||||
|
||||
describe('regex-tester', () => {
|
||||
for (const reg of regexesData) {
|
||||
const { regex, text, flags, result: expected_result } = reg;
|
||||
it(`Should matchRegex("${regex}","${text}","${flags}") return correct result`, async () => {
|
||||
const result = matchRegex(regex, text, `${flags}d`);
|
||||
|
||||
expect(result).to.deep.equal(expected_result);
|
||||
});
|
||||
}
|
||||
});
|
||||
@@ -0,0 +1,61 @@
|
||||
interface RegExpGroupIndices {
|
||||
[name: string]: [number, number]
|
||||
}
|
||||
interface RegExpIndices extends Array<[number, number]> {
|
||||
groups: RegExpGroupIndices
|
||||
}
|
||||
interface RegExpExecArrayWithIndices extends RegExpExecArray {
|
||||
indices: RegExpIndices
|
||||
}
|
||||
interface GroupCapture {
|
||||
name: string
|
||||
value: string
|
||||
start: number
|
||||
end: number
|
||||
};
|
||||
|
||||
export function matchRegex(regex: string, text: string, flags: string) {
|
||||
// if (regex === '' || text === '') {
|
||||
// return [];
|
||||
// }
|
||||
|
||||
let lastIndex = -1;
|
||||
const re = new RegExp(regex, flags);
|
||||
const results = [];
|
||||
let match = re.exec(text) as RegExpExecArrayWithIndices;
|
||||
while (match !== null) {
|
||||
if (re.lastIndex === lastIndex || match[0] === '') {
|
||||
break;
|
||||
}
|
||||
const indices = match.indices;
|
||||
const captures: Array<GroupCapture> = [];
|
||||
Object.entries(match).forEach(([captureName, captureValue]) => {
|
||||
if (captureName !== '0' && captureName.match(/\d+/)) {
|
||||
captures.push({
|
||||
name: captureName,
|
||||
value: captureValue,
|
||||
start: indices[Number(captureName)][0],
|
||||
end: indices[Number(captureName)][1],
|
||||
});
|
||||
}
|
||||
});
|
||||
const groups: Array<GroupCapture> = [];
|
||||
Object.entries(match.groups || {}).forEach(([groupName, groupValue]) => {
|
||||
groups.push({
|
||||
name: groupName,
|
||||
value: groupValue,
|
||||
start: indices.groups[groupName][0],
|
||||
end: indices.groups[groupName][1],
|
||||
});
|
||||
});
|
||||
results.push({
|
||||
index: match.index,
|
||||
value: match[0],
|
||||
captures,
|
||||
groups,
|
||||
});
|
||||
lastIndex = re.lastIndex;
|
||||
match = re.exec(text) as RegExpExecArrayWithIndices;
|
||||
}
|
||||
return results;
|
||||
}
|
||||
@@ -0,0 +1,193 @@
|
||||
<script setup lang="ts">
|
||||
import RandExp from 'randexp';
|
||||
import { render } from '@regexper/render';
|
||||
import type { ShadowRootExpose } from 'vue-shadow-dom';
|
||||
import { matchRegex } from './regex-tester.service';
|
||||
import { useValidation } from '@/composable/validation';
|
||||
import { useQueryParamOrStorage } from '@/composable/queryParams';
|
||||
|
||||
const regex = useQueryParamOrStorage({ name: 'regex', storageName: 'regex-tester:regex', defaultValue: '' });
|
||||
const text = ref('');
|
||||
const global = ref(true);
|
||||
const ignoreCase = ref(false);
|
||||
const multiline = ref(false);
|
||||
const dotAll = ref(true);
|
||||
const unicode = ref(true);
|
||||
const unicodeSets = ref(false);
|
||||
const visualizerSVG = ref<ShadowRootExpose>();
|
||||
|
||||
const regexValidation = useValidation({
|
||||
source: regex,
|
||||
rules: [
|
||||
{
|
||||
message: 'Invalid regex: {0}',
|
||||
validator: value => new RegExp(value),
|
||||
getErrorMessage: (value) => {
|
||||
const _ = new RegExp(value);
|
||||
return '';
|
||||
},
|
||||
},
|
||||
],
|
||||
});
|
||||
const results = computed(() => {
|
||||
let flags = 'd';
|
||||
if (global.value) {
|
||||
flags += 'g';
|
||||
}
|
||||
if (ignoreCase.value) {
|
||||
flags += 'i';
|
||||
}
|
||||
if (multiline.value) {
|
||||
flags += 'm';
|
||||
}
|
||||
if (dotAll.value) {
|
||||
flags += 's';
|
||||
}
|
||||
if (unicode.value) {
|
||||
flags += 'u';
|
||||
}
|
||||
else if (unicodeSets.value) {
|
||||
flags += 'v';
|
||||
}
|
||||
|
||||
try {
|
||||
return matchRegex(regex.value, text.value, flags);
|
||||
}
|
||||
catch (_) {
|
||||
return [];
|
||||
}
|
||||
});
|
||||
|
||||
const sample = computed(() => {
|
||||
try {
|
||||
const randexp = new RandExp(new RegExp(regex.value.replace(/\(\?\<[^\>]*\>/g, '(?:')));
|
||||
return randexp.gen();
|
||||
}
|
||||
catch (_) {
|
||||
return '';
|
||||
}
|
||||
});
|
||||
|
||||
watchEffect(
|
||||
async () => {
|
||||
const regexValue = regex.value;
|
||||
// shadow root is required:
|
||||
// @regexper/render append a <defs><style> that broke svg transparency of icons in the whole site
|
||||
const visualizer = visualizerSVG.value?.shadow_root;
|
||||
if (visualizer) {
|
||||
while (visualizer.lastChild) {
|
||||
visualizer.removeChild(visualizer.lastChild);
|
||||
}
|
||||
const svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg');
|
||||
try {
|
||||
await render(regexValue, svg);
|
||||
}
|
||||
catch (_) {
|
||||
}
|
||||
visualizer.appendChild(svg);
|
||||
}
|
||||
},
|
||||
);
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div max-w-600px>
|
||||
<c-card title="Regex" mb-1>
|
||||
<c-input-text
|
||||
v-model:value="regex"
|
||||
label="Regex to test:"
|
||||
placeholder="Put the regex to test"
|
||||
multiline
|
||||
rows="3"
|
||||
:validation="regexValidation"
|
||||
/>
|
||||
<router-link target="_blank" to="/regex-memo" mb-1 mt-1>
|
||||
See Regular Expression Cheatsheet
|
||||
</router-link>
|
||||
<n-space>
|
||||
<n-checkbox v-model:checked="global">
|
||||
<span title="Global search">Global search. (<code>g</code>)</span>
|
||||
</n-checkbox>
|
||||
<n-checkbox v-model:checked="ignoreCase">
|
||||
<span title="Case-insensitive search">Case-insensitive search. (<code>i</code>)</span>
|
||||
</n-checkbox>
|
||||
<n-checkbox v-model:checked="multiline">
|
||||
<span title="Allows ^ and $ to match next to newline characters.">Multiline(<code>m</code>)</span>
|
||||
</n-checkbox>
|
||||
<n-checkbox v-model:checked="dotAll">
|
||||
<span title="Allows . to match newline characters.">Singleline(<code>s</code>)</span>
|
||||
</n-checkbox>
|
||||
<n-checkbox v-model:checked="unicode">
|
||||
<span title="Unicode; treat a pattern as a sequence of Unicode code points.">Unicode(<code>u</code>)</span>
|
||||
</n-checkbox>
|
||||
<n-checkbox v-model:checked="unicodeSets">
|
||||
<span title="An upgrade to the u mode with more Unicode features.">Unicode Sets (<code>v</code>)</span>
|
||||
</n-checkbox>
|
||||
</n-space>
|
||||
|
||||
<n-divider />
|
||||
|
||||
<c-input-text
|
||||
v-model:value="text"
|
||||
label="Text to match:"
|
||||
placeholder="Put the text to match"
|
||||
multiline
|
||||
rows="5"
|
||||
/>
|
||||
</c-card>
|
||||
|
||||
<c-card title="Matches" mb-1 mt-3>
|
||||
<n-table v-if="results?.length > 0">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">
|
||||
Index in text
|
||||
</th>
|
||||
<th scope="col">
|
||||
Value
|
||||
</th>
|
||||
<th scope="col">
|
||||
Captures
|
||||
</th>
|
||||
<th scope="col">
|
||||
Groups
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr v-for="match of results" :key="match.index">
|
||||
<td>{{ match.index }}</td>
|
||||
<td>{{ match.value }}</td>
|
||||
<td>
|
||||
<ul>
|
||||
<li v-for="capture in match.captures" :key="capture.name">
|
||||
"{{ capture.name }}" = {{ capture.value }} [{{ capture.start }} - {{ capture.end }}]
|
||||
</li>
|
||||
</ul>
|
||||
</td>
|
||||
<td>
|
||||
<ul>
|
||||
<li v-for="group in match.groups" :key="group.name">
|
||||
"{{ group.name }}" = {{ group.value }} [{{ group.start }} - {{ group.end }}]
|
||||
</li>
|
||||
</ul>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</n-table>
|
||||
<c-alert v-else>
|
||||
No match
|
||||
</c-alert>
|
||||
</c-card>
|
||||
|
||||
<c-card title="Sample matching text" mt-3>
|
||||
<pre style="white-space: pre-wrap; word-break: break-all;">{{ sample }}</pre>
|
||||
</c-card>
|
||||
|
||||
<c-card title="Regex Diagram" style="overflow-x: scroll;" mt-3>
|
||||
<shadow-root ref="visualizerSVG">
|
||||
 
|
||||
</shadow-root>
|
||||
</c-card>
|
||||
</div>
|
||||
</template>
|
||||
@@ -0,0 +1,12 @@
|
||||
import { Gauge } from '@vicons/tabler';
|
||||
import { defineTool } from '../tool';
|
||||
|
||||
export const tool = defineTool({
|
||||
name: 'Volume Units Converter',
|
||||
path: '/volume-converter',
|
||||
description: 'Convert values from volume units',
|
||||
keywords: ['volume', 'converter'],
|
||||
component: () => import('./volume-converter.vue'),
|
||||
icon: Gauge,
|
||||
createdAt: new Date('2024-08-15'),
|
||||
});
|
||||
@@ -0,0 +1,68 @@
|
||||
<script setup lang="ts">
|
||||
import UnitsConverter from '@/components/UnitsConverter.vue';
|
||||
|
||||
const supportedUnits = {
|
||||
'm³': 'cubic meter/stere',
|
||||
'Pm³': 'cubic petameter',
|
||||
'Tm³': 'cubic terameter',
|
||||
'Gm³': 'cubic gigameter',
|
||||
'Mm³': 'cubic megameter',
|
||||
'km³': 'cubic kilometer',
|
||||
'hm³': 'cubic hectometer',
|
||||
'dam³': 'cubic decameter',
|
||||
'dm³': 'cubic decimeter',
|
||||
'cm³': 'cubic centimeter',
|
||||
'mm³': 'cubic millimeter',
|
||||
'µm³': 'cubic micrometer',
|
||||
'nm³': 'cubic nanometer',
|
||||
'pm³': 'cubic picometer',
|
||||
'fm³': 'cubic femtometer',
|
||||
'L': 'liter',
|
||||
'Pl': 'petaliter',
|
||||
'Tl': 'teraliter',
|
||||
'Gl': 'gigaliter',
|
||||
'Ml': 'megaliter',
|
||||
'kL': 'kiloliter',
|
||||
'hL': 'hectoliter',
|
||||
'daL': 'decaliter',
|
||||
'dL': 'deciliter',
|
||||
'cL': 'centiliter',
|
||||
'mL': 'milliliter',
|
||||
'µL': 'microliter',
|
||||
'nL': 'nanoliter',
|
||||
'pL': 'picoliter',
|
||||
'fL': 'femtoliter',
|
||||
'mi³': 'cubic mile',
|
||||
'ac ft': 'acre-foot',
|
||||
'yd³': 'cubic yard',
|
||||
'ft³': 'cubic foot',
|
||||
'board feet': 'board feet',
|
||||
'in³': 'cubic inch',
|
||||
'MTON': 'measurement ton',
|
||||
'imp bbl': 'imperial barrel',
|
||||
'imp bsh': 'imperial bushel',
|
||||
'pk': 'imperial peck',
|
||||
'imp gal': 'imperial gallon',
|
||||
'imp qt': 'imperial quart',
|
||||
'imp pt': 'imperial pint',
|
||||
'imp fl oz': 'imperial fluid ounce',
|
||||
'tsp': 'teaspoon',
|
||||
'tbsp': 'tablespoon',
|
||||
'fl oz': 'US fluid ounce',
|
||||
'c': 'cup',
|
||||
'US lc': 'US legal cup',
|
||||
'pt': 'US liquid pint',
|
||||
'qt': 'US liquid quart',
|
||||
'gal': 'US liquid gallon',
|
||||
'US bsh': 'US bushel',
|
||||
'US pk': 'US peck',
|
||||
'US dry gal': 'US dry gallon',
|
||||
'US dry bbl': 'US dry barrel',
|
||||
'US dry qt': 'US dry quart',
|
||||
'US dry pt': 'US dry pint',
|
||||
};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<UnitsConverter default-unit="m³" :supported-units="supportedUnits" label-width="150px" />
|
||||
</template>
|
||||
@@ -0,0 +1,12 @@
|
||||
import { Braces } from '@vicons/tabler';
|
||||
import { defineTool } from '../tool';
|
||||
|
||||
export const tool = defineTool({
|
||||
name: 'XML to JSON',
|
||||
path: '/xml-to-json',
|
||||
description: 'Convert XML to JSON',
|
||||
keywords: ['xml', 'json'],
|
||||
component: () => import('./xml-to-json.vue'),
|
||||
icon: Braces,
|
||||
createdAt: new Date('2024-08-09'),
|
||||
});
|
||||
@@ -0,0 +1,32 @@
|
||||
<script setup lang="ts">
|
||||
import convert from 'xml-js';
|
||||
import { isValidXML } from '../xml-formatter/xml-formatter.service';
|
||||
import { withDefaultOnError } from '@/utils/defaults';
|
||||
import type { UseValidationRule } from '@/composable/validation';
|
||||
|
||||
const defaultValue = '<a x="1.234" y="It\'s"/>';
|
||||
function transformer(value: string) {
|
||||
return withDefaultOnError(() => {
|
||||
return JSON.stringify(convert.xml2js(value, { compact: true }), null, 2);
|
||||
}, '');
|
||||
}
|
||||
|
||||
const rules: UseValidationRule<string>[] = [
|
||||
{
|
||||
validator: isValidXML,
|
||||
message: 'Provided XML is not valid.',
|
||||
},
|
||||
];
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<format-transformer
|
||||
input-label="Your XML content"
|
||||
:input-default="defaultValue"
|
||||
input-placeholder="Paste your XML content here..."
|
||||
output-label="Converted JSON"
|
||||
output-language="json"
|
||||
:transformer="transformer"
|
||||
:input-validation-rules="rules"
|
||||
/>
|
||||
</template>
|
||||
@@ -38,7 +38,8 @@ describe('base64 utils', () => {
|
||||
|
||||
it('should throw for incorrect base64 string', () => {
|
||||
expect(() => base64ToText('a')).to.throw('Incorrect base64 string');
|
||||
expect(() => base64ToText(' ')).to.throw('Incorrect base64 string');
|
||||
// should not really be false because trimming of space is now implied
|
||||
// expect(() => base64ToText(' ')).to.throw('Incorrect base64 string');
|
||||
expect(() => base64ToText('é')).to.throw('Incorrect base64 string');
|
||||
// missing final '='
|
||||
expect(() => base64ToText('bG9yZW0gaXBzdW0')).to.throw('Incorrect base64 string');
|
||||
@@ -56,17 +57,17 @@ describe('base64 utils', () => {
|
||||
|
||||
it('should return false for incorrect base64 string', () => {
|
||||
expect(isValidBase64('a')).to.eql(false);
|
||||
expect(isValidBase64(' ')).to.eql(false);
|
||||
expect(isValidBase64('é')).to.eql(false);
|
||||
expect(isValidBase64('data:text/plain;notbase64,YQ==')).to.eql(false);
|
||||
// missing final '='
|
||||
expect(isValidBase64('bG9yZW0gaXBzdW0')).to.eql(false);
|
||||
});
|
||||
|
||||
it('should return false for untrimmed correct base64 string', () => {
|
||||
expect(isValidBase64('bG9yZW0gaXBzdW0= ')).to.eql(false);
|
||||
expect(isValidBase64(' LTE=')).to.eql(false);
|
||||
expect(isValidBase64(' YQ== ')).to.eql(false);
|
||||
it('should return true for untrimmed correct base64 string', () => {
|
||||
expect(isValidBase64('bG9yZW0gaXBzdW0= ')).to.eql(true);
|
||||
expect(isValidBase64(' LTE=')).to.eql(true);
|
||||
expect(isValidBase64(' YQ== ')).to.eql(true);
|
||||
expect(isValidBase64(' ')).to.eql(true);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
+7
-4
@@ -1,7 +1,9 @@
|
||||
import { Base64 } from 'js-base64';
|
||||
|
||||
export { textToBase64, base64ToText, isValidBase64, removePotentialDataAndMimePrefix };
|
||||
|
||||
function textToBase64(str: string, { makeUrlSafe = false }: { makeUrlSafe?: boolean } = {}) {
|
||||
const encoded = window.btoa(str);
|
||||
const encoded = Base64.encode(str);
|
||||
return makeUrlSafe ? makeUriSafe(encoded) : encoded;
|
||||
}
|
||||
|
||||
@@ -16,7 +18,7 @@ function base64ToText(str: string, { makeUrlSafe = false }: { makeUrlSafe?: bool
|
||||
}
|
||||
|
||||
try {
|
||||
return window.atob(cleanStr);
|
||||
return Base64.decode(cleanStr);
|
||||
}
|
||||
catch (_) {
|
||||
throw new Error('Incorrect base64 string');
|
||||
@@ -34,10 +36,11 @@ function isValidBase64(str: string, { makeUrlSafe = false }: { makeUrlSafe?: boo
|
||||
}
|
||||
|
||||
try {
|
||||
const reEncodedBase64 = Base64.fromUint8Array(Base64.toUint8Array(cleanStr));
|
||||
if (makeUrlSafe) {
|
||||
return removePotentialPadding(window.btoa(window.atob(cleanStr))) === cleanStr;
|
||||
return removePotentialPadding(reEncodedBase64) === cleanStr;
|
||||
}
|
||||
return window.btoa(window.atob(cleanStr)) === cleanStr;
|
||||
return reEncodedBase64 === cleanStr.replace(/\s/g, '');
|
||||
}
|
||||
catch (err) {
|
||||
return false;
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import { resolve } from 'node:path';
|
||||
import { URL, fileURLToPath } from 'node:url';
|
||||
import { nodePolyfills } from 'vite-plugin-node-polyfills';
|
||||
|
||||
import VueI18n from '@intlify/unplugin-vue-i18n/vite';
|
||||
import vue from '@vitejs/plugin-vue';
|
||||
@@ -98,7 +97,6 @@ export default defineConfig({
|
||||
resolvers: [NaiveUiResolver(), IconsResolver({ prefix: 'icon' })],
|
||||
}),
|
||||
Unocss(),
|
||||
nodePolyfills(),
|
||||
],
|
||||
base: baseUrl,
|
||||
resolve: {
|
||||
|
||||
Reference in new issue
Block a user