@ecomcx/ecomweb-theme-sdk 1.42.0 → 2.0.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 +1546 -0
- package/CHANGELOG.md +31 -0
- package/LICENSE +21 -0
- package/README.md +52 -0
- package/dist/api.d.ts +86 -14
- package/dist/api.js +84 -19
- package/dist/auth-shared.d.ts +2 -1
- package/dist/auth-shared.js +2 -1
- package/dist/auth.d.ts +1 -1
- package/dist/auth.js +1 -1
- package/dist/client.d.ts +26 -5
- package/dist/client.js +62 -12
- package/dist/components.d.ts +17 -2
- package/dist/components.js +41 -12
- package/dist/conditions.d.ts +45 -0
- package/dist/conditions.js +27 -0
- package/dist/consent-server.d.ts +6 -0
- package/dist/consent-server.js +11 -0
- package/dist/consent.d.ts +0 -5
- package/dist/consent.js +0 -11
- package/dist/content.js +2 -1
- package/dist/dynamic.js +5 -5
- package/dist/i18n.d.ts +4 -0
- package/dist/i18n.js +4 -0
- package/dist/index.d.ts +8 -5
- package/dist/index.js +10 -5
- package/dist/rich.d.ts +2 -0
- package/dist/rich.js +61 -26
- package/dist/runtime.d.ts +12 -6
- package/dist/runtime.js +14 -5
- package/dist/utils.d.ts +18 -1
- package/dist/utils.js +24 -1
- package/package.json +15 -8
package/dist/rich.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
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 { DYNAMIC_NODES, ICON_PATHS, widgetMarkup, widthClass, blockCitation, blockShell, buttonWrapShell, coverParts, linkRel, embedInfo, motionClasses, normalizeContent, safeUrl, styleClass, styleCss, controlsCss, CORE_CONTROLS } from "@ecomcx/ecomweb-content";
|
|
3
|
+
import { DYNAMIC_NODES, ICON_PATHS, 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
4
|
import { cx } from "./utils.js";
|
|
5
5
|
import { SOCIAL_ICONS } from "./social-icons.js";
|
|
6
|
-
import { CountdownClient, FormBlockClient, LightboxClient, Link, TabsClient } from "./client.js";
|
|
6
|
+
import { CountdownClient, FormBlockClient, LightboxClient, Link, TabsClient, TocSpy } from "./client.js";
|
|
7
7
|
import { CounterClient } from "./counter-client.js";
|
|
8
8
|
import { AssetScript } from "./browser.js";
|
|
9
9
|
import { getT } from "./i18n.js";
|
|
@@ -30,7 +30,7 @@ function collectHeadings(blocks) {
|
|
|
30
30
|
const out = [];
|
|
31
31
|
const walk = (n) => {
|
|
32
32
|
if (n.type === "heading")
|
|
33
|
-
out.push({ level: Math.min(6, Math.max(1, Number(n.attrs?.level) || 2)), id: headingId(n), text: plainText(n) });
|
|
33
|
+
out.push({ level: Math.min(6, Math.max(1, Number(n.attrs?.level) || 2)), id: headingId(n), text: (typeof n.attrs?.tocTitle === "string" && n.attrs.tocTitle.trim()) || plainText(n) });
|
|
34
34
|
else
|
|
35
35
|
for (const c of n.content ?? [])
|
|
36
36
|
walk(c);
|
|
@@ -63,11 +63,16 @@ function plainText(node) {
|
|
|
63
63
|
const COLOR = /^(#[0-9a-f]{3,8}|(?:rgb|hsl)a?\([\d\s.,%deg/]+\)|[a-z]{3,20}|var\(--[\w-]+\))$/i;
|
|
64
64
|
const safeColor = (v) => (typeof v === "string" && COLOR.test(v.trim()) ? v.trim() : undefined);
|
|
65
65
|
const PADDING = { none: "0", small: "0.75rem", medium: "1.5rem", large: "3rem" };
|
|
66
|
-
const TONES = { info: "#
|
|
66
|
+
const TONES = { info: "#1a597b", success: "#16a34a", warning: "#d97706", danger: "#dc2626" };
|
|
67
67
|
function alignStyle(attrs) {
|
|
68
68
|
return attrs?.textAlign && attrs.textAlign !== "left" ? { textAlign: attrs.textAlign } : undefined;
|
|
69
69
|
}
|
|
70
70
|
/** Vẽ khối theo vỏ markup dùng chung với trình soạn (@ecomcx/ecomweb-content › blockShell): thẻ / class / style cùng một nguồn. */
|
|
71
|
+
/** Liên kết phủ cả cột (1.26): nằm trên nội dung — khi có thì thứ khác trong cột không bấm được (như bộ khối lớn). */
|
|
72
|
+
function overlayLink(a) {
|
|
73
|
+
const href = safeUrl(a.href, "");
|
|
74
|
+
return href ? _jsx(Link, { href: href, className: "ecx-overlay-link", "aria-label": a.linkLabel || undefined, style: { position: "absolute", inset: 0, zIndex: 1 }, ...(a.linkTarget === "_blank" ? { target: "_blank", rel: "noopener noreferrer" } : {}) }) : null;
|
|
75
|
+
}
|
|
71
76
|
function shelled(type, a, key, children, extra, parent) {
|
|
72
77
|
const sh = blockShell(type, a, parent);
|
|
73
78
|
// Nút / khối có link: Link của SDK (link nội bộ chuyển trang không tải lại; link ngoài, tab mới, file vẫn là <a>)
|
|
@@ -150,7 +155,7 @@ function overridden(style) {
|
|
|
150
155
|
keys.push("textAlign");
|
|
151
156
|
if (style.color?.text)
|
|
152
157
|
keys.push("color");
|
|
153
|
-
if (style.color?.background)
|
|
158
|
+
if (style.color?.background || style.gradient || style.textGradient)
|
|
154
159
|
keys.push("background", "backgroundColor");
|
|
155
160
|
if (style.border)
|
|
156
161
|
keys.push(...SIDES.map((x) => `border${x}`));
|
|
@@ -176,8 +181,9 @@ function decorate(el, a, key, ctx, type, ctrl, data) {
|
|
|
176
181
|
if (isValidElement(el) && el.type !== Fragment && (typeof el.type === "string" || el.type === Link)) {
|
|
177
182
|
const e = el;
|
|
178
183
|
let inline = e.props.style;
|
|
179
|
-
if (inline && style) {
|
|
180
|
-
|
|
184
|
+
if (inline && (style || ctrl?.self)) {
|
|
185
|
+
// Phần nhắm chính thẻ khối (vd phần "Nút" = chính <a>) cũng thay inline như attrs.style
|
|
186
|
+
const drop = new Set([...(style ? overridden(style) : []), ...(ctrl?.self ? overridden(ctrl.self) : [])]);
|
|
181
187
|
inline = Object.fromEntries(Object.entries(inline).filter(([k]) => !drop.has(k)));
|
|
182
188
|
}
|
|
183
189
|
return cloneElement(e, { className: cx(e.props.className, extra) || undefined, style: inline, id: a.anchor ?? e.props.id, ...data });
|
|
@@ -312,7 +318,14 @@ async function renderNodeInner(node, key, ctx) {
|
|
|
312
318
|
if (!path)
|
|
313
319
|
return null;
|
|
314
320
|
const size = Math.min(128, Math.max(12, Number(a.size) || 24));
|
|
315
|
-
|
|
321
|
+
const stroke = Math.min(4, Math.max(0.5, Number(a.stroke) || 2));
|
|
322
|
+
const shape = a.iconStyle === "circle" || a.iconStyle === "square" ? a.iconStyle : undefined;
|
|
323
|
+
const svg = _jsx("svg", { width: size, height: size, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: stroke, strokeLinecap: "round", strokeLinejoin: "round", role: a.label ? "img" : undefined, "aria-label": a.label || undefined, "aria-hidden": a.label ? undefined : true, children: _jsx("path", { d: path }) });
|
|
324
|
+
const href = safeUrl(a.href, "");
|
|
325
|
+
const cls = `ecx-icon-shape${shape ? ` is-${shape}` : ""}`, pad = shape ? { padding: Math.round(size * 0.4) } : undefined;
|
|
326
|
+
return _jsx("div", { className: "ecx-icon-block", style: alignStyle(a), children: href
|
|
327
|
+
? _jsx(Link, { href: href, className: cls, style: pad, ...(a.linkTarget === "_blank" ? { target: "_blank", rel: "noopener noreferrer" } : {}), children: svg })
|
|
328
|
+
: _jsx("span", { className: cls, style: pad, children: svg }) }, key);
|
|
316
329
|
}
|
|
317
330
|
case "horizontalRule": return _jsx("hr", {}, key);
|
|
318
331
|
case "image": {
|
|
@@ -332,11 +345,11 @@ async function renderNodeInner(node, key, ctx) {
|
|
|
332
345
|
case "gallery": {
|
|
333
346
|
const items = (a.images ?? []).filter((im) => !!im?.src); // ảnh chưa chọn (không src) không vẽ <img> hỏng
|
|
334
347
|
const cols = Math.min(6, Math.max(1, Number(a.columns) || 3));
|
|
335
|
-
const crop = a.imageCrop !== false; // next: imageCrop=false giữ nguyên tỉ lệ ảnh
|
|
348
|
+
const crop = a.imageCrop !== false && a.layout !== "masonry"; // next: imageCrop=false giữ nguyên tỉ lệ ảnh; masonry luôn giữ tỉ lệ
|
|
336
349
|
return (_jsxs("figure", { className: blockShell("gallery", a).className, style: blockShell("gallery", a).style, children: [items.map((im, i) => {
|
|
337
350
|
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" } });
|
|
338
351
|
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;
|
|
339
|
-
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.full && a.linkTo !== "none" ? _jsx("a", { href: safeUrl(im.full), children: pic }) : pic, im.caption && _jsx("figcaption", { children: im.caption })] }, i);
|
|
352
|
+
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);
|
|
340
353
|
}), a.caption && _jsx("figcaption", { className: "ecx-gallery-caption cms-gallery-caption", style: { gridColumn: "1 / -1" }, children: a.caption })] }, key));
|
|
341
354
|
}
|
|
342
355
|
case "video":
|
|
@@ -370,18 +383,22 @@ async function renderNodeInner(node, key, ctx) {
|
|
|
370
383
|
case "columns": {
|
|
371
384
|
const cols = await Promise.all((node.content ?? []).map(async (c, i) => {
|
|
372
385
|
const inner = await Promise.all((c.content ?? []).map((cc, j) => renderNode(cc, `${key}-${i}-${j}`, ctx)));
|
|
373
|
-
return shelled("column", c.attrs ?? {}, `${key}-${i}`, inner, undefined, { type: "columns", attrs: a });
|
|
386
|
+
return shelled("column", c.attrs ?? {}, `${key}-${i}`, _jsxs(_Fragment, { children: [inner, overlayLink(c.attrs ?? {})] }), undefined, { type: "columns", attrs: a });
|
|
374
387
|
}));
|
|
375
388
|
return shelled("columns", a, key, cols);
|
|
376
389
|
}
|
|
377
|
-
case "column": return shelled("column", a, key, await children());
|
|
390
|
+
case "column": return shelled("column", a, key, _jsxs(_Fragment, { children: [await children(), overlayLink(a)] }));
|
|
378
391
|
case "group": return shelled("group", a, key, await children());
|
|
379
392
|
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()] }));
|
|
380
393
|
case "button": {
|
|
381
394
|
if (!a.text)
|
|
382
395
|
return null;
|
|
383
396
|
const target = a.target === "_blank" ? "_blank" : undefined;
|
|
384
|
-
|
|
397
|
+
// 1.26: icon trái / phải của chữ (svg trang trí)
|
|
398
|
+
const ic = buttonIcon(a);
|
|
399
|
+
// Chỉ icon: chữ đã thành aria-label của nút (blockShell)
|
|
400
|
+
const label = ic ? (a.iconOnly === true ? widgetEl(ic, "i") : a.iconPosition === "right" ? [a.text, widgetEl(ic, "i")] : [widgetEl(ic, "i"), a.text]) : a.text;
|
|
401
|
+
const link = shelled("button", a, ctx.inButtons ? key : "", label, { href: safeUrl(a.href), target, rel: linkRel(a.rel, target) });
|
|
385
402
|
if (ctx.inButtons)
|
|
386
403
|
return link;
|
|
387
404
|
return createElement(buttonWrapShell(a).tag, { key, className: buttonWrapShell(a).className, style: buttonWrapShell(a).style }, link);
|
|
@@ -404,16 +421,27 @@ async function renderNodeInner(node, key, ctx) {
|
|
|
404
421
|
// chữ trần (dữ liệu cũ) mới cần <p>
|
|
405
422
|
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) })] }));
|
|
406
423
|
case "accordion": {
|
|
407
|
-
const
|
|
408
|
-
|
|
424
|
+
const tag = ["h2", "h3", "h4", "h5", "h6"].includes(String(a.titleTag)) ? String(a.titleTag) : undefined;
|
|
425
|
+
const sub = { ...ctx, accordion: a.multiple === true ? undefined : `ecx-acc-${key}`, accTag: tag };
|
|
426
|
+
// Mở sẵn: mục đầu / tất cả (nhóm "mở một mục" chỉ mở được mục đầu); không đụng khi có mục tự đặt `open`
|
|
427
|
+
const raw = node.content ?? [];
|
|
428
|
+
const start = a.startOpen === "all" && a.multiple === true ? "all" : a.startOpen === "first" || a.startOpen === "all" ? "first" : "none";
|
|
429
|
+
const items = start === "none" || raw.some((c) => c.type === "details" && c.attrs?.open === true) ? raw
|
|
430
|
+
: raw.map((c, i) => (c.type === "details" && (start === "all" || i === 0) ? { ...c, attrs: { ...c.attrs, open: true } } : c));
|
|
431
|
+
// FAQ Schema: câu hỏi = tiêu đề mục, trả lời = chữ trong mục (JSON trong <script>: thoát "<" để không đóng thẻ sớm)
|
|
432
|
+
const faq = a.faq === true && items.some((c) => c.type === "details" && c.attrs?.summary) ? JSON.stringify({
|
|
433
|
+
"@context": "https://schema.org", "@type": "FAQPage",
|
|
434
|
+
mainEntity: items.filter((c) => c.type === "details" && c.attrs?.summary).map((c) => ({ "@type": "Question", name: String(c.attrs.summary), acceptedAnswer: { "@type": "Answer", text: (c.content ?? []).map(nodeText).join(" ").trim() } })),
|
|
435
|
+
}).replace(/</g, "\\u003c") : null;
|
|
436
|
+
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));
|
|
409
437
|
}
|
|
410
438
|
case "countdown": {
|
|
411
|
-
const ms =
|
|
439
|
+
const ms = countdownTarget(a);
|
|
412
440
|
if (!Number.isFinite(ms))
|
|
413
441
|
return null;
|
|
414
442
|
const t = await getT();
|
|
415
443
|
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)
|
|
416
|
-
return _jsx(CountdownClient, { target: ms, serverNow: Date.now(), units: units, label: a.label ? String(a.label) : undefined, expiredText: a.expiredText ? String(a.expiredText) : undefined }, key);
|
|
444
|
+
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);
|
|
417
445
|
}
|
|
418
446
|
case "form": {
|
|
419
447
|
// 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)
|
|
@@ -422,7 +450,7 @@ async function renderNodeInner(node, key, ctx) {
|
|
|
422
450
|
return null;
|
|
423
451
|
const t = await getT();
|
|
424
452
|
const inner = await Promise.all((node.content ?? []).map((c, i) => renderNode(c, `${key}-${i}`, { ...ctx, form: formId })));
|
|
425
|
-
return (_jsx(FormBlockClient, { formId: formId, source: ctx.source, 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: 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));
|
|
453
|
+
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));
|
|
426
454
|
}
|
|
427
455
|
case "formField": {
|
|
428
456
|
const name = typeof a.name === "string" && /^[a-z][a-z0-9_]{0,39}$/.test(a.name) ? a.name : "";
|
|
@@ -439,19 +467,20 @@ async function renderNodeInner(node, key, ctx) {
|
|
|
439
467
|
const check = kind === "checkbox" || kind === "consent";
|
|
440
468
|
const types = { email: "email", tel: "tel", number: "number", date: "date" };
|
|
441
469
|
const choose = kind === "select" && !a.placeholder ? (await getT())("form.choose") : String(a.placeholder ?? "");
|
|
442
|
-
return (_jsxs("div", { className: cx("ecx-field", `is-${kind}`, a.width === "half"
|
|
470
|
+
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] })] })
|
|
443
471
|
: 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)) })] }))
|
|
444
472
|
: _jsxs("label", { htmlFor: id, children: [label, star] }), kind === "textarea" ? _jsx("textarea", { rows: 5, maxLength: 5000, ...common })
|
|
445
473
|
: 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))] })
|
|
446
474
|
: check || kind === "radio" ? null
|
|
447
|
-
: _jsx("input", { type: types[kind] ?? "text", maxLength: kind === "number" || kind === "date" ? undefined : 500, autoComplete: { name: "name", email: "email", phone: "tel" }[name] ?? (kind === "email" ? "email" : kind === "tel" ? "tel" : undefined), ...common }), a.help ? _jsx("span", { className: "ecx-field-help", id: `${id}-help`, children: String(a.help) }) : null, _jsx("span", { className: "ecx-field-error", id: `${id}-error`, "aria-live": "polite" })] }, key));
|
|
475
|
+
: _jsx("input", { type: types[kind] ?? "text", maxLength: kind === "number" || kind === "date" ? undefined : 500, autoComplete: typeof a.autocomplete === "string" && /^[a-z0-9-]{2,20}$/.test(a.autocomplete) ? a.autocomplete : { name: "name", email: "email", phone: "tel" }[name] ?? (kind === "email" ? "email" : kind === "tel" ? "tel" : undefined), ...common }), a.help ? _jsx("span", { className: "ecx-field-help", id: `${id}-help`, children: String(a.help) }) : null, _jsx("span", { className: "ecx-field-error", id: `${id}-error`, "aria-live": "polite" })] }, key));
|
|
448
476
|
}
|
|
449
477
|
case "iconBox":
|
|
450
478
|
case "imageBox":
|
|
451
479
|
case "iconList":
|
|
452
480
|
case "counter":
|
|
453
481
|
case "testimonial":
|
|
454
|
-
case "progressBar":
|
|
482
|
+
case "progressBar":
|
|
483
|
+
case "map": {
|
|
455
484
|
const tree = widgetMarkup(node.type, a);
|
|
456
485
|
return tree ? widgetEl(tree, key) : null;
|
|
457
486
|
}
|
|
@@ -465,7 +494,7 @@ async function renderNodeInner(node, key, ctx) {
|
|
|
465
494
|
if (!tabs.length)
|
|
466
495
|
return null;
|
|
467
496
|
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)));
|
|
468
|
-
return _jsx(TabsClient, { titles: tabs.map((t, i) => String(t.attrs?.title || `Tab ${i + 1}`)), panels: panels }, key);
|
|
497
|
+
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) => ICON_PATHS[String(t.attrs?.icon ?? "")]), 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);
|
|
469
498
|
}
|
|
470
499
|
case "tab":
|
|
471
500
|
return _jsx("div", { className: "ecx-tab", children: await children() }, key);
|
|
@@ -482,7 +511,7 @@ async function renderNodeInner(node, key, ctx) {
|
|
|
482
511
|
return Comp ? _jsx(Comp, { attrs: (a.args && typeof a.args === "object" ? a.args : {}), site: ctx.site, post: ctx.post }, key) : null;
|
|
483
512
|
}
|
|
484
513
|
case "details":
|
|
485
|
-
return _jsxs("details", { className: "ecx-details", name: ctx.accordion, open: a.open === true || undefined, children: [_jsx("summary", { children: a.summary || "…" }), await children()] }, key);
|
|
514
|
+
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);
|
|
486
515
|
case "customHtml":
|
|
487
516
|
// Máy chủ đã lọc HTML khi người soạn thiếu quyền unfiltered_html (ContentSanitizer)
|
|
488
517
|
return a.html ? createElement(blockShell("customHtml", a).tag, { key, className: blockShell("customHtml", a).className, dangerouslySetInnerHTML: { __html: String(a.html) } }) : null;
|
|
@@ -496,12 +525,18 @@ async function renderNodeInner(node, key, ctx) {
|
|
|
496
525
|
}) }, key));
|
|
497
526
|
}
|
|
498
527
|
case "tableOfContents": {
|
|
499
|
-
const
|
|
500
|
-
const
|
|
528
|
+
const min = Math.min(6, Math.max(2, Number(a.minLevel) || 2));
|
|
529
|
+
const max = Math.min(6, Math.max(min, Number(a.maxLevel) || 3));
|
|
530
|
+
const items = (ctx.headings ?? []).filter((h) => h.level >= min && h.level <= max && h.id);
|
|
501
531
|
if (!items.length)
|
|
502
532
|
return null;
|
|
503
533
|
const title = a.title || ctx.labels?.toc || "Contents";
|
|
504
|
-
|
|
534
|
+
const cols = Math.min(3, Math.max(1, Number(a.columns) || 1));
|
|
535
|
+
const List = a.listStyle === "bullets" || a.listStyle === "none" ? "ul" : "ol";
|
|
536
|
+
const list = (_jsx(List, { className: cx("ecx-toc-list", a.listStyle === "none" && "is-plain", cols > 1 && `has-cols-${cols}`), children: items.map((h, i) => _jsx("li", { className: `ecx-toc-l${h.level}`, style: h.level > min ? { marginLeft: `${h.level - min}em` } : undefined, children: _jsx("a", { href: `#${h.id}`, children: h.text }) }, i)) }));
|
|
537
|
+
return (_jsxs("nav", { className: cx("ecx-toc", a.smoothScroll === true && "is-smooth"), "aria-label": title, children: [a.collapsible === true
|
|
538
|
+
? _jsxs("details", { className: "ecx-toc-details", open: a.startCollapsed !== true || undefined, children: [_jsx("summary", { className: "ecx-toc-title", children: title }), list] })
|
|
539
|
+
: _jsxs(_Fragment, { children: [a.showTitle !== false && _jsx("p", { className: "ecx-toc-title", children: title }), list] }), a.highlight === true && _jsx(TocSpy, {})] }, key));
|
|
505
540
|
}
|
|
506
541
|
case "preformatted":
|
|
507
542
|
return _jsx("pre", { className: "ecx-pre", children: await children() }, key);
|
package/dist/runtime.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import "server-only";
|
|
1
2
|
import type { ComponentType } from "react";
|
|
2
3
|
import type { FilterMap, LayoutProps, PluginDefinition, PluginLoader, RegionProps, ShortcodeProps, Site, TemplateProps, ThemeEntry } from "./types.js";
|
|
3
4
|
interface RuntimeConfig {
|
|
@@ -21,9 +22,9 @@ export interface LoadedTheme {
|
|
|
21
22
|
}>;
|
|
22
23
|
layout(): Promise<ComponentType<LayoutProps> | null>;
|
|
23
24
|
}
|
|
24
|
-
/** Theme đang active (kèm theme cha nếu là child theme). Fallback về "default" nếu theme không tồn tại trong bản build. */
|
|
25
|
+
/** @internal Theme đang active (kèm theme cha nếu là child theme). Fallback về "default" nếu theme không tồn tại trong bản build. */
|
|
25
26
|
export declare const getActiveTheme: (site?: Site) => Promise<LoadedTheme>;
|
|
26
|
-
/** Định nghĩa của plugin đang bật + phần "extend" của theme. */
|
|
27
|
+
/** @internal Định nghĩa của plugin đang bật + phần "extend" của theme. */
|
|
27
28
|
export declare const getActiveExtensions: (site?: Site) => Promise<PluginDefinition[]>;
|
|
28
29
|
/**
|
|
29
30
|
* Hàm mà plugin đang bật công bố qua definePlugin({ exports }). null nếu plugin chưa cài/chưa bật — luôn kiểm tra:
|
|
@@ -34,19 +35,23 @@ export declare const getActiveExtensions: (site?: Site) => Promise<PluginDefinit
|
|
|
34
35
|
export declare function getPlugin<T = Record<string, unknown>>(slug: string, site?: Site): Promise<T | null>;
|
|
35
36
|
/** Plugin có đang bật không. */
|
|
36
37
|
export declare function hasPlugin(slug: string, site?: Site): Promise<boolean>;
|
|
38
|
+
/** @internal Component của shortcode theo tên (core dùng khi vẽ nội dung). */
|
|
37
39
|
export declare function findShortcode(name: string, site?: Site): Promise<ComponentType<ShortcodeProps> | null>;
|
|
40
|
+
/** @internal Component của widget theo loại. */
|
|
38
41
|
export declare function findWidget(type: string, site?: Site): Promise<ComponentType<import("./types.js").WidgetProps<any>> | null>;
|
|
39
|
-
/** Route gốc của plugin đang bật (vd "/news-sitemap.xml"). */
|
|
42
|
+
/** @internal Route gốc của plugin đang bật (vd "/news-sitemap.xml"). */
|
|
40
43
|
export declare function findRoute(path: string, site?: Site): Promise<import("./types.js").PluginRoute | null>;
|
|
44
|
+
/** @internal Component của khối theo loại (khối của plugin / theme). */
|
|
41
45
|
export declare function findBlock(type: string, site?: Site): Promise<ComponentType<import("./types.js").BlockProps<any>> | null>;
|
|
42
|
-
/** Component thay vùng (definePlugin → regions): priority nhỏ nhất thắng, bằng nhau thì plugin trước theme. */
|
|
46
|
+
/** @internal Component thay vùng (definePlugin → regions): priority nhỏ nhất thắng, bằng nhau thì plugin trước theme. */
|
|
43
47
|
export declare function findRegion(name: string, site?: Site): Promise<ComponentType<RegionProps> | null>;
|
|
44
48
|
export interface LoadedSlotItem {
|
|
45
49
|
Component: ComponentType<any>;
|
|
46
50
|
priority: number;
|
|
47
51
|
}
|
|
52
|
+
/** @internal Mục gắn vào slot, kèm plugin sở hữu (core dùng để cô lập lỗi từng plugin). Theme dùng `<Slot>`. */
|
|
48
53
|
export declare function getSlotItems(name: string, site?: Site): Promise<LoadedSlotItem[]>;
|
|
49
|
-
/**
|
|
54
|
+
/** @internal Các component gắn vào slot, đã sắp xếp theo priority. Theme dùng `<Slot>`. */
|
|
50
55
|
export declare function getSlotComponents(name: string, site?: Site): Promise<ComponentType<any>[]>;
|
|
51
56
|
/** Chạy filter của các plugin/theme đang bật theo thứ tự, bỏ qua filter bị lỗi. */
|
|
52
57
|
export declare function applyFilters<K extends keyof FilterMap>(name: K, value: Parameters<NonNullable<FilterMap[K]>>[0], ctx?: Parameters<NonNullable<FilterMap[K]>>[1], site?: Site): Promise<Parameters<NonNullable<FilterMap[K]>>[0]>;
|
|
@@ -55,4 +60,5 @@ export declare function applyFilters<T = any>(name: string, value: T, ctx?: any,
|
|
|
55
60
|
export declare function doAction(name: string, arg?: any, site?: Site): Promise<void>;
|
|
56
61
|
/** Dùng trong file entry của plugin/theme: export default definePlugin({...}). */
|
|
57
62
|
export declare function definePlugin(def: PluginDefinition): PluginDefinition;
|
|
58
|
-
export {};
|
|
63
|
+
export { cmsApi, varyHeader, resolvePath, getPreview, getTemplates, TEMPLATE_DRAFT_COOKIE, UNLOCK_COOKIE, UNLOCK_HEADER } from "./api.js";
|
|
64
|
+
export { getAccessToken } from "./auth.js";
|
package/dist/runtime.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import "server-only";
|
|
1
2
|
import { cache } from "react";
|
|
2
3
|
import { getSite, getTemplates } from "./api.js";
|
|
3
4
|
// Lưu trên globalThis để mọi bản sao module (server/edge chunk) dùng chung một registry.
|
|
@@ -21,7 +22,7 @@ const BUILTIN_TEMPLATES = {
|
|
|
21
22
|
};
|
|
22
23
|
/** Tên template trang có sẵn (theme có template cùng tên thì dùng của theme). */
|
|
23
24
|
export const BUILTIN_PAGE_TEMPLATES = ["canvas", "full-width", "landing"];
|
|
24
|
-
/** Theme đang active (kèm theme cha nếu là child theme). Fallback về "default" nếu theme không tồn tại trong bản build. */
|
|
25
|
+
/** @internal Theme đang active (kèm theme cha nếu là child theme). Fallback về "default" nếu theme không tồn tại trong bản build. */
|
|
25
26
|
export const getActiveTheme = cache(async (site) => {
|
|
26
27
|
const s = site ?? (await getSite());
|
|
27
28
|
const { themes } = runtime();
|
|
@@ -76,7 +77,7 @@ export const getActiveTheme = cache(async (site) => {
|
|
|
76
77
|
},
|
|
77
78
|
};
|
|
78
79
|
});
|
|
79
|
-
/** Định nghĩa của plugin đang bật + phần "extend" của theme. */
|
|
80
|
+
/** @internal Định nghĩa của plugin đang bật + phần "extend" của theme. */
|
|
80
81
|
export const getActiveExtensions = cache(async (site) => {
|
|
81
82
|
const s = site ?? (await getSite());
|
|
82
83
|
const { plugins } = runtime();
|
|
@@ -134,32 +135,35 @@ export async function hasPlugin(slug, site) {
|
|
|
134
135
|
const BUILTIN_SHORTCODES = {
|
|
135
136
|
"cms-form": async () => (await import("./plugin-form.js")).CmsFormShortcode,
|
|
136
137
|
};
|
|
138
|
+
/** @internal Component của shortcode theo tên (core dùng khi vẽ nội dung). */
|
|
137
139
|
export async function findShortcode(name, site) {
|
|
138
140
|
for (const d of await getActiveExtensions(site))
|
|
139
141
|
if (d.shortcodes?.[name])
|
|
140
142
|
return d.shortcodes[name];
|
|
141
143
|
return BUILTIN_SHORTCODES[name] ? await BUILTIN_SHORTCODES[name]() : null;
|
|
142
144
|
}
|
|
145
|
+
/** @internal Component của widget theo loại. */
|
|
143
146
|
export async function findWidget(type, site) {
|
|
144
147
|
for (const d of await getActiveExtensions(site))
|
|
145
148
|
if (d.widgets?.[type])
|
|
146
149
|
return d.widgets[type];
|
|
147
150
|
return null;
|
|
148
151
|
}
|
|
149
|
-
/** Route gốc của plugin đang bật (vd "/news-sitemap.xml"). */
|
|
152
|
+
/** @internal Route gốc của plugin đang bật (vd "/news-sitemap.xml"). */
|
|
150
153
|
export async function findRoute(path, site) {
|
|
151
154
|
for (const d of await getActiveExtensions(site))
|
|
152
155
|
if (d.routes?.[path])
|
|
153
156
|
return d.routes[path];
|
|
154
157
|
return null;
|
|
155
158
|
}
|
|
159
|
+
/** @internal Component của khối theo loại (khối của plugin / theme). */
|
|
156
160
|
export async function findBlock(type, site) {
|
|
157
161
|
for (const d of await getActiveExtensions(site))
|
|
158
162
|
if (d.blocks?.[type])
|
|
159
163
|
return d.blocks[type];
|
|
160
164
|
return null;
|
|
161
165
|
}
|
|
162
|
-
/** Component thay vùng (definePlugin → regions): priority nhỏ nhất thắng, bằng nhau thì plugin trước theme. */
|
|
166
|
+
/** @internal Component thay vùng (definePlugin → regions): priority nhỏ nhất thắng, bằng nhau thì plugin trước theme. */
|
|
163
167
|
export async function findRegion(name, site) {
|
|
164
168
|
let best = null;
|
|
165
169
|
for (const d of await getActiveExtensions(site)) {
|
|
@@ -172,6 +176,7 @@ export async function findRegion(name, site) {
|
|
|
172
176
|
}
|
|
173
177
|
return best?.Component ?? null;
|
|
174
178
|
}
|
|
179
|
+
/** @internal Mục gắn vào slot, kèm plugin sở hữu (core dùng để cô lập lỗi từng plugin). Theme dùng `<Slot>`. */
|
|
175
180
|
export async function getSlotItems(name, site) {
|
|
176
181
|
const defs = await getActiveExtensions(site);
|
|
177
182
|
const items = [];
|
|
@@ -193,7 +198,7 @@ export async function getSlotItems(name, site) {
|
|
|
193
198
|
}
|
|
194
199
|
return items.sort((a, b) => a.priority - b.priority);
|
|
195
200
|
}
|
|
196
|
-
/**
|
|
201
|
+
/** @internal Các component gắn vào slot, đã sắp xếp theo priority. Theme dùng `<Slot>`. */
|
|
197
202
|
export async function getSlotComponents(name, site) {
|
|
198
203
|
const items = await getSlotItems(name, site);
|
|
199
204
|
return items.map((x) => x.Component);
|
|
@@ -237,3 +242,7 @@ export async function doAction(name, arg, site) {
|
|
|
237
242
|
export function definePlugin(def) {
|
|
238
243
|
return def;
|
|
239
244
|
}
|
|
245
|
+
// Tên nội bộ của core (dựng trang theo URL, xem trước, cookie phiên): chỉ export ở entry "/runtime" — theme và plugin không dùng,
|
|
246
|
+
// có thể đổi ở bản phụ.
|
|
247
|
+
export { cmsApi, varyHeader, resolvePath, getPreview, getTemplates, TEMPLATE_DRAFT_COOKIE, UNLOCK_COOKIE, UNLOCK_HEADER } from "./api.js";
|
|
248
|
+
export { getAccessToken } from "./auth.js";
|
package/dist/utils.d.ts
CHANGED
|
@@ -1,9 +1,25 @@
|
|
|
1
1
|
import type { Site } from "./types.js";
|
|
2
|
-
/**
|
|
2
|
+
/** @internal Cảnh báo một lần mỗi tiến trình khi gọi API đã cũ (chỉ ở môi trường dev). */
|
|
3
|
+
export declare function deprecated(old: string, use: string): void;
|
|
4
|
+
/**
|
|
5
|
+
* Định dạng một ngày theo cấu hình ngày của website (Cài đặt › Chung: `site.dateFormat`, `site.timezone`) — tương đương `date_i18n`.
|
|
6
|
+
* Token: `yyyy`, `MMMM` (tên tháng theo `site.locale`), `MM`, `dd`, `d`. Luôn truyền `site` (có trong `TemplateProps`): thiếu thì dùng
|
|
7
|
+
* `dd/MM/yyyy` + `Asia/Ho_Chi_Minh`, không theo cấu hình admin. Giá trị rỗng → `""`. Chạy được ở server và client.
|
|
8
|
+
* @example formatDate(post.publishedAt, site) // "16/11/2026"
|
|
9
|
+
*/
|
|
3
10
|
export declare function formatDate(value: string | null | undefined, site?: Pick<Site, "dateFormat" | "timezone"> & {
|
|
4
11
|
locale?: string;
|
|
5
12
|
}): string;
|
|
13
|
+
/**
|
|
14
|
+
* Đọc một giá trị Tuỳ biến của theme (`theme.json › settings`) từ `settings` của `TemplateProps` / `LayoutProps`, kèm giá trị dự phòng
|
|
15
|
+
* (tương đương `get_theme_mod`). Rỗng / chưa đặt → `fallback`. Không gọi mạng.
|
|
16
|
+
* @example setting(settings, "showComments", true)
|
|
17
|
+
*/
|
|
6
18
|
export declare function setting<T = string>(settings: Record<string, unknown>, key: string, fallback: T): T;
|
|
19
|
+
/**
|
|
20
|
+
* Đường dẫn trang thứ `page` của một danh sách (`/tin-tuc/page/2`), giữ từ khoá tìm kiếm nếu có. Trang 1 → đường dẫn gốc.
|
|
21
|
+
* Danh sách có bộ lọc khác → {@link pageLinkWithQuery}.
|
|
22
|
+
*/
|
|
7
23
|
export declare function pageLink(basePath: string, page: number, search?: string | null): string;
|
|
8
24
|
/**
|
|
9
25
|
* Link của một trang trong danh sách CÓ bộ lọc: giữ nguyên mọi tham số truy vấn hiện có (phòng ban,
|
|
@@ -12,4 +28,5 @@ export declare function pageLink(basePath: string, page: number, search?: string
|
|
|
12
28
|
* <Link href={pageLinkWithQuery(data.basePath, 2, data.query)}>2</Link>
|
|
13
29
|
*/
|
|
14
30
|
export declare function pageLinkWithQuery(basePath: string, page: number, query?: Record<string, string> | null): string;
|
|
31
|
+
/** Ghép class CSS, bỏ giá trị rỗng / false (như `clsx`). @example cx("card", active && "is-active") */
|
|
15
32
|
export declare function cx(...classes: Array<string | false | null | undefined>): string;
|
package/dist/utils.js
CHANGED
|
@@ -1,4 +1,17 @@
|
|
|
1
|
-
|
|
1
|
+
const warned = new Set();
|
|
2
|
+
/** @internal Cảnh báo một lần mỗi tiến trình khi gọi API đã cũ (chỉ ở môi trường dev). */
|
|
3
|
+
export function deprecated(old, use) {
|
|
4
|
+
if (process.env.NODE_ENV === "production" || warned.has(old))
|
|
5
|
+
return;
|
|
6
|
+
warned.add(old);
|
|
7
|
+
console.warn(`[ecomweb-theme-sdk] ${old} đã cũ, dùng ${use}. Xem CHANGELOG của @ecomcx/ecomweb-theme-sdk.`);
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Định dạng một ngày theo cấu hình ngày của website (Cài đặt › Chung: `site.dateFormat`, `site.timezone`) — tương đương `date_i18n`.
|
|
11
|
+
* Token: `yyyy`, `MMMM` (tên tháng theo `site.locale`), `MM`, `dd`, `d`. Luôn truyền `site` (có trong `TemplateProps`): thiếu thì dùng
|
|
12
|
+
* `dd/MM/yyyy` + `Asia/Ho_Chi_Minh`, không theo cấu hình admin. Giá trị rỗng → `""`. Chạy được ở server và client.
|
|
13
|
+
* @example formatDate(post.publishedAt, site) // "16/11/2026"
|
|
14
|
+
*/
|
|
2
15
|
export function formatDate(value, site) {
|
|
3
16
|
if (!value)
|
|
4
17
|
return "";
|
|
@@ -15,10 +28,19 @@ export function formatDate(value, site) {
|
|
|
15
28
|
.replace("dd", parts.day)
|
|
16
29
|
.replace(/\bd\b/, String(Number(parts.day)));
|
|
17
30
|
}
|
|
31
|
+
/**
|
|
32
|
+
* Đọc một giá trị Tuỳ biến của theme (`theme.json › settings`) từ `settings` của `TemplateProps` / `LayoutProps`, kèm giá trị dự phòng
|
|
33
|
+
* (tương đương `get_theme_mod`). Rỗng / chưa đặt → `fallback`. Không gọi mạng.
|
|
34
|
+
* @example setting(settings, "showComments", true)
|
|
35
|
+
*/
|
|
18
36
|
export function setting(settings, key, fallback) {
|
|
19
37
|
const v = settings?.[key];
|
|
20
38
|
return (v === undefined || v === null || v === "" ? fallback : v);
|
|
21
39
|
}
|
|
40
|
+
/**
|
|
41
|
+
* Đường dẫn trang thứ `page` của một danh sách (`/tin-tuc/page/2`), giữ từ khoá tìm kiếm nếu có. Trang 1 → đường dẫn gốc.
|
|
42
|
+
* Danh sách có bộ lọc khác → {@link pageLinkWithQuery}.
|
|
43
|
+
*/
|
|
22
44
|
export function pageLink(basePath, page, search) {
|
|
23
45
|
const base = basePath === "/" ? "" : basePath.replace(/\/$/, "");
|
|
24
46
|
const path = page <= 1 ? base || "/" : `${base}/page/${page}`;
|
|
@@ -43,6 +65,7 @@ export function pageLinkWithQuery(basePath, page, query) {
|
|
|
43
65
|
const qs = params.toString();
|
|
44
66
|
return qs ? `${path}${path.includes("?") ? "&" : "?"}${qs}` : path;
|
|
45
67
|
}
|
|
68
|
+
/** Ghép class CSS, bỏ giá trị rỗng / false (như `clsx`). @example cx("card", active && "is-active") */
|
|
46
69
|
export function cx(...classes) {
|
|
47
70
|
return classes.filter(Boolean).join(" ");
|
|
48
71
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ecomcx/ecomweb-theme-sdk",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.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",
|
|
@@ -30,16 +30,20 @@
|
|
|
30
30
|
},
|
|
31
31
|
"files": [
|
|
32
32
|
"dist",
|
|
33
|
-
"README.md"
|
|
33
|
+
"README.md",
|
|
34
|
+
"LICENSE",
|
|
35
|
+
"CHANGELOG.md",
|
|
36
|
+
"API.md"
|
|
34
37
|
],
|
|
35
38
|
"dependencies": {
|
|
36
|
-
"@ecomcx/ecomweb-content": "^1.
|
|
37
|
-
"intl-messageformat": "12.1.3"
|
|
39
|
+
"@ecomcx/ecomweb-content": "^1.26.0",
|
|
40
|
+
"intl-messageformat": "12.1.3",
|
|
41
|
+
"server-only": "0.0.1"
|
|
38
42
|
},
|
|
39
43
|
"peerDependencies": {
|
|
40
|
-
"next": ">=16",
|
|
41
|
-
"next-fetch-kit": ">=0.5.0",
|
|
42
|
-
"react": ">=19"
|
|
44
|
+
"next": ">=16 <17",
|
|
45
|
+
"next-fetch-kit": ">=0.5.0 <1",
|
|
46
|
+
"react": ">=19 <20"
|
|
43
47
|
},
|
|
44
48
|
"peerDependenciesMeta": {
|
|
45
49
|
"next": {
|
|
@@ -60,5 +64,8 @@
|
|
|
60
64
|
"access": "public",
|
|
61
65
|
"provenance": true
|
|
62
66
|
},
|
|
63
|
-
"sideEffects":
|
|
67
|
+
"sideEffects": [
|
|
68
|
+
"./dist/index.js",
|
|
69
|
+
"./dist/runtime.js"
|
|
70
|
+
]
|
|
64
71
|
}
|