@thanh01.pmt/presentation-kit 0.3.3 → 0.3.5
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-2FJGU32M.cjs → chunk-4JRWOBKO.cjs} +4 -4
- package/dist/{chunk-2FJGU32M.cjs.map → chunk-4JRWOBKO.cjs.map} +1 -1
- package/dist/{chunk-LVSQN2VI.js → chunk-754Q7SHQ.js} +37 -6
- package/dist/chunk-754Q7SHQ.js.map +1 -0
- package/dist/{chunk-FIBXWRWQ.js → chunk-IWJA7J7Y.js} +3 -3
- package/dist/{chunk-FIBXWRWQ.js.map → chunk-IWJA7J7Y.js.map} +1 -1
- package/dist/{chunk-YO6TN5TA.cjs → chunk-LDWFQE4C.cjs} +37 -6
- package/dist/chunk-LDWFQE4C.cjs.map +1 -0
- package/dist/index.cjs +48 -48
- package/dist/index.d.cts +10 -0
- package/dist/index.d.ts +10 -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-LVSQN2VI.js.map +0 -1
- package/dist/chunk-YO6TN5TA.cjs.map +0 -1
|
@@ -3038,6 +3038,11 @@ function sanitizeSlideHtml(raw) {
|
|
|
3038
3038
|
});
|
|
3039
3039
|
return { html: html.trim(), removed: Array.from(new Set(removed)) };
|
|
3040
3040
|
}
|
|
3041
|
+
var COMPOSITION_LINTS = [
|
|
3042
|
+
"full-height root uses justify-content:space-between",
|
|
3043
|
+
"card stretched by a flex:1 parent uses justify-content:space-between"
|
|
3044
|
+
];
|
|
3045
|
+
var isCompositionLint = (issue) => COMPOSITION_LINTS.some((p) => issue.startsWith(p));
|
|
3041
3046
|
function validateBespokeSlideHtml(raw, contract = {}) {
|
|
3042
3047
|
const maxChars = contract.maxChars ?? 16e3;
|
|
3043
3048
|
const minChars = contract.minChars ?? 120;
|
|
@@ -3081,11 +3086,33 @@ function validateBespokeSlideHtml(raw, contract = {}) {
|
|
|
3081
3086
|
);
|
|
3082
3087
|
break;
|
|
3083
3088
|
}
|
|
3084
|
-
|
|
3089
|
+
const stretchClasses = /* @__PURE__ */ new Set();
|
|
3090
|
+
for (const [, , cls, body] of clean.matchAll(blockRe)) {
|
|
3091
|
+
if (/flex:\s*1(?:\s|;|$)/.test(body.replace(" ", ""))) stretchClasses.add(cls);
|
|
3092
|
+
}
|
|
3093
|
+
for (const [, , cls, body] of clean.matchAll(blockRe)) {
|
|
3094
|
+
if (!/flex-direction:\s*column/.test(body)) continue;
|
|
3095
|
+
if (!/justify-content:\s*space-between/.test(body)) continue;
|
|
3096
|
+
if (countElementChildren(clean, cls) > 4) continue;
|
|
3097
|
+
const inStretch = [...stretchClasses].some((anc) => {
|
|
3098
|
+
const inner = elementInner(clean, anc);
|
|
3099
|
+
return inner ? new RegExp(`class="[^"]*\\b${cls}\\b[^"]*"`).test(inner) : false;
|
|
3100
|
+
});
|
|
3101
|
+
if (!inStretch) continue;
|
|
3102
|
+
issues.push(
|
|
3103
|
+
"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"
|
|
3104
|
+
);
|
|
3105
|
+
break;
|
|
3106
|
+
}
|
|
3107
|
+
return {
|
|
3108
|
+
valid: issues.length === 0,
|
|
3109
|
+
issues,
|
|
3110
|
+
compositionOnly: issues.length > 0 && issues.every(isCompositionLint)
|
|
3111
|
+
};
|
|
3085
3112
|
}
|
|
3086
|
-
function
|
|
3113
|
+
function elementInner(html, cls) {
|
|
3087
3114
|
const rootOpen = new RegExp(`<([a-z]+)[^>]*class="[^"]*\\b${cls}\\b[^"]*"[^>]*>`, "i").exec(html);
|
|
3088
|
-
if (!rootOpen) return
|
|
3115
|
+
if (!rootOpen) return null;
|
|
3089
3116
|
const rootTag = rootOpen[1];
|
|
3090
3117
|
const start = rootOpen.index + rootOpen[0].length;
|
|
3091
3118
|
const tagRe = new RegExp(`<\\/?${rootTag}\\b[^>]*?>`, "gi");
|
|
@@ -3100,7 +3127,11 @@ function countElementChildren(html, cls) {
|
|
|
3100
3127
|
break;
|
|
3101
3128
|
}
|
|
3102
3129
|
}
|
|
3103
|
-
|
|
3130
|
+
return html.slice(start, end);
|
|
3131
|
+
}
|
|
3132
|
+
function countElementChildren(html, cls) {
|
|
3133
|
+
const inner = elementInner(html, cls);
|
|
3134
|
+
if (inner === null) return 99;
|
|
3104
3135
|
const allTags = inner.match(/<\/?[a-z][^>]*?>/gi) || [];
|
|
3105
3136
|
const VOID = /* @__PURE__ */ new Set(["br", "img", "hr", "source", "wbr", "col", "area", "embed", "track", "param", "input", "meta", "link", "base"]);
|
|
3106
3137
|
let d = 0;
|
|
@@ -3246,5 +3277,5 @@ async function compileHtmlDeckAsync(deckData, options) {
|
|
|
3246
3277
|
}
|
|
3247
3278
|
|
|
3248
3279
|
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-
|
|
3280
|
+
//# sourceMappingURL=chunk-754Q7SHQ.js.map
|
|
3281
|
+
//# sourceMappingURL=chunk-754Q7SHQ.js.map
|