@ecomcx/ecomweb-theme-sdk 1.41.0 → 1.41.1
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/content.d.ts +5 -0
- package/dist/content.js +12 -1
- package/dist/page-full-width.d.ts +1 -1
- package/dist/page-full-width.js +5 -4
- package/dist/page-landing.d.ts +1 -1
- package/dist/page-landing.js +5 -4
- package/package.json +2 -2
package/dist/content.d.ts
CHANGED
|
@@ -24,3 +24,8 @@ export declare function EditableRegion({ name, data, className, children }: {
|
|
|
24
24
|
}): Promise<import("react").JSX.Element>;
|
|
25
25
|
/** Ngữ cảnh vẽ nội dung dùng chung cho bài viết và template khối. */
|
|
26
26
|
export declare function contentContext(site: Site, post?: Post | null, data?: ResolveResult): Promise<RenderContext>;
|
|
27
|
+
/**
|
|
28
|
+
* Header / footer của theme dựng bằng khối cho template có sẵn của SDK (full-width, landing): theme khối không có header/footer
|
|
29
|
+
* trong layout mà ở template part trong từng template khối → template có sẵn phải tự vẽ part "header" / "footer". Theme thường: null.
|
|
30
|
+
*/
|
|
31
|
+
export declare function blockThemeParts(site: Site, data?: ResolveResult): Promise<[ReactNode, ReactNode]>;
|
package/dist/content.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 { ExtensionBoundary, Link, PostPasswordForm } from "./client.js";
|
|
3
|
-
import { applyFilters, findBlock, findRegion, findShortcode, getActiveExtensions } from "./runtime.js";
|
|
3
|
+
import { applyFilters, findBlock, findRegion, findShortcode, getActiveExtensions, getActiveTheme } from "./runtime.js";
|
|
4
4
|
import { getPattern, getSite, getTemplates } from "./api.js";
|
|
5
5
|
import { CORE_BINDING_SOURCES } from "./bindings.js";
|
|
6
6
|
import { getT } from "./i18n.js";
|
|
@@ -108,3 +108,14 @@ export async function contentContext(site, post, data) {
|
|
|
108
108
|
},
|
|
109
109
|
};
|
|
110
110
|
}
|
|
111
|
+
/**
|
|
112
|
+
* Header / footer của theme dựng bằng khối cho template có sẵn của SDK (full-width, landing): theme khối không có header/footer
|
|
113
|
+
* trong layout mà ở template part trong từng template khối → template có sẵn phải tự vẽ part "header" / "footer". Theme thường: null.
|
|
114
|
+
*/
|
|
115
|
+
export async function blockThemeParts(site, data) {
|
|
116
|
+
if ((await getActiveTheme(site)).chain[0]?.manifest.editing !== "blocks")
|
|
117
|
+
return [null, null];
|
|
118
|
+
const ctx = await contentContext(site, data?.post, data);
|
|
119
|
+
const part = async (slug) => _jsx(_Fragment, { children: await renderContent({ type: "doc", content: [{ type: "templatePart", attrs: { slug, tagName: slug } }] }, ctx) });
|
|
120
|
+
return [await part("header"), await part("footer")];
|
|
121
|
+
}
|
|
@@ -3,4 +3,4 @@ import type { TemplateProps } from "./types.js";
|
|
|
3
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
4
|
* (--ecx-content-width), chỉ khối đặt độ rộng "Rộng" / "Toàn trang" mới tràn ra.
|
|
5
5
|
*/
|
|
6
|
-
export default function FullWidth({ data }: TemplateProps): import("react").JSX.Element
|
|
6
|
+
export default function FullWidth({ data, site }: TemplateProps): Promise<import("react").JSX.Element>;
|
package/dist/page-full-width.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { PostContent } from "./content.js";
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { blockThemeParts, PostContent } from "./content.js";
|
|
3
3
|
/**
|
|
4
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
5
|
* (--ecx-content-width), chỉ khối đặt độ rộng "Rộng" / "Toàn trang" mới tràn ra.
|
|
6
6
|
*/
|
|
7
|
-
export default function FullWidth({ data }) {
|
|
8
|
-
|
|
7
|
+
export default async function FullWidth({ data, site }) {
|
|
8
|
+
const [header, footer] = await blockThemeParts(site, data);
|
|
9
|
+
return (_jsxs(_Fragment, { children: [header, _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" })] }), footer] }));
|
|
9
10
|
}
|
package/dist/page-landing.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { TemplateProps } from "./types.js";
|
|
2
2
|
/** Template "landing": như "full-width" (giữ header/footer, khối "Toàn trang" tràn màn hình) nhưng không in tiêu đề — section đầu (hero) sát header. */
|
|
3
|
-
export default function Landing({ data }: TemplateProps): import("react").JSX.Element
|
|
3
|
+
export default function Landing({ data, site }: TemplateProps): Promise<import("react").JSX.Element>;
|
package/dist/page-landing.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { PostContent } from "./content.js";
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { blockThemeParts, PostContent } from "./content.js";
|
|
3
3
|
/** Template "landing": như "full-width" (giữ header/footer, khối "Toàn trang" tràn màn hình) nhưng không in tiêu đề — section đầu (hero) sát header. */
|
|
4
|
-
export default function Landing({ data }) {
|
|
5
|
-
|
|
4
|
+
export default async function Landing({ data, site }) {
|
|
5
|
+
const [header, footer] = await blockThemeParts(site, data);
|
|
6
|
+
return (_jsxs(_Fragment, { children: [header, _jsx("div", { className: "ecx-full-width ecx-landing", children: _jsx(PostContent, { post: data.post, className: "entry-content ecx-layout-constrained" }) }), footer] }));
|
|
6
7
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ecomcx/ecomweb-theme-sdk",
|
|
3
|
-
"version": "1.41.
|
|
3
|
+
"version": "1.41.1",
|
|
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.
|
|
36
|
+
"@ecomcx/ecomweb-content": "^1.23.1",
|
|
37
37
|
"intl-messageformat": "12.1.3"
|
|
38
38
|
},
|
|
39
39
|
"peerDependencies": {
|