@jjlmoya/utils-developer 1.16.0 → 1.18.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.
- package/package.json +1 -1
- package/src/category/index.ts +3 -1
- package/src/entries.ts +7 -1
- package/src/index.ts +4 -0
- package/src/tests/locale_completeness.test.ts +2 -2
- package/src/tests/tool_validation.test.ts +2 -2
- package/src/tool/calculadoraTiempoDatos/data-time-calculator-web-speed-impact.css +498 -499
- package/src/tool/jwtDecoder/bibliography.astro +14 -0
- package/src/tool/jwtDecoder/bibliography.ts +12 -0
- package/src/tool/jwtDecoder/component.astro +209 -0
- package/src/tool/jwtDecoder/entry.ts +30 -0
- package/src/tool/jwtDecoder/i18n/de.ts +248 -0
- package/src/tool/jwtDecoder/i18n/en.ts +247 -0
- package/src/tool/jwtDecoder/i18n/es.ts +248 -0
- package/src/tool/jwtDecoder/i18n/fr.ts +248 -0
- package/src/tool/jwtDecoder/i18n/id.ts +248 -0
- package/src/tool/jwtDecoder/i18n/it.ts +248 -0
- package/src/tool/jwtDecoder/i18n/ja.ts +248 -0
- package/src/tool/jwtDecoder/i18n/ko.ts +248 -0
- package/src/tool/jwtDecoder/i18n/nl.ts +247 -0
- package/src/tool/jwtDecoder/i18n/pl.ts +247 -0
- package/src/tool/jwtDecoder/i18n/pt.ts +247 -0
- package/src/tool/jwtDecoder/i18n/ru.ts +248 -0
- package/src/tool/jwtDecoder/i18n/sv.ts +248 -0
- package/src/tool/jwtDecoder/i18n/tr.ts +248 -0
- package/src/tool/jwtDecoder/i18n/zh.ts +248 -0
- package/src/tool/jwtDecoder/index.ts +11 -0
- package/src/tool/jwtDecoder/jwt-decoder-parser-and-claims-inspector.css +358 -0
- package/src/tool/jwtDecoder/logic.ts +96 -0
- package/src/tool/jwtDecoder/seo.astro +15 -0
- package/src/tool/jwtDecoder/ui.ts +38 -0
- package/src/tool/serpPixelSimulator/bibliography.astro +11 -4
- package/src/tool/serpPixelSimulator/index.ts +0 -4
- package/src/tool/serpPixelSimulator/seo.astro +8 -5
- package/src/tool/visualCssGridFlexboxGenerator/bibliography.astro +14 -0
- package/src/tool/visualCssGridFlexboxGenerator/bibliography.ts +20 -0
- package/src/tool/visualCssGridFlexboxGenerator/canvas.ts +103 -0
- package/src/tool/visualCssGridFlexboxGenerator/component.astro +218 -0
- package/src/tool/visualCssGridFlexboxGenerator/entry.ts +30 -0
- package/src/tool/visualCssGridFlexboxGenerator/i18n/de.ts +110 -0
- package/src/tool/visualCssGridFlexboxGenerator/i18n/en.ts +256 -0
- package/src/tool/visualCssGridFlexboxGenerator/i18n/es.ts +110 -0
- package/src/tool/visualCssGridFlexboxGenerator/i18n/fr.ts +110 -0
- package/src/tool/visualCssGridFlexboxGenerator/i18n/id.ts +110 -0
- package/src/tool/visualCssGridFlexboxGenerator/i18n/it.ts +110 -0
- package/src/tool/visualCssGridFlexboxGenerator/i18n/ja.ts +110 -0
- package/src/tool/visualCssGridFlexboxGenerator/i18n/ko.ts +110 -0
- package/src/tool/visualCssGridFlexboxGenerator/i18n/nl.ts +110 -0
- package/src/tool/visualCssGridFlexboxGenerator/i18n/pl.ts +110 -0
- package/src/tool/visualCssGridFlexboxGenerator/i18n/pt.ts +110 -0
- package/src/tool/visualCssGridFlexboxGenerator/i18n/ru.ts +110 -0
- package/src/tool/visualCssGridFlexboxGenerator/i18n/sv.ts +110 -0
- package/src/tool/visualCssGridFlexboxGenerator/i18n/tr.ts +110 -0
- package/src/tool/visualCssGridFlexboxGenerator/i18n/zh.ts +110 -0
- package/src/tool/visualCssGridFlexboxGenerator/index.ts +11 -0
- package/src/tool/visualCssGridFlexboxGenerator/interactions.ts +45 -0
- package/src/tool/visualCssGridFlexboxGenerator/logic.ts +49 -0
- package/src/tool/visualCssGridFlexboxGenerator/presets.ts +63 -0
- package/src/tool/visualCssGridFlexboxGenerator/seo.astro +15 -0
- package/src/tool/visualCssGridFlexboxGenerator/ui.ts +58 -0
- package/src/tool/visualCssGridFlexboxGenerator/visual-css-grid-flexbox-generator.css +816 -0
- package/src/tool/visualCssGridFlexboxGenerator/workspace.ts +192 -0
- package/src/tools.ts +3 -1
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
import type { LayoutMode, LayoutState } from './logic';
|
|
2
|
+
import { buildLayoutCss } from './logic';
|
|
3
|
+
import type { VisualCssGridFlexboxGeneratorUI } from './ui';
|
|
4
|
+
import {
|
|
5
|
+
getAllItems, getItemSpans, paintCanvas, updateLabels, toggleVisibility,
|
|
6
|
+
refreshItemLabels, makeItem, clearPresetActive,
|
|
7
|
+
} from './canvas';
|
|
8
|
+
import { applyPreset } from './presets';
|
|
9
|
+
|
|
10
|
+
export { setupSpanHandler, spawnConfetti } from './interactions';
|
|
11
|
+
|
|
12
|
+
interface Ctrls {
|
|
13
|
+
canvas: HTMLElement;
|
|
14
|
+
code: HTMLElement;
|
|
15
|
+
codePanel: HTMLElement;
|
|
16
|
+
gap: HTMLInputElement;
|
|
17
|
+
cols: HTMLInputElement;
|
|
18
|
+
width: HTMLInputElement;
|
|
19
|
+
height: HTMLInputElement;
|
|
20
|
+
size: HTMLInputElement;
|
|
21
|
+
justify: HTMLSelectElement;
|
|
22
|
+
align: HTMLSelectElement;
|
|
23
|
+
direction: HTMLSelectElement;
|
|
24
|
+
wrap: HTMLSelectElement;
|
|
25
|
+
alignContent: HTMLSelectElement;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export interface Workspace {
|
|
29
|
+
readState(): LayoutState;
|
|
30
|
+
update(): void;
|
|
31
|
+
setMode(mode: LayoutMode): void;
|
|
32
|
+
addItem(): void;
|
|
33
|
+
removeItem(): void;
|
|
34
|
+
resetLayout(): void;
|
|
35
|
+
applyPreset(name: string): void;
|
|
36
|
+
canvas: HTMLElement;
|
|
37
|
+
gapInput: HTMLInputElement;
|
|
38
|
+
columnsInput: HTMLInputElement;
|
|
39
|
+
widthInput: HTMLInputElement;
|
|
40
|
+
heightInput: HTMLInputElement;
|
|
41
|
+
itemSizeInput: HTMLInputElement;
|
|
42
|
+
justifySelect: HTMLSelectElement;
|
|
43
|
+
alignSelect: HTMLSelectElement;
|
|
44
|
+
directionSelect: HTMLSelectElement;
|
|
45
|
+
wrapSelect: HTMLSelectElement;
|
|
46
|
+
alignContentSelect: HTMLSelectElement;
|
|
47
|
+
code: HTMLElement;
|
|
48
|
+
codePanel: HTMLElement;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
class WorkspaceImpl implements Workspace {
|
|
52
|
+
private mode: LayoutMode = 'flex';
|
|
53
|
+
private c: Ctrls;
|
|
54
|
+
private t: VisualCssGridFlexboxGeneratorUI;
|
|
55
|
+
private root: HTMLElement;
|
|
56
|
+
private flexBtn: HTMLButtonElement;
|
|
57
|
+
private gridBtn: HTMLButtonElement;
|
|
58
|
+
|
|
59
|
+
get canvas() { return this.c.canvas; }
|
|
60
|
+
get gapInput() { return this.c.gap; }
|
|
61
|
+
get columnsInput() { return this.c.cols; }
|
|
62
|
+
get widthInput() { return this.c.width; }
|
|
63
|
+
get heightInput() { return this.c.height; }
|
|
64
|
+
get itemSizeInput() { return this.c.size; }
|
|
65
|
+
get justifySelect() { return this.c.justify; }
|
|
66
|
+
get alignSelect() { return this.c.align; }
|
|
67
|
+
get directionSelect() { return this.c.direction; }
|
|
68
|
+
get wrapSelect() { return this.c.wrap; }
|
|
69
|
+
get alignContentSelect() { return this.c.alignContent; }
|
|
70
|
+
get code() { return this.c.code; }
|
|
71
|
+
get codePanel() { return this.c.codePanel; }
|
|
72
|
+
|
|
73
|
+
constructor(root: HTMLElement, t: VisualCssGridFlexboxGeneratorUI) {
|
|
74
|
+
this.root = root;
|
|
75
|
+
this.t = t;
|
|
76
|
+
this.c = {
|
|
77
|
+
canvas: document.getElementById('vcg-canvas') as HTMLElement,
|
|
78
|
+
code: document.getElementById('vcg-code') as HTMLElement,
|
|
79
|
+
codePanel: document.getElementById('vcg-code-panel') as HTMLElement,
|
|
80
|
+
gap: document.getElementById('vcg-gap') as HTMLInputElement,
|
|
81
|
+
cols: document.getElementById('vcg-columns') as HTMLInputElement,
|
|
82
|
+
width: document.getElementById('vcg-width') as HTMLInputElement,
|
|
83
|
+
height: document.getElementById('vcg-height') as HTMLInputElement,
|
|
84
|
+
size: document.getElementById('vcg-item-size') as HTMLInputElement,
|
|
85
|
+
justify: document.getElementById('vcg-justify') as HTMLSelectElement,
|
|
86
|
+
align: document.getElementById('vcg-align') as HTMLSelectElement,
|
|
87
|
+
direction: document.getElementById('vcg-direction') as HTMLSelectElement,
|
|
88
|
+
wrap: document.getElementById('vcg-wrap') as HTMLSelectElement,
|
|
89
|
+
alignContent: document.getElementById('vcg-align-content') as HTMLSelectElement,
|
|
90
|
+
};
|
|
91
|
+
this.flexBtn = document.getElementById('vcg-flex') as HTMLButtonElement;
|
|
92
|
+
this.gridBtn = document.getElementById('vcg-grid') as HTMLButtonElement;
|
|
93
|
+
this.setupResizeObserver();
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
private setupResizeObserver() {
|
|
97
|
+
new ResizeObserver((entries) => {
|
|
98
|
+
if (!entries[0]) return;
|
|
99
|
+
const r = entries[0].contentRect;
|
|
100
|
+
const rw = String(Math.round(r.width));
|
|
101
|
+
const rh = String(Math.round(r.height));
|
|
102
|
+
if (rw !== this.c.width.value || rh !== this.c.height.value) {
|
|
103
|
+
this.c.width.value = rw;
|
|
104
|
+
this.c.height.value = rh;
|
|
105
|
+
this.update();
|
|
106
|
+
}
|
|
107
|
+
}).observe(this.c.canvas);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
readState(): LayoutState {
|
|
111
|
+
return {
|
|
112
|
+
mode: this.mode, gap: Number(this.c.gap.value),
|
|
113
|
+
columns: Number(this.c.cols.value), width: Number(this.c.width.value),
|
|
114
|
+
height: Number(this.c.height.value), itemSize: Number(this.c.size.value),
|
|
115
|
+
justifyContent: this.c.justify.value, alignItems: this.c.align.value,
|
|
116
|
+
flexDirection: this.c.direction.value, flexWrap: this.c.wrap.value,
|
|
117
|
+
alignContent: this.c.alignContent.value,
|
|
118
|
+
itemSpans: getItemSpans(this.c.canvas),
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
private flushCss(state: LayoutState) {
|
|
123
|
+
this.c.code.textContent = buildLayoutCss(state);
|
|
124
|
+
this.c.codePanel.classList.remove('vcg-code-updated');
|
|
125
|
+
requestAnimationFrame(() => this.c.codePanel.classList.add('vcg-code-updated'));
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
update() {
|
|
129
|
+
const state = this.readState();
|
|
130
|
+
paintCanvas(this.c.canvas, state);
|
|
131
|
+
updateLabels(state);
|
|
132
|
+
toggleVisibility(this.mode, this.c.wrap.value);
|
|
133
|
+
this.flushCss(state);
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
setMode(nextMode: LayoutMode) {
|
|
137
|
+
this.mode = nextMode;
|
|
138
|
+
this.flexBtn.classList.toggle('vcg-active', nextMode === 'flex');
|
|
139
|
+
this.gridBtn.classList.toggle('vcg-active', nextMode === 'grid');
|
|
140
|
+
this.flexBtn.setAttribute('aria-pressed', String(nextMode === 'flex'));
|
|
141
|
+
this.gridBtn.setAttribute('aria-pressed', String(nextMode === 'grid'));
|
|
142
|
+
this.root.dataset.mode = nextMode;
|
|
143
|
+
clearPresetActive();
|
|
144
|
+
this.update();
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
addItem() {
|
|
148
|
+
if (getAllItems(this.c.canvas).length >= 9) return;
|
|
149
|
+
this.c.canvas.append(makeItem(getAllItems(this.c.canvas).length + 1, this.t.itemPrefix));
|
|
150
|
+
this.update();
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
removeItem() {
|
|
154
|
+
const items = getAllItems(this.c.canvas);
|
|
155
|
+
if (items.length <= 2) return;
|
|
156
|
+
const last = items[items.length - 1]!;
|
|
157
|
+
last.classList.add('vcg-exit');
|
|
158
|
+
last.addEventListener('animationend', () => {
|
|
159
|
+
last.remove();
|
|
160
|
+
refreshItemLabels(this.c.canvas, this.t.itemPrefix);
|
|
161
|
+
this.update();
|
|
162
|
+
}, { once: true });
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
resetLayout() {
|
|
166
|
+
this.c.gap.value = '24'; this.c.cols.value = '3';
|
|
167
|
+
this.c.width.value = '760'; this.c.height.value = '380'; this.c.size.value = '104';
|
|
168
|
+
this.c.justify.value = 'center'; this.c.align.value = 'center';
|
|
169
|
+
this.c.direction.value = 'row'; this.c.wrap.value = 'wrap'; this.c.alignContent.value = 'stretch';
|
|
170
|
+
getAllItems(this.c.canvas).forEach((item) => { item.dataset.span = '1'; });
|
|
171
|
+
this.setMode('flex');
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
applyPreset(name: string) {
|
|
175
|
+
applyPreset(name, {
|
|
176
|
+
canvas: this.c.canvas,
|
|
177
|
+
ctrls: {
|
|
178
|
+
gapInput: this.c.gap, columnsInput: this.c.cols,
|
|
179
|
+
widthInput: this.c.width, heightInput: this.c.height, itemSizeInput: this.c.size,
|
|
180
|
+
justifySelect: this.c.justify, alignSelect: this.c.align,
|
|
181
|
+
directionSelect: this.c.direction, wrapSelect: this.c.wrap,
|
|
182
|
+
alignContentSelect: this.c.alignContent,
|
|
183
|
+
},
|
|
184
|
+
setMode: (m) => this.setMode(m),
|
|
185
|
+
update: () => this.update(),
|
|
186
|
+
});
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
export function createWorkspace(root: HTMLElement, t: VisualCssGridFlexboxGeneratorUI): Workspace {
|
|
191
|
+
return new WorkspaceImpl(root, t);
|
|
192
|
+
}
|
package/src/tools.ts
CHANGED
|
@@ -25,5 +25,7 @@ import { GENERADOR_SECURITY_TXT_TOOL } from './tool/generadorSecurityTxt/index';
|
|
|
25
25
|
import { CALCULADORA_TIEMPO_DATOS_TOOL } from './tool/calculadoraTiempoDatos/index';
|
|
26
26
|
import { CONVERSOR_EXCEL_CSV_HTML_TOOL } from './tool/conversorExcelCsvHtml/index';
|
|
27
27
|
import { SERP_PIXEL_SIMULATOR_TOOL } from './tool/serpPixelSimulator/index';
|
|
28
|
+
import { JWT_DECODER_TOOL } from './tool/jwtDecoder/index';
|
|
29
|
+
import { VISUAL_CSS_GRID_FLEXBOX_GENERATOR_TOOL } from './tool/visualCssGridFlexboxGenerator/index';
|
|
28
30
|
|
|
29
|
-
export const ALL_TOOLS: ToolDefinition[] = [JSON_FORMATTER_TOOL, SVG_TO_CSS_TOOL, ASPECT_RATIO_TOOL, PLACEHOLDER_GENERATOR_TOOL, URL_ENCODER_DECODER_TOOL, DUPLICATE_CSS_REMOVER_TOOL, CSS_TO_INLINE_CONVERTER_TOOL, CSS_SPECIFICITY_CALCULATOR_TOOL, CRON_GENERATOR_TOOL, KEYCODE_TOOL, LLM_COST_CALCULATOR_TOOL, MUSICAL_TYPOGRAPHY_TOOL, MOBILE_MOCKUP_GENERATOR_TOOL, HASH_GENERATOR_TOOL, PROMPT_LIBRARY_TOOL, COLOR_CONVERTER_TOOL, READABILITY_CALCULATOR_TOOL, SVG_SANITIZER_TOOL, UTM_GENERATOR_TOOL, URL_CLEANER_TOOL, INSPECTOR_CERTIFICADOS_SSL_TOOL, GENERADOR_SECURITY_TXT_TOOL, CALCULADORA_TIEMPO_DATOS_TOOL, CONVERSOR_EXCEL_CSV_HTML_TOOL, SERP_PIXEL_SIMULATOR_TOOL];
|
|
31
|
+
export const ALL_TOOLS: ToolDefinition[] = [JSON_FORMATTER_TOOL, SVG_TO_CSS_TOOL, ASPECT_RATIO_TOOL, PLACEHOLDER_GENERATOR_TOOL, URL_ENCODER_DECODER_TOOL, DUPLICATE_CSS_REMOVER_TOOL, CSS_TO_INLINE_CONVERTER_TOOL, CSS_SPECIFICITY_CALCULATOR_TOOL, CRON_GENERATOR_TOOL, KEYCODE_TOOL, LLM_COST_CALCULATOR_TOOL, MUSICAL_TYPOGRAPHY_TOOL, MOBILE_MOCKUP_GENERATOR_TOOL, HASH_GENERATOR_TOOL, PROMPT_LIBRARY_TOOL, COLOR_CONVERTER_TOOL, READABILITY_CALCULATOR_TOOL, SVG_SANITIZER_TOOL, UTM_GENERATOR_TOOL, URL_CLEANER_TOOL, INSPECTOR_CERTIFICADOS_SSL_TOOL, GENERADOR_SECURITY_TXT_TOOL, CALCULADORA_TIEMPO_DATOS_TOOL, CONVERSOR_EXCEL_CSV_HTML_TOOL, SERP_PIXEL_SIMULATOR_TOOL, JWT_DECODER_TOOL, VISUAL_CSS_GRID_FLEXBOX_GENERATOR_TOOL];
|