@thanh01.pmt/presentation-kit 0.3.4 → 0.3.6
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/dist/ai/index.cjs +8 -8
- package/dist/ai/index.js +1 -1
- package/dist/{chunk-KXX5PGN7.cjs → chunk-JRPN5PMM.cjs} +16 -4
- package/dist/chunk-JRPN5PMM.cjs.map +1 -0
- package/dist/{chunk-WKTPYYO2.cjs → chunk-OALGKQ73.cjs} +4 -4
- package/dist/{chunk-WKTPYYO2.cjs.map → chunk-OALGKQ73.cjs.map} +1 -1
- package/dist/{chunk-7ZQHP7OD.js → chunk-QP7WKYFF.js} +16 -4
- package/dist/chunk-QP7WKYFF.js.map +1 -0
- package/dist/{chunk-UOWSDZEF.js → chunk-VGB2SDTQ.js} +3 -3
- package/dist/{chunk-UOWSDZEF.js.map → chunk-VGB2SDTQ.js.map} +1 -1
- package/dist/index.cjs +48 -48
- package/dist/index.d.cts +24 -0
- package/dist/index.d.ts +24 -0
- package/dist/index.js +3 -3
- package/dist/node/index.cjs +2 -2
- package/dist/node/index.js +1 -1
- package/dist/react/index.cjs +13 -13
- package/dist/react/index.js +3 -3
- package/package.json +1 -1
- package/dist/chunk-7ZQHP7OD.js.map +0 -1
- package/dist/chunk-KXX5PGN7.cjs.map +0 -1
package/dist/ai/index.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var chunk3Q4RMZVQ_cjs = require('../chunk-3Q4RMZVQ.cjs');
|
|
4
|
-
var
|
|
4
|
+
var chunkJRPN5PMM_cjs = require('../chunk-JRPN5PMM.cjs');
|
|
5
5
|
var chunkEAPUC5BA_cjs = require('../chunk-EAPUC5BA.cjs');
|
|
6
6
|
var zod = require('zod');
|
|
7
7
|
|
|
@@ -471,20 +471,20 @@ function validateHtmlSlideDeck(deck, strict = false) {
|
|
|
471
471
|
slides.forEach((slide, idx) => {
|
|
472
472
|
const slideNumber = idx + 1;
|
|
473
473
|
const layoutId = slide.layoutId;
|
|
474
|
-
const preset =
|
|
474
|
+
const preset = chunkJRPN5PMM_cjs.HTML_SLIDE_PRESETS[layoutId];
|
|
475
475
|
if (!preset) {
|
|
476
476
|
issues.push({
|
|
477
477
|
slideIndex: slideNumber,
|
|
478
478
|
severity: "error",
|
|
479
479
|
rule: "INVALID_LAYOUT_PRESET",
|
|
480
|
-
message: `Unknown layoutId "${slide.layoutId}". Available presets: ${Object.keys(
|
|
480
|
+
message: `Unknown layoutId "${slide.layoutId}". Available presets: ${Object.keys(chunkJRPN5PMM_cjs.HTML_SLIDE_PRESETS).join(", ")}`
|
|
481
481
|
});
|
|
482
482
|
return;
|
|
483
483
|
}
|
|
484
484
|
if (preset.category === "cover" && idx === 0) hasCover = true;
|
|
485
485
|
if (preset.id === "checkpoint-quiz") hasQuiz = true;
|
|
486
486
|
if (preset.id === "summary-takeaways") hasSummary = true;
|
|
487
|
-
const slots =
|
|
487
|
+
const slots = chunkJRPN5PMM_cjs.normalizeSlideSlots(slide);
|
|
488
488
|
for (const slotDef of preset.slots) {
|
|
489
489
|
if (slotDef.required) {
|
|
490
490
|
const val = slots[slotDef.name];
|
|
@@ -775,7 +775,7 @@ var createHtmlSlideSchema = zod.z.object({
|
|
|
775
775
|
// src/ai/html/tools.ts
|
|
776
776
|
function handleListHtmlSlidePresets(input) {
|
|
777
777
|
const category = input.category || "all";
|
|
778
|
-
const presets = Object.values(
|
|
778
|
+
const presets = Object.values(chunkJRPN5PMM_cjs.HTML_SLIDE_PRESETS).filter((p) => category === "all" || p.category === category).map((p) => ({
|
|
779
779
|
id: p.id,
|
|
780
780
|
name: p.name,
|
|
781
781
|
category: p.category,
|
|
@@ -791,12 +791,12 @@ function handleListHtmlSlidePresets(input) {
|
|
|
791
791
|
return {
|
|
792
792
|
success: true,
|
|
793
793
|
presets,
|
|
794
|
-
availableThemes: Object.keys(
|
|
794
|
+
availableThemes: Object.keys(chunkJRPN5PMM_cjs.HTML_THEMES)
|
|
795
795
|
};
|
|
796
796
|
}
|
|
797
797
|
function handleGenerateHtmlDeck(input) {
|
|
798
798
|
try {
|
|
799
|
-
const result =
|
|
799
|
+
const result = chunkJRPN5PMM_cjs.compileHtmlDeck(input);
|
|
800
800
|
return {
|
|
801
801
|
success: true,
|
|
802
802
|
title: result.title,
|
|
@@ -812,7 +812,7 @@ function handleGenerateHtmlDeck(input) {
|
|
|
812
812
|
}
|
|
813
813
|
}
|
|
814
814
|
function handleCreateHtmlSlide(input) {
|
|
815
|
-
const preset =
|
|
815
|
+
const preset = chunkJRPN5PMM_cjs.HTML_SLIDE_PRESETS[input.layoutId];
|
|
816
816
|
if (!preset) {
|
|
817
817
|
return {
|
|
818
818
|
success: false,
|
package/dist/ai/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { SLIDE_LAYOUT_PRESETS, getSlideLayoutPresetsByCategory, getSlideLayoutPresetById, serializeLayoutToComment, updateSlideLayoutInMarkdown, splitMarkdownSlides } from '../chunk-V6X7D44H.js';
|
|
2
|
-
import { HTML_SLIDE_PRESETS, normalizeSlideSlots, HTML_THEMES, compileHtmlDeck } from '../chunk-
|
|
2
|
+
import { HTML_SLIDE_PRESETS, normalizeSlideSlots, HTML_THEMES, compileHtmlDeck } from '../chunk-QP7WKYFF.js';
|
|
3
3
|
export { FRONTEND_SLIDES_CORE_RULES, SLIDE_HTML_PROMPT_CONTRACT, STYLE_PRESETS, TEMPLATES_CATALOG, VIEWPORT_BASE_CSS, frontendSlidesTools, getFrontendSlidesSkillPrompt, getSlideStylePresetSchema, getStylePreset, getStylePresetById, getTemplatesCatalog, querySlideTemplatesSchema, searchTemplates } from '../chunk-WNPKREEW.js';
|
|
4
4
|
import { z } from 'zod';
|
|
5
5
|
|
|
@@ -3040,12 +3040,18 @@ function sanitizeSlideHtml(raw) {
|
|
|
3040
3040
|
});
|
|
3041
3041
|
return { html: html.trim(), removed: Array.from(new Set(removed)) };
|
|
3042
3042
|
}
|
|
3043
|
+
var COMPOSITION_LINTS = [
|
|
3044
|
+
"full-height root uses justify-content:space-between",
|
|
3045
|
+
"card stretched by a flex:1 parent uses justify-content:space-between"
|
|
3046
|
+
];
|
|
3047
|
+
var isCompositionLint = (issue) => COMPOSITION_LINTS.some((p) => issue.startsWith(p));
|
|
3043
3048
|
function validateBespokeSlideHtml(raw, contract = {}) {
|
|
3044
3049
|
const maxChars = contract.maxChars ?? 16e3;
|
|
3045
3050
|
const minChars = contract.minChars ?? 120;
|
|
3046
3051
|
const issues = [];
|
|
3047
3052
|
const html = String(raw ?? "").trim();
|
|
3048
|
-
if (!html)
|
|
3053
|
+
if (!html)
|
|
3054
|
+
return { valid: false, issues: ["slide html is empty"], hardIssues: ["slide html is empty"], compositionIssues: [] };
|
|
3049
3055
|
if (html.length > maxChars) issues.push(`slide html exceeds ${maxChars} chars (${html.length})`);
|
|
3050
3056
|
if (html.replace(/<[^>]*>/g, "").replace(/\s+/g, "").length < minChars) {
|
|
3051
3057
|
issues.push("slide has too little text content to teach anything");
|
|
@@ -3101,7 +3107,13 @@ function validateBespokeSlideHtml(raw, contract = {}) {
|
|
|
3101
3107
|
);
|
|
3102
3108
|
break;
|
|
3103
3109
|
}
|
|
3104
|
-
|
|
3110
|
+
const hardIssues = issues.filter((i) => !isCompositionLint(i));
|
|
3111
|
+
const compositionIssues = issues.filter(isCompositionLint);
|
|
3112
|
+
const compositionOnly = compositionIssues.length > 0 && hardIssues.length === 0;
|
|
3113
|
+
if (contract.waiveCompositionLints) {
|
|
3114
|
+
return { valid: hardIssues.length === 0, issues: hardIssues, hardIssues, compositionIssues, compositionOnly };
|
|
3115
|
+
}
|
|
3116
|
+
return { valid: issues.length === 0, issues, hardIssues, compositionIssues, compositionOnly };
|
|
3105
3117
|
}
|
|
3106
3118
|
function elementInner(html, cls) {
|
|
3107
3119
|
const rootOpen = new RegExp(`<([a-z]+)[^>]*class="[^"]*\\b${cls}\\b[^"]*"[^>]*>`, "i").exec(html);
|
|
@@ -3284,5 +3296,5 @@ exports.normalizeSlideSlots = normalizeSlideSlots;
|
|
|
3284
3296
|
exports.resolveHtmlTheme = resolveHtmlTheme;
|
|
3285
3297
|
exports.sanitizeSlideHtml = sanitizeSlideHtml;
|
|
3286
3298
|
exports.validateBespokeSlideHtml = validateBespokeSlideHtml;
|
|
3287
|
-
//# sourceMappingURL=chunk-
|
|
3288
|
-
//# sourceMappingURL=chunk-
|
|
3299
|
+
//# sourceMappingURL=chunk-JRPN5PMM.cjs.map
|
|
3300
|
+
//# sourceMappingURL=chunk-JRPN5PMM.cjs.map
|