slides-grab 1.3.0 → 1.4.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/README-ko.md +8 -6
- package/README.md +8 -6
- package/bin/ppt-agent.js +119 -6
- package/package.json +6 -2
- package/runtimes/claude-code/agents/design-critic-agent.md +23 -0
- package/runtimes/codex/agents/slides-grab-design-critic.md +22 -0
- package/scripts/build-viewer.js +67 -5
- package/scripts/design-gate.js +241 -0
- package/scripts/html2png.js +246 -0
- package/scripts/install-runtime.js +216 -0
- package/skills/slides-grab/SKILL.md +19 -14
- package/skills/slides-grab/references/presentation-workflow-reference.md +8 -6
- package/skills/slides-grab-card-news/SKILL.md +1 -1
- package/skills/slides-grab-design/SKILL.md +19 -11
- package/skills/slides-grab-design/references/design-gate.md +349 -0
- package/skills/slides-grab-design/references/design-rules.md +12 -3
- package/skills/slides-grab-design/references/design-system-full.md +4 -4
- package/skills/slides-grab-design/references/detailed-design-rules.md +9 -0
- package/skills/slides-grab-export/SKILL.md +10 -7
- package/skills/slides-grab-export/references/export-rules.md +3 -0
- package/skills/slides-grab-export/references/pptx-skill-reference.md +7 -42
- package/skills/slides-grab-plan/SKILL.md +6 -3
- package/skills/slides-grab-plan/references/plan-workflow-reference.md +14 -14
- package/src/design-diversity-data.js +6932 -0
- package/src/design-gate-report.js +244 -0
- package/src/design-gate-state.js +294 -0
- package/src/design-styles.js +82 -2
- package/src/editor/codex-edit.js +26 -1
- package/src/editor/editor.html +1 -1
- package/src/editor/js/model-registry.js +1 -1
- package/src/validation/core.js +76 -0
- package/templates/design-styles/README.md +2 -1
- package/templates/design-styles/preview.html +1088 -6
|
@@ -18,7 +18,7 @@ export const CODEX_MODELS = [
|
|
|
18
18
|
'gpt-5.3-codex-spark',
|
|
19
19
|
];
|
|
20
20
|
|
|
21
|
-
export const CLAUDE_MODELS = ['claude-opus-4-
|
|
21
|
+
export const CLAUDE_MODELS = ['claude-opus-4-8', 'claude-sonnet-4-6'];
|
|
22
22
|
|
|
23
23
|
export const ALL_MODELS = [...CODEX_MODELS, ...CLAUDE_MODELS];
|
|
24
24
|
|
package/src/validation/core.js
CHANGED
|
@@ -362,6 +362,10 @@ export async function inspectSlide(page, fileName, slidesDir, slideMode = DEFAUL
|
|
|
362
362
|
if (document.fonts?.ready) {
|
|
363
363
|
await document.fonts.ready;
|
|
364
364
|
}
|
|
365
|
+
|
|
366
|
+
await new Promise((resolve) => {
|
|
367
|
+
requestAnimationFrame(() => requestAnimationFrame(resolve));
|
|
368
|
+
});
|
|
365
369
|
});
|
|
366
370
|
|
|
367
371
|
const inspection = await page.evaluate(
|
|
@@ -406,6 +410,61 @@ export async function inspectSlide(page, fileName, slidesDir, slideMode = DEFAUL
|
|
|
406
410
|
};
|
|
407
411
|
};
|
|
408
412
|
|
|
413
|
+
const inspectCanvasPaint = (canvas) => {
|
|
414
|
+
const rect = canvas.getBoundingClientRect();
|
|
415
|
+
const context = canvas.getContext('2d');
|
|
416
|
+
const metrics = {
|
|
417
|
+
layoutWidth: round(rect.width),
|
|
418
|
+
layoutHeight: round(rect.height),
|
|
419
|
+
bufferWidth: canvas.width,
|
|
420
|
+
bufferHeight: canvas.height,
|
|
421
|
+
sampledPixels: 0,
|
|
422
|
+
paintedSamples: 0,
|
|
423
|
+
};
|
|
424
|
+
|
|
425
|
+
if (!context || canvas.width <= 0 || canvas.height <= 0) {
|
|
426
|
+
return {
|
|
427
|
+
empty: true,
|
|
428
|
+
reason: !context ? '2d-context-unavailable' : 'zero-size-drawing-buffer',
|
|
429
|
+
metrics,
|
|
430
|
+
};
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
try {
|
|
434
|
+
const imageData = context.getImageData(0, 0, canvas.width, canvas.height).data;
|
|
435
|
+
const totalPixels = canvas.width * canvas.height;
|
|
436
|
+
const stride = Math.max(1, Math.ceil(totalPixels / 50000));
|
|
437
|
+
let sampledPixels = 0;
|
|
438
|
+
let paintedSamples = 0;
|
|
439
|
+
|
|
440
|
+
for (let pixel = 0; pixel < totalPixels; pixel += stride) {
|
|
441
|
+
sampledPixels += 1;
|
|
442
|
+
if (imageData[(pixel * 4) + 3] !== 0) {
|
|
443
|
+
paintedSamples += 1;
|
|
444
|
+
break;
|
|
445
|
+
}
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
metrics.sampledPixels = sampledPixels;
|
|
449
|
+
metrics.paintedSamples = paintedSamples;
|
|
450
|
+
|
|
451
|
+
return {
|
|
452
|
+
empty: paintedSamples === 0,
|
|
453
|
+
reason: paintedSamples === 0 ? 'transparent-drawing-buffer' : '',
|
|
454
|
+
metrics,
|
|
455
|
+
};
|
|
456
|
+
} catch (error) {
|
|
457
|
+
return {
|
|
458
|
+
empty: true,
|
|
459
|
+
reason: 'drawing-buffer-unreadable',
|
|
460
|
+
metrics: {
|
|
461
|
+
...metrics,
|
|
462
|
+
detail: error instanceof Error ? error.message : String(error),
|
|
463
|
+
},
|
|
464
|
+
};
|
|
465
|
+
}
|
|
466
|
+
};
|
|
467
|
+
|
|
409
468
|
const elementPath = (element) => {
|
|
410
469
|
if (!element || element.nodeType !== Node.ELEMENT_NODE) return '';
|
|
411
470
|
if (element === document.body) return 'body';
|
|
@@ -587,6 +646,23 @@ export async function inspectSlide(page, fileName, slidesDir, slideMode = DEFAUL
|
|
|
587
646
|
});
|
|
588
647
|
}
|
|
589
648
|
|
|
649
|
+
const canvases = Array.from(document.querySelectorAll('canvas'));
|
|
650
|
+
for (const canvas of canvases) {
|
|
651
|
+
if (!isVisible(canvas)) continue;
|
|
652
|
+
|
|
653
|
+
const result = inspectCanvasPaint(canvas);
|
|
654
|
+
if (!result.empty) continue;
|
|
655
|
+
|
|
656
|
+
critical.push({
|
|
657
|
+
code: 'empty-canvas',
|
|
658
|
+
message: 'Canvas has visible layout size but no painted pixels. Chart.js and other canvas charts must render before validation.',
|
|
659
|
+
element: elementPath(canvas),
|
|
660
|
+
detail: result.reason,
|
|
661
|
+
metrics: result.metrics,
|
|
662
|
+
bbox: normalizeRect(canvas.getBoundingClientRect()),
|
|
663
|
+
});
|
|
664
|
+
}
|
|
665
|
+
|
|
590
666
|
const parents = [document.body, ...allVisibleElements];
|
|
591
667
|
for (const parent of parents) {
|
|
592
668
|
const children = Array.from(parent.children).filter((child) => visibleSet.has(child));
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Design Style Collections
|
|
2
2
|
|
|
3
|
-
slides-grab bundles
|
|
3
|
+
slides-grab bundles 95 design styles: 30 derived from [corazzon/pptx-design-styles](https://github.com/corazzon/pptx-design-styles) (MIT), 5 slides-grab originals, and 60 PPT packs derived from [epoko77-ai/design-diversity](https://github.com/epoko77-ai/design-diversity) (MIT).
|
|
4
4
|
|
|
5
5
|
These styles are reference directions for slide generation, not drop-in HTML slide templates. Agents may also design fully custom visuals beyond the bundled collection.
|
|
6
6
|
|
|
@@ -15,5 +15,6 @@ The preview/select flow is intentionally simple: it keeps design approval inside
|
|
|
15
15
|
## Citation
|
|
16
16
|
|
|
17
17
|
- Upstream collection: `corazzon/pptx-design-styles`
|
|
18
|
+
- Upstream design catalog: `epoko77-ai/design-diversity`
|
|
18
19
|
- URL: <https://github.com/corazzon/pptx-design-styles>
|
|
19
20
|
- Reference used in this repo: `references/styles.md`
|