@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.
@@ -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
- return { valid: issues.length === 0, issues };
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 countElementChildren(html, cls) {
3113
+ function elementInner(html, cls) {
3087
3114
  const rootOpen = new RegExp(`<([a-z]+)[^>]*class="[^"]*\\b${cls}\\b[^"]*"[^>]*>`, "i").exec(html);
3088
- if (!rootOpen) return 99;
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
- const inner = html.slice(start, end);
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-LVSQN2VI.js.map
3250
- //# sourceMappingURL=chunk-LVSQN2VI.js.map
3280
+ //# sourceMappingURL=chunk-754Q7SHQ.js.map
3281
+ //# sourceMappingURL=chunk-754Q7SHQ.js.map