@jjlmoya/utils-developer 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (228) hide show
  1. package/package.json +64 -0
  2. package/src/category/i18n/en.ts +34 -0
  3. package/src/category/i18n/es.ts +34 -0
  4. package/src/category/i18n/fr.ts +34 -0
  5. package/src/category/index.ts +31 -0
  6. package/src/category/seo.astro +15 -0
  7. package/src/components/PreviewNavSidebar.astro +116 -0
  8. package/src/components/PreviewToolbar.astro +143 -0
  9. package/src/data.ts +11 -0
  10. package/src/env.d.ts +5 -0
  11. package/src/index.ts +78 -0
  12. package/src/layouts/PreviewLayout.astro +117 -0
  13. package/src/pages/[locale]/[slug].astro +146 -0
  14. package/src/pages/[locale].astro +251 -0
  15. package/src/pages/index.astro +4 -0
  16. package/src/tests/css_specificity_logic.test.ts +39 -0
  17. package/src/tests/faq_count.test.ts +19 -0
  18. package/src/tests/locale_completeness.test.ts +42 -0
  19. package/src/tests/mocks/astro_mock.js +2 -0
  20. package/src/tests/no_h1_in_components.test.ts +48 -0
  21. package/src/tests/schemas_fulfillment.test.ts +23 -0
  22. package/src/tests/seo_length.test.ts +22 -0
  23. package/src/tests/title_quality.test.ts +55 -0
  24. package/src/tests/tool_validation.test.ts +17 -0
  25. package/src/tool/aspectRatio/bibliography.astro +14 -0
  26. package/src/tool/aspectRatio/component.astro +468 -0
  27. package/src/tool/aspectRatio/i18n/en.ts +177 -0
  28. package/src/tool/aspectRatio/i18n/es.ts +177 -0
  29. package/src/tool/aspectRatio/i18n/fr.ts +177 -0
  30. package/src/tool/aspectRatio/index.ts +34 -0
  31. package/src/tool/aspectRatio/seo.astro +14 -0
  32. package/src/tool/aspectRatio/ui.ts +12 -0
  33. package/src/tool/calculadoraTiempoDatos/bibliography.astro +14 -0
  34. package/src/tool/calculadoraTiempoDatos/component.astro +829 -0
  35. package/src/tool/calculadoraTiempoDatos/i18n/en.ts +150 -0
  36. package/src/tool/calculadoraTiempoDatos/i18n/es.ts +163 -0
  37. package/src/tool/calculadoraTiempoDatos/i18n/fr.ts +150 -0
  38. package/src/tool/calculadoraTiempoDatos/index.ts +33 -0
  39. package/src/tool/calculadoraTiempoDatos/seo.astro +14 -0
  40. package/src/tool/calculadoraTiempoDatos/ui.ts +24 -0
  41. package/src/tool/colorConverter/bibliography.astro +14 -0
  42. package/src/tool/colorConverter/component.astro +504 -0
  43. package/src/tool/colorConverter/i18n/en.ts +126 -0
  44. package/src/tool/colorConverter/i18n/es.ts +126 -0
  45. package/src/tool/colorConverter/i18n/fr.ts +126 -0
  46. package/src/tool/colorConverter/index.ts +33 -0
  47. package/src/tool/colorConverter/seo.astro +14 -0
  48. package/src/tool/colorConverter/ui.ts +16 -0
  49. package/src/tool/conversorExcelCsvHtml/bibliography.astro +14 -0
  50. package/src/tool/conversorExcelCsvHtml/component.astro +595 -0
  51. package/src/tool/conversorExcelCsvHtml/i18n/en.ts +129 -0
  52. package/src/tool/conversorExcelCsvHtml/i18n/es.ts +129 -0
  53. package/src/tool/conversorExcelCsvHtml/i18n/fr.ts +129 -0
  54. package/src/tool/conversorExcelCsvHtml/index.ts +33 -0
  55. package/src/tool/conversorExcelCsvHtml/seo.astro +14 -0
  56. package/src/tool/conversorExcelCsvHtml/ui.ts +14 -0
  57. package/src/tool/cronGenerator/bibliography.astro +14 -0
  58. package/src/tool/cronGenerator/component.astro +667 -0
  59. package/src/tool/cronGenerator/i18n/en.ts +191 -0
  60. package/src/tool/cronGenerator/i18n/es.ts +191 -0
  61. package/src/tool/cronGenerator/i18n/fr.ts +191 -0
  62. package/src/tool/cronGenerator/index.ts +34 -0
  63. package/src/tool/cronGenerator/seo.astro +14 -0
  64. package/src/tool/cronGenerator/ui.ts +45 -0
  65. package/src/tool/cssSpecificityCalculator/bibliography.astro +14 -0
  66. package/src/tool/cssSpecificityCalculator/component.astro +292 -0
  67. package/src/tool/cssSpecificityCalculator/i18n/en.ts +168 -0
  68. package/src/tool/cssSpecificityCalculator/i18n/es.ts +168 -0
  69. package/src/tool/cssSpecificityCalculator/i18n/fr.ts +168 -0
  70. package/src/tool/cssSpecificityCalculator/index.ts +34 -0
  71. package/src/tool/cssSpecificityCalculator/logic.ts +100 -0
  72. package/src/tool/cssSpecificityCalculator/seo.astro +14 -0
  73. package/src/tool/cssSpecificityCalculator/ui-controller.ts +57 -0
  74. package/src/tool/cssSpecificityCalculator/ui.ts +11 -0
  75. package/src/tool/cssToInlineConverter/bibliography.astro +14 -0
  76. package/src/tool/cssToInlineConverter/component.astro +308 -0
  77. package/src/tool/cssToInlineConverter/i18n/en.ts +160 -0
  78. package/src/tool/cssToInlineConverter/i18n/es.ts +160 -0
  79. package/src/tool/cssToInlineConverter/i18n/fr.ts +160 -0
  80. package/src/tool/cssToInlineConverter/index.ts +34 -0
  81. package/src/tool/cssToInlineConverter/seo.astro +14 -0
  82. package/src/tool/cssToInlineConverter/ui.ts +12 -0
  83. package/src/tool/duplicateCssRemover/bibliography.astro +14 -0
  84. package/src/tool/duplicateCssRemover/component.astro +353 -0
  85. package/src/tool/duplicateCssRemover/i18n/en.ts +167 -0
  86. package/src/tool/duplicateCssRemover/i18n/es.ts +167 -0
  87. package/src/tool/duplicateCssRemover/i18n/fr.ts +167 -0
  88. package/src/tool/duplicateCssRemover/index.ts +34 -0
  89. package/src/tool/duplicateCssRemover/seo.astro +14 -0
  90. package/src/tool/duplicateCssRemover/ui.ts +12 -0
  91. package/src/tool/generadorSecurityTxt/bibliography.astro +14 -0
  92. package/src/tool/generadorSecurityTxt/component.astro +473 -0
  93. package/src/tool/generadorSecurityTxt/i18n/en.ts +173 -0
  94. package/src/tool/generadorSecurityTxt/i18n/es.ts +173 -0
  95. package/src/tool/generadorSecurityTxt/i18n/fr.ts +173 -0
  96. package/src/tool/generadorSecurityTxt/index.ts +33 -0
  97. package/src/tool/generadorSecurityTxt/seo.astro +14 -0
  98. package/src/tool/generadorSecurityTxt/ui.ts +27 -0
  99. package/src/tool/hashGenerator/bibliography.astro +14 -0
  100. package/src/tool/hashGenerator/component.astro +367 -0
  101. package/src/tool/hashGenerator/i18n/en.ts +118 -0
  102. package/src/tool/hashGenerator/i18n/es.ts +118 -0
  103. package/src/tool/hashGenerator/i18n/fr.ts +118 -0
  104. package/src/tool/hashGenerator/index.ts +33 -0
  105. package/src/tool/hashGenerator/md5.ts +138 -0
  106. package/src/tool/hashGenerator/seo.astro +14 -0
  107. package/src/tool/hashGenerator/ui.ts +11 -0
  108. package/src/tool/inspectorCertificadosSsl/bibliography.astro +14 -0
  109. package/src/tool/inspectorCertificadosSsl/component.astro +580 -0
  110. package/src/tool/inspectorCertificadosSsl/i18n/en.ts +214 -0
  111. package/src/tool/inspectorCertificadosSsl/i18n/es.ts +214 -0
  112. package/src/tool/inspectorCertificadosSsl/i18n/fr.ts +214 -0
  113. package/src/tool/inspectorCertificadosSsl/index.ts +33 -0
  114. package/src/tool/inspectorCertificadosSsl/seo.astro +14 -0
  115. package/src/tool/inspectorCertificadosSsl/ui.ts +29 -0
  116. package/src/tool/jsonFormatter/bibliography.astro +14 -0
  117. package/src/tool/jsonFormatter/component.astro +590 -0
  118. package/src/tool/jsonFormatter/i18n/en.ts +156 -0
  119. package/src/tool/jsonFormatter/i18n/es.ts +156 -0
  120. package/src/tool/jsonFormatter/i18n/fr.ts +156 -0
  121. package/src/tool/jsonFormatter/index.ts +34 -0
  122. package/src/tool/jsonFormatter/seo.astro +14 -0
  123. package/src/tool/jsonFormatter/ui.ts +15 -0
  124. package/src/tool/keycode/bibliography.astro +14 -0
  125. package/src/tool/keycode/component.astro +540 -0
  126. package/src/tool/keycode/i18n/en.ts +160 -0
  127. package/src/tool/keycode/i18n/es.ts +160 -0
  128. package/src/tool/keycode/i18n/fr.ts +160 -0
  129. package/src/tool/keycode/index.ts +34 -0
  130. package/src/tool/keycode/seo.astro +14 -0
  131. package/src/tool/keycode/ui.ts +10 -0
  132. package/src/tool/llmCostCalculator/bibliography.astro +14 -0
  133. package/src/tool/llmCostCalculator/component.astro +488 -0
  134. package/src/tool/llmCostCalculator/data.ts +99 -0
  135. package/src/tool/llmCostCalculator/i18n/en.ts +165 -0
  136. package/src/tool/llmCostCalculator/i18n/es.ts +165 -0
  137. package/src/tool/llmCostCalculator/i18n/fr.ts +165 -0
  138. package/src/tool/llmCostCalculator/index.ts +34 -0
  139. package/src/tool/llmCostCalculator/seo.astro +14 -0
  140. package/src/tool/llmCostCalculator/ui.ts +11 -0
  141. package/src/tool/mobileMockupGenerator/app.ts +614 -0
  142. package/src/tool/mobileMockupGenerator/bibliography.astro +14 -0
  143. package/src/tool/mobileMockupGenerator/component.astro +1044 -0
  144. package/src/tool/mobileMockupGenerator/constants.ts +48 -0
  145. package/src/tool/mobileMockupGenerator/i18n/en.ts +121 -0
  146. package/src/tool/mobileMockupGenerator/i18n/es.ts +121 -0
  147. package/src/tool/mobileMockupGenerator/i18n/fr.ts +121 -0
  148. package/src/tool/mobileMockupGenerator/index.ts +33 -0
  149. package/src/tool/mobileMockupGenerator/rendering.ts +189 -0
  150. package/src/tool/mobileMockupGenerator/seo.astro +14 -0
  151. package/src/tool/mobileMockupGenerator/store.ts +145 -0
  152. package/src/tool/mobileMockupGenerator/types.ts +41 -0
  153. package/src/tool/mobileMockupGenerator/ui.ts +48 -0
  154. package/src/tool/musicalTypography/bibliography.astro +14 -0
  155. package/src/tool/musicalTypography/component.astro +480 -0
  156. package/src/tool/musicalTypography/i18n/en.ts +179 -0
  157. package/src/tool/musicalTypography/i18n/es.ts +179 -0
  158. package/src/tool/musicalTypography/i18n/fr.ts +179 -0
  159. package/src/tool/musicalTypography/index.ts +33 -0
  160. package/src/tool/musicalTypography/seo.astro +14 -0
  161. package/src/tool/musicalTypography/ui.ts +25 -0
  162. package/src/tool/placeholderGenerator/bibliography.astro +14 -0
  163. package/src/tool/placeholderGenerator/component.astro +499 -0
  164. package/src/tool/placeholderGenerator/i18n/en.ts +176 -0
  165. package/src/tool/placeholderGenerator/i18n/es.ts +176 -0
  166. package/src/tool/placeholderGenerator/i18n/fr.ts +176 -0
  167. package/src/tool/placeholderGenerator/index.ts +34 -0
  168. package/src/tool/placeholderGenerator/seo.astro +14 -0
  169. package/src/tool/placeholderGenerator/ui.ts +14 -0
  170. package/src/tool/promptLibrary/bibliography.astro +14 -0
  171. package/src/tool/promptLibrary/component.astro +1131 -0
  172. package/src/tool/promptLibrary/controller.ts +49 -0
  173. package/src/tool/promptLibrary/i18n/en.ts +131 -0
  174. package/src/tool/promptLibrary/i18n/es.ts +131 -0
  175. package/src/tool/promptLibrary/i18n/fr.ts +126 -0
  176. package/src/tool/promptLibrary/index.ts +33 -0
  177. package/src/tool/promptLibrary/seo.astro +14 -0
  178. package/src/tool/promptLibrary/ui.ts +29 -0
  179. package/src/tool/readabilityCalculator/bibliography.astro +14 -0
  180. package/src/tool/readabilityCalculator/component.astro +534 -0
  181. package/src/tool/readabilityCalculator/i18n/en.ts +133 -0
  182. package/src/tool/readabilityCalculator/i18n/es.ts +133 -0
  183. package/src/tool/readabilityCalculator/i18n/fr.ts +133 -0
  184. package/src/tool/readabilityCalculator/index.ts +33 -0
  185. package/src/tool/readabilityCalculator/seo.astro +14 -0
  186. package/src/tool/readabilityCalculator/ui.ts +27 -0
  187. package/src/tool/svgSanitizer/bibliography.astro +14 -0
  188. package/src/tool/svgSanitizer/component.astro +554 -0
  189. package/src/tool/svgSanitizer/i18n/en.ts +125 -0
  190. package/src/tool/svgSanitizer/i18n/es.ts +125 -0
  191. package/src/tool/svgSanitizer/i18n/fr.ts +125 -0
  192. package/src/tool/svgSanitizer/index.ts +33 -0
  193. package/src/tool/svgSanitizer/seo.astro +14 -0
  194. package/src/tool/svgSanitizer/ui.ts +18 -0
  195. package/src/tool/svgToCss/bibliography.astro +14 -0
  196. package/src/tool/svgToCss/component.astro +381 -0
  197. package/src/tool/svgToCss/i18n/en.ts +174 -0
  198. package/src/tool/svgToCss/i18n/es.ts +174 -0
  199. package/src/tool/svgToCss/i18n/fr.ts +174 -0
  200. package/src/tool/svgToCss/index.ts +34 -0
  201. package/src/tool/svgToCss/seo.astro +14 -0
  202. package/src/tool/svgToCss/ui.ts +13 -0
  203. package/src/tool/urlCleaner/bibliography.astro +14 -0
  204. package/src/tool/urlCleaner/component.astro +458 -0
  205. package/src/tool/urlCleaner/i18n/en.ts +116 -0
  206. package/src/tool/urlCleaner/i18n/es.ts +116 -0
  207. package/src/tool/urlCleaner/i18n/fr.ts +116 -0
  208. package/src/tool/urlCleaner/index.ts +33 -0
  209. package/src/tool/urlCleaner/seo.astro +14 -0
  210. package/src/tool/urlCleaner/ui.ts +12 -0
  211. package/src/tool/urlEncoderDecoder/bibliography.astro +14 -0
  212. package/src/tool/urlEncoderDecoder/component.astro +291 -0
  213. package/src/tool/urlEncoderDecoder/i18n/en.ts +162 -0
  214. package/src/tool/urlEncoderDecoder/i18n/es.ts +162 -0
  215. package/src/tool/urlEncoderDecoder/i18n/fr.ts +162 -0
  216. package/src/tool/urlEncoderDecoder/index.ts +34 -0
  217. package/src/tool/urlEncoderDecoder/seo.astro +14 -0
  218. package/src/tool/urlEncoderDecoder/ui.ts +11 -0
  219. package/src/tool/utmGenerator/bibliography.astro +14 -0
  220. package/src/tool/utmGenerator/component.astro +270 -0
  221. package/src/tool/utmGenerator/i18n/en.ts +117 -0
  222. package/src/tool/utmGenerator/i18n/es.ts +117 -0
  223. package/src/tool/utmGenerator/i18n/fr.ts +117 -0
  224. package/src/tool/utmGenerator/index.ts +33 -0
  225. package/src/tool/utmGenerator/seo.astro +14 -0
  226. package/src/tool/utmGenerator/ui.ts +13 -0
  227. package/src/tools.ts +27 -0
  228. package/src/types.ts +72 -0
@@ -0,0 +1,33 @@
1
+ import type { DeveloperToolEntry, ToolLocaleContent, ToolDefinition } from '../../types';
2
+ import InspectorCertificadosSslComponent from './component.astro';
3
+ import InspectorCertificadosSslSEO from './seo.astro';
4
+ import InspectorCertificadosSslBibliography from './bibliography.astro';
5
+ import type { InspectorCertificadosSslUI } from './ui';
6
+
7
+ export type InspectorCertificadosSslLocaleContent = ToolLocaleContent<InspectorCertificadosSslUI>;
8
+
9
+ import { content as es } from './i18n/es';
10
+ import { content as en } from './i18n/en';
11
+ import { content as fr } from './i18n/fr';
12
+
13
+ export const inspectorCertificadosSsl: DeveloperToolEntry<InspectorCertificadosSslUI> = {
14
+ id: 'inspector-certificados-ssl',
15
+ icons: {
16
+ bg: 'mdi:security',
17
+ fg: 'mdi:certificate',
18
+ },
19
+ i18n: {
20
+ es: async () => es,
21
+ en: async () => en,
22
+ fr: async () => fr,
23
+ },
24
+ };
25
+
26
+ export { InspectorCertificadosSslComponent, InspectorCertificadosSslSEO, InspectorCertificadosSslBibliography };
27
+
28
+ export const INSPECTOR_CERTIFICADOS_SSL_TOOL: ToolDefinition = {
29
+ entry: inspectorCertificadosSsl,
30
+ Component: InspectorCertificadosSslComponent,
31
+ SEOComponent: InspectorCertificadosSslSEO,
32
+ BibliographyComponent: InspectorCertificadosSslBibliography,
33
+ };
@@ -0,0 +1,14 @@
1
+ ---
2
+ import { SEORenderer } from '@jjlmoya/utils-shared';
3
+ import { inspectorCertificadosSsl } from './index';
4
+ import type { KnownLocale } from '../../types';
5
+
6
+ interface Props {
7
+ locale?: KnownLocale;
8
+ }
9
+
10
+ const { locale = 'es' } = Astro.props;
11
+ const content = await inspectorCertificadosSsl.i18n[locale]?.();
12
+ ---
13
+
14
+ {content && <SEORenderer content={{ locale, sections: content.seo }} />}
@@ -0,0 +1,29 @@
1
+ export interface InspectorCertificadosSslUI extends Record<string, string> {
2
+ labelAnalyzeCertificate: string;
3
+ dragDropText: string;
4
+ dragDropSubtext: string;
5
+ cardStatusTitle: string;
6
+ cardSubjectTitle: string;
7
+ cardIssuerTitle: string;
8
+ cardFingerprintsTitle: string;
9
+ cardTechnicalTitle: string;
10
+ labelValidityStatus: string;
11
+ labelExpiryDate: string;
12
+ labelIssueDate: string;
13
+ labelSha256: string;
14
+ labelSha1: string;
15
+ labelSignatureAlgorithm: string;
16
+ labelVersion: string;
17
+ labelSerialNumber: string;
18
+ labelCommonName: string;
19
+ labelOrganization: string;
20
+ labelOrgUnit: string;
21
+ labelLocality: string;
22
+ labelState: string;
23
+ labelCountry: string;
24
+ labelEmail: string;
25
+ statusValid: string;
26
+ statusExpired: string;
27
+ errorMessageInvalid: string;
28
+ supportedFormats: string;
29
+ }
@@ -0,0 +1,14 @@
1
+ ---
2
+ import { Bibliography as SharedBibliography } from '@jjlmoya/utils-shared';
3
+ import { jsonFormatter } from './index';
4
+ import type { KnownLocale } from '../../types';
5
+
6
+ interface Props {
7
+ locale?: KnownLocale;
8
+ }
9
+
10
+ const { locale = 'es' } = Astro.props;
11
+ const content = await jsonFormatter.i18n[locale]?.();
12
+ ---
13
+
14
+ {content && <SharedBibliography links={content.bibliography} />}
@@ -0,0 +1,590 @@
1
+ ---
2
+ import type { KnownLocale } from '../../types';
3
+ import type { JsonFormatterUI } from './ui';
4
+
5
+ interface Props {
6
+ locale?: KnownLocale;
7
+ ui?: Record<string, unknown>;
8
+ }
9
+
10
+ const { ui } = Astro.props;
11
+ const t = (ui ?? {}) as JsonFormatterUI;
12
+ ---
13
+
14
+ <div
15
+ class="jf-root"
16
+ data-status-waiting={t.statusWaiting}
17
+ data-status-valid={t.statusValid}
18
+ data-status-invalid={t.statusInvalid}
19
+ data-toast-copied={t.toastCopied}
20
+ data-toast-fixed={t.toastFixed}
21
+ data-toast-fix-failed={t.toastFixFailed}
22
+ data-btn-minify={t.btnMinify}
23
+ data-btn-beautify={t.btnBeautify}
24
+ >
25
+ <div class="jf-toolbar">
26
+ <div class="jf-status-pill">
27
+ <span id="jf-status-badge" class="jf-badge jf-badge-empty"></span>
28
+ <span id="jf-status-text" class="jf-status-text jf-text-empty">{t.statusWaiting}</span>
29
+ </div>
30
+
31
+ <div class="jf-actions">
32
+ <button id="jf-btn-minify" class="jf-btn jf-btn-muted">
33
+ <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true">
34
+ <path d="M19 11H7.83l4.88-4.88c.39-.39.39-1.03 0-1.42-.39-.39-1.02-.39-1.41 0l-6.59 6.59c-.39.39-.39 1.02 0 1.41l6.59 6.59c.39.39 1.02.39 1.41 0 .39-.39.39-1.02 0-1.41L7.83 13H19c.55 0 1-.45 1-1s-.45-1-1-1z"/>
35
+ </svg>
36
+ <span id="jf-btn-minify-text">{t.btnMinify}</span>
37
+ </button>
38
+ <button id="jf-btn-fix" class="jf-btn jf-btn-amber">
39
+ <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true">
40
+ <path d="M7.5 5.6L10 7 8.6 4.5 10 2 7.5 3.4 5 2l1.4 2.5L5 7zm12 9.8L17 14l1.4 2.5L17 19l2.5-1.4L22 19l-1.4-2.5L22 14zM22 2l-2.5 1.4L17 2l1.4 2.5L17 7l2.5-1.4L22 7l-1.4-2.5zm-7.63 5.29a.9959.9959 0 0 0-1.41 0L1.29 18.96c-.39.39-.39 1.02 0 1.41l2.34 2.34c.39.39 1.02.39 1.41 0L16.7 11.05c.39-.39.39-1.02 0-1.41l-2.33-2.35zm-1.03 5.49l-2.12-2.12 2.44-2.44 2.12 2.12-2.44 2.44z"/>
41
+ </svg>
42
+ {t.btnFix}
43
+ </button>
44
+ <div class="jf-divider"></div>
45
+ <button id="jf-btn-copy" class="jf-btn jf-btn-emerald">
46
+ <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true">
47
+ <path d="M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12V1zm3 4H8c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h11c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm0 16H8V7h11v14z"/>
48
+ </svg>
49
+ {t.btnCopy}
50
+ </button>
51
+ </div>
52
+ </div>
53
+
54
+ <div class="jf-grid">
55
+ <div class="jf-panel">
56
+ <div class="jf-panel-header">
57
+ <span>{t.labelInput}</span>
58
+ </div>
59
+ <textarea
60
+ id="jf-input"
61
+ class="jf-textarea"
62
+ placeholder={t.placeholder}
63
+ spellcheck="false"
64
+ ></textarea>
65
+ </div>
66
+
67
+ <div class="jf-panel">
68
+ <div class="jf-panel-header">
69
+ <span>{t.labelOutput}</span>
70
+ <span id="jf-size-info" class="jf-size-info">0 B</span>
71
+ </div>
72
+ <pre id="jf-output" tabindex="0" class="jf-output"><code id="jf-code"></code></pre>
73
+ </div>
74
+ </div>
75
+
76
+ <div id="jf-toast" class="jf-toast"></div>
77
+ </div>
78
+
79
+ <style>
80
+ .jf-root {
81
+ width: 100%;
82
+ max-width: 72rem;
83
+ margin: 0 auto;
84
+ display: flex;
85
+ flex-direction: column;
86
+ gap: 1.5rem;
87
+ }
88
+
89
+ .jf-toolbar {
90
+ display: flex;
91
+ flex-wrap: wrap;
92
+ align-items: center;
93
+ justify-content: space-between;
94
+ gap: 1rem;
95
+ background: rgba(255, 255, 255, 0.5);
96
+ backdrop-filter: blur(8px);
97
+ padding: 1rem;
98
+ border-radius: 1rem;
99
+ border: 1px solid rgba(0, 0, 0, 0.08);
100
+ box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
101
+ }
102
+
103
+ .jf-status-pill {
104
+ display: flex;
105
+ align-items: center;
106
+ gap: 0.5rem;
107
+ padding: 0.375rem 0.75rem;
108
+ background: #f1f5f9;
109
+ border-radius: 0.5rem;
110
+ font-size: 0.75rem;
111
+ text-transform: uppercase;
112
+ letter-spacing: 0.05em;
113
+ }
114
+
115
+ .jf-badge {
116
+ width: 0.5rem;
117
+ height: 0.5rem;
118
+ border-radius: 50%;
119
+ flex-shrink: 0;
120
+ transition: background 0.2s, box-shadow 0.2s;
121
+ }
122
+
123
+ .jf-status-text {
124
+ transition: color 0.2s;
125
+ }
126
+
127
+ .jf-actions {
128
+ display: flex;
129
+ flex-wrap: wrap;
130
+ align-items: center;
131
+ gap: 0.5rem;
132
+ }
133
+
134
+ .jf-btn {
135
+ display: inline-flex;
136
+ align-items: center;
137
+ gap: 0.5rem;
138
+ padding: 0.5rem 1rem;
139
+ font-size: 0.875rem;
140
+ font-weight: 500;
141
+ border: none;
142
+ border-radius: 0.5rem;
143
+ cursor: pointer;
144
+ transition: background 0.15s, transform 0.1s;
145
+ line-height: 1;
146
+ }
147
+
148
+ .jf-btn-muted {
149
+ color: #475569;
150
+ background: transparent;
151
+ }
152
+
153
+ .jf-btn-muted:hover {
154
+ background: #f1f5f9;
155
+ }
156
+
157
+ .jf-btn-amber {
158
+ color: #d97706;
159
+ background: transparent;
160
+ }
161
+
162
+ .jf-btn-amber:hover {
163
+ background: #fef3c7;
164
+ }
165
+
166
+ .jf-btn-emerald {
167
+ color: #fff;
168
+ background: #10b981;
169
+ box-shadow: 0 4px 14px rgba(16, 185, 129, 0.25);
170
+ font-weight: 700;
171
+ padding-inline: 1.5rem;
172
+ }
173
+
174
+ .jf-btn-emerald:hover {
175
+ background: #059669;
176
+ }
177
+
178
+ .jf-btn-emerald:active {
179
+ transform: scale(0.96);
180
+ }
181
+
182
+ .jf-divider {
183
+ width: 1px;
184
+ height: 2rem;
185
+ background: #e2e8f0;
186
+ margin-inline: 0.5rem;
187
+ }
188
+
189
+ .jf-grid {
190
+ display: grid;
191
+ gap: 1.5rem;
192
+ }
193
+
194
+ @media (min-width: 1024px) {
195
+ .jf-grid {
196
+ grid-template-columns: 1fr 1fr;
197
+ }
198
+ }
199
+
200
+ .jf-panel {
201
+ position: relative;
202
+ height: 600px;
203
+ display: flex;
204
+ flex-direction: column;
205
+ border-radius: 1rem;
206
+ border: 1px solid #e2e8f0;
207
+ overflow: hidden;
208
+ background: #fff;
209
+ }
210
+
211
+ .jf-panel-header {
212
+ display: flex;
213
+ justify-content: space-between;
214
+ align-items: center;
215
+ padding: 0.5rem 1rem;
216
+ background: #f8fafc;
217
+ border-bottom: 1px solid #e2e8f0;
218
+ font-size: 0.75rem;
219
+ text-transform: uppercase;
220
+ letter-spacing: 0.05em;
221
+ color: #64748b;
222
+ flex-shrink: 0;
223
+ }
224
+
225
+ .jf-size-info {
226
+ color: #94a3b8;
227
+ }
228
+
229
+ .jf-textarea {
230
+ flex: 1;
231
+ width: 100%;
232
+ padding: 1rem;
233
+ background: transparent;
234
+ font-size: 0.875rem;
235
+ line-height: 1.6;
236
+ color: #334155;
237
+ resize: none;
238
+ border: none;
239
+ outline: none;
240
+ }
241
+
242
+ .jf-textarea::placeholder {
243
+ color: #cbd5e1;
244
+ }
245
+
246
+ .jf-output {
247
+ flex: 1;
248
+ min-height: 0;
249
+ padding: 1rem;
250
+ overflow: auto;
251
+ font-size: 0.875rem;
252
+ line-height: 1.6;
253
+ color: #334155;
254
+ background: #f8fafc;
255
+ margin: 0;
256
+ white-space: pre-wrap;
257
+ overflow-wrap: break-word;
258
+ outline: none;
259
+ }
260
+
261
+ .jf-output:focus {
262
+ box-shadow: inset 0 0 0 2px rgba(168, 85, 247, 0.3);
263
+ }
264
+
265
+ .jf-toast {
266
+ position: fixed;
267
+ bottom: 2rem;
268
+ right: 2rem;
269
+ padding: 0.5rem 1rem;
270
+ background: #0f172a;
271
+ color: #fff;
272
+ border-radius: 0.5rem;
273
+ box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
274
+ font-size: 0.875rem;
275
+ font-weight: 500;
276
+ transform: translateY(5rem);
277
+ opacity: 0;
278
+ transition: transform 0.3s, opacity 0.3s;
279
+ pointer-events: none;
280
+ z-index: 50;
281
+ }
282
+
283
+ :global(.theme-dark) .jf-toolbar {
284
+ background: rgba(15, 23, 42, 0.5);
285
+ border-color: rgba(255, 255, 255, 0.08);
286
+ }
287
+
288
+ :global(.theme-dark) .jf-status-pill {
289
+ background: #1e293b;
290
+ }
291
+
292
+ :global(.theme-dark) .jf-btn-muted {
293
+ color: #cbd5e1;
294
+ }
295
+
296
+ :global(.theme-dark) .jf-btn-muted:hover {
297
+ background: #1e293b;
298
+ }
299
+
300
+ :global(.theme-dark) .jf-btn-amber {
301
+ color: #fbbf24;
302
+ }
303
+
304
+ :global(.theme-dark) .jf-btn-amber:hover {
305
+ background: rgba(251, 191, 36, 0.1);
306
+ }
307
+
308
+ :global(.theme-dark) .jf-divider {
309
+ background: #334155;
310
+ }
311
+
312
+ :global(.theme-dark) .jf-panel {
313
+ background: #0f172a;
314
+ border-color: #1e293b;
315
+ }
316
+
317
+ :global(.theme-dark) .jf-panel-header {
318
+ background: rgba(30, 41, 59, 0.5);
319
+ border-color: #1e293b;
320
+ }
321
+
322
+ :global(.theme-dark) .jf-textarea {
323
+ color: #cbd5e1;
324
+ }
325
+
326
+ :global(.theme-dark) .jf-textarea::placeholder {
327
+ color: #334155;
328
+ }
329
+
330
+ :global(.theme-dark) .jf-output {
331
+ background: #0d1117;
332
+ color: #cbd5e1;
333
+ }
334
+
335
+ :global(.theme-dark) .jf-toast {
336
+ background: #f8fafc;
337
+ color: #0f172a;
338
+ }
339
+
340
+ :global(.jf-badge-empty) {
341
+ background: #94a3b8;
342
+ }
343
+
344
+ :global(.jf-badge-valid) {
345
+ background: #10b981;
346
+ box-shadow: 0 0 8px rgba(16, 185, 129, 0.5);
347
+ }
348
+
349
+ :global(.jf-badge-invalid) {
350
+ background: #ef4444;
351
+ box-shadow: 0 0 8px rgba(239, 68, 68, 0.5);
352
+ }
353
+
354
+ :global(.jf-text-empty) {
355
+ color: #64748b;
356
+ }
357
+
358
+ :global(.jf-text-valid) {
359
+ color: #10b981;
360
+ font-weight: 600;
361
+ }
362
+
363
+ :global(.theme-dark) :global(.jf-text-valid) {
364
+ color: #34d399;
365
+ }
366
+
367
+ :global(.jf-text-invalid) {
368
+ color: #ef4444;
369
+ font-weight: 600;
370
+ }
371
+
372
+ :global(.theme-dark) :global(.jf-text-invalid) {
373
+ color: #f87171;
374
+ }
375
+
376
+ :global(.jf-toast-visible) {
377
+ transform: translateY(0);
378
+ opacity: 1;
379
+ }
380
+
381
+ :global(.jf-token-key) {
382
+ color: #7c3aed;
383
+ }
384
+
385
+ :global(.theme-dark) :global(.jf-token-key) {
386
+ color: #a78bfa;
387
+ }
388
+
389
+ :global(.jf-token-string) {
390
+ color: #16a34a;
391
+ }
392
+
393
+ :global(.theme-dark) :global(.jf-token-string) {
394
+ color: #4ade80;
395
+ }
396
+
397
+ :global(.jf-token-number) {
398
+ color: #c2410c;
399
+ }
400
+
401
+ :global(.theme-dark) :global(.jf-token-number) {
402
+ color: #fb923c;
403
+ }
404
+
405
+ :global(.jf-token-boolean) {
406
+ color: #1d4ed8;
407
+ }
408
+
409
+ :global(.theme-dark) :global(.jf-token-boolean) {
410
+ color: #60a5fa;
411
+ }
412
+
413
+ :global(.jf-token-null) {
414
+ color: #dc2626;
415
+ }
416
+
417
+ :global(.theme-dark) :global(.jf-token-null) {
418
+ color: #f87171;
419
+ }
420
+
421
+ :global(.jf-token-error) {
422
+ color: #ef4444;
423
+ }
424
+ </style>
425
+
426
+ <script>
427
+ const root = document.querySelector('.jf-root') as HTMLElement | null;
428
+ const inputEditor = document.getElementById('jf-input') as HTMLTextAreaElement | null;
429
+ const outputCode = document.getElementById('jf-code');
430
+ const statusBadge = document.getElementById('jf-status-badge');
431
+ const statusText = document.getElementById('jf-status-text');
432
+ const sizeInfo = document.getElementById('jf-size-info');
433
+ const btnMinifyText = document.getElementById('jf-btn-minify-text');
434
+ const btnFix = document.getElementById('jf-btn-fix');
435
+ const btnCopy = document.getElementById('jf-btn-copy');
436
+ const btnMinify = document.getElementById('jf-btn-minify');
437
+ const toast = document.getElementById('jf-toast');
438
+ const outputViewer = document.getElementById('jf-output');
439
+
440
+ const i18n = {
441
+ statusWaiting: root?.dataset.statusWaiting ?? 'Waiting...',
442
+ statusValid: root?.dataset.statusValid ?? 'Valid JSON',
443
+ statusInvalid: root?.dataset.statusInvalid ?? 'Invalid JSON',
444
+ toastCopied: root?.dataset.toastCopied ?? 'Copied!',
445
+ toastFixed: root?.dataset.toastFixed ?? 'JSON repaired',
446
+ toastFixFailed: root?.dataset.toastFixFailed ?? 'Could not repair',
447
+ btnMinify: root?.dataset.btnMinify ?? 'Minify',
448
+ btnBeautify: root?.dataset.btnBeautify ?? 'Beautify',
449
+ };
450
+
451
+ let currentJSON: unknown = null;
452
+ let isMinified = false;
453
+
454
+ function formatBytes(bytes: number): string {
455
+ if (bytes === 0) return '0 B';
456
+ const k = 1024;
457
+ const sizes = ['B', 'KB', 'MB'];
458
+ const i = Math.floor(Math.log(bytes) / Math.log(k));
459
+ return parseFloat((bytes / Math.pow(k, i)).toFixed(2)) + ' ' + sizes[i];
460
+ }
461
+
462
+ function setStatus(type: 'valid' | 'invalid' | 'empty'): void {
463
+ if (!statusBadge || !statusText) return;
464
+ const configs = {
465
+ valid: { badge: 'jf-badge-valid', text: 'jf-text-valid', label: i18n.statusValid },
466
+ invalid: { badge: 'jf-badge-invalid', text: 'jf-text-invalid', label: i18n.statusInvalid },
467
+ empty: { badge: 'jf-badge-empty', text: 'jf-text-empty', label: i18n.statusWaiting },
468
+ };
469
+ const cfg = configs[type];
470
+ statusBadge.className = `jf-badge ${cfg.badge}`;
471
+ statusText.className = `jf-status-text ${cfg.text}`;
472
+ statusText.textContent = cfg.label;
473
+ }
474
+
475
+ function highlightJSON(jsonStr: string): string {
476
+ if (!jsonStr) return '';
477
+ return jsonStr.replace(
478
+ /("(\\u[a-zA-Z0-9]{4}|\\[^u]|[^\\"])*"(\s*:)?|\b(true|false|null)\b|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?)/g,
479
+ (match: string) => {
480
+ let cls = 'jf-token-number';
481
+ if (/^"/.test(match)) {
482
+ cls = /:$/.test(match) ? 'jf-token-key' : 'jf-token-string';
483
+ } else if (/true|false/.test(match)) {
484
+ cls = 'jf-token-boolean';
485
+ } else if (/null/.test(match)) {
486
+ cls = 'jf-token-null';
487
+ }
488
+ return `<span class="${cls}">${match}</span>`;
489
+ }
490
+ );
491
+ }
492
+
493
+ function renderFormatted(parsed: unknown, minify: boolean): void {
494
+ const formatted = JSON.stringify(parsed, null, minify ? 0 : 2);
495
+ if (outputCode) outputCode.innerHTML = highlightJSON(formatted);
496
+ if (sizeInfo) sizeInfo.textContent = formatBytes(new Blob([formatted]).size);
497
+ }
498
+
499
+ function handleEmpty(): void {
500
+ if (outputCode) outputCode.innerHTML = '';
501
+ setStatus('empty');
502
+ currentJSON = null;
503
+ if (sizeInfo) sizeInfo.textContent = '0 B';
504
+ }
505
+
506
+ function handleParseError(raw: string, e: Error): void {
507
+ currentJSON = null;
508
+ if (outputCode)
509
+ outputCode.innerHTML = `<span class="jf-token-error">${e.message}</span>`;
510
+ setStatus('invalid');
511
+ if (sizeInfo) sizeInfo.textContent = formatBytes(new Blob([raw]).size);
512
+ }
513
+
514
+ function processJSON(minify = isMinified): void {
515
+ if (!inputEditor) return;
516
+ const raw = inputEditor.value;
517
+ if (!raw.trim()) { handleEmpty(); return; }
518
+ try {
519
+ const parsed = JSON.parse(raw);
520
+ currentJSON = parsed;
521
+ renderFormatted(parsed, minify);
522
+ setStatus('valid');
523
+ } catch (e) {
524
+ handleParseError(raw, e as Error);
525
+ }
526
+ }
527
+
528
+ function applyFixes(raw: string): string {
529
+ let result = raw.replace(/'([^']+)'\s*:/g, '"$1":');
530
+ result = result.replace(/:\s*'([^']+)'/g, ': "$1"');
531
+ result = result.replace(/,\s*([}\]])/g, '$1');
532
+ return result;
533
+ }
534
+
535
+ function fixJSON(): void {
536
+ if (!inputEditor) return;
537
+ try {
538
+ const parsed = JSON.parse(applyFixes(inputEditor.value));
539
+ currentJSON = parsed;
540
+ renderFormatted(parsed, isMinified);
541
+ setStatus('valid');
542
+ showToast(i18n.toastFixed);
543
+ } catch {
544
+ showToast(i18n.toastFixFailed);
545
+ }
546
+ }
547
+
548
+ function showToast(msg: string): void {
549
+ if (!toast) return;
550
+ toast.textContent = msg;
551
+ toast.classList.add('jf-toast-visible');
552
+ setTimeout(() => {
553
+ toast.classList.remove('jf-toast-visible');
554
+ }, 2000);
555
+ }
556
+
557
+ inputEditor?.addEventListener('input', () => processJSON());
558
+
559
+ btnMinify?.addEventListener('click', () => {
560
+ if (currentJSON === null) return;
561
+ isMinified = !isMinified;
562
+ renderFormatted(currentJSON, isMinified);
563
+ if (btnMinifyText)
564
+ btnMinifyText.textContent = isMinified ? i18n.btnBeautify : i18n.btnMinify;
565
+ });
566
+
567
+ btnFix?.addEventListener('click', fixJSON);
568
+
569
+ btnCopy?.addEventListener('click', async () => {
570
+ if (outputCode?.textContent) {
571
+ await navigator.clipboard.writeText(outputCode.textContent);
572
+ showToast(i18n.toastCopied);
573
+ }
574
+ });
575
+
576
+ outputViewer?.addEventListener('keydown', (e: KeyboardEvent) => {
577
+ if ((e.ctrlKey || e.metaKey) && e.key === 'a') {
578
+ e.preventDefault();
579
+ const selection = window.getSelection();
580
+ const range = document.createRange();
581
+ if (outputCode) {
582
+ range.selectNodeContents(outputCode);
583
+ selection?.removeAllRanges();
584
+ selection?.addRange(range);
585
+ }
586
+ }
587
+ });
588
+
589
+ processJSON();
590
+ </script>