@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,160 @@
1
+ import type { WithContext, FAQPage, HowToThing, SoftwareApplication } from 'schema-dts';
2
+ import type { ToolLocaleContent } from '../../../types';
3
+ import type { KeycodeUI } from '../ui';
4
+
5
+ const slug = 'keycode';
6
+ const title = 'Visualizador de Códigos de Teclado Online. KeyCode Inspector';
7
+ const description =
8
+ 'Herramienta online gratuita para ver en tiempo real el event.key, event.code, event.which y location de cualquier tecla de tu teclado. Genera snippets de código JavaScript listos para usar.';
9
+
10
+ const faqData = [
11
+ {
12
+ question: '¿Qué diferencia hay entre event.key y event.code?',
13
+ answer:
14
+ 'event.code representa la tecla física del teclado, independiente del idioma configurado. event.key representa el carácter generado, que puede cambiar si pulsas Shift o usas otro idioma. Para controles de juego usa code; para texto y atajos semánticos, usa key.',
15
+ },
16
+ {
17
+ question: '¿Qué es event.which y por qué aparece como obsoleto?',
18
+ answer:
19
+ 'event.which es una propiedad heredada que devuelve un código numérico ASCII de la tecla. Está marcada como obsoleta (deprecated) en los estándares modernos porque event.key y event.code la reemplazan con información más precisa y legible. Se muestra en esta herramienta con fines educativos.',
20
+ },
21
+ {
22
+ question: '¿Qué significa la propiedad location?',
23
+ answer:
24
+ 'La propiedad location indica dónde está físicamente la tecla en el teclado: Standard (posición normal), Left (tecla modificadora izquierda), Right (tecla modificadora derecha) o Numpad (teclado numérico). Es útil para distinguir entre el CTRL izquierdo y el derecho, por ejemplo.',
25
+ },
26
+ {
27
+ question: '¿Funciona con teclados internacionales y distribuciones no QWERTY?',
28
+ answer:
29
+ 'Sí. La herramienta muestra exactamente lo que reporta el navegador para tu configuración de teclado. event.code siempre devolverá el nombre QWERTY de la posición física, mientras que event.key mostrará el carácter real según tu idioma.',
30
+ },
31
+ ];
32
+
33
+ const howToData = [
34
+ {
35
+ name: 'Pulsar cualquier tecla',
36
+ text: 'Con el foco en la página, pulsa cualquier tecla del teclado para ver instantáneamente toda la información del evento.',
37
+ },
38
+ {
39
+ name: 'Copiar valores individuales',
40
+ text: 'Haz clic en el botón de copiar junto a cada propiedad (event.key, event.code, etc.) para copiar ese valor concreto al portapapeles.',
41
+ },
42
+ {
43
+ name: 'Usar los snippets de código',
44
+ text: 'En la sección "Snippets Rápidos" encontrarás bloques de código JavaScript listos para pegar directamente en tu proyecto.',
45
+ },
46
+ ];
47
+
48
+ const faqSchema: WithContext<FAQPage> = {
49
+ '@context': 'https://schema.org',
50
+ '@type': 'FAQPage',
51
+ mainEntity: faqData.map((item) => ({
52
+ '@type': 'Question',
53
+ name: item.question,
54
+ acceptedAnswer: { '@type': 'Answer', text: item.answer },
55
+ })),
56
+ };
57
+
58
+ const howToSchema: WithContext<HowToThing> = {
59
+ '@context': 'https://schema.org',
60
+ '@type': 'HowTo',
61
+ name: title,
62
+ description,
63
+ step: howToData.map((step, i) => ({
64
+ '@type': 'HowToStep',
65
+ position: i + 1,
66
+ name: step.name,
67
+ text: step.text,
68
+ })),
69
+ };
70
+
71
+ const appSchema: WithContext<SoftwareApplication> = {
72
+ '@context': 'https://schema.org',
73
+ '@type': 'SoftwareApplication',
74
+ name: title,
75
+ description,
76
+ applicationCategory: 'DeveloperApplication',
77
+ operatingSystem: 'All',
78
+ offers: { '@type': 'Offer', price: '0', priceCurrency: 'EUR' },
79
+ inLanguage: 'es',
80
+ };
81
+
82
+ const ui: KeycodeUI = {
83
+ promptTitle: 'Presiona una tecla',
84
+ promptSubtitle: 'Cualquier tecla de tu teclado para ver su código',
85
+ snippetsTitle: 'Snippets Rápidos',
86
+ btnCopy: 'Copiar',
87
+ locationStandard: 'Standard',
88
+ locationLeft: 'Left',
89
+ locationRight: 'Right',
90
+ locationNumpad: 'Numpad',
91
+ };
92
+
93
+ export const content: ToolLocaleContent<KeycodeUI> = {
94
+ slug,
95
+ title,
96
+ description,
97
+ ui,
98
+ faqTitle: 'Preguntas Frecuentes',
99
+ faq: faqData,
100
+ bibliographyTitle: 'Referencias y Estándares',
101
+ bibliography: [
102
+ {
103
+ name: 'MDN Web Docs – KeyboardEvent',
104
+ url: 'https://developer.mozilla.org/es/docs/Web/API/KeyboardEvent',
105
+ },
106
+ {
107
+ name: 'UI Events Specification (W3C) – KeyboardEvent',
108
+ url: 'https://www.w3.org/TR/uievents/#events-keyboardevents',
109
+ },
110
+ {
111
+ name: 'MDN – KeyboardEvent.code values',
112
+ url: 'https://developer.mozilla.org/en-US/docs/Web/API/UI_Events/Keyboard_event_code_values',
113
+ },
114
+ ],
115
+ howTo: howToData,
116
+ schemas: [faqSchema, howToSchema, appSchema],
117
+ seo: [
118
+ {
119
+ type: 'title',
120
+ text: 'Entendiendo los eventos de teclado en JavaScript',
121
+ level: 2,
122
+ },
123
+ {
124
+ type: 'paragraph',
125
+ html: 'Cuando un usuario pulsa una tecla, el navegador dispara tres eventos: <code>keydown</code>, <code>keypress</code> y <code>keyup</code>. Cada uno expone propiedades con información sobre la tecla pulsada, pero no todas son equivalentes ni recomendadas.',
126
+ },
127
+ {
128
+ type: 'title',
129
+ text: 'Propiedades clave del evento',
130
+ level: 3,
131
+ },
132
+ {
133
+ type: 'grid',
134
+ columns: 2,
135
+ },
136
+ {
137
+ type: 'card',
138
+ title: 'event.code — La tecla física',
139
+ html: '<p>Devuelve el identificador de la <strong>posición física</strong> de la tecla en el teclado, usando nomenclatura QWERTY. Por ejemplo, la tecla "A" en un teclado AZERTY devuelve <code>KeyQ</code>. Ideal para controles de videojuegos donde importa la posición, no el carácter.</p>',
140
+ },
141
+ {
142
+ type: 'card',
143
+ title: 'event.key — El carácter generado',
144
+ html: '<p>Devuelve el <strong>valor del carácter</strong> generado según el idioma y modificadores activos. Si pulsas Shift+A devuelve <code>"A"</code>; sin Shift devuelve <code>"a"</code>. Para teclas especiales devuelve nombres como <code>"Enter"</code>, <code>"Escape"</code>, <code>"ArrowUp"</code>.</p>',
145
+ },
146
+ {
147
+ type: 'title',
148
+ text: 'Cuándo usar cada propiedad',
149
+ level: 3,
150
+ },
151
+ {
152
+ type: 'tip',
153
+ html: 'Usa <code>event.code</code> para controles de juego (WASD independiente del idioma) y <code>event.key</code> para detectar caracteres específicos o atajos de teclado semánticos como <code>Ctrl+C</code>.',
154
+ },
155
+ {
156
+ type: 'paragraph',
157
+ html: 'Las propiedades <code>event.which</code> y <code>event.keyCode</code> están oficialmente <strong>obsoletas</strong> según el estándar W3C. Aunque los navegadores modernos las siguen soportando por compatibilidad, no deben usarse en código nuevo.',
158
+ },
159
+ ],
160
+ };
@@ -0,0 +1,160 @@
1
+ import type { WithContext, FAQPage, HowToThing, SoftwareApplication } from 'schema-dts';
2
+ import type { ToolLocaleContent } from '../../../types';
3
+ import type { KeycodeUI } from '../ui';
4
+
5
+ const slug = 'keycode';
6
+ const title = 'Visualiseur de codes clavier en ligne. KeyCode Inspector';
7
+ const description =
8
+ 'Outil en ligne gratuit pour voir en temps réel le event.key, event.code, event.which et la location de n\'importe quelle touche de clavier. Génère des extraits de code JavaScript prêts à l\'emploi.';
9
+
10
+ const faqData = [
11
+ {
12
+ question: 'Quelle est la différence entre event.key et event.code ?',
13
+ answer:
14
+ 'event.code représente la touche physique du clavier, indépendamment de la langue configurée. event.key représente le caractère généré, qui peut changer si vous appuyez sur Shift ou utilisez une autre langue. Utilisez code pour les contrôles de jeu ; utilisez key pour la saisie de texte et les raccourcis sémantiques.',
15
+ },
16
+ {
17
+ question: 'Qu\'est-ce que event.which et pourquoi est-il déprécié ?',
18
+ answer:
19
+ 'event.which est une propriété héritée qui renvoie un code ASCII numérique de la touche. Elle est marquée comme dépréciée dans les standards modernes car event.key et event.code la remplacent avec des informations plus précises et lisibles. Elle est affichée dans cet outil à des fins éducatives.',
20
+ },
21
+ {
22
+ question: 'Que signifie la propriété location ?',
23
+ answer:
24
+ 'La propriété location indique où la touche est physiquement située sur le clavier : Standard (position normale), Left (modificateur gauche), Right (modificateur droit) ou Numpad (pavé numérique). Elle est utile pour distinguer la touche CTRL gauche de la droite, par exemple.',
25
+ },
26
+ {
27
+ question: 'Fonctionne-t-il avec les claviers internationaux et les dispositions non-QWERTY ?',
28
+ answer:
29
+ 'Oui. L\'outil affiche exactement ce que le navigateur signale pour votre configuration de clavier. event.code renverra toujours le nom QWERTY de la position physique, tandis que event.key affichera le caractère réel selon votre langue.',
30
+ },
31
+ ];
32
+
33
+ const howToData = [
34
+ {
35
+ name: 'Appuyer sur n\'importe quelle touche',
36
+ text: 'Avec le focus sur la page, appuyez sur n\'importe quelle touche du clavier pour voir instantanément toutes les informations de l\'événement.',
37
+ },
38
+ {
39
+ name: 'Copier les valeurs individuelles',
40
+ text: 'Cliquez sur le bouton de copie à côté de chaque propriété (event.key, event.code, etc.) pour copier cette valeur spécifique dans le presse-papiers.',
41
+ },
42
+ {
43
+ name: 'Utiliser les extraits de code',
44
+ text: 'Dans la section "Extraits rapides", vous trouverez des blocs de code JavaScript prêts à coller directement dans votre projet.',
45
+ },
46
+ ];
47
+
48
+ const faqSchema: WithContext<FAQPage> = {
49
+ '@context': 'https://schema.org',
50
+ '@type': 'FAQPage',
51
+ mainEntity: faqData.map((item) => ({
52
+ '@type': 'Question',
53
+ name: item.question,
54
+ acceptedAnswer: { '@type': 'Answer', text: item.answer },
55
+ })),
56
+ };
57
+
58
+ const howToSchema: WithContext<HowToThing> = {
59
+ '@context': 'https://schema.org',
60
+ '@type': 'HowTo',
61
+ name: title,
62
+ description,
63
+ step: howToData.map((step, i) => ({
64
+ '@type': 'HowToStep',
65
+ position: i + 1,
66
+ name: step.name,
67
+ text: step.text,
68
+ })),
69
+ };
70
+
71
+ const appSchema: WithContext<SoftwareApplication> = {
72
+ '@context': 'https://schema.org',
73
+ '@type': 'SoftwareApplication',
74
+ name: title,
75
+ description,
76
+ applicationCategory: 'DeveloperApplication',
77
+ operatingSystem: 'All',
78
+ offers: { '@type': 'Offer', price: '0', priceCurrency: 'EUR' },
79
+ inLanguage: 'fr',
80
+ };
81
+
82
+ const ui: KeycodeUI = {
83
+ promptTitle: 'Appuyez sur une touche',
84
+ promptSubtitle: 'N\'importe quelle touche de votre clavier pour voir son code',
85
+ snippetsTitle: 'Extraits rapides',
86
+ btnCopy: 'Copier',
87
+ locationStandard: 'Standard',
88
+ locationLeft: 'Left',
89
+ locationRight: 'Right',
90
+ locationNumpad: 'Numpad',
91
+ };
92
+
93
+ export const content: ToolLocaleContent<KeycodeUI> = {
94
+ slug,
95
+ title,
96
+ description,
97
+ ui,
98
+ faqTitle: 'Questions fréquentes',
99
+ faq: faqData,
100
+ bibliographyTitle: 'Références et standards',
101
+ bibliography: [
102
+ {
103
+ name: 'MDN Web Docs – KeyboardEvent',
104
+ url: 'https://developer.mozilla.org/fr/docs/Web/API/KeyboardEvent',
105
+ },
106
+ {
107
+ name: 'Spécification UI Events (W3C) – KeyboardEvent',
108
+ url: 'https://www.w3.org/TR/uievents/#events-keyboardevents',
109
+ },
110
+ {
111
+ name: 'MDN – Valeurs de KeyboardEvent.code',
112
+ url: 'https://developer.mozilla.org/en-US/docs/Web/API/UI_Events/Keyboard_event_code_values',
113
+ },
114
+ ],
115
+ howTo: howToData,
116
+ schemas: [faqSchema, howToSchema, appSchema],
117
+ seo: [
118
+ {
119
+ type: 'title',
120
+ text: 'Comprendre les événements clavier en JavaScript',
121
+ level: 2,
122
+ },
123
+ {
124
+ type: 'paragraph',
125
+ html: 'Lorsqu\'un utilisateur appuie sur une touche, le navigateur déclenche trois événements : <code>keydown</code>, <code>keypress</code> et <code>keyup</code>. Chacun expose des propriétés avec des informations sur la touche pressée, mais elles ne sont pas toutes équivalentes ni recommandées.',
126
+ },
127
+ {
128
+ type: 'title',
129
+ text: 'Propriétés clés de l\'événement',
130
+ level: 3,
131
+ },
132
+ {
133
+ type: 'grid',
134
+ columns: 2,
135
+ },
136
+ {
137
+ type: 'card',
138
+ title: 'event.code — La touche physique',
139
+ html: '<p>Retourne l\'identifiant de la <strong>position physique</strong> de la touche sur le clavier, en utilisant la nomenclature QWERTY. Par exemple, la touche "A" sur un clavier AZERTY retourne <code>KeyQ</code>. Idéal pour les contrôles de jeu où la position importe, pas le caractère.</p>',
140
+ },
141
+ {
142
+ type: 'card',
143
+ title: 'event.key — Le caractère généré',
144
+ html: '<p>Retourne la <strong>valeur du caractère</strong> généré selon la langue et les modificateurs actifs. Appuyer sur Shift+A retourne <code>"A"</code> ; sans Shift retourne <code>"a"</code>. Pour les touches spéciales, retourne des noms comme <code>"Enter"</code>, <code>"Escape"</code>, <code>"ArrowUp"</code>.</p>',
145
+ },
146
+ {
147
+ type: 'title',
148
+ text: 'Quand utiliser chaque propriété',
149
+ level: 3,
150
+ },
151
+ {
152
+ type: 'tip',
153
+ html: 'Utilisez <code>event.code</code> pour les contrôles de jeu (WASD indépendamment de la langue) et <code>event.key</code> pour détecter des caractères spécifiques ou des raccourcis sémantiques comme <code>Ctrl+C</code>.',
154
+ },
155
+ {
156
+ type: 'paragraph',
157
+ html: 'Les propriétés <code>event.which</code> et <code>event.keyCode</code> sont officiellement <strong>dépréciées</strong> selon le standard W3C. Bien que les navigateurs modernes continuent de les supporter par compatibilité, elles ne doivent pas être utilisées dans du nouveau code.',
158
+ },
159
+ ],
160
+ };
@@ -0,0 +1,34 @@
1
+ import type { DeveloperToolEntry, ToolLocaleContent, ToolDefinition } from '../../types';
2
+ import KeycodeComponent from './component.astro';
3
+ import KeycodeSEO from './seo.astro';
4
+ import KeycodeBibliography from './bibliography.astro';
5
+
6
+ import type { KeycodeUI } from './ui';
7
+
8
+ export type KeycodeLocaleContent = ToolLocaleContent<KeycodeUI>;
9
+
10
+ import { content as es } from './i18n/es';
11
+ import { content as en } from './i18n/en';
12
+ import { content as fr } from './i18n/fr';
13
+
14
+ export const keycode: DeveloperToolEntry<KeycodeUI> = {
15
+ id: 'keycode',
16
+ icons: {
17
+ bg: 'mdi:keyboard-outline',
18
+ fg: 'mdi:code-braces',
19
+ },
20
+ i18n: {
21
+ es: async () => es,
22
+ en: async () => en,
23
+ fr: async () => fr,
24
+ },
25
+ };
26
+
27
+ export { KeycodeComponent, KeycodeSEO, KeycodeBibliography };
28
+
29
+ export const KEYCODE_TOOL: ToolDefinition = {
30
+ entry: keycode,
31
+ Component: KeycodeComponent,
32
+ SEOComponent: KeycodeSEO,
33
+ BibliographyComponent: KeycodeBibliography,
34
+ };
@@ -0,0 +1,14 @@
1
+ ---
2
+ import { SEORenderer } from '@jjlmoya/utils-shared';
3
+ import { keycode } 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 keycode.i18n[locale]?.();
12
+ ---
13
+
14
+ {content && <SEORenderer content={{ locale, sections: content.seo }} />}
@@ -0,0 +1,10 @@
1
+ export interface KeycodeUI extends Record<string, string> {
2
+ promptTitle: string;
3
+ promptSubtitle: string;
4
+ snippetsTitle: string;
5
+ btnCopy: string;
6
+ locationStandard: string;
7
+ locationLeft: string;
8
+ locationRight: string;
9
+ locationNumpad: string;
10
+ }
@@ -0,0 +1,14 @@
1
+ ---
2
+ import { Bibliography as SharedBibliography } from '@jjlmoya/utils-shared';
3
+ import { llmCostCalculator } 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 llmCostCalculator.i18n[locale]?.();
12
+ ---
13
+
14
+ {content && <SharedBibliography links={content.bibliography} />}