/
Starolat
/
DeepDive
Обзор
Документация
Войти
/
Starolat
/
DeepDive
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
master
scripts/dump-presets.browser.js
44 строки
1 KB
Starolat Sergei
docs: dev-инструмент встраивания макетов во встроенные пресеты (dump + embed скрипты, workflow в AGENTS.md)
14 июл 2026, 09:30
14 июл 2026, 09:30
99b0fc4
Код
Авторство
О чём код?
// @ts-check /** * @fileoverview Browser-side dump of all layout presets (dev tool). * @version 1.0.0 * * Usage (dev server must be running, e.g. http://127.0.0.1:8080/): * 1. Open the app in the browser. * 2. Open DevTools console and run: * import('/scripts/dump-presets.browser.js') * 3. A file deepdive-presets-dump_YYYY-MM-DD.json will be downloaded. * 4. Embed the presets as built-in: * node scripts/embed-presets.js path/to/deepdive-presets-dump_YYYY-MM-DD.json * * The dump contains ALL presets known to LayoutPresetService (built-in and * user-created), exactly as the running app sees them. */ const { LayoutPresetService } = await import('/js/services/LayoutPresetService.js'); const lps = LayoutPresetService.getInstance(); const presets = await lps.listPresets(); const dump = { format: 'deepdive-presets-dump', version: '1.0.0', exportedAt: new Date().toISOString(), presets, }; const date = new Date().toISOString().slice(0, 10); const blob = new Blob([JSON.stringify(dump, null, 2)], { type: 'application/json' }); const url = URL.createObjectURL(blob); const a = document.createElement('a'); a.href = url; a.download = `deepdive-presets-dump_${date}.json`; document.body.appendChild(a); a.click(); document.body.removeChild(a); URL.revokeObjectURL(url); console.log(`[dump-presets] Dumped ${presets.length} presets:`); for (const p of presets) { console.log(` - ${p.name} (${p.presetId})${p.isBuiltIn ? ' [built-in]' : ''}`); }