@thanh01.pmt/presentation-kit 0.3.3 → 0.3.4
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-LVSQN2VI.js → chunk-7ZQHP7OD.js} +27 -5
- package/dist/chunk-7ZQHP7OD.js.map +1 -0
- package/dist/{chunk-YO6TN5TA.cjs → chunk-KXX5PGN7.cjs} +27 -5
- package/dist/chunk-KXX5PGN7.cjs.map +1 -0
- package/dist/{chunk-FIBXWRWQ.js → chunk-UOWSDZEF.js} +3 -3
- package/dist/{chunk-FIBXWRWQ.js.map → chunk-UOWSDZEF.js.map} +1 -1
- package/dist/{chunk-2FJGU32M.cjs → chunk-WKTPYYO2.cjs} +4 -4
- package/dist/{chunk-2FJGU32M.cjs.map → chunk-WKTPYYO2.cjs.map} +1 -1
- package/dist/index.cjs +48 -48
- 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-LVSQN2VI.js.map +0 -1
- package/dist/chunk-YO6TN5TA.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 chunkKXX5PGN7_cjs = require('../chunk-KXX5PGN7.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 = chunkKXX5PGN7_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(chunkKXX5PGN7_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 = chunkKXX5PGN7_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(chunkKXX5PGN7_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(chunkKXX5PGN7_cjs.HTML_THEMES)
|
|
795
795
|
};
|
|
796
796
|
}
|
|
797
797
|
function handleGenerateHtmlDeck(input) {
|
|
798
798
|
try {
|
|
799
|
-
const result =
|
|
799
|
+
const result = chunkKXX5PGN7_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 = chunkKXX5PGN7_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-7ZQHP7OD.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
|
|
|
@@ -3081,11 +3081,29 @@ function validateBespokeSlideHtml(raw, contract = {}) {
|
|
|
3081
3081
|
);
|
|
3082
3082
|
break;
|
|
3083
3083
|
}
|
|
3084
|
+
const stretchClasses = /* @__PURE__ */ new Set();
|
|
3085
|
+
for (const [, , cls, body] of clean.matchAll(blockRe)) {
|
|
3086
|
+
if (/flex:\s*1(?:\s|;|$)/.test(body.replace(" ", ""))) stretchClasses.add(cls);
|
|
3087
|
+
}
|
|
3088
|
+
for (const [, , cls, body] of clean.matchAll(blockRe)) {
|
|
3089
|
+
if (!/flex-direction:\s*column/.test(body)) continue;
|
|
3090
|
+
if (!/justify-content:\s*space-between/.test(body)) continue;
|
|
3091
|
+
if (countElementChildren(clean, cls) > 4) continue;
|
|
3092
|
+
const inStretch = [...stretchClasses].some((anc) => {
|
|
3093
|
+
const inner = elementInner(clean, anc);
|
|
3094
|
+
return inner ? new RegExp(`class="[^"]*\\b${cls}\\b[^"]*"`).test(inner) : false;
|
|
3095
|
+
});
|
|
3096
|
+
if (!inStretch) continue;
|
|
3097
|
+
issues.push(
|
|
3098
|
+
"card stretched by a flex:1 parent uses justify-content:space-between with few children \u2014 leftover height pools into a hole inside the card; spread content with gap/flex:1 on the middle block or anchor to content instead of edges"
|
|
3099
|
+
);
|
|
3100
|
+
break;
|
|
3101
|
+
}
|
|
3084
3102
|
return { valid: issues.length === 0, issues };
|
|
3085
3103
|
}
|
|
3086
|
-
function
|
|
3104
|
+
function elementInner(html, cls) {
|
|
3087
3105
|
const rootOpen = new RegExp(`<([a-z]+)[^>]*class="[^"]*\\b${cls}\\b[^"]*"[^>]*>`, "i").exec(html);
|
|
3088
|
-
if (!rootOpen) return
|
|
3106
|
+
if (!rootOpen) return null;
|
|
3089
3107
|
const rootTag = rootOpen[1];
|
|
3090
3108
|
const start = rootOpen.index + rootOpen[0].length;
|
|
3091
3109
|
const tagRe = new RegExp(`<\\/?${rootTag}\\b[^>]*?>`, "gi");
|
|
@@ -3100,7 +3118,11 @@ function countElementChildren(html, cls) {
|
|
|
3100
3118
|
break;
|
|
3101
3119
|
}
|
|
3102
3120
|
}
|
|
3103
|
-
|
|
3121
|
+
return html.slice(start, end);
|
|
3122
|
+
}
|
|
3123
|
+
function countElementChildren(html, cls) {
|
|
3124
|
+
const inner = elementInner(html, cls);
|
|
3125
|
+
if (inner === null) return 99;
|
|
3104
3126
|
const allTags = inner.match(/<\/?[a-z][^>]*?>/gi) || [];
|
|
3105
3127
|
const VOID = /* @__PURE__ */ new Set(["br", "img", "hr", "source", "wbr", "col", "area", "embed", "track", "param", "input", "meta", "link", "base"]);
|
|
3106
3128
|
let d = 0;
|
|
@@ -3246,5 +3268,5 @@ async function compileHtmlDeckAsync(deckData, options) {
|
|
|
3246
3268
|
}
|
|
3247
3269
|
|
|
3248
3270
|
export { HTML_SLIDE_PRESETS, HTML_THEMES, SLIDE_UTILITY_CSS, buildBespokeSlideMarkup, compileHtmlDeck, compileHtmlDeckAsync, generateHtmlShell, getHighlighter, highlightCodeBlocks, highlightDeckCodeBlocks, listUtilityClasses, normalizeSlideSlots, resolveHtmlTheme, sanitizeSlideHtml, validateBespokeSlideHtml };
|
|
3249
|
-
//# sourceMappingURL=chunk-
|
|
3250
|
-
//# sourceMappingURL=chunk-
|
|
3271
|
+
//# sourceMappingURL=chunk-7ZQHP7OD.js.map
|
|
3272
|
+
//# sourceMappingURL=chunk-7ZQHP7OD.js.map
|