@ecomcx/ecomweb-theme-sdk 1.36.1 → 1.38.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/dist/client.d.ts CHANGED
@@ -118,10 +118,11 @@ export declare function LanguageSwitcherClient({ languages, current, defaultLoca
118
118
  export { LoginForm, RegisterForm, ForgotPasswordForm, ResetPasswordForm, LogoutButton, LoginOutLink, useCurrentUser, extraFields, ProfileForm, ChangePasswordForm, DeleteAccountForm, AUTH_LABELS, AUTH_PATHS, type AuthLabels, type AuthPaths, type SignInProvider } from "./auth-forms.js";
119
119
  export { safeRedirect, type CurrentUser } from "./auth-shared.js";
120
120
  /** Khối countdown: đếm ngược tới `target` (ms). Dựng lần đầu cùng giá trị trên máy chủ, rồi cập nhật mỗi giây. */
121
- export declare function CountdownClient({ target, label, expiredText }: {
121
+ export declare function CountdownClient({ target, label, expiredText, units }: {
122
122
  target: number;
123
123
  label?: string;
124
124
  expiredText?: string;
125
+ units?: Partial<Record<"d" | "h" | "m" | "s", string>>;
125
126
  }): import("react").JSX.Element;
126
127
  /** Khối tabs: các panel đã vẽ sẵn trên máy chủ (nội dung vẫn có trong HTML cho SEO); chỉ đổi panel đang hiện. */
127
128
  export declare function TabsClient({ titles, panels }: {
package/dist/client.js CHANGED
@@ -193,7 +193,7 @@ export function LanguageSwitcherClient({ languages, current, defaultLocale, labe
193
193
  export { LoginForm, RegisterForm, ForgotPasswordForm, ResetPasswordForm, LogoutButton, LoginOutLink, useCurrentUser, extraFields, ProfileForm, ChangePasswordForm, DeleteAccountForm, AUTH_LABELS, AUTH_PATHS } from "./auth-forms.js";
194
194
  export { safeRedirect } from "./auth-shared.js";
195
195
  /** Khối countdown: đếm ngược tới `target` (ms). Dựng lần đầu cùng giá trị trên máy chủ, rồi cập nhật mỗi giây. */
196
- export function CountdownClient({ target, label, expiredText }) {
196
+ export function CountdownClient({ target, label, expiredText, units }) {
197
197
  const [now, setNow] = useState(() => Date.now());
198
198
  useEffect(() => { const id = setInterval(() => setNow(Date.now()), 1000); return () => clearInterval(id); }, []);
199
199
  const left = Math.max(0, target - now);
@@ -202,7 +202,7 @@ export function CountdownClient({ target, label, expiredText }) {
202
202
  const p = (n) => String(n).padStart(2, "0");
203
203
  const s = Math.floor(left / 1000);
204
204
  const parts = [["d", Math.floor(s / 86400)], ["h", Math.floor(s / 3600) % 24], ["m", Math.floor(s / 60) % 60], ["s", s % 60]];
205
- return (_jsxs("div", { className: "ecx-countdown", role: "timer", "aria-live": "off", suppressHydrationWarning: true, children: [label && _jsx("p", { className: "ecx-countdown-label", children: label }), _jsx("div", { className: "ecx-countdown-parts", children: parts.map(([u, n]) => _jsxs("span", { className: `ecx-countdown-${u}`, children: [_jsx("strong", { children: p(n) }), _jsx("small", { children: u })] }, u)) })] }));
205
+ return (_jsxs("div", { className: "ecx-countdown", role: "timer", "aria-live": "off", suppressHydrationWarning: true, children: [label && _jsx("p", { className: "ecx-countdown-label", children: label }), _jsx("div", { className: "ecx-countdown-parts", children: parts.map(([u, n]) => _jsxs("span", { className: `ecx-countdown-${u}`, children: [_jsx("strong", { children: p(n) }), _jsx("small", { children: units?.[u] ?? u })] }, u)) })] }));
206
206
  }
207
207
  /** Khối tabs: các panel đã vẽ sẵn trên máy chủ (nội dung vẫn có trong HTML cho SEO); chỉ đổi panel đang hiện. */
208
208
  export function TabsClient({ titles, panels }) {
@@ -37,11 +37,13 @@ export declare function Pagination({ data, prevLabel, nextLabel, pageParam, type
37
37
  midSize?: number;
38
38
  }): Promise<import("react").JSX.Element | null>;
39
39
  /** Ảnh đại diện: responsive, WebP, srcset. */
40
- export declare function FeaturedImage({ media, size, className, link, sizes, priority }: {
40
+ /** `label`: tên của link khi ảnh chưa có alt (thường là tiêu đề bài) — không có thì trình đọc màn hình chỉ đọc "liên kết". */
41
+ export declare function FeaturedImage({ media, size, className, link, label, sizes, priority }: {
41
42
  media?: Media | null;
42
43
  size?: string;
43
44
  className?: string;
44
45
  link?: string;
46
+ label?: string;
45
47
  sizes?: string;
46
48
  priority?: boolean;
47
49
  }): import("react").JSX.Element | null;
@@ -120,11 +120,13 @@ export async function Pagination({ data, prevLabel, nextLabel, pageParam, type =
120
120
  : _jsx(Link, { href: link(p), children: p }, p)), type !== "numbers" && data.page < data.totalPages && _jsx(Link, { className: "next", href: link(data.page + 1), children: nextLabel })] }));
121
121
  }
122
122
  /** Ảnh đại diện: responsive, WebP, srcset. */
123
- export function FeaturedImage({ media, size = "large", className, link, sizes, priority }) {
123
+ /** `label`: tên của link khi ảnh chưa có alt (thường là tiêu đề bài) — không có thì trình đọc màn hình chỉ đọc "liên kết". */
124
+ export function FeaturedImage({ media, size = "large", className, link, label, sizes, priority }) {
124
125
  if (!media)
125
126
  return null;
126
127
  const img = _jsx(Img, { media: media, size: size, sizes: sizes, priority: priority });
127
- return _jsx("figure", { className: cx("featured-image", className), children: link ? _jsx(Link, { href: link, children: img }) : img });
128
+ const name = link && !media.alt?.trim() && label?.trim() ? label : undefined;
129
+ return _jsx("figure", { className: cx("featured-image", className), children: link ? _jsx(Link, { href: link, "aria-label": name, children: img }) : img });
128
130
  }
129
131
  export function PostDate({ post, site }) {
130
132
  return _jsx("time", { dateTime: post.publishedAt ?? post.createdAt, children: formatDate(post.publishedAt ?? post.createdAt, site) });
package/dist/dynamic.js CHANGED
@@ -4,6 +4,7 @@ import { getArchives, getPosts, getTerms } from "./api.js";
4
4
  import { Link, LoginOutLink } from "./client.js";
5
5
  import { Comments, FeaturedImage, LanguageSwitcher, Menu, Pagination, PostDate, SearchForm, TermLinks } from "./components.js";
6
6
  import { getT } from "./i18n.js";
7
+ import { applyFilters } from "./runtime.js";
7
8
  import { localeHref } from "./locale.js";
8
9
  import { renderContent } from "./rich.js";
9
10
  import { cx } from "./utils.js";
@@ -66,7 +67,7 @@ export async function renderDynamic(node, key, ctx, children) {
66
67
  if (!post?.featuredMedia)
67
68
  return null;
68
69
  const ratio = ASPECT[a.aspect];
69
- return _jsx("div", { className: "ecx-featured-image", style: ratio ? { aspectRatio: ratio, overflow: "hidden" } : undefined, children: _jsx(FeaturedImage, { media: post.featuredMedia, size: a.size ?? "large", link: a.link ? post.link : undefined }) }, key);
70
+ return _jsx("div", { className: "ecx-featured-image", style: ratio ? { aspectRatio: ratio, overflow: "hidden" } : undefined, children: _jsx(FeaturedImage, { media: post.featuredMedia, size: a.size ?? "large", link: a.link ? post.link : undefined, label: post.title }) }, key);
70
71
  }
71
72
  case "postDate":
72
73
  return post ? _jsx("p", { className: "ecx-post-date", style: align(a), children: _jsx(PostDate, { post: a.displayType === "modified" ? { ...post, publishedAt: post.updatedAt } : post, site: site }) }, key) : null;
@@ -175,8 +176,9 @@ export async function renderDynamic(node, key, ctx, children) {
175
176
  return null;
176
177
  const base = (site.url ?? "").replace(/\/$/, "");
177
178
  // Schema BreadcrumbList: Google hiện đường dẫn thay cho URL trong kết quả tìm kiếm
178
- const jsonLd = { "@context": "https://schema.org", "@type": "BreadcrumbList", itemListElement: items.map((it, i) => ({ "@type": "ListItem", position: i + 1, name: it.name, ...(it.href ? { item: /^https?:/.test(it.href) ? it.href : base + it.href } : {}) })) };
179
- return (_jsxs("nav", { className: "ecx-breadcrumbs", "aria-label": t("breadcrumbs.label"), children: [_jsx("ol", { children: items.map((it, i) => _jsxs("li", { children: [i > 0 && _jsx("span", { className: "ecx-breadcrumbs-sep", "aria-hidden": "true", children: a.separator ?? "›" }), it.href ? _jsx(Link, { href: it.href, children: it.name }) : _jsx("span", { "aria-current": "page", children: it.name })] }, i)) }), _jsx("script", { type: "application/ld+json", dangerouslySetInnerHTML: { __html: JSON.stringify(jsonLd).replace(/</g, "\\u003c") } })] }, key));
179
+ // Plugin SEO có schema riêng (BreadcrumbList trong @graph) trả null để trang không có hai BreadcrumbList mâu thuẫn
180
+ const jsonLd = await applyFilters("breadcrumbs.schema", { "@context": "https://schema.org", "@type": "BreadcrumbList", itemListElement: items.map((it, i) => ({ "@type": "ListItem", position: i + 1, name: it.name, ...(it.href ? { item: /^https?:/.test(it.href) ? it.href : base + it.href } : {}) })) }, { site, items }, site);
181
+ return (_jsxs("nav", { className: "ecx-breadcrumbs", "aria-label": t("breadcrumbs.label"), children: [_jsx("ol", { children: items.map((it, i) => _jsxs("li", { children: [i > 0 && _jsx("span", { className: "ecx-breadcrumbs-sep", "aria-hidden": "true", children: a.separator ?? "›" }), it.href ? _jsx(Link, { href: it.href, children: it.name }) : _jsx("span", { "aria-current": "page", children: it.name })] }, i)) }), jsonLd && _jsx("script", { type: "application/ld+json", dangerouslySetInnerHTML: { __html: JSON.stringify(jsonLd).replace(/</g, "\\u003c") } })] }, key));
180
182
  }
181
183
  case "postNavigation": {
182
184
  const cur = ctx.data?.post;
package/dist/i18n.js CHANGED
@@ -7,7 +7,7 @@ export const BUILTIN = {
7
7
  vi: {
8
8
  "search.placeholder": "Tìm kiếm…", "search.button": "Tìm", "search.label": "Từ khoá", "navigation.menu": "Menu", "toc.title": "Mục lục", "query.search": "Kết quả tìm kiếm: {q}", "query.category": "Chuyên mục: {name}", "query.tag": "Thẻ: {name}", "query.author": "Tác giả: {name}", "breadcrumbs.home": "Trang chủ", "breadcrumbs.label": "Đường dẫn", "postNav.previous": "Bài trước", "postNav.next": "Bài sau", "postNav.label": "Bài khác",
9
9
  "post.read_more": "Đọc tiếp", "pagination.prev": "« Trước", "pagination.next": "Sau »", "pagination.label": "Phân trang",
10
- "comments.title": "Bình luận", "comments.closed": "Bình luận đã đóng.",
10
+ "comments.title": "Bình luận", "comments.closed": "Bình luận đã đóng.", "countdown.d": "ngày", "countdown.h": "giờ", "countdown.m": "phút", "countdown.s": "giây",
11
11
  "comments.form.title": "Để lại bình luận", "comments.form.content": "Bình luận", "comments.form.name": "Tên",
12
12
  "comments.form.email": "Email", "comments.form.website": "Website", "comments.form.submit": "Gửi bình luận",
13
13
  "comments.form.sending": "Đang gửi…", "comments.form.approved": "Cảm ơn bạn! Bình luận đã được đăng (tải lại trang để xem).",
@@ -28,11 +28,12 @@ export const BUILTIN = {
28
28
  "auth.submitProfile": "Lưu hồ sơ", "auth.submitPassword": "Đổi mật khẩu", "auth.notSignedIn": "Bạn cần đăng nhập để xem trang này.",
29
29
  "auth.deleteWarning": "Xoá tài khoản là vĩnh viễn: bạn không đăng nhập được nữa, bài viết của bạn không còn tác giả.",
30
30
  "auth.deleteConfirm": "Tôi hiểu, xoá tài khoản của tôi", "auth.submitDelete": "Xoá tài khoản",
31
+ "styleBook.title": "Mẫu kiểu dáng", "styleBook.h": "Tiêu đề", "styleBook.para": "Đoạn văn mẫu: chữ của bài viết trên website hiển thị như thế này.", "styleBook.bold": "chữ đậm", "styleBook.italic": "chữ nghiêng", "styleBook.link": "liên kết", "styleBook.item": "Mục", "styleBook.quote": "Trích dẫn mẫu: một câu đáng nhớ.", "styleBook.cite": "Tác giả", "styleBook.button": "Nút bấm", "styleBook.callout": "Hộp lưu ý: thông tin cần chú ý.", "styleBook.group": "Nhóm có nền", "styleBook.column": "Cột", "styleBook.details": "Bấm để xem thêm", "styleBook.cover": "Ảnh bìa",
31
32
  },
32
33
  en: {
33
34
  "search.placeholder": "Search…", "search.button": "Search", "search.label": "Keyword", "navigation.menu": "Menu", "toc.title": "Contents", "query.search": "Search results: {q}", "query.category": "Category: {name}", "query.tag": "Tag: {name}", "query.author": "Author: {name}", "breadcrumbs.home": "Home", "breadcrumbs.label": "Breadcrumb", "postNav.previous": "Previous", "postNav.next": "Next", "postNav.label": "More posts",
34
35
  "post.read_more": "Read more", "pagination.prev": "« Previous", "pagination.next": "Next »", "pagination.label": "Pagination",
35
- "comments.title": "Comments", "comments.closed": "Comments are closed.",
36
+ "comments.title": "Comments", "comments.closed": "Comments are closed.", "countdown.d": "d", "countdown.h": "h", "countdown.m": "m", "countdown.s": "s",
36
37
  "comments.form.title": "Leave a comment", "comments.form.content": "Comment", "comments.form.name": "Name",
37
38
  "comments.form.email": "Email", "comments.form.website": "Website", "comments.form.submit": "Post comment",
38
39
  "comments.form.sending": "Sending…", "comments.form.approved": "Thanks! Your comment is published (reload to see it).",
@@ -53,6 +54,7 @@ export const BUILTIN = {
53
54
  "auth.submitProfile": "Save profile", "auth.submitPassword": "Change password", "auth.notSignedIn": "Please log in to see this page.",
54
55
  "auth.deleteWarning": "Deleting your account is permanent: you can no longer log in and your posts will have no author.",
55
56
  "auth.deleteConfirm": "I understand, delete my account", "auth.submitDelete": "Delete account",
57
+ "styleBook.title": "Style book", "styleBook.h": "Heading", "styleBook.para": "Sample paragraph: post text on the website looks like this.", "styleBook.bold": "bold text", "styleBook.italic": "italic text", "styleBook.link": "a link", "styleBook.item": "Item", "styleBook.quote": "Sample quote: a memorable line.", "styleBook.cite": "Author", "styleBook.button": "Button", "styleBook.callout": "Callout: something worth noticing.", "styleBook.group": "Group with background", "styleBook.column": "Column", "styleBook.details": "Click to see more", "styleBook.cover": "Cover",
56
58
  },
57
59
  };
58
60
  /**
package/dist/metadata.js CHANGED
@@ -1,11 +1,12 @@
1
1
  import { applyFilters } from "./runtime.js";
2
+ import { pageLink } from "./utils.js";
2
3
  /** Metadata mặc định cho trang + cho plugin (vd SEO) sửa qua filter "document.metadata". */
3
4
  export async function buildDocumentMetadata(data, site) {
4
5
  const isHome = data.kind === "home" || data.kind === "front-page";
5
6
  const base = {
6
7
  title: isHome ? `${site.title}${site.tagline ? ` – ${site.tagline}` : ""}` : `${data.title} – ${site.title}`,
7
8
  description: data.post?.excerpt || (data.term?.description || undefined) || site.tagline,
8
- canonical: data.post?.link ? data.post.link + (Number(data.query?.trang) > 1 ? `?trang=${Math.floor(Number(data.query?.trang))}` : "") : (data.basePath || undefined),
9
+ canonical: data.post?.link ? data.post.link + (Number(data.query?.trang) > 1 ? `?trang=${Math.floor(Number(data.query?.trang))}` : "") : (data.basePath ? pageLink(data.basePath, Number(data.page) || 1) : undefined), // trang phân trang tự canonical về chính nó (không dồn về trang 1: nội dung mỗi trang khác nhau)
9
10
  alternates: Object.fromEntries((data.alternates ?? []).map((a) => [a.locale, a.link])),
10
11
  openGraph: {
11
12
  title: data.post?.title ?? data.title,
@@ -2,6 +2,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { PostContent } from "./content.js";
3
3
  /** Template "canvas": không có header/footer của theme, chỉ nội dung trang (trang dựng bằng khối). */
4
4
  export default function Canvas({ data }) {
5
- return _jsx("main", { className: "ecx-canvas", children: _jsx(PostContent, { post: data.post }) });
5
+ // Chữ ở cột giữa, khối "Rộng" / "Toàn trang" tràn ra (như template trống của WordPress)
6
+ return _jsx("main", { className: "ecx-canvas", children: _jsx(PostContent, { post: data.post, className: "entry-content ecx-layout-constrained" }) });
6
7
  }
7
8
  export const layout = false;
@@ -1,3 +1,6 @@
1
1
  import type { TemplateProps } from "./types.js";
2
- /** Template "full-width": giữ header/footer của theme, nội dung trải hết chiều ngang màn hình. */
2
+ /**
3
+ * Template "full-width": giữ header/footer của theme, vùng bài trải hết chiều ngang màn hình. Như WordPress: chữ vẫn ở cột giữa
4
+ * (--ecx-content-width), chỉ khối đặt độ rộng "Rộng" / "Toàn trang" mới tràn ra.
5
+ */
3
6
  export default function FullWidth({ data }: TemplateProps): import("react").JSX.Element;
@@ -1,6 +1,9 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { PostContent } from "./content.js";
3
- /** Template "full-width": giữ header/footer của theme, nội dung trải hết chiều ngang màn hình. */
3
+ /**
4
+ * Template "full-width": giữ header/footer của theme, vùng bài trải hết chiều ngang màn hình. Như WordPress: chữ vẫn ở cột giữa
5
+ * (--ecx-content-width), chỉ khối đặt độ rộng "Rộng" / "Toàn trang" mới tràn ra.
6
+ */
4
7
  export default function FullWidth({ data }) {
5
- return _jsx("div", { className: "ecx-full-width", children: _jsx(PostContent, { post: data.post }) });
8
+ return (_jsxs("div", { className: "ecx-full-width", children: [data.post?.title && _jsx("h1", { className: "entry-title ecx-page-title", children: data.post.title }), _jsx(PostContent, { post: data.post, className: "entry-content ecx-layout-constrained" })] }));
6
9
  }
package/dist/rich.js CHANGED
@@ -1,10 +1,11 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
2
  import { Fragment, cloneElement, createElement, isValidElement } from "react";
3
3
  import { ICON_PATHS } from "./icons.js";
4
- import { DYNAMIC_NODES, blockCitation, blockShell, buttonWrapShell, coverParts, linkRel, embedInfo, motionClasses, normalizeContent, safeUrl, styleClass, styleCss } from "@ecomcx/ecomweb-content";
4
+ import { DYNAMIC_NODES, widthClass, blockCitation, blockShell, buttonWrapShell, coverParts, linkRel, embedInfo, motionClasses, normalizeContent, safeUrl, styleClass, styleCss } from "@ecomcx/ecomweb-content";
5
5
  import { cx } from "./utils.js";
6
6
  import { SOCIAL_ICONS } from "./social-icons.js";
7
7
  import { CountdownClient, LightboxClient, TabsClient } from "./client.js";
8
+ import { getT } from "./i18n.js";
8
9
  const DYNAMIC = new Set(DYNAMIC_NODES);
9
10
  const SHORTCODE = /^\s*\[([a-z0-9_-]+)((?:\s+[a-z0-9_-]+=(?:"[^"]*"|'[^']*'|[^\s\]]+))*)\s*\]\s*$/i;
10
11
  const SHORTCODE_INLINE = /\[([a-z0-9_-]+)((?:\s+[a-z0-9_-]+=(?:"[^"]*"|'[^']*'|[^\s\]]+))*)\s*\]/gi;
@@ -155,14 +156,14 @@ function overridden(style) {
155
156
  * Gắn kiểu dáng (class `ecx-s-…`), biến thể (`ecx-is-…`), class riêng và neo (id) của khối vào phần tử đã vẽ
156
157
  * (không có phần tử bọc ngoài → thêm div). Giá trị đã được normalizeContent kiểm.
157
158
  */
158
- function decorate(el, a, key, ctx) {
159
+ function decorate(el, a, key, ctx, type) {
159
160
  if (el == null || el === false)
160
161
  return el;
161
162
  const style = a.style && typeof a.style === "object" ? a.style : null;
162
163
  const cls = style ? styleClass(style) : null;
163
164
  if (style && cls && ctx.styles && !ctx.styles.has(cls))
164
165
  ctx.styles.set(cls, styleCss(style, cls));
165
- const extra = cx(cls, motionClasses(style), a.blockStyle && `ecx-is-${a.blockStyle}`, a.className);
166
+ const extra = cx(cls, motionClasses(style), widthClass(type, a), a.blockStyle && `ecx-is-${a.blockStyle}`, a.className);
166
167
  if (isValidElement(el) && el.type !== Fragment && typeof el.type === "string") {
167
168
  const e = el;
168
169
  let inline = e.props.style;
@@ -220,7 +221,7 @@ async function renderNode(node, key, ctx) {
220
221
  if (ctx.filterBlock && node.type !== "text" && node.type !== "doc")
221
222
  el = await ctx.filterBlock(node, el);
222
223
  const a = node.attrs;
223
- const out = a && (a.style || a.blockStyle || a.className || a.anchor) ? decorate(el, a, key, ctx) : el;
224
+ const out = a && (a.style || a.blockStyle || a.className || a.anchor || widthClass(node.type, a)) ? decorate(el, a, key, ctx, node.type) : el;
224
225
  return ctx.markBlocks && ctx.source && ctx.pathRoot != null && key.startsWith(ctx.pathRoot + "-") && !UNMARKED.has(node.type)
225
226
  ? markBlock(out, ctx.source, key.slice(ctx.pathRoot.length + 1), key)
226
227
  : out;
@@ -286,7 +287,10 @@ async function renderNodeInner(node, key, ctx) {
286
287
  // Ảnh chèn từ thư viện mang sẵn srcset (JPEG + WebP) và kích thước → responsive, không nhảy layout
287
288
  // Bề rộng hiển thị = cỡ người viết kéo trong trình soạn → trình duyệt chọn file vừa đúng
288
289
  const sizes = a.width ? `(max-width: ${a.width}px) 100vw, ${a.width}px` : (a.sizes || "(max-width: 1024px) 100vw, 1024px");
289
- const img = _jsx("img", { src: safeUrl(a.src, ""), srcSet: a.srcset || undefined, sizes: a.srcset ? sizes : undefined, alt: a.alt ?? "", title: a.title ?? undefined, width: a.width ?? undefined, height: a.height ?? undefined, loading: "lazy", decoding: "async" });
290
+ const imgSrc = safeUrl(a.src, "");
291
+ if (!imgSrc)
292
+ return null; // chưa chọn ảnh: không in <img> không có địa chỉ (hiện icon ảnh hỏng)
293
+ const img = _jsx("img", { src: imgSrc, srcSet: a.srcset || undefined, sizes: a.srcset ? sizes : undefined, alt: a.alt ?? "", title: a.title ?? undefined, width: a.width ?? undefined, height: a.height ?? undefined, loading: "lazy", decoding: "async" });
290
294
  const bare = a.webpSrcset ? _jsxs("picture", { children: [_jsx("source", { type: "image/webp", srcSet: a.webpSrcset, sizes: sizes }), img] }) : img;
291
295
  // next: ảnh có liên kết (href qua safeUrl; mở tab mới thì noopener)
292
296
  const pic = a.lightbox === true && !a.href ? _jsx(LightboxClient, { src: safeUrl(a.src, ""), alt: a.alt ?? "", children: bare }) : a.href ? _jsx("a", { href: safeUrl(a.href), target: a.linkTarget === "_blank" ? "_blank" : undefined, rel: a.linkTarget === "_blank" ? "noopener noreferrer" : undefined, children: bare }) : bare;
@@ -362,7 +366,9 @@ async function renderNodeInner(node, key, ctx) {
362
366
  }
363
367
  case "mediaText": return shelled("mediaText", a, key, _jsxs(_Fragment, { children: [_jsx("figure", { className: "ecx-media-text-media", style: { margin: 0 }, children: a.src && _jsx("img", { src: safeUrl(a.src, ""), alt: a.alt ?? "", loading: "lazy", decoding: "async" }) }), _jsx("div", { className: "ecx-media-text-content", children: await children() })] }));
364
368
  case "pullquote":
365
- return shelled("pullquote", a, key, _jsxs(_Fragment, { children: [_jsx("blockquote", { children: _jsx("p", { children: await children() }) }), blockCitation(a) && _jsx("figcaption", { children: blockCitation(a) })] }));
369
+ // Nội dung là các khối (đoạn văn…) → không bọc <p> (<p><p> sai HTML: trình duyệt tách thẻ → React báo lệch khi hydrate);
370
+ // chữ trần (dữ liệu cũ) mới cần <p>
371
+ return shelled("pullquote", a, key, _jsxs(_Fragment, { children: [_jsx("blockquote", { children: (node.content ?? []).every((c) => c.type === "text" || c.type === "hardBreak") ? _jsx("p", { children: await children() }) : await children() }), blockCitation(a) && _jsx("figcaption", { children: blockCitation(a) })] }));
366
372
  case "accordion": {
367
373
  const sub = a.multiple === true ? ctx : { ...ctx, accordion: `ecx-acc-${key}` };
368
374
  return _jsx("div", { className: "ecx-accordion", children: await Promise.all((node.content ?? []).map((c, i) => renderNode(c, `${key}-${i}`, sub))) }, key);
@@ -371,7 +377,9 @@ async function renderNodeInner(node, key, ctx) {
371
377
  const ms = Date.parse(String(a.target ?? ""));
372
378
  if (!Number.isFinite(ms))
373
379
  return null;
374
- return _jsx(CountdownClient, { target: ms, label: a.label ? String(a.label) : undefined, expiredText: a.expiredText ? String(a.expiredText) : undefined }, key);
380
+ const t = await getT();
381
+ const units = { d: t("countdown.d"), h: t("countdown.h"), m: t("countdown.m"), s: t("countdown.s") }; // theo ngôn ngữ của trang (vi: ngày/giờ/phút/giây)
382
+ return _jsx(CountdownClient, { target: ms, units: units, label: a.label ? String(a.label) : undefined, expiredText: a.expiredText ? String(a.expiredText) : undefined }, key);
375
383
  }
376
384
  case "rating": {
377
385
  const max = Math.min(10, Math.max(1, Math.round(Number(a.max) || 5)));
package/dist/runtime.js CHANGED
@@ -80,7 +80,7 @@ export const getActiveExtensions = cache(async (site) => {
80
80
  const s = site ?? (await getSite());
81
81
  const { plugins } = runtime();
82
82
  const defs = [];
83
- for (const slug of s.activePlugins) {
83
+ for (const slug of s.activePlugins ?? []) {
84
84
  const loader = plugins[slug];
85
85
  if (!loader)
86
86
  continue;
package/dist/types.d.ts CHANGED
@@ -489,6 +489,17 @@ export interface FilterMap {
489
489
  site: Site;
490
490
  data: ResolveResult;
491
491
  }) => string[] | Promise<string[]>;
492
+ /**
493
+ * Schema BreadcrumbList của khối "breadcrumbs" trong theme. Plugin SEO tự in BreadcrumbList trong @graph của nó thì trả null
494
+ * (trang chỉ có một BreadcrumbList); vẫn vẽ đường dẫn nhìn thấy.
495
+ */
496
+ "breadcrumbs.schema": (schema: Record<string, unknown> | null, ctx: {
497
+ site: Site;
498
+ items: Array<{
499
+ name: string;
500
+ href?: string;
501
+ }>;
502
+ }) => Record<string, unknown> | null | Promise<Record<string, unknown> | null>;
492
503
  /** Thêm/bớt class của thẻ <body> (vd "logged-in", "has-promo-bar") */
493
504
  "body.class": (classes: string[], ctx: {
494
505
  site: Site;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ecomcx/ecomweb-theme-sdk",
3
- "version": "1.36.1",
3
+ "version": "1.38.0",
4
4
  "description": "SDK để viết theme và phần frontend của plugin cho Ecomweb",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -33,7 +33,7 @@
33
33
  "README.md"
34
34
  ],
35
35
  "dependencies": {
36
- "@ecomcx/ecomweb-content": "^1.19.0",
36
+ "@ecomcx/ecomweb-content": "^1.20.0",
37
37
  "intl-messageformat": "12.1.3"
38
38
  },
39
39
  "peerDependencies": {