@ecomcx/ecomweb-theme-sdk 2.1.0 → 2.3.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/API.md +53 -5
- package/dist/bindings.d.ts +1 -1
- package/dist/bindings.js +12 -4
- package/dist/client.d.ts +81 -6
- package/dist/client.js +362 -12
- package/dist/content.js +6 -38
- package/dist/dynamic.js +6 -5
- package/dist/i18n.js +2 -2
- package/dist/icon-svg.d.ts +12 -0
- package/dist/icon-svg.js +21 -0
- package/dist/query-filters.js +11 -3
- package/dist/rich.d.ts +2 -0
- package/dist/rich.js +104 -67
- package/package.json +2 -2
package/dist/query-filters.js
CHANGED
|
@@ -94,15 +94,23 @@ export function buildPostQuery(a, env) {
|
|
|
94
94
|
delete q.order;
|
|
95
95
|
Object.assign(q, SORTS[url.fq_sort]);
|
|
96
96
|
}
|
|
97
|
+
const yr = Math.floor(Number(url.fq_year)), mo = Math.floor(Number(url.fq_month));
|
|
98
|
+
if (yr >= 1990 && yr <= 2100) {
|
|
99
|
+
q.year = yr;
|
|
100
|
+
if (mo >= 1 && mo <= 12)
|
|
101
|
+
q.month = mo;
|
|
102
|
+
}
|
|
97
103
|
const tn = taxonomy;
|
|
98
|
-
|
|
99
|
-
|
|
104
|
+
// ?fq_<phân loại>=a hoặc a,b,c (checkbox nhiều lựa chọn = bất kỳ mục nào)
|
|
105
|
+
const picked = tn ? slugs(url[`fq_${tn}`]).slice(0, 10) : [];
|
|
106
|
+
if (tn && picked.length)
|
|
107
|
+
tax.push({ taxonomy: tn, terms: picked });
|
|
100
108
|
}
|
|
101
109
|
if (tax.length)
|
|
102
110
|
q.taxQuery = tax;
|
|
103
111
|
// Mọi ?fq_… còn lại chuyển cho plugin đọc (vd giá, giảm giá, còn hàng của plugin bán hàng)
|
|
104
112
|
if (a.urlFilters === true) {
|
|
105
|
-
const extra = Object.fromEntries(Object.entries(url).filter(([k, v]) => /^fq_[a-z0-9_-]{1,40}$/i.test(k) && typeof v === "string" && v.length <= 100 && k !== "fq_s"));
|
|
113
|
+
const extra = Object.fromEntries(Object.entries(url).filter(([k, v]) => /^fq_[a-z0-9_-]{1,40}$/i.test(k) && typeof v === "string" && v.length <= 100 && k !== "fq_s" && k !== "fq_year" && k !== "fq_month"));
|
|
106
114
|
if (Object.keys(extra).length)
|
|
107
115
|
q.extra = extra;
|
|
108
116
|
}
|
package/dist/rich.d.ts
CHANGED
|
@@ -60,6 +60,8 @@ export interface RenderContext {
|
|
|
60
60
|
styles?: Map<string, string>;
|
|
61
61
|
/** Đang vẽ bên trong nhóm nút (`buttons`): nút không bọc thêm đoạn văn. */
|
|
62
62
|
inButtons?: boolean;
|
|
63
|
+
/** Đang vẽ bên trong một liên kết (tiêu đề có link cả khối): link trong chữ chỉ giữ chữ — không lồng <a> trong <a>. */
|
|
64
|
+
inLink?: boolean;
|
|
63
65
|
/** Lấy giá trị của nguồn gắn dữ liệu (attrs.bindings). Không có → bỏ qua bindings (giữ nội dung gõ tay). */
|
|
64
66
|
binding?(source: string, args: Record<string, string | number | boolean>, ctx: RenderContext): Promise<unknown>;
|
|
65
67
|
/** Tiêu đề của bài (khối mục lục) — renderContent ngoài cùng tính. */
|
package/dist/rich.js
CHANGED
|
@@ -1,9 +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
|
-
import {
|
|
3
|
+
import { ICON_LIBRARY } from "@ecomcx/ecomweb-content/icon-library";
|
|
4
|
+
import { iconSvg } from "./icon-svg.js";
|
|
5
|
+
import { BINDING_URL_ATTRS, CORE_BINDABLE, registerIconLibrary, tableClass, blockBgVideo, typedConfig, coverVideo, scheduleVisible, normalizeStyle, imageFx, countdownRules, testimonialsConfig, testimonialsVars, popupClass, popupConfig, popupPlayStyle, popupVars, carouselConfig, DYNAMIC_NODES, countdownTarget, nodeText, buttonIcon, widgetMarkup, tabsClass, formSizeClass, widthClass, blockCitation, blockShell, buttonWrapShell, coverParts, linkRel, embedInfo, motionClasses, normalizeContent, safeUrl, styleClass, styleCss, controlsCss, CORE_CONTROLS } from "@ecomcx/ecomweb-content";
|
|
4
6
|
import { cx } from "./utils.js";
|
|
5
7
|
import { SOCIAL_ICONS } from "./social-icons.js";
|
|
6
|
-
import { CountdownClient, FormBlockClient, LightboxClient, Link, TabsClient, TocSpy } from "./client.js";
|
|
8
|
+
import { GalleryThumbsClient, AudienceGate, TypedText, BgVideo, PopupClient, CarouselClient, CountdownClient, FormBlockClient, LightboxClient, Link, TabsClient, TocSpy } from "./client.js";
|
|
7
9
|
import { CounterClient } from "./counter-client.js";
|
|
8
10
|
import { AssetScript } from "./browser.js";
|
|
9
11
|
import { getT } from "./i18n.js";
|
|
@@ -100,10 +102,11 @@ function renderMarks(text, marks, key, ctx) {
|
|
|
100
102
|
out = _jsx("code", { children: out }, k);
|
|
101
103
|
break;
|
|
102
104
|
case "footnote": {
|
|
105
|
+
// 2 (v3): khối "Chú thích cuối trang" đã bỏ — dấu [n] giữ lại, nội dung chú thích hiện khi rê chuột
|
|
103
106
|
const f = ctx?.footnotes;
|
|
104
107
|
const n = f ? f.notes.findIndex((x) => x.mark === m) + 1 : 0;
|
|
105
108
|
if (n > 0)
|
|
106
|
-
out = _jsxs(Fragment, { children: [out,
|
|
109
|
+
out = _jsxs(Fragment, { children: [out, _jsxs("sup", { className: "ecx-footnote-ref", title: typeof m.attrs?.note === "string" ? m.attrs.note : undefined, children: ["[", n, "]"] })] }, k);
|
|
107
110
|
break;
|
|
108
111
|
}
|
|
109
112
|
case "kbd":
|
|
@@ -124,7 +127,7 @@ function renderMarks(text, marks, key, ctx) {
|
|
|
124
127
|
case "link": {
|
|
125
128
|
const target = m.attrs?.target;
|
|
126
129
|
const href = safeUrl(m.attrs?.href);
|
|
127
|
-
out = href ? _jsx(Link, { href: href, target: target ?? undefined, rel: linkRel(m.attrs?.rel, target), children: out }, k) : _jsx("a", { children: out }, k);
|
|
130
|
+
out = ctx?.inLink ? out : href ? _jsx(Link, { href: href, target: target ?? undefined, rel: linkRel(m.attrs?.rel, target), children: out }, k) : _jsx("a", { children: out }, k);
|
|
128
131
|
break;
|
|
129
132
|
}
|
|
130
133
|
}
|
|
@@ -201,15 +204,13 @@ function widgetEl(el, key) {
|
|
|
201
204
|
return el.tag === "a" ? _jsx(Link, { ...props, href: String(el.props?.href ?? ""), children: kids }) : createElement(el.tag, props, ...kids);
|
|
202
205
|
}
|
|
203
206
|
/** Thuộc tính gắn được của khối lõi (ngoài danh sách bị bỏ qua). */
|
|
204
|
-
const BINDABLE = { paragraph: ["content"], heading: ["content"], image: ["src", "alt", "caption"], button: ["text", "href"] };
|
|
205
|
-
const URL_ATTRS = new Set(["src", "href"]);
|
|
206
207
|
/**
|
|
207
208
|
* Áp gắn dữ liệu: thay chữ / thuộc tính bằng giá trị của nguồn lúc hiển thị. Giá trị là chữ thường (không HTML), đường dẫn qua safeUrl;
|
|
208
209
|
* nguồn không có / trả về rỗng → giữ nội dung gõ tay. Lỗi của nguồn (plugin) chỉ bỏ qua thuộc tính đó.
|
|
209
210
|
*/
|
|
210
211
|
async function applyBindings(node, ctx) {
|
|
211
212
|
const bindings = node.attrs?.bindings;
|
|
212
|
-
const allowed =
|
|
213
|
+
const allowed = CORE_BINDABLE[node.type];
|
|
213
214
|
if (!bindings || !allowed || !ctx.binding)
|
|
214
215
|
return node;
|
|
215
216
|
let out = node;
|
|
@@ -232,7 +233,7 @@ async function applyBindings(node, ctx) {
|
|
|
232
233
|
const text = String(v);
|
|
233
234
|
if (attr === "content")
|
|
234
235
|
out = { ...out, content: [{ type: "text", text }] };
|
|
235
|
-
else if (
|
|
236
|
+
else if (BINDING_URL_ATTRS.has(attr)) {
|
|
236
237
|
const u = safeUrl(text, "");
|
|
237
238
|
if (u)
|
|
238
239
|
out = { ...out, attrs: { ...out.attrs, [attr]: u } };
|
|
@@ -242,7 +243,14 @@ async function applyBindings(node, ctx) {
|
|
|
242
243
|
}
|
|
243
244
|
return out;
|
|
244
245
|
}
|
|
246
|
+
// Thư viện ~1.900 icon: nạp một lần khi module chạy (máy chủ) → mọi khối có icon vẽ được tên trong thư viện
|
|
247
|
+
registerIconLibrary(ICON_LIBRARY);
|
|
248
|
+
/** Video nền của Section / Row / Column (style.background.video): thẻ <video> tự phát, tắt tiếng, lặp, nằm dưới nội dung. */
|
|
249
|
+
const bgVideoNode = (a) => { const v = a?.style ? blockBgVideo(a.style) : null; return v ? _jsx(BgVideo, { className: "ecx-bg-video", src: v }, "bgv") : null; };
|
|
245
250
|
async function renderNode(node, key, ctx) {
|
|
251
|
+
// Lịch hiển thị (tab Nâng cao): ngoài khoảng [from, until) thì website không vẽ khối (trình soạn vẫn hiện để sửa)
|
|
252
|
+
if (node.type !== "text" && node.attrs?.style && typeof node.attrs.style === "object" && node.attrs.style.schedule && !scheduleVisible(normalizeStyle(node.attrs.style)))
|
|
253
|
+
return null;
|
|
246
254
|
if (node.attrs?.bindings) {
|
|
247
255
|
const bound = await applyBindings(node, ctx);
|
|
248
256
|
if (!bound)
|
|
@@ -266,13 +274,16 @@ async function renderNode(node, key, ctx) {
|
|
|
266
274
|
const given = pick?.filter((k) => !emptyAttr(a?.[k]));
|
|
267
275
|
const data = pick && (!pick.length || given.length) ? { "data-ecx-ready": node.type, "data-ecx-attrs": JSON.stringify(Object.fromEntries(given.map((k) => [k, a[k]]))) } : undefined;
|
|
268
276
|
const out = (a && (a.style || a.blockStyle || a.className || a.anchor || widthClass(node.type, a))) || ctrl || data ? decorate(el, a ?? {}, key, ctx, node.type, ctrl, data) : el;
|
|
269
|
-
|
|
277
|
+
const marked = ctx.markBlocks && ctx.source && ctx.pathRoot != null && key.startsWith(ctx.pathRoot + "-") && !UNMARKED.has(node.type)
|
|
270
278
|
? markBlock(out, ctx.source, key.slice(ctx.pathRoot.length + 1), key)
|
|
271
279
|
: out;
|
|
280
|
+
// Nhóm người xem (tab Nâng cao): bỏ qua ở trình soạn (markBlocks) để vẫn sửa được
|
|
281
|
+
const aud = node.type !== "text" && !ctx.markBlocks && node.attrs?.style ? normalizeStyle(node.attrs.style)?.audience : undefined;
|
|
282
|
+
return aud && marked != null ? _jsx(AudienceGate, { audience: aud, children: marked }, key) : marked;
|
|
272
283
|
}
|
|
273
284
|
const emptyAttr = (v) => v === undefined || v === null || v === "" || (Array.isArray(v) && !v.length);
|
|
274
285
|
/** Nút không chọn riêng được trong khung soạn (hoặc bọc thêm thẻ sẽ sai cấu trúc HTML: li trong ul, ô trong bảng). */
|
|
275
|
-
const UNMARKED = new Set(["text", "hardBreak", "listItem", "
|
|
286
|
+
const UNMARKED = new Set(["text", "hardBreak", "listItem", "tableRow", "tableCell", "tableHeader"]);
|
|
276
287
|
/** Gắn vị trí khối: thẻ HTML thì thêm thuộc tính, component thì bọc thẻ display:contents (không đổi bố cục). */
|
|
277
288
|
function markBlock(el, source, path, key) {
|
|
278
289
|
if (el == null || el === false)
|
|
@@ -303,38 +314,35 @@ async function renderNodeInner(node, key, ctx) {
|
|
|
303
314
|
return shelled("paragraph", a, key, await children());
|
|
304
315
|
}
|
|
305
316
|
case "heading": {
|
|
306
|
-
|
|
317
|
+
// Chữ gõ ở cuối tiêu đề (heading.typedWords): HTML dựng sẵn có từ đầu tiên, trình duyệt gõ lần lượt các từ
|
|
318
|
+
const typed = typedConfig(a);
|
|
319
|
+
const hHref = safeUrl(a.href, "");
|
|
320
|
+
const kids = hHref ? await Promise.all((node.content ?? []).map((c, i) => renderNode(c, `${key}-${i}`, { ...ctx, inLink: true }))) : await children();
|
|
321
|
+
const inner = typed ? _jsxs(_Fragment, { children: [kids, " ", _jsx(TypedText, { words: typed.words, speed: typed.speed, pause: typed.pause, loop: typed.loop })] }) : kids;
|
|
322
|
+
// 1.32: liên kết cả tiêu đề
|
|
323
|
+
const body = hHref ? _jsx(Link, { className: "ecx-heading-link", href: hHref, target: a.linkTarget === "_blank" ? "_blank" : undefined, rel: linkRel(a.linkRel, a.linkTarget), children: inner }) : inner;
|
|
324
|
+
return shelled("heading", a, key, body, { id: headingId(node) || undefined });
|
|
307
325
|
}
|
|
308
326
|
case "bulletList": return _jsx("ul", { children: await children() }, key);
|
|
309
327
|
case "orderedList": return _jsx("ol", { start: a.start && a.start !== 1 ? a.start : undefined, reversed: a.reversed === true || undefined, children: await children() }, key);
|
|
310
328
|
case "listItem": return _jsx("li", { children: await children() }, key);
|
|
311
|
-
case "taskList": return _jsx("ul", { className: "ecx-task-list task-list", children: await children() }, key);
|
|
312
|
-
case "taskItem": return _jsxs("li", { className: "ecx-task-item task-item", children: [_jsx("input", { type: "checkbox", checked: !!a.checked, readOnly: true }), " ", await children()] }, key);
|
|
313
329
|
case "blockquote": return shelled("blockquote", a, key, _jsxs(_Fragment, { children: [await children(), blockCitation(a) && _jsx("cite", { children: blockCitation(a) })] }));
|
|
314
330
|
case "codeBlock": return _jsx("pre", { children: _jsx("code", { className: a.language ? `language-${a.language}` : undefined, children: plainText(node) }) }, key);
|
|
315
331
|
case "hardBreak": return _jsx("br", {}, key);
|
|
316
|
-
case "pageBreak": return null;
|
|
317
|
-
case "footnotes": {
|
|
318
|
-
const f = ctx.footnotes;
|
|
319
|
-
if (!f?.notes.length)
|
|
320
|
-
return null;
|
|
321
|
-
return (_jsxs("aside", { className: "ecx-footnotes", children: [a.title && _jsx("p", { className: "ecx-footnotes-title", children: a.title }), _jsx("ol", { children: f.notes.map((x, i) => _jsxs("li", { id: `fn-${f.prefix}-${i + 1}`, children: [x.note, " ", _jsx("a", { href: `#fnref-${f.prefix}-${i + 1}`, "aria-label": "\u21A9", children: "\u21A9" })] }, i)) })] }, key));
|
|
322
|
-
}
|
|
323
332
|
case "icon": {
|
|
324
|
-
const path = ICON_PATHS[String(a.name)];
|
|
325
|
-
if (!path)
|
|
326
|
-
return null;
|
|
327
333
|
const size = Math.min(128, Math.max(12, Number(a.size) || 24));
|
|
328
334
|
const stroke = Math.min(4, Math.max(0.5, Number(a.stroke) || 2));
|
|
329
335
|
const shape = a.iconStyle === "circle" || a.iconStyle === "square" ? a.iconStyle : undefined;
|
|
330
|
-
const
|
|
336
|
+
const tip = typeof a.tooltip === "string" && a.tooltip.trim() ? a.tooltip.trim().slice(0, 120) : undefined;
|
|
337
|
+
const svg = iconSvg(a.name, { size, stroke, label: a.label ? String(a.label) : undefined });
|
|
338
|
+
if (!svg)
|
|
339
|
+
return null;
|
|
331
340
|
const href = safeUrl(a.href, "");
|
|
332
|
-
const cls = `ecx-icon-shape${shape ? ` is-${shape}` : ""}`, pad = shape ? {
|
|
341
|
+
const cls = `ecx-icon-shape${shape ? ` is-${shape}` : ""}`, pad = shape ? { "--ecx-icon-pad-auto": `${Math.round(size * 0.4)}px` } : undefined;
|
|
333
342
|
return _jsx("div", { className: "ecx-icon-block", style: alignStyle(a), children: href
|
|
334
|
-
? _jsx(Link, { href: href, className: cls, style: pad, ...(a.linkTarget === "_blank" ? { target: "_blank", rel: "noopener noreferrer" } : {}), children: svg })
|
|
335
|
-
: _jsx("span", { className: cls, style: pad, children: svg }) }, key);
|
|
343
|
+
? _jsx(Link, { href: href, className: cls, style: pad, "data-ecx-tip": tip, ...(a.linkTarget === "_blank" ? { target: "_blank", rel: "noopener noreferrer" } : {}), children: svg })
|
|
344
|
+
: _jsx("span", { className: cls, style: pad, "data-ecx-tip": tip, children: svg }) }, key);
|
|
336
345
|
}
|
|
337
|
-
case "horizontalRule": return _jsx("hr", {}, key);
|
|
338
346
|
case "image": {
|
|
339
347
|
// Ảnh chèn từ thư viện mang sẵn srcset (JPEG + WebP) và kích thước → responsive, không nhảy layout
|
|
340
348
|
// 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
|
|
@@ -342,7 +350,8 @@ async function renderNodeInner(node, key, ctx) {
|
|
|
342
350
|
const imgSrc = safeUrl(a.src, "");
|
|
343
351
|
if (!imgSrc)
|
|
344
352
|
return null; // chưa chọn ảnh: không in <img> không có địa chỉ (hiện icon ảnh hỏng)
|
|
345
|
-
const
|
|
353
|
+
const fx = imageFx(a);
|
|
354
|
+
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", className: fx.className || undefined, style: fx.style });
|
|
346
355
|
const bare = a.webpSrcset ? _jsxs("picture", { children: [_jsx("source", { type: "image/webp", srcSet: a.webpSrcset, sizes: sizes }), img] }) : img;
|
|
347
356
|
// next: ảnh có liên kết (href qua safeUrl; mở tab mới thì noopener)
|
|
348
357
|
const pic = a.lightbox === true && !a.href ? _jsx(LightboxClient, { src: safeUrl(a.src, ""), alt: a.alt ?? "", children: bare }) : a.href ? _jsx(Link, { href: safeUrl(a.href), target: a.linkTarget === "_blank" ? "_blank" : undefined, rel: a.linkTarget === "_blank" ? "noopener noreferrer" : undefined, children: bare }) : bare;
|
|
@@ -353,11 +362,22 @@ async function renderNodeInner(node, key, ctx) {
|
|
|
353
362
|
const items = (a.images ?? []).filter((im) => !!im?.src); // ảnh chưa chọn (không src) không vẽ <img> hỏng
|
|
354
363
|
const cols = Math.min(6, Math.max(1, Number(a.columns) || 3));
|
|
355
364
|
const crop = a.imageCrop !== false && a.layout !== "masonry"; // next: imageCrop=false giữ nguyên tỉ lệ ảnh; masonry luôn giữ tỉ lệ
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
365
|
+
// Một ảnh (có srcset / WebP / lightbox) — dùng cho cả lưới lẫn slide
|
|
366
|
+
const galleryItem = (im, i) => {
|
|
367
|
+
const el = _jsx("img", { src: safeUrl(im.src, ""), srcSet: im.srcset || undefined, sizes: `(max-width: 768px) 50vw, ${Math.round(100 / cols)}vw`, alt: im.alt ?? "", width: im.width, height: im.height, loading: "lazy", decoding: "async", style: crop ? { width: "100%", height: "100%", objectFit: "cover", aspectRatio: "1" } : { width: "100%", height: "auto" } });
|
|
368
|
+
const pic = im.webpSrcset ? _jsxs("picture", { children: [_jsx("source", { type: "image/webp", srcSet: im.webpSrcset, sizes: `(max-width: 768px) 50vw, ${Math.round(100 / cols)}vw` }), el] }) : el;
|
|
369
|
+
return _jsxs("figure", { className: "ecx-gallery-item cms-gallery-item", style: { margin: 0 }, children: [a.lightbox === true ? _jsx(LightboxClient, { src: safeUrl(im.full || im.src, ""), alt: im.alt ?? "", children: pic }) : im.href && safeUrl(im.href, "") ? _jsx("a", { href: safeUrl(im.href), children: pic }) : im.full && a.linkTo !== "none" ? _jsx("a", { href: safeUrl(im.full), children: pic }) : pic, im.caption && _jsx("figcaption", { children: im.caption })] }, i);
|
|
370
|
+
};
|
|
371
|
+
const caption = a.caption && _jsx("figcaption", { className: "ecx-gallery-caption cms-gallery-caption", style: { gridColumn: "1 / -1" }, children: a.caption });
|
|
372
|
+
// Dạng slider: mỗi ảnh một slide, số ảnh thấy cùng lúc = columns (tối đa 4) — dùng chung CarouselClient với Slider
|
|
373
|
+
if (a.layout === "slider" && items.length > 1) {
|
|
374
|
+
return (_jsxs("figure", { className: "ecx-gallery cms-gallery is-slider", style: { margin: 0 }, children: [_jsx(CarouselClient, { count: items.length, config: carouselConfig({ slidesPerView: Math.min(4, cols), arrows: a.arrows, dots: a.dots, autoplay: a.autoplay, interval: a.interval, loop: a.loop, gap: "var(--ecx-gallery-gap, 8px)" }), children: items.map((im, i) => _jsx("div", { className: "ecx-carousel-slide", role: "group", "aria-roledescription": "slide", "aria-label": `${i + 1} / ${items.length}`, children: galleryItem(im, i) }, i)) }), caption] }, key));
|
|
375
|
+
}
|
|
376
|
+
// Thumbnail slider: ảnh lớn + dải ảnh nhỏ (không lightbox riêng — ảnh lớn đã là ảnh chính)
|
|
377
|
+
if (a.layout === "thumbs" && items.length > 1) {
|
|
378
|
+
return (_jsxs("figure", { className: "ecx-gallery cms-gallery is-thumbs", style: { margin: 0 }, children: [_jsx(GalleryThumbsClient, { mains: items.map((im, i) => galleryItem(im, i)), thumbs: items.map((im, i) => _jsx("img", { src: safeUrl(im.src, ""), alt: "", loading: "lazy", decoding: "async" }, i)) }), caption] }, key));
|
|
379
|
+
}
|
|
380
|
+
return _jsxs("figure", { className: blockShell("gallery", a).className, style: blockShell("gallery", a).style, children: [items.map((im, i) => galleryItem(im, i)), caption] }, key);
|
|
361
381
|
}
|
|
362
382
|
case "video":
|
|
363
383
|
return _jsxs("figure", { className: "ecx-video cms-video", children: [_jsx("video", { src: safeUrl(a.src, ""), poster: a.poster ? safeUrl(a.poster, "") : undefined, controls: a.controls !== false, autoPlay: a.autoplay === true, loop: a.loop === true, muted: a.muted === true || a.autoplay === true, preload: ["none", "metadata", "auto"].includes(a.preload) ? a.preload : "metadata", playsInline: a.playsInline !== false, style: { width: "100%", height: "auto" } }), a.caption && _jsx("figcaption", { children: a.caption })] }, key);
|
|
@@ -376,27 +396,29 @@ async function renderNodeInner(node, key, ctx) {
|
|
|
376
396
|
// Hàng cuối là chân bảng (attrs.footer) → <tfoot>
|
|
377
397
|
const foot = a.footer === true && rows.length > (head ? 2 : 1);
|
|
378
398
|
const body = rows.slice(head ? 1 : 0, foot ? -1 : undefined);
|
|
379
|
-
return _jsx("div", { className:
|
|
399
|
+
return _jsx("div", { className: tableClass(a), children: _jsxs("table", { className: a.fixed ? "is-fixed" : undefined, children: [typeof a.caption === "string" && a.caption.trim() && _jsx("caption", { children: a.caption }), head && _jsx("thead", { children: rows[0] }), _jsx("tbody", { children: body }), foot && _jsx("tfoot", { children: rows.at(-1) })] }) }, key);
|
|
380
400
|
}
|
|
381
401
|
case "tableRow": return _jsx("tr", { children: await children() }, key);
|
|
382
402
|
case "tableHeader": return _jsx("th", { colSpan: a.colspan > 1 ? a.colspan : undefined, rowSpan: a.rowspan > 1 ? a.rowspan : undefined, children: await children() }, key);
|
|
383
403
|
case "tableCell": return _jsx("td", { colSpan: a.colspan > 1 ? a.colspan : undefined, rowSpan: a.rowspan > 1 ? a.rowspan : undefined, children: await children() }, key);
|
|
384
|
-
case "youtube": {
|
|
385
|
-
const m = String(a.src ?? "").match(/(?:v=|youtu\.be\/|embed\/)([\w-]{11})/);
|
|
386
|
-
const start = Number(a.start) > 0 ? `?start=${Math.floor(Number(a.start))}` : "";
|
|
387
|
-
return m ? _jsx("div", { className: "ecx-youtube embed", children: _jsx("iframe", { src: `https://www.youtube-nocookie.com/embed/${m[1]}${start}`, allowFullScreen: true, loading: "lazy", title: "YouTube" }) }, key) : null;
|
|
388
|
-
}
|
|
389
404
|
// Bố cục (@ecomcx/ecomweb-content 1.2). Cấu trúc dùng style trực tiếp → mọi theme hiển thị đúng; class `ecx-*` để theme tạo kiểu thêm (`cms-*` giữ tới 2.0).
|
|
390
405
|
case "columns": {
|
|
391
406
|
const cols = await Promise.all((node.content ?? []).map(async (c, i) => {
|
|
392
407
|
const inner = await Promise.all((c.content ?? []).map((cc, j) => renderNode(cc, `${key}-${i}-${j}`, ctx)));
|
|
393
|
-
return shelled("column", c.attrs ?? {}, `${key}-${i}`, _jsxs(_Fragment, { children: [inner, overlayLink(c.attrs ?? {})] }), undefined, { type: "columns", attrs: a });
|
|
408
|
+
return shelled("column", c.attrs ?? {}, `${key}-${i}`, _jsxs(_Fragment, { children: [bgVideoNode(c.attrs), inner, overlayLink(c.attrs ?? {})] }), undefined, { type: "columns", attrs: a });
|
|
394
409
|
}));
|
|
395
|
-
return shelled("columns", a, key, cols);
|
|
410
|
+
return shelled("columns", a, key, _jsxs(_Fragment, { children: [bgVideoNode(a), cols] }));
|
|
411
|
+
}
|
|
412
|
+
case "column": return shelled("column", a, key, _jsxs(_Fragment, { children: [bgVideoNode(a), await children(), overlayLink(a)] }));
|
|
413
|
+
case "group": {
|
|
414
|
+
const g = shelled("group", a, key, _jsxs(_Fragment, { children: [bgVideoNode(a), await children(), overlayLink(a)] }));
|
|
415
|
+
// Xem thêm: cắt khối ở chiều cao thu gọn, nút là <label> của ô tick ẩn (CSS thuần, không cần JS)
|
|
416
|
+
const ch = typeof a.collapseHeight === "string" && /^\d{1,3}(\.\d{1,2})?(rem|em|px|vh)$/.test(a.collapseHeight.trim()) ? a.collapseHeight.trim() : "";
|
|
417
|
+
if (!ch || ctx.markBlocks)
|
|
418
|
+
return g;
|
|
419
|
+
const id = `sm-${key.replace(/[^a-z0-9]/gi, "")}`;
|
|
420
|
+
return _jsxs("div", { className: `ecx-sm${a.collapseFade === false ? " is-nofade" : ""}${a.collapseOnce === true ? " is-once" : ""}`, style: { "--ecx-sm-h": ch }, children: [_jsx("input", { type: "checkbox", id: id, className: "ecx-sm-in", "aria-label": String(a.moreText || "Xem thêm") }), g, _jsxs("label", { htmlFor: id, className: "ecx-sm-btn", children: [_jsx("span", { className: "ecx-sm-more", children: String(a.moreText || "Xem thêm") }), _jsx("span", { className: "ecx-sm-less", children: String(a.lessText || "Thu gọn") })] })] }, `${key}-sm`);
|
|
396
421
|
}
|
|
397
|
-
case "column": return shelled("column", a, key, _jsxs(_Fragment, { children: [await children(), overlayLink(a)] }));
|
|
398
|
-
case "group": return shelled("group", a, key, await children());
|
|
399
|
-
case "callout": return shelled("callout", a, key, _jsxs(_Fragment, { children: [a.title && _jsx("p", { className: "ecx-callout-title cms-callout-title", style: { margin: 0, fontWeight: 600 }, children: a.title }), await children()] }));
|
|
400
422
|
case "button": {
|
|
401
423
|
if (!a.text)
|
|
402
424
|
return null;
|
|
@@ -405,7 +427,7 @@ async function renderNodeInner(node, key, ctx) {
|
|
|
405
427
|
const ic = buttonIcon(a);
|
|
406
428
|
// Chỉ icon: chữ đã thành aria-label của nút (blockShell)
|
|
407
429
|
const label = ic ? (a.iconOnly === true ? widgetEl(ic, "i") : a.iconPosition === "right" ? [a.text, widgetEl(ic, "i")] : [widgetEl(ic, "i"), a.text]) : a.text;
|
|
408
|
-
const link = shelled("button", a, ctx.inButtons ? key : "", label, { href: safeUrl(a.href), target, rel: linkRel(a.rel, target) });
|
|
430
|
+
const link = shelled("button", a, ctx.inButtons ? key : "", label, { href: safeUrl(a.href), target, rel: linkRel(a.rel, target), title: typeof a.tooltip === "string" && a.tooltip ? a.tooltip : undefined });
|
|
409
431
|
if (ctx.inButtons)
|
|
410
432
|
return link;
|
|
411
433
|
return createElement(buttonWrapShell(a).tag, { key, className: buttonWrapShell(a).className, style: buttonWrapShell(a).style }, link);
|
|
@@ -420,13 +442,9 @@ async function renderNodeInner(node, key, ctx) {
|
|
|
420
442
|
case "cover": {
|
|
421
443
|
const { src, fixed, overlay, imgStyle, overlayStyle } = coverParts(a);
|
|
422
444
|
const url = src ? safeUrl(src, "") : "";
|
|
423
|
-
|
|
445
|
+
const video = coverVideo(a);
|
|
446
|
+
return shelled("cover", a, key, _jsxs(_Fragment, { children: [video && _jsx(BgVideo, { className: "ecx-cover-video", src: video, poster: url || undefined, style: imgStyle }), url && !fixed && !video && _jsx("img", { className: "ecx-cover-img", src: url, alt: a.alt ?? "", loading: "lazy", decoding: "async", style: imgStyle }), overlay && _jsx("span", { className: "ecx-cover-overlay", "aria-hidden": "true", style: overlayStyle }), _jsx("div", { className: "ecx-cover-inner", children: await children() })] }), undefined);
|
|
424
447
|
}
|
|
425
|
-
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() })] }));
|
|
426
|
-
case "pullquote":
|
|
427
|
-
// 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);
|
|
428
|
-
// chữ trần (dữ liệu cũ) mới cần <p>
|
|
429
|
-
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) })] }));
|
|
430
448
|
case "accordion": {
|
|
431
449
|
const tag = ["h2", "h3", "h4", "h5", "h6"].includes(String(a.titleTag)) ? String(a.titleTag) : undefined;
|
|
432
450
|
const sub = { ...ctx, accordion: a.multiple === true ? undefined : `ecx-acc-${key}`, accTag: tag };
|
|
@@ -443,12 +461,14 @@ async function renderNodeInner(node, key, ctx) {
|
|
|
443
461
|
return (_jsxs("div", { className: cx("ecx-accordion", Number(a.columns) === 2 && "is-cols-2", `has-icon-${["plus", "none"].includes(String(a.icon)) ? a.icon : "arrow"}`, a.iconSide === "left" && "is-icon-left"), children: [await Promise.all(items.map((c, i) => renderNode(c, `${key}-${i}`, sub))), faq && _jsx("script", { type: "application/ld+json", dangerouslySetInnerHTML: { __html: faq } })] }, key));
|
|
444
462
|
}
|
|
445
463
|
case "countdown": {
|
|
446
|
-
const
|
|
464
|
+
const rules = countdownRules(a);
|
|
465
|
+
// Evergreen không cần ngày; còn lại cần mốc hợp lệ
|
|
466
|
+
const ms = rules.evergreenMs ? 0 : countdownTarget(a); // evergreen: mốc do client tính theo từng người xem (HTML dựng sẵn hiện đủ thời lượng)
|
|
447
467
|
if (!Number.isFinite(ms))
|
|
448
468
|
return null;
|
|
449
469
|
const t = await getT();
|
|
450
470
|
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)
|
|
451
|
-
return _jsx(CountdownClient, { target: ms, serverNow: Date.now(), units: units, label: a.label ? String(a.label) : undefined, expiredText: a.expiredText ? String(a.expiredText) : undefined, attrs: { layout: a.layout, divider: a.divider, pad: a.pad, postText: a.postText, showDays: a.showDays, showSeconds: a.showSeconds, daysLabel: a.daysLabel, hoursLabel: a.hoursLabel, minutesLabel: a.minutesLabel, secondsLabel: a.secondsLabel } }, key);
|
|
471
|
+
return _jsx(CountdownClient, { target: ms, rules: rules, storageKey: typeof a.anchor === "string" && a.anchor ? a.anchor : `${a.label ?? ""}|${a.evergreenHours ?? 0}|${a.evergreenMinutes ?? 0}`, serverNow: Date.now(), units: units, label: a.label ? String(a.label) : undefined, expiredText: a.expiredText ? String(a.expiredText) : undefined, attrs: { layout: a.layout, divider: a.divider, pad: a.pad, postText: a.postText, showDays: a.showDays, showSeconds: a.showSeconds, daysLabel: a.daysLabel, hoursLabel: a.hoursLabel, minutesLabel: a.minutesLabel, secondsLabel: a.secondsLabel } }, key);
|
|
452
472
|
}
|
|
453
473
|
case "form": {
|
|
454
474
|
// Form cơ bản của lõi: ô vẽ sẵn ở máy chủ, phần gửi chạy trên trình duyệt; máy chủ tìm lại định nghĩa form theo (source, formId)
|
|
@@ -457,7 +477,7 @@ async function renderNodeInner(node, key, ctx) {
|
|
|
457
477
|
return null;
|
|
458
478
|
const t = await getT();
|
|
459
479
|
const inner = await Promise.all((node.content ?? []).map((c, i) => renderNode(c, `${key}-${i}`, { ...ctx, form: formId })));
|
|
460
|
-
return (_jsx(FormBlockClient, { formId: formId, source: ctx.source, className: formSizeClass(a) || undefined, successMessage: a.successMessage ? String(a.successMessage) : undefined, fields: (await getSlotItems("form.fields")).length ? _jsx(Slot, { name: "form.fields", props: { form: `core:${ctx.source}/${formId}`, settings: a.ext && typeof a.ext === "object" ? a.ext : {} } }) : undefined, button: { className: blockShell("button", { variant: "primary" })?.className, style: (({ background: _b, color: _c, ...rest }) => rest)(blockShell("button", { variant: "primary" })?.style) }, labels: { submit: a.submitText ? String(a.submitText) : t("form.submit"), sending: t("form.sending"), error: t("form.error") }, children: inner }, key));
|
|
480
|
+
return (_jsx(FormBlockClient, { formId: formId, source: ctx.source, className: formSizeClass(a) || undefined, successMessage: a.successMessage ? String(a.successMessage) : undefined, fields: (await getSlotItems("form.fields")).length ? _jsx(Slot, { name: "form.fields", props: { form: `core:${ctx.source}/${formId}`, settings: a.ext && typeof a.ext === "object" ? a.ext : {} } }) : undefined, button: { className: blockShell("button", { variant: "primary" })?.className, style: (({ background: _b, color: _c, ...rest }) => rest)(blockShell("button", { variant: "primary" })?.style) }, labels: { next: t("form.next"), back: t("form.back"), step: t("form.step"), submit: a.submitText ? String(a.submitText) : t("form.submit"), sending: t("form.sending"), error: t("form.error") }, children: inner }, key));
|
|
461
481
|
}
|
|
462
482
|
case "formField": {
|
|
463
483
|
const name = typeof a.name === "string" && /^[a-z][a-z0-9_]{0,39}$/.test(a.name) ? a.name : "";
|
|
@@ -474,7 +494,7 @@ async function renderNodeInner(node, key, ctx) {
|
|
|
474
494
|
const check = kind === "checkbox" || kind === "consent";
|
|
475
495
|
const types = { email: "email", tel: "tel", number: "number", date: "date" };
|
|
476
496
|
const choose = kind === "select" && !a.placeholder ? (await getT())("form.choose") : String(a.placeholder ?? "");
|
|
477
|
-
return (_jsxs("div", { className: cx("ecx-field", `is-${kind}`, (a.width === "half" || a.width === "third") && `is-${a.width}`, check && "is-check"), "data-field": name, children: [check ? _jsxs("label", { htmlFor: id, children: [_jsx("input", { type: "checkbox", id: id, name: name, value: "1", required: required, "aria-describedby": describedBy }), " ", _jsxs("span", { children: [kind === "consent" ? linkedLabel(label) : label, star] })] })
|
|
497
|
+
return (_jsxs("div", { className: cx("ecx-field", `is-${kind}`, (a.width === "half" || a.width === "third") && `is-${a.width}`, check && "is-check"), "data-field": name, "data-showif": typeof a.showIf === "string" && /^[a-z][a-z0-9_]{0,39}(!?=[^\n]{0,100})?$/.test(a.showIf.trim()) ? a.showIf.trim() : undefined, "data-step": Number.isInteger(a.step) && a.step >= 1 && a.step <= 8 ? a.step : undefined, children: [check ? _jsxs("label", { htmlFor: id, children: [_jsx("input", { type: "checkbox", id: id, name: name, value: "1", required: required, "aria-describedby": describedBy }), " ", _jsxs("span", { children: [kind === "consent" ? linkedLabel(label) : label, star] })] })
|
|
478
498
|
: kind === "radio" ? (_jsxs("fieldset", { "aria-describedby": describedBy, children: [_jsxs("legend", { children: [label, star] }), _jsx("div", { className: "ecx-field-options", children: options.map((o, i) => _jsxs("label", { children: [_jsx("input", { type: "radio", name: name, value: o, required: required }), " ", o] }, i)) })] }))
|
|
479
499
|
: _jsxs("label", { htmlFor: id, children: [label, star] }), kind === "textarea" ? _jsx("textarea", { rows: 5, maxLength: 5000, ...common })
|
|
480
500
|
: kind === "select" ? _jsxs("select", { ...common, defaultValue: "", children: [_jsx("option", { value: "", disabled: required, children: choose }), options.map((o, i) => _jsx("option", { value: o, children: o }, i))] })
|
|
@@ -483,6 +503,7 @@ async function renderNodeInner(node, key, ctx) {
|
|
|
483
503
|
}
|
|
484
504
|
case "iconBox":
|
|
485
505
|
case "imageBox":
|
|
506
|
+
case "imageOverlay":
|
|
486
507
|
case "iconList":
|
|
487
508
|
case "counter":
|
|
488
509
|
case "testimonial":
|
|
@@ -491,24 +512,20 @@ async function renderNodeInner(node, key, ctx) {
|
|
|
491
512
|
const tree = widgetMarkup(node.type, a);
|
|
492
513
|
return tree ? widgetEl(tree, key) : null;
|
|
493
514
|
}
|
|
494
|
-
case "rating": {
|
|
495
|
-
const max = Math.min(10, Math.max(1, Math.round(Number(a.max) || 5)));
|
|
496
|
-
const v = Math.min(max, Math.max(0, Number(a.value) || 0));
|
|
497
|
-
return (_jsxs("div", { className: "ecx-rating", role: "img", "aria-label": `${v}/${max}`, children: [Array.from({ length: max }, (_, i) => _jsx("span", { "aria-hidden": "true", className: i < Math.round(v) ? "is-on" : "is-off", style: { color: i < Math.round(v) ? "#f59e0b" : "#d4d4d8" }, children: "\u2605" }, i)), a.label && _jsxs("span", { className: "ecx-rating-label", children: [" ", String(a.label)] })] }, key));
|
|
498
|
-
}
|
|
499
515
|
case "tabs": {
|
|
500
516
|
const tabs = (node.content ?? []).filter((c) => c.type === "tab");
|
|
501
517
|
if (!tabs.length)
|
|
502
518
|
return null;
|
|
503
519
|
const panels = await Promise.all(tabs.map(async (t, i) => _jsx(Fragment, { children: await Promise.all((t.content ?? []).map((c, j) => renderNode(c, `${key}-${i}-${j}`, ctx))) }, i)));
|
|
504
|
-
return _jsx(TabsClient, { titles: tabs.map((t, i) => String(t.attrs?.title || `Tab ${i + 1}`)), panels: panels, initial: Math.max(0, (Number(a.initial) || 1) - 1), icons: tabs.map((t) =>
|
|
520
|
+
return _jsx(TabsClient, { titles: tabs.map((t, i) => String(t.attrs?.title || `Tab ${i + 1}`)), panels: panels, initial: Math.max(0, (Number(a.initial) || 1) - 1), icons: tabs.map((t, i) => iconSvg(t.attrs?.icon, { size: 18, className: "ecx-tab-icon", key: `i${i}` }) || undefined), subtitles: tabs.map((t) => (t.attrs?.subtitle ? String(t.attrs.subtitle) : undefined)), anchors: tabs.map((t) => (typeof t.attrs?.anchor === "string" && /^[\w-]{1,80}$/.test(t.attrs.anchor) ? t.attrs.anchor : undefined)), vertical: a.orientation === "vertical", mobileAccordion: a.mobileAccordion === true, extraClass: tabsClass(a) }, key);
|
|
505
521
|
}
|
|
506
522
|
case "tab":
|
|
507
523
|
return _jsx("div", { className: "ecx-tab", children: await children() }, key);
|
|
508
524
|
case "carousel": {
|
|
509
|
-
const
|
|
510
|
-
const
|
|
511
|
-
|
|
525
|
+
const cfg = carouselConfig(a);
|
|
526
|
+
const total = (node.content ?? []).length;
|
|
527
|
+
const kids = await Promise.all((node.content ?? []).map(async (c, i) => _jsx("div", { className: "ecx-carousel-slide", role: "group", "aria-roledescription": "slide", "aria-label": `${i + 1} / ${total}`, children: await renderNode(c, `${key}-${i}`, ctx) }, i)));
|
|
528
|
+
return _jsx(CarouselClient, { count: total, config: cfg, children: kids }, key);
|
|
512
529
|
}
|
|
513
530
|
case "shortcode": {
|
|
514
531
|
const name = String(a.name ?? "");
|
|
@@ -517,6 +534,28 @@ async function renderNodeInner(node, key, ctx) {
|
|
|
517
534
|
const Comp = await ctx.resolve.shortcode(name);
|
|
518
535
|
return Comp ? _jsx(Comp, { attrs: (a.args && typeof a.args === "object" ? a.args : {}), site: ctx.site, post: ctx.post }, key) : null;
|
|
519
536
|
}
|
|
537
|
+
case "testimonials": {
|
|
538
|
+
// Nhiều lời chứng thực: lưới theo số cột từng khổ, hoặc slider (dùng chung bộ máy Slider)
|
|
539
|
+
const c = testimonialsConfig(a);
|
|
540
|
+
const items = node.content ?? [];
|
|
541
|
+
if (!items.length)
|
|
542
|
+
return null;
|
|
543
|
+
if (c.layout === "carousel") {
|
|
544
|
+
const slides = await Promise.all(items.map(async (it, i) => _jsx("div", { className: "ecx-carousel-slide", role: "group", "aria-roledescription": "slide", "aria-label": `${i + 1} / ${items.length}`, children: await renderNode(it, `${key}-${i}`, ctx) }, i)));
|
|
545
|
+
return _jsx(CarouselClient, { count: items.length, config: c.carousel, children: slides }, key);
|
|
546
|
+
}
|
|
547
|
+
return _jsx("div", { className: "ecx-testimonials", style: testimonialsVars(c), children: await children() }, key);
|
|
548
|
+
}
|
|
549
|
+
case "popup": {
|
|
550
|
+
// Nút mở (kiểu như khối Nút) + hộp thoại; không có chữ nút thì không vẽ gì (không có cách mở)
|
|
551
|
+
const c = popupConfig(a);
|
|
552
|
+
const text = typeof a.triggerText === "string" ? a.triggerText : "";
|
|
553
|
+
if (!text && !c.id && c.auto === "none")
|
|
554
|
+
return null; // không nút, không ID, không tự mở = không có cách mở
|
|
555
|
+
const plain = c.triggerStyle === "link" || c.triggerStyle === "play";
|
|
556
|
+
const shell = plain ? null : blockShell("button", { variant: c.triggerStyle });
|
|
557
|
+
return _jsx(PopupClient, { className: popupClass(c), style: popupVars(c), label: typeof a.label === "string" ? a.label : text, closeButton: c.closeButton, closeOnOverlay: c.closeOnOverlay, popupId: c.id || undefined, auto: c.auto, autoDelay: c.autoDelay, autoScroll: c.autoScroll, onceDays: c.onceDays, trigger: !text ? null : c.triggerStyle === "play" ? _jsx("span", { className: "ecx-visually-hidden", children: text }) : text, triggerClass: `ecx-popup-trigger ${shell ? shell.className : c.triggerStyle === "play" ? "is-play" : "is-link"}`, triggerStyle: (shell?.style ?? (c.triggerStyle === "play" ? popupPlayStyle(a) : undefined)), children: await children() }, key);
|
|
558
|
+
}
|
|
520
559
|
case "details":
|
|
521
560
|
return _jsxs("details", { className: "ecx-details", name: ctx.accordion, open: a.open === true || undefined, children: [_jsx("summary", { children: ctx.accTag ? createElement(ctx.accTag, { className: "ecx-details-title" }, a.summary || "…") : a.summary || "…" }), await children()] }, key);
|
|
522
561
|
case "customHtml":
|
|
@@ -545,8 +584,6 @@ async function renderNodeInner(node, key, ctx) {
|
|
|
545
584
|
? _jsxs("details", { className: "ecx-toc-details", open: a.startCollapsed !== true || undefined, children: [_jsx("summary", { className: "ecx-toc-title", children: title }), list] })
|
|
546
585
|
: _jsxs(_Fragment, { children: [a.showTitle !== false && _jsx("p", { className: "ecx-toc-title", children: title }), list] }), a.highlight === true && _jsx(TocSpy, {})] }, key));
|
|
547
586
|
}
|
|
548
|
-
case "preformatted":
|
|
549
|
-
return _jsx("pre", { className: "ecx-pre", children: await children() }, key);
|
|
550
587
|
case "embed": {
|
|
551
588
|
// Khung nhúng chỉ cho nhà cung cấp đã biết; địa chỉ khung do embedInfo dựng → không nhúng được trang tuỳ ý
|
|
552
589
|
const info = embedInfo(a.url);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ecomcx/ecomweb-theme-sdk",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.3.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",
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"API.md"
|
|
37
37
|
],
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@ecomcx/ecomweb-content": "^1.
|
|
39
|
+
"@ecomcx/ecomweb-content": "^1.28.1",
|
|
40
40
|
"intl-messageformat": "12.1.3",
|
|
41
41
|
"server-only": "0.0.1"
|
|
42
42
|
},
|