@jjlmoya/utils-diy 1.1.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 (135) hide show
  1. package/package.json +60 -0
  2. package/src/category/i18n/en.ts +110 -0
  3. package/src/category/i18n/es.ts +110 -0
  4. package/src/category/i18n/fr.ts +101 -0
  5. package/src/category/index.ts +25 -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 +57 -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/faq_count.test.ts +19 -0
  17. package/src/tests/locale_completeness.test.ts +42 -0
  18. package/src/tests/mocks/astro_mock.js +2 -0
  19. package/src/tests/no_h1_in_components.test.ts +48 -0
  20. package/src/tests/schemas_fulfillment.test.ts +23 -0
  21. package/src/tests/seo_length.test.ts +22 -0
  22. package/src/tests/title_quality.test.ts +55 -0
  23. package/src/tests/tool_validation.test.ts +17 -0
  24. package/src/tool/balusterCalculator/bibliography.astro +14 -0
  25. package/src/tool/balusterCalculator/component.astro +605 -0
  26. package/src/tool/balusterCalculator/i18n/en.ts +264 -0
  27. package/src/tool/balusterCalculator/i18n/es.ts +264 -0
  28. package/src/tool/balusterCalculator/i18n/fr.ts +264 -0
  29. package/src/tool/balusterCalculator/index.ts +33 -0
  30. package/src/tool/balusterCalculator/seo.astro +15 -0
  31. package/src/tool/balusterCalculator/ui.ts +15 -0
  32. package/src/tool/clayCalculator/bibliography.astro +14 -0
  33. package/src/tool/clayCalculator/component.astro +731 -0
  34. package/src/tool/clayCalculator/i18n/en.ts +183 -0
  35. package/src/tool/clayCalculator/i18n/es.ts +183 -0
  36. package/src/tool/clayCalculator/i18n/fr.ts +183 -0
  37. package/src/tool/clayCalculator/index.ts +33 -0
  38. package/src/tool/clayCalculator/seo.astro +15 -0
  39. package/src/tool/clayCalculator/ui.ts +19 -0
  40. package/src/tool/concreteCalculator/bibliography.astro +13 -0
  41. package/src/tool/concreteCalculator/component.astro +1089 -0
  42. package/src/tool/concreteCalculator/i18n/en.ts +201 -0
  43. package/src/tool/concreteCalculator/i18n/es.ts +201 -0
  44. package/src/tool/concreteCalculator/i18n/fr.ts +201 -0
  45. package/src/tool/concreteCalculator/index.ts +28 -0
  46. package/src/tool/concreteCalculator/seo.astro +14 -0
  47. package/src/tool/concreteCalculator/ui.ts +35 -0
  48. package/src/tool/cutOptimizer/bibliography.astro +13 -0
  49. package/src/tool/cutOptimizer/component.astro +825 -0
  50. package/src/tool/cutOptimizer/i18n/en.ts +178 -0
  51. package/src/tool/cutOptimizer/i18n/es.ts +178 -0
  52. package/src/tool/cutOptimizer/i18n/fr.ts +178 -0
  53. package/src/tool/cutOptimizer/index.ts +28 -0
  54. package/src/tool/cutOptimizer/optimizer.ts +199 -0
  55. package/src/tool/cutOptimizer/seo.astro +14 -0
  56. package/src/tool/cutOptimizer/ui.ts +25 -0
  57. package/src/tool/drillCalculator/bibliography.astro +13 -0
  58. package/src/tool/drillCalculator/component.astro +1210 -0
  59. package/src/tool/drillCalculator/engine.ts +63 -0
  60. package/src/tool/drillCalculator/i18n/en.ts +137 -0
  61. package/src/tool/drillCalculator/i18n/es.ts +137 -0
  62. package/src/tool/drillCalculator/i18n/fr.ts +137 -0
  63. package/src/tool/drillCalculator/index.ts +28 -0
  64. package/src/tool/drillCalculator/seo.astro +14 -0
  65. package/src/tool/drillCalculator/ui.ts +41 -0
  66. package/src/tool/drillSharpener/bibliography.astro +13 -0
  67. package/src/tool/drillSharpener/component.astro +712 -0
  68. package/src/tool/drillSharpener/engine.ts +42 -0
  69. package/src/tool/drillSharpener/i18n/en.ts +121 -0
  70. package/src/tool/drillSharpener/i18n/es.ts +121 -0
  71. package/src/tool/drillSharpener/i18n/fr.ts +121 -0
  72. package/src/tool/drillSharpener/index.ts +31 -0
  73. package/src/tool/drillSharpener/seo.astro +14 -0
  74. package/src/tool/drillSharpener/ui.ts +53 -0
  75. package/src/tool/epoxyCalculator/bibliography.astro +14 -0
  76. package/src/tool/epoxyCalculator/component.astro +888 -0
  77. package/src/tool/epoxyCalculator/i18n/en.ts +195 -0
  78. package/src/tool/epoxyCalculator/i18n/es.ts +195 -0
  79. package/src/tool/epoxyCalculator/i18n/fr.ts +195 -0
  80. package/src/tool/epoxyCalculator/index.ts +33 -0
  81. package/src/tool/epoxyCalculator/seo.astro +15 -0
  82. package/src/tool/epoxyCalculator/ui.ts +22 -0
  83. package/src/tool/furnitureFit/bibliography.astro +13 -0
  84. package/src/tool/furnitureFit/component.astro +552 -0
  85. package/src/tool/furnitureFit/engine.ts +51 -0
  86. package/src/tool/furnitureFit/i18n/en.ts +152 -0
  87. package/src/tool/furnitureFit/i18n/es.ts +152 -0
  88. package/src/tool/furnitureFit/i18n/fr.ts +152 -0
  89. package/src/tool/furnitureFit/index.ts +28 -0
  90. package/src/tool/furnitureFit/seo.astro +14 -0
  91. package/src/tool/furnitureFit/ui.ts +21 -0
  92. package/src/tool/mortarCalculator/bibliography.astro +13 -0
  93. package/src/tool/mortarCalculator/component.astro +1139 -0
  94. package/src/tool/mortarCalculator/i18n/en.ts +219 -0
  95. package/src/tool/mortarCalculator/i18n/es.ts +205 -0
  96. package/src/tool/mortarCalculator/i18n/fr.ts +220 -0
  97. package/src/tool/mortarCalculator/index.ts +24 -0
  98. package/src/tool/mortarCalculator/seo.astro +14 -0
  99. package/src/tool/mortarCalculator/ui.ts +37 -0
  100. package/src/tool/passepartoutCalculator/bibliography.astro +13 -0
  101. package/src/tool/passepartoutCalculator/component.astro +741 -0
  102. package/src/tool/passepartoutCalculator/i18n/en.ts +178 -0
  103. package/src/tool/passepartoutCalculator/i18n/es.ts +178 -0
  104. package/src/tool/passepartoutCalculator/i18n/fr.ts +178 -0
  105. package/src/tool/passepartoutCalculator/index.ts +28 -0
  106. package/src/tool/passepartoutCalculator/seo.astro +14 -0
  107. package/src/tool/passepartoutCalculator/ui.ts +17 -0
  108. package/src/tool/stairCalculator/bibliography.astro +52 -0
  109. package/src/tool/stairCalculator/component.astro +766 -0
  110. package/src/tool/stairCalculator/engine.ts +128 -0
  111. package/src/tool/stairCalculator/i18n/en.ts +149 -0
  112. package/src/tool/stairCalculator/i18n/es.ts +149 -0
  113. package/src/tool/stairCalculator/i18n/fr.ts +149 -0
  114. package/src/tool/stairCalculator/index.ts +31 -0
  115. package/src/tool/stairCalculator/seo.astro +211 -0
  116. package/src/tool/stairCalculator/ui.ts +109 -0
  117. package/src/tool/thermalExpansionCalculator/bibliography.astro +13 -0
  118. package/src/tool/thermalExpansionCalculator/component.astro +771 -0
  119. package/src/tool/thermalExpansionCalculator/engine.ts +23 -0
  120. package/src/tool/thermalExpansionCalculator/i18n/en.ts +174 -0
  121. package/src/tool/thermalExpansionCalculator/i18n/es.ts +174 -0
  122. package/src/tool/thermalExpansionCalculator/i18n/fr.ts +174 -0
  123. package/src/tool/thermalExpansionCalculator/index.ts +28 -0
  124. package/src/tool/thermalExpansionCalculator/seo.astro +14 -0
  125. package/src/tool/thermalExpansionCalculator/ui.ts +41 -0
  126. package/src/tool/voltageDropCalculator/bibliography.astro +13 -0
  127. package/src/tool/voltageDropCalculator/component.astro +1022 -0
  128. package/src/tool/voltageDropCalculator/i18n/en.ts +155 -0
  129. package/src/tool/voltageDropCalculator/i18n/es.ts +155 -0
  130. package/src/tool/voltageDropCalculator/i18n/fr.ts +148 -0
  131. package/src/tool/voltageDropCalculator/index.ts +28 -0
  132. package/src/tool/voltageDropCalculator/seo.astro +14 -0
  133. package/src/tool/voltageDropCalculator/ui.ts +22 -0
  134. package/src/tools.ts +16 -0
  135. package/src/types.ts +72 -0
