@ecomcx/ecomweb-theme-sdk 1.41.1 → 1.43.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.
Files changed (2) hide show
  1. package/dist/rich.js +7 -5
  2. package/package.json +2 -2
package/dist/rich.js CHANGED
@@ -1,6 +1,6 @@
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 } from "@ecomcx/ecomweb-content";
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";
4
4
  import { cx } from "./utils.js";
5
5
  import { SOCIAL_ICONS } from "./social-icons.js";
6
6
  import { CountdownClient, FormBlockClient, LightboxClient, Link, TabsClient } from "./client.js";
@@ -172,7 +172,8 @@ function decorate(el, a, key, ctx, type, ctrl, data) {
172
172
  if (ctrl && ctx.styles && !ctx.styles.has(ctrl.cls))
173
173
  ctx.styles.set(ctrl.cls, ctrl.css);
174
174
  const extra = cx(cls, ctrl?.cls, motionClasses(style), widthClass(type, a), a.blockStyle && `ecx-is-${a.blockStyle}`, a.className);
175
- if (isValidElement(el) && el.type !== Fragment && typeof el.type === "string") {
175
+ // Link của SDK in thẳng <a> (nhận className / style / id) → gắn class lên chính thẻ như khung soạn, không bọc thêm <div> (nút trong nhóm nút)
176
+ if (isValidElement(el) && el.type !== Fragment && (typeof el.type === "string" || el.type === Link)) {
176
177
  const e = el;
177
178
  let inline = e.props.style;
178
179
  if (inline && style) {
@@ -245,7 +246,8 @@ async function renderNode(node, key, ctx) {
245
246
  for (const c of a.className.split(/\s+/))
246
247
  ctx.used.classes.add(c);
247
248
  }
248
- const ctrl = ctx.controls?.length && node.type !== "text" ? controlsCss(ctx.controls, node.type, a ?? {}) : null;
249
+ // Ô Kiểu dáng của khối lõi (1.24) + của plugin — cùng controlsCss với khung soạn
250
+ const ctrl = node.type !== "text" && a ? controlsCss(ctx.controls?.length ? [...CORE_CONTROLS, ...ctx.controls] : CORE_CONTROLS, node.type, a) : null;
249
251
  const pick = ctx.ready && node.type !== "text" ? ctx.ready[node.type] ?? ctx.ready["*"] : undefined;
250
252
  // Có liệt kê thuộc tính → chỉ gắn khi khối có ít nhất một giá trị (không phình HTML mọi nhóm / bìa); [] = mọi khối loại đó
251
253
  const given = pick?.filter((k) => !emptyAttr(a?.[k]));
@@ -392,9 +394,9 @@ async function renderNodeInner(node, key, ctx) {
392
394
  return shelled("buttons", a, key, items);
393
395
  }
394
396
  case "cover": {
395
- const { src, fixed, overlay, opacity } = coverParts(a);
397
+ const { src, fixed, overlay, imgStyle, overlayStyle } = coverParts(a);
396
398
  const url = src ? safeUrl(src, "") : "";
397
- return shelled("cover", a, key, _jsxs(_Fragment, { children: [url && !fixed && _jsx("img", { className: "ecx-cover-img", src: url, alt: a.alt ?? "", loading: "lazy", decoding: "async" }), overlay && _jsx("span", { className: "ecx-cover-overlay", "aria-hidden": "true", style: { background: overlay, opacity } }), _jsx("div", { className: "ecx-cover-inner", children: await children() })] }), undefined);
399
+ return shelled("cover", a, key, _jsxs(_Fragment, { children: [url && !fixed && _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);
398
400
  }
399
401
  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() })] }));
400
402
  case "pullquote":
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ecomcx/ecomweb-theme-sdk",
3
- "version": "1.41.1",
3
+ "version": "1.43.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.23.1",
36
+ "@ecomcx/ecomweb-content": "^1.25.0",
37
37
  "intl-messageformat": "12.1.3"
38
38
  },
39
39
  "peerDependencies": {