@@ -0,0 +1,128 @@
1
+ export interface StairCalculation {
2
+ riser: number;
3
+ tread: number;
4
+ angle: number;
5
+ realLength: number;
6
+ blondel: number;
7
+ blondelStatus: 'success' | 'warning' | 'error';
8
+ blondelTitleKey: string;
9
+ blondelMessageKey: string;
10
+ blondelMessageVal: number;
11
+ tableRows: TableRow[];
12
+ volume: number;
13
+ cement: number;
14
+ sand: number;
15
+ spacingWarningKey: string;
16
+ }
17
+
18
+ export interface TableRow {
19
+ step: number;
20
+ concreteHeight: number;
21
+ finishedHeight: number;
22
+ horizontalDistance: number;
23
+ }
24
+
25
+ /* eslint-disable max-lines-per-function, complexity, max-params */
26
+ export function calculateStairs(
27
+ totalHeight: number,
28
+ availableLength: number,
29
+ numSteps: number,
30
+ slabThickness: number,
31
+ finishThickness: number,
32
+ ceilingHeight: number,
33
+ stairWidth: number,
34
+ cementFactor: number
35
+ ): StairCalculation {
36
+ if (totalHeight <= 0 || numSteps <= 0) {
37
+ return {
38
+ riser: 0,
39
+ tread: 0,
40
+ angle: 0,
41
+ realLength: 0,
42
+ blondel: 0,
43
+ blondelStatus: 'error',
44
+ blondelTitleKey: 'statusRiserError',
45
+ blondelMessageKey: 'msgInvalidValues',
46
+ blondelMessageVal: 0,
47
+ tableRows: [],
48
+ volume: 0,
49
+ cement: 0,
50
+ sand: 0,
51
+ spacingWarningKey: ''
52
+ };
53
+ }
54
+
55
+ const riser = totalHeight / numSteps;
56
+ const targetTread = 63 - (2 * riser);
57
+ const tread = availableLength > 0 ? (availableLength / (numSteps - 1)) : Math.max(24, targetTread);
58
+
59
+ const blondel = (2 * riser) + tread;
60
+ const realLength = tread * (numSteps - 1);
61
+
62
+ const angleRad = Math.atan(totalHeight / (realLength || 1));
63
+ const angle = angleRad * (180 / Math.PI);
64
+ const hypo = Math.sqrt(totalHeight ** 2 + realLength ** 2);
65
+
66
+ let spacingWarningKey = '';
67
+ let blondelStatus: 'success' | 'warning' | 'error' = 'warning';
68
+ let blondelTitleKey = 'statusMarginLimit';
69
+ let blondelMessageKey = 'msgBlondelValue';
70
+ let blondelMessageVal = blondel;
71
+
72
+ if (availableLength > 0 && tread < 24) {
73
+ spacingWarningKey = 'msgInsufficientSpace';
74
+ blondelStatus = 'error';
75
+ blondelTitleKey = 'statusRiserError';
76
+ blondelMessageKey = 'msgDangerousTread';
77
+ blondelMessageVal = tread;
78
+ } else if (blondel >= 62 && blondel <= 64.5) {
79
+ blondelStatus = 'success';
80
+ blondelTitleKey = 'statusOptimalComfort';
81
+ blondelMessageKey = 'msgOptimalStep';
82
+ blondelMessageVal = blondel;
83
+ } else {
84
+ const level = (riser > 19 || tread < 25) ? 'error' : 'warning';
85
+ blondelStatus = level as 'error' | 'warning';
86
+ blondelTitleKey = level === 'error' ? 'statusCriticalDesign' : 'statusMarginLimit';
87
+ }
88
+
89
+ if (ceilingHeight > 0) {
90
+ const minHead = ceilingHeight - totalHeight;
91
+ if (minHead < 200) spacingWarningKey = 'msgLowCeiling';
92
+ }
93
+
94
+ const tableRows: TableRow[] = [];
95
+ for (let i = 1; i <= numSteps; i++) {
96
+ const finishedHeight = i * riser;
97
+ let concreteHeight = finishedHeight;
98
+ if (i === 1) concreteHeight = riser - finishThickness;
99
+
100
+ const horizontalDistance = (i - 1) * tread;
101
+ tableRows.push({ step: i, concreteHeight, finishedHeight, horizontalDistance });
102
+ }
103
+
104
+ const volSteps = (tread * riser / 2) * stairWidth * numSteps / 1000000;
105
+ const volSlab = (hypo * slabThickness * stairWidth) / 1000000;
106
+ const totalVol = volSteps + volSlab;
107
+
108
+ const cement = Math.ceil(totalVol * cementFactor / 25);
109
+ const sand = Math.round(totalVol * 0.5 * 1000);
110
+
111
+ return {
112
+ riser,
113
+ tread,
114
+ angle: isFinite(angle) ? angle : 90,
115
+ realLength,
116
+ blondel,
117
+ blondelStatus,
118
+ blondelTitleKey,
119
+ blondelMessageKey,
120
+ blondelMessageVal,
121
+ tableRows,
122
+ volume: totalVol,
123
+ cement,
124
+ sand,
125
+ spacingWarningKey
126
+ };
127
+ }
128
+ /* eslint-enable max-lines-per-function, complexity, max-params */
@@ -0,0 +1,149 @@
1
+ import type { WithContext, FAQPage, HowToThing, SoftwareApplication } from 'schema-dts';
2
+ import type { ToolLocaleContent } from '../../../types';
3
+ import type { StairCalculatorUI } from '../ui';
4
+
5
+ const slug = 'stair-calculator';
6
+ const title = 'Stair Calculator: Design and Execution';
7
+ const description = 'Calculate exact stair measurements: tread, riser, slope and materials. Apply Blondel\'s law and avoid construction errors.';
8
+
9
+ const faqData = [
10
+ {
11
+ question: 'What is Blondel\'s law?',
12
+ answer: 'It is a formula that establishes that for a staircase to be comfortable, the sum of two risers and one tread should be between 62 and 64 cm (2R + T = 63). This law is based on average human step length and ensures that climbing or descending is safe and comfortable.',
13
+ },
14
+ {
15
+ question: 'What is the maximum height of a step?',
16
+ answer: 'In residential buildings, 18-19 cm is recommended. For public spaces, the maximum is typically 17.5 cm according to standards. Higher risers are tiring and potentially dangerous, especially for children and elderly people.',
17
+ },
18
+ {
19
+ question: 'How do I calculate if space is limited?',
20
+ answer: 'If horizontal space is limited, you must increase the number of steps (reducing riser height) or accept a steeper slope, though less comfortable. The calculator helps you find the optimal balance.',
21
+ },
22
+ {
23
+ question: 'What does concrete volume calculation include?',
24
+ answer: 'The total concrete volume is calculated considering the steps plus the inclined slab (the sloped plane supporting the steps). Ignoring this volume would result in insufficient concrete orders.',
25
+ },
26
+ {
27
+ question: 'Why is cumulative layout important?',
28
+ answer: 'Measuring each step separately generates cumulative errors. Cumulative layout ensures all steps have exactly the same height, avoiding hazards and improving usage comfort.',
29
+ },
30
+ ];
31
+
32
+ const howToData = [
33
+ { name: 'Measure the height difference', text: 'Measure the total height difference (H) from finished floor to finished floor above. This is the fundamental value for the entire calculation.' },
34
+ { name: 'Enter available length', text: 'Optional: If you have space constraints, enter available horizontal length. Use 0 for free calculation without limits.' },
35
+ { name: 'Adjust number of steps', text: 'The calculator proposes an initial number, but you can adjust it. Watch the Blondel indicator: it should be green (62-64 cm) for maximum comfort.' },
36
+ { name: 'Define construction parameters', text: 'Specify slab thickness, finishes, concrete strength and stair width. These values affect final material calculations.' },
37
+ ];
38
+
39
+ const faqSchema: WithContext<FAQPage> = {
40
+ '@context': 'https://schema.org',
41
+ '@type': 'FAQPage',
42
+ mainEntity: faqData.map((item) => ({
43
+ '@type': 'Question',
44
+ name: item.question,
45
+ acceptedAnswer: { '@type': 'Answer', text: item.answer },
46
+ })),
47
+ };
48
+
49
+ const howToSchema: WithContext<HowToThing> = {
50
+ '@context': 'https://schema.org',
51
+ '@type': 'HowTo',
52
+ name: title,
53
+ description,
54
+ step: howToData.map((step, i) => ({
55
+ '@type': 'HowToStep',
56
+ position: i + 1,
57
+ name: step.name,
58
+ text: step.text,
59
+ })),
60
+ };
61
+
62
+ const appSchema: WithContext<SoftwareApplication> = {
63
+ '@context': 'https://schema.org',
64
+ '@type': 'SoftwareApplication',
65
+ name: title,
66
+ description,
67
+ applicationCategory: 'UtilityApplication',
68
+ operatingSystem: 'All',
69
+ offers: { '@type': 'Offer', price: '0', priceCurrency: 'EUR' },
70
+ inLanguage: 'en',
71
+ };
72
+
73
+ export const content: ToolLocaleContent<StairCalculatorUI> = {
74
+ slug,
75
+ title,
76
+ description,
77
+ faqTitle: 'Frequently Asked Questions',
78
+ faq: faqData,
79
+ bibliographyTitle: 'References and Standards',
80
+ bibliography: [
81
+ { name: 'Building Code - Stair Design Standards', url: 'https://www.ibc.org/' },
82
+ { name: 'Blondel\'s Law - Wikipedia', url: 'https://en.wikipedia.org/wiki/Staircase' },
83
+ { name: 'ISO 12122-1: Building stairs - Performance requirements', url: 'https://www.iso.org/' },
84
+ ],
85
+ howTo: howToData,
86
+ schemas: [faqSchema, howToSchema, appSchema],
87
+ seo: [
88
+ { type: 'title', text: 'Staircase Design Geometry: Blondel\'s Law', level: 2 },
89
+ { type: 'paragraph', html: 'The comfort of a staircase depends on human step length. When you climb or descend stairs, your body expects a predictable rhythm. Blondel\'s law establishes that 2 risers + 1 tread = 62-64 cm is the standard ensuring maximum comfort and safety.' },
90
+ { type: 'title', text: 'Structural Control and Materials', level: 3 },
91
+ { type: 'paragraph', html: 'For professional execution, it is vital to account for the concrete slab (the inclined plane supporting the steps). Ignoring this volume would result in insufficient concrete orders and defective construction. The calculator automatically integrates this calculation.' },
92
+ { type: 'title', text: 'Layout and Marking: Cumulative Error', level: 3 },
93
+ { type: 'paragraph', html: 'In construction, the greatest enemy is millimetre-level error. If you measure each step separately, the sum of small errors can leave the last step 5 cm higher or lower than the first. Cumulative layout prevents this problem.' },
94
+ { type: 'title', text: 'Final Finish Provisions', level: 3 },
95
+ { type: 'paragraph', html: 'A critical detail: are you installing 3 cm granite steps? This data is fundamental. If not properly accounted for, the first step will be 3 cm higher and the last 3 cm lower, creating a real safety hazard.' },
96
+ ],
97
+ ui: {
98
+ labelGeometry: 'Geometry and Opening',
99
+ labelTotalHeight: 'Total Height Difference (H)',
100
+ labelAvailableLength: 'Available Length (L)',
101
+ labelAvailableLengthHint: 'Use 0 for free calculation.',
102
+ labelNumSteps: 'Number of Steps',
103
+ labelOptimize: 'Optimize (18cm)',
104
+ labelWork: 'Construction Details',
105
+ labelSlabThickness: 'Slab (e)',
106
+ labelFinishThickness: 'Finish',
107
+ labelCeilingHeight: 'Ceiling Height (Optional)',
108
+ labelStairWidth: 'Stair Width',
109
+ labelConcreteStrength: 'Concrete Strength',
110
+ optionH150: 'H-150 (Lean)',
111
+ optionH200: 'H-200 (Residential)',
112
+ optionH250: 'H-250 (Structural)',
113
+ labelRiser: 'Riser',
114
+ labelTread: 'Tread',
115
+ labelSlope: 'Slope',
116
+ labelRealAdvance: 'Actual Run',
117
+ labelLayoutTable: 'Layout and Execution',
118
+ colStep: 'Step',
119
+ colConcreteHeight: 'Concrete Height',
120
+ colFinishedHeight: 'Finished Height',
121
+ colAdvance: 'Run',
122
+ adjustedNote: 'Adjusted',
123
+ labelMaterials: 'Material Estimate',
124
+ labelTotalConcrete: 'Total Concrete:',
125
+ labelCement: 'Cement (bags/25kg):',
126
+ labelSand: 'Sand Required:',
127
+ unitM3: 'm³',
128
+ unitBags: 'bags',
129
+ unitLiters: 'L',
130
+ btnShare: 'Share',
131
+ btnPrint: 'Print PDF',
132
+ statusOptimalComfort: 'Optimal Comfort',
133
+ statusMarginLimit: 'Margin Limit',
134
+ statusCriticalDesign: 'Critical Design',
135
+ statusRiserError: 'Tread Error',
136
+
137
+ msgInvalidValues: 'Invalid values',
138
+ msgInsufficientSpace: 'INSUFFICIENT SPACE',
139
+ msgDangerousTread: 'The {val}cm tread is dangerous.',
140
+ msgBlondelValue: 'Blondel: {val}cm.',
141
+ msgOptimalStep: 'Comfortable step: {val}cm.',
142
+ msgLowCeiling: 'LOW HEADROOM (<2m)',
143
+ msgCalculating: 'Calculating...',
144
+ msgEnterMeasurements: 'Enter measurements',
145
+
146
+ shareTitle: 'Construction Summary',
147
+ shareMessage: 'Stairs: H={h}cm, N={n}, CH={ch}cm, Vol={vol}m3',
148
+ },
149
+ };
@@ -0,0 +1,149 @@
1
+ import type { WithContext, FAQPage, HowToThing, SoftwareApplication } from 'schema-dts';
2
+ import type { ToolLocaleContent } from '../../../types';
3
+ import type { StairCalculatorUI } from '../ui';
4
+
5
+ const slug = 'calculadora-escaleras';
6
+ const title = 'Calculadora de Escaleras: Diseño y Ejecución';
7
+ const description = 'Calcula las medidas exactas de tu escalera: huella, contrahuella, ángulo y materiales. Respeta la Ley de Blondel y evita errores de obra.';
8
+
9
+ const faqData = [
10
+ {
11
+ question: '¿Qué es la Ley de Blondel?',
12
+ answer: 'Es una fórmula que establece que para que una escalera sea cómoda, la suma de dos contrahuellas y una huella debe estar entre 62 y 64 cm (2CH + H = 63). Esta ley se basa en la longitud media del paso humano y garantiza que subir o bajar la escalera sea seguro y cómodo.',
13
+ },
14
+ {
15
+ question: '¿Cuál es la altura máxima de un peldaño?',
16
+ answer: 'En viviendas se recomienda no superar los 18-19 cm. Para espacios públicos, el máximo suele ser 17.5 cm según normativa. Contrahuellas mayores cansan más y pueden ser peligrosas, especialmente para niños y personas mayores.',
17
+ },
18
+ {
19
+ question: '¿Cómo calculo si tengo poco espacio?',
20
+ answer: 'Si el avance horizontal es limitado, deberás aumentar el número de peldaños (reduciendo la contrahuella) o aceptar una pendiente mayor, aunque sea menos cómoda. La calculadora te ayuda a encontrar el equilibrio óptimo.',
21
+ },
22
+ {
23
+ question: '¿Qué incluye la cubicación de hormigón?',
24
+ answer: 'Se calcula el volumen total de hormigón considerando los peldaños más la losa inclinada (el plano inclinado que soporta los escalones). Ignorar este volumen resultaría en un pedido de hormigón insuficiente.',
25
+ },
26
+ {
27
+ question: '¿Por qué es importante el replanteo acumulado?',
28
+ answer: 'Medir cada escalón por separado genera errores acumulados. El replanteo acumulado garantiza que todos los peldaños tengan exactamente la misma altura, evitando riesgos y mejorando la comodidad de uso.',
29
+ },
30
+ ];
31
+
32
+ const howToData = [
33
+ { name: 'Medir el desnivel', text: 'Mide el desnivel total (H) desde el suelo terminado inferior al suelo terminado superior. Este es el dato fundamental para toda la calculadora.' },
34
+ { name: 'Introduce la longitud disponible', text: 'Opcional: Si tienes restricciones de espacio, introduce la longitud horizontal disponible. Usa 0 para cálculo libre sin limitaciones.' },
35
+ { name: 'Ajusta el número de peldaños', text: 'La calculadora propone un número inicial, pero puedes ajustarlo. Observa el indicador de Blondel: debe estar en verde (62-64 cm) para máxima comodidad.' },
36
+ { name: 'Define parámetros de obra', text: 'Especifica el espesor de la losa, acabados finales, resistencia del hormigón y ancho de la escalera. Estos datos afectan a la cubicación final.' },
37
+ ];
38
+
39
+ const faqSchema: WithContext<FAQPage> = {
40
+ '@context': 'https://schema.org',
41
+ '@type': 'FAQPage',
42
+ mainEntity: faqData.map((item) => ({
43
+ '@type': 'Question',
44
+ name: item.question,
45
+ acceptedAnswer: { '@type': 'Answer', text: item.answer },
46
+ })),
47
+ };
48
+
49
+ const howToSchema: WithContext<HowToThing> = {
50
+ '@context': 'https://schema.org',
51
+ '@type': 'HowTo',
52
+ name: title,
53
+ description,
54
+ step: howToData.map((step, i) => ({
55
+ '@type': 'HowToStep',
56
+ position: i + 1,
57
+ name: step.name,
58
+ text: step.text,
59
+ })),
60
+ };
61
+
62
+ const appSchema: WithContext<SoftwareApplication> = {
63
+ '@context': 'https://schema.org',
64
+ '@type': 'SoftwareApplication',
65
+ name: title,
66
+ description,
67
+ applicationCategory: 'UtilityApplication',
68
+ operatingSystem: 'All',
69
+ offers: { '@type': 'Offer', price: '0', priceCurrency: 'EUR' },
70
+ inLanguage: 'es',
71
+ };
72
+
73
+ export const content: ToolLocaleContent<StairCalculatorUI> = {
74
+ slug,
75
+ title,
76
+ description,
77
+ faqTitle: 'Preguntas Frecuentes',
78
+ faq: faqData,
79
+ bibliographyTitle: 'Referencias y Normativa',
80
+ bibliography: [
81
+ { name: 'CTE DB SUA Seguridad de Utilización y Accesibilidad', url: 'https://www.codigotecnico.org/' },
82
+ { name: 'Ley de Blondel - Wikipedia', url: 'https://es.wikipedia.org/wiki/Escalera#Geometr%C3%ADa_de_la_escalera' },
83
+ { name: 'Instrucción para la Recepción de Cementos (RC-16)', url: 'https://www.fomento.gob.es/' },
84
+ ],
85
+ howTo: howToData,
86
+ schemas: [faqSchema, howToSchema, appSchema],
87
+ seo: [
88
+ { type: 'title', text: 'Diseño Geométrico de Escaleras: La Ley de Blondel', level: 2 },
89
+ { type: 'paragraph', html: 'El confort de una escalera depende de la longitud del paso humano. Cuando subes o bajas escaleras, tu cuerpo espera un ritmo predecible. La Ley de Blondel establece que 2 contrahuellas + 1 huella = 62-64 cm es el estándar que garantiza máxima comodidad y seguridad.' },
90
+ { type: 'title', text: 'Control de Estructura y Materiales', level: 3 },
91
+ { type: 'paragraph', html: 'Para una ejecución profesional, es vital considerar la losa de hormigón (el plano inclinado que sostiene los escalones). Ignorar este volumen resultaría en un pedido de hormigón insuficiente y ejecución defectuosa. La calculadora integra automáticamente este cálculo.' },
92
+ { type: 'title', text: 'Replanteo y Trazado: El Error Acumulado', level: 3 },
93
+ { type: 'paragraph', html: 'En construcción, el mayor enemigo es el error milimétrico. Si mides cada escalón por separado, la suma de pequeños errores puede dejar el último peldaño 5 cm más alto o más bajo que el primero. El replanteo acumulado evita este problema.' },
94
+ { type: 'title', text: 'Previsión de Acabados Finales', level: 3 },
95
+ { type: 'paragraph', html: 'Un detalle crítico: ¿vas a instalar peldaños de granito de 3 cm? Este dato es fundamental. Si no se prevé correctamente, el primer peldaño quedará 3 cm más alto y el último 3 cm más bajo, creando un riesgo de seguridad real.' },
96
+ ],
97
+ ui: {
98
+ labelGeometry: 'Geometría y Hueco',
99
+ labelTotalHeight: 'Desnivel Total (H)',
100
+ labelAvailableLength: 'Longitud Disponible (L)',
101
+ labelAvailableLengthHint: 'Usa 0 para cálculo libre.',
102
+ labelNumSteps: 'Nº Peldaños',
103
+ labelOptimize: 'Optimizar (18cm)',
104
+ labelWork: 'Obra e Instalación',
105
+ labelSlabThickness: 'Losa (e)',
106
+ labelFinishThickness: 'Acabado',
107
+ labelCeilingHeight: 'Altura Techo (Opción)',
108
+ labelStairWidth: 'Ancho Escalera',
109
+ labelConcreteStrength: 'Resistencia Hormigón',
110
+ optionH150: 'H-150 (Limpieza)',
111
+ optionH200: 'H-200 (Vivienda)',
112
+ optionH250: 'H-250 (Estructural)',
113
+ labelRiser: 'Contrahuella',
114
+ labelTread: 'Huella',
115
+ labelSlope: 'Pendiente',
116
+ labelRealAdvance: 'Avance Real',
117
+ labelLayoutTable: 'Replanteo y Ejecución',
118
+ colStep: 'Peldaño',
119
+ colConcreteHeight: 'H. Hormigón',
120
+ colFinishedHeight: 'H. Terminada',
121
+ colAdvance: 'Avance',
122
+ adjustedNote: 'Ajustado',
123
+ labelMaterials: 'Cubicación y Pedido',
124
+ labelTotalConcrete: 'Hormigón Total:',
125
+ labelCement: 'Cemento (sacos/25kg):',
126
+ labelSand: 'Arena necesaria:',
127
+ unitM3: 'm³',
128
+ unitBags: 'sacos',
129
+ unitLiters: 'L',
130
+ btnShare: 'Compartir',
131
+ btnPrint: 'Imprimir PDF',
132
+ statusOptimalComfort: 'Confort Óptimo',
133
+ statusMarginLimit: 'Margen Límite',
134
+ statusCriticalDesign: 'Diseño Crítico',
135
+ statusRiserError: 'Error de Huella',
136
+
137
+ msgInvalidValues: 'Valores inválidos',
138
+ msgInsufficientSpace: 'ESPACIO INSUFICIENTE',
139
+ msgDangerousTread: 'La huella de {val}cm es peligrosa.',
140
+ msgBlondelValue: 'Blondel: {val}cm.',
141
+ msgOptimalStep: 'Paso cómodo: {val}cm.',
142
+ msgLowCeiling: 'CABECEO BAJO (<2m)',
143
+ msgCalculating: 'Calculando...',
144
+ msgEnterMeasurements: 'Ingresa medidas',
145
+
146
+ shareTitle: 'Resumen Obra',
147
+ shareMessage: 'Escalera: H={h}cm, N={n}, CH={ch}cm, Vol={vol}m3',
148
+ },
149
+ };
@@ -0,0 +1,149 @@
1
+ import type { WithContext, FAQPage, HowToThing, SoftwareApplication } from 'schema-dts';
2
+ import type { ToolLocaleContent } from '../../../types';
3
+ import type { StairCalculatorUI } from '../ui';
4
+
5
+ const slug = 'calculatrice-escaliers';
6
+ const title = 'Calculatrice d\'Escaliers: Conception et Exécution';
7
+ const description = 'Calculez les mesures exactes de votre escalier: giron, hauteur de marche, pente et matériaux. Appliquez la loi de Blondel et évitez les erreurs de construction.';
8
+
9
+ const faqData = [
10
+ {
11
+ question: 'Qu\'est-ce que la Loi de Blondel?',
12
+ answer: 'C\'est une formule qui établit que pour qu\'un escalier soit confortable, la somme de deux hauteurs de marche et d\'un giron doit être entre 62 et 64 cm (2H + G = 63). Cette loi est basée sur la longueur moyenne du pas humain et garantit que la montée ou la descente est sûre et confortable.',
13
+ },
14
+ {
15
+ question: 'Quelle est la hauteur maximale d\'une marche?',
16
+ answer: 'Pour les bâtiments résidentiels, 18-19 cm est recommandé. Pour les espaces publics, le maximum est généralement 17,5 cm selon les normes. Les hauteurs de marche plus importantes sont fatigantes et potentiellement dangereuses, notamment pour les enfants et les personnes âgées.',
17
+ },
18
+ {
19
+ question: 'Comment calculer si l\'espace est limité?',
20
+ answer: 'Si l\'espace horizontal est limité, vous devez augmenter le nombre de marches (réduire la hauteur) ou accepter une pente plus raide, bien que moins confortable. La calculatrice vous aide à trouver l\'équilibre optimal.',
21
+ },
22
+ {
23
+ question: 'Qu\'inclut le calcul du volume de béton?',
24
+ answer: 'Le volume total de béton est calculé en considérant les marches plus la dalle inclinée (le plan incliné qui soutient les marches). Ignorer ce volume entraînerait une commande de béton insuffisante.',
25
+ },
26
+ {
27
+ question: 'Pourquoi la mise en plan cumulée est-elle importante?',
28
+ answer: 'Mesurer chaque marche séparément génère des erreurs cumulées. La mise en plan cumulée garantit que toutes les marches ont exactement la même hauteur, évitant les risques et améliorant le confort d\'utilisation.',
29
+ },
30
+ ];
31
+
32
+ const howToData = [
33
+ { name: 'Mesurer la dénivellation', text: 'Mesurez la dénivellation totale (H) du sol fini inférieur au sol fini supérieur. C\'est la valeur fondamentale pour tout le calcul.' },
34
+ { name: 'Entrez la longueur disponible', text: 'Optionnel: Si vous avez des contraintes d\'espace, entrez la longueur horizontale disponible. Utilisez 0 pour un calcul libre sans limites.' },
35
+ { name: 'Ajustez le nombre de marches', text: 'La calculatrice propose un nombre initial, mais vous pouvez l\'ajuster. Observez l\'indicateur de Blondel: il doit être au vert (62-64 cm) pour un confort maximal.' },
36
+ { name: 'Définissez les paramètres de construction', text: 'Spécifiez l\'épaisseur de la dalle, les finitions, la résistance du béton et la largeur de l\'escalier. Ces valeurs affectent les calculs finaux des matériaux.' },
37
+ ];
38
+
39
+ const faqSchema: WithContext<FAQPage> = {
40
+ '@context': 'https://schema.org',
41
+ '@type': 'FAQPage',
42
+ mainEntity: faqData.map((item) => ({
43
+ '@type': 'Question',
44
+ name: item.question,
45
+ acceptedAnswer: { '@type': 'Answer', text: item.answer },
46
+ })),
47
+ };
48
+
49
+ const howToSchema: WithContext<HowToThing> = {
50
+ '@context': 'https://schema.org',
51
+ '@type': 'HowTo',
52
+ name: title,
53
+ description,
54
+ step: howToData.map((step, i) => ({
55
+ '@type': 'HowToStep',
56
+ position: i + 1,
57
+ name: step.name,
58
+ text: step.text,
59
+ })),
60
+ };
61
+
62
+ const appSchema: WithContext<SoftwareApplication> = {
63
+ '@context': 'https://schema.org',
64
+ '@type': 'SoftwareApplication',
65
+ name: title,
66
+ description,
67
+ applicationCategory: 'UtilityApplication',
68
+ operatingSystem: 'All',
69
+ offers: { '@type': 'Offer', price: '0', priceCurrency: 'EUR' },
70
+ inLanguage: 'fr',
71
+ };
72
+
73
+ export const content: ToolLocaleContent<StairCalculatorUI> = {
74
+ slug,
75
+ title,
76
+ description,
77
+ faqTitle: 'Questions Fréquentes',
78
+ faq: faqData,
79
+ bibliographyTitle: 'Références et Normes',
80
+ bibliography: [
81
+ { name: 'Règles de construction des escaliers intérieurs - DTU', url: 'https://www.afnor.org/' },
82
+ { name: 'Loi de Blondel - Wikipédia', url: 'https://fr.wikipedia.org/wiki/Escalier' },
83
+ { name: 'ISO 12122-1: Escaliers de bâtiment - Prescriptions de sécurité', url: 'https://www.iso.org/' },
84
+ ],
85
+ howTo: howToData,
86
+ schemas: [faqSchema, howToSchema, appSchema],
87
+ seo: [
88
+ { type: 'title', text: 'Géométrie de Conception d\'Escaliers: Loi de Blondel', level: 2 },
89
+ { type: 'paragraph', html: 'Le confort d\'un escalier dépend de la longueur du pas humain. Quand vous montez ou descendez des escaliers, votre corps s\'attend à un rythme prévisible. La loi de Blondel établit que 2 hauteurs + 1 giron = 62-64 cm est la norme garantissant un confort et une sécurité maximaux.' },
90
+ { type: 'title', text: 'Contrôle Structurel et Matériaux', level: 3 },
91
+ { type: 'paragraph', html: 'Pour une exécution professionnelle, il est vital de tenir compte de la dalle de béton (le plan incliné supportant les marches). Ignorer ce volume entraînerait une commande de béton insuffisante et une construction défectueuse. La calculatrice intègre automatiquement ce calcul.' },
92
+ { type: 'title', text: 'Mise en Plan et Traçage: Erreur Cumulée', level: 3 },
93
+ { type: 'paragraph', html: 'En construction, le plus grand ennemi est l\'erreur au niveau millimétrique. Si vous mesurez chaque marche séparément, la somme des petites erreurs peut laisser la dernière marche 5 cm plus haute ou plus basse que la première. La mise en plan cumulée évite ce problème.' },
94
+ { type: 'title', text: 'Prévision des Finitions Finales', level: 3 },
95
+ { type: 'paragraph', html: 'Un détail critique: allez-vous installer des marches en granit de 3 cm? Cette donnée est fondamentale. Si elle n\'est pas correctement prévue, la première marche sera 3 cm plus haute et la dernière 3 cm plus basse, créant un vrai risque de sécurité.' },
96
+ ],
97
+ ui: {
98
+ labelGeometry: 'Géométrie et Ouverture',
99
+ labelTotalHeight: 'Dénivellation Totale (H)',
100
+ labelAvailableLength: 'Longueur Disponible (L)',
101
+ labelAvailableLengthHint: 'Utilisez 0 pour calcul libre.',
102
+ labelNumSteps: 'Nombre de Marches',
103
+ labelOptimize: 'Optimiser (18cm)',
104
+ labelWork: 'Détails de Construction',
105
+ labelSlabThickness: 'Dalle (e)',
106
+ labelFinishThickness: 'Finition',
107
+ labelCeilingHeight: 'Hauteur Plafond (Optionnel)',
108
+ labelStairWidth: 'Largeur Escalier',
109
+ labelConcreteStrength: 'Résistance Béton',
110
+ optionH150: 'H-150 (Béton Maigre)',
111
+ optionH200: 'H-200 (Résidentiel)',
112
+ optionH250: 'H-250 (Structurel)',
113
+ labelRiser: 'Hauteur de Marche',
114
+ labelTread: 'Giron',
115
+ labelSlope: 'Pente',
116
+ labelRealAdvance: 'Avance Réelle',
117
+ labelLayoutTable: 'Mise en Plan et Exécution',
118
+ colStep: 'Marche',
119
+ colConcreteHeight: 'Hauteur Béton',
120
+ colFinishedHeight: 'Hauteur Finie',
121
+ colAdvance: 'Avance',
122
+ adjustedNote: 'Ajusté',
123
+ labelMaterials: 'Estimation des Matériaux',
124
+ labelTotalConcrete: 'Béton Total:',
125
+ labelCement: 'Ciment (sacs/25kg):',
126
+ labelSand: 'Sable Nécessaire:',
127
+ unitM3: 'm³',
128
+ unitBags: 'sacs',
129
+ unitLiters: 'L',
130
+ btnShare: 'Partager',
131
+ btnPrint: 'Imprimer PDF',
132
+ statusOptimalComfort: 'Confort Optimal',
133
+ statusMarginLimit: 'Limite Marge',
134
+ statusCriticalDesign: 'Conception Critique',
135
+ statusRiserError: 'Erreur de Giron',
136
+
137
+ msgInvalidValues: 'Valeurs invalides',
138
+ msgInsufficientSpace: 'ESPACE INSUFFISANT',
139
+ msgDangerousTread: 'Le giron de {val}cm est dangereux.',
140
+ msgBlondelValue: 'Blondel: {val}cm.',
141
+ msgOptimalStep: 'Pas confortable: {val}cm.',
142
+ msgLowCeiling: 'ECHAPPÉE BASSE (<2m)',
143
+ msgCalculating: 'Calcul en cours...',
144
+ msgEnterMeasurements: 'Saisissez les mesures',
145
+
146
+ shareTitle: 'Résumé de l\'ouvrage',
147
+ shareMessage: 'Escalier: H={h}cm, N={n}, CH={ch}cm, Vol={vol}m3',
148
+ },
149
+ };
@@ -0,0 +1,31 @@
1
+ import StairCalculatorComponent from './component.astro';
2
+ import StairCalculatorSEO from './seo.astro';
3
+ import StairCalculatorBibliography from './bibliography.astro';
4
+ import type { DiyToolEntry, ToolDefinition } from '../../types';
5
+ import type { StairCalculatorUI } from './ui';
6
+ import { stairCalculatorUI } from './ui';
7
+
8
+ export {
9
+ StairCalculatorComponent,
10
+ StairCalculatorSEO,
11
+ StairCalculatorBibliography,
12
+ };
13
+
14
+ const es = async () => (await import('./i18n/es')).content;
15
+ const en = async () => (await import('./i18n/en')).content;
16
+ const fr = async () => (await import('./i18n/fr')).content;
17
+
18
+ export const stairCalculator: DiyToolEntry<StairCalculatorUI> = {
19
+ id: 'stair-calculator',
20
+ icons: { bg: 'mdi:stairs', fg: 'mdi:ruler-square' },
21
+ i18n: { es, en, fr },
22
+ };
23
+
24
+ export const STAIR_CALCULATOR_TOOL: ToolDefinition = {
25
+ entry: stairCalculator,
26
+ Component: StairCalculatorComponent,
27
+ SEOComponent: StairCalculatorSEO,
28
+ BibliographyComponent: StairCalculatorBibliography,
29
+ };
30
+
31
+ export { stairCalculatorUI };