@ecomcx/nexus-theme-sdk 0.0.0-stage → 1.24.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 (52) hide show
  1. package/dist/api.d.ts +92 -0
  2. package/dist/api.js +149 -0
  3. package/dist/auth-forms.d.ts +83 -0
  4. package/dist/auth-forms.js +206 -0
  5. package/dist/auth-pages.d.ts +6 -0
  6. package/dist/auth-pages.js +33 -0
  7. package/dist/auth-shared.d.ts +14 -0
  8. package/dist/auth-shared.js +7 -0
  9. package/dist/auth.d.ts +16 -0
  10. package/dist/auth.js +48 -0
  11. package/dist/client.d.ts +102 -0
  12. package/dist/client.js +191 -0
  13. package/dist/components.d.ts +68 -0
  14. package/dist/components.js +154 -0
  15. package/dist/content.d.ts +25 -0
  16. package/dist/content.js +59 -0
  17. package/dist/dynamic.d.ts +9 -0
  18. package/dist/dynamic.js +128 -0
  19. package/dist/i18n.d.ts +11 -0
  20. package/dist/i18n.js +104 -0
  21. package/dist/image.d.ts +24 -0
  22. package/dist/image.js +37 -0
  23. package/dist/index.d.ts +19 -0
  24. package/dist/index.js +21 -0
  25. package/dist/locale.d.ts +9 -0
  26. package/dist/locale.js +20 -0
  27. package/dist/metadata.d.ts +3 -0
  28. package/dist/metadata.js +26 -0
  29. package/dist/page-canvas.d.ts +4 -0
  30. package/dist/page-canvas.js +7 -0
  31. package/dist/page-full-width.d.ts +3 -0
  32. package/dist/page-full-width.js +6 -0
  33. package/dist/plugin-form-client.d.ts +27 -0
  34. package/dist/plugin-form-client.js +55 -0
  35. package/dist/plugin-form.d.ts +15 -0
  36. package/dist/plugin-form.js +25 -0
  37. package/dist/preferences.d.ts +9 -0
  38. package/dist/preferences.js +17 -0
  39. package/dist/rich.d.ts +66 -0
  40. package/dist/rich.js +388 -0
  41. package/dist/runtime.d.ts +58 -0
  42. package/dist/runtime.js +238 -0
  43. package/dist/social-icons.d.ts +5 -0
  44. package/dist/social-icons.js +21 -0
  45. package/dist/template-blocks.d.ts +3 -0
  46. package/dist/template-blocks.js +11 -0
  47. package/dist/types.d.ts +475 -0
  48. package/dist/types.js +1 -0
  49. package/dist/utils.d.ts +8 -0
  50. package/dist/utils.js +29 -0
  51. package/package.json +62 -4
  52. package/README.md +0 -3
@@ -0,0 +1,238 @@
1
+ import { cache } from "react";
2
+ import { getSite, getTemplates } from "./api.js";
3
+ // Lưu trên globalThis để mọi bản sao module (server/edge chunk) dùng chung một registry.
4
+ const g = globalThis;
5
+ /** Frontend core gọi một lần với registry được sinh tự động (generated/registry.ts). */
6
+ export function configureRuntime(config) {
7
+ g.__cmsRuntime = config;
8
+ }
9
+ function runtime() {
10
+ if (!g.__cmsRuntime)
11
+ throw new Error("CMS runtime chưa được cấu hình (configureRuntime)");
12
+ return g.__cmsRuntime;
13
+ }
14
+ export const FALLBACK_THEME = "default";
15
+ /** Template có sẵn của SDK, dùng khi cả theme lẫn plugin không có: trang đăng nhập/đăng ký, template trang canvas / full-width. */
16
+ const BUILTIN_TEMPLATES = {
17
+ auth: () => import("./auth-pages.js"),
18
+ canvas: () => import("./page-canvas.js"),
19
+ "full-width": () => import("./page-full-width.js"),
20
+ };
21
+ /** Tên template trang có sẵn (theme có template cùng tên thì dùng của theme). */
22
+ export const BUILTIN_PAGE_TEMPLATES = ["canvas", "full-width"];
23
+ /** 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. */
24
+ export const getActiveTheme = cache(async (site) => {
25
+ const s = site ?? (await getSite());
26
+ const { themes } = runtime();
27
+ let slug = themes[s.activeTheme] ? s.activeTheme : FALLBACK_THEME;
28
+ if (!themes[slug])
29
+ slug = Object.keys(themes)[0];
30
+ const chain = [];
31
+ let current = slug;
32
+ while (current && themes[current] && chain.length < 5) {
33
+ chain.push(themes[current]);
34
+ current = themes[current].manifest.parent;
35
+ }
36
+ const templateNames = [...new Set(chain.flatMap((t) => Object.keys(t.templates)))];
37
+ return {
38
+ slug,
39
+ chain,
40
+ templateNames,
41
+ async resolveTemplate(candidates) {
42
+ // Mỗi tên template theo thứ tự ưu tiên: template khối → theme (con trước cha) → plugin đang bật → template có sẵn của SDK.
43
+ // Theme luôn ghi đè được template của plugin; tên cụ thể hơn (single-product) thắng tên chung (single) dù nằm ở plugin.
44
+ const extensions = await getActiveExtensions(s);
45
+ // Theme dựng bằng khối: template khối (bản sửa trong Trình dựng / templates/*.json) thắng file .tsx cùng tên
46
+ const blockTemplates = chain[0]?.manifest.editing === "blocks" ? (await getTemplates().catch(() => null))?.templates ?? {} : {};
47
+ for (const name of [...candidates, "index"]) {
48
+ if (blockTemplates[name])
49
+ return { name, Component: (await import("./template-blocks.js")).default, layout: true };
50
+ for (const theme of chain) {
51
+ const loader = theme.templates[name];
52
+ if (loader) {
53
+ const mod = (await loader());
54
+ return { name, Component: mod.default, layout: mod.layout !== false };
55
+ }
56
+ }
57
+ for (const d of extensions) {
58
+ const Component = d.templates?.[name];
59
+ if (Component)
60
+ return { name, Component, layout: Component.layout !== false };
61
+ }
62
+ const builtin = BUILTIN_TEMPLATES[name];
63
+ if (builtin) {
64
+ const mod = await builtin();
65
+ return { name, Component: mod.default, layout: mod.layout !== false };
66
+ }
67
+ }
68
+ throw new Error(`Theme "${slug}" thiếu templates/index.tsx`);
69
+ },
70
+ async layout() {
71
+ for (const theme of chain)
72
+ if (theme.layout)
73
+ return (await theme.layout()).default;
74
+ return null;
75
+ },
76
+ };
77
+ });
78
+ /** Định nghĩa của plugin đang bật + phần "extend" của theme. */
79
+ export const getActiveExtensions = cache(async (site) => {
80
+ const s = site ?? (await getSite());
81
+ const { plugins } = runtime();
82
+ const defs = [];
83
+ for (const slug of s.activePlugins) {
84
+ const loader = plugins[slug];
85
+ if (!loader)
86
+ continue;
87
+ try {
88
+ defs.push((await loader()).default);
89
+ }
90
+ catch (e) {
91
+ console.error(`[cms] Không nạp được plugin frontend "${slug}"`, e);
92
+ }
93
+ }
94
+ const theme = await getActiveTheme(s);
95
+ for (const t of [...theme.chain].reverse()) {
96
+ if (t.extend) {
97
+ try {
98
+ defs.push((await t.extend()).default);
99
+ }
100
+ catch (e) {
101
+ console.error(`[cms] Không nạp được extend của theme`, e);
102
+ }
103
+ }
104
+ }
105
+ return defs;
106
+ });
107
+ /**
108
+ * 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:
109
+ * const shop = await getPlugin<ShopApi>("shop");
110
+ * if (shop) cart = await shop.getCart();
111
+ * Chỉ dùng phía server (Server Component, route, generateMetadata). Component client nhận dữ liệu qua props.
112
+ */
113
+ export async function getPlugin(slug, site) {
114
+ const s = site ?? (await getSite());
115
+ if (!s.activePlugins.includes(slug))
116
+ return null;
117
+ const loader = runtime().plugins[slug];
118
+ if (!loader)
119
+ return null;
120
+ try {
121
+ return ((await loader()).default.exports ?? {});
122
+ }
123
+ catch (e) {
124
+ console.error(`[cms] Không nạp được plugin frontend "${slug}"`, e);
125
+ return null;
126
+ }
127
+ }
128
+ /** Plugin có đang bật không. */
129
+ export async function hasPlugin(slug, site) {
130
+ return (site ?? (await getSite())).activePlugins.includes(slug);
131
+ }
132
+ /** Shortcode có sẵn của SDK (plugin cùng tên được ưu tiên): [cms-form plugin="…" table="…" submit="…"]. */
133
+ const BUILTIN_SHORTCODES = {
134
+ "cms-form": async () => (await import("./plugin-form.js")).CmsFormShortcode,
135
+ };
136
+ export async function findShortcode(name, site) {
137
+ for (const d of await getActiveExtensions(site))
138
+ if (d.shortcodes?.[name])
139
+ return d.shortcodes[name];
140
+ return BUILTIN_SHORTCODES[name] ? await BUILTIN_SHORTCODES[name]() : null;
141
+ }
142
+ export async function findWidget(type, site) {
143
+ for (const d of await getActiveExtensions(site))
144
+ if (d.widgets?.[type])
145
+ return d.widgets[type];
146
+ return null;
147
+ }
148
+ /** Route gốc của plugin đang bật (vd "/news-sitemap.xml"). */
149
+ export async function findRoute(path, site) {
150
+ for (const d of await getActiveExtensions(site))
151
+ if (d.routes?.[path])
152
+ return d.routes[path];
153
+ return null;
154
+ }
155
+ export async function findBlock(type, site) {
156
+ for (const d of await getActiveExtensions(site))
157
+ if (d.blocks?.[type])
158
+ return d.blocks[type];
159
+ return null;
160
+ }
161
+ /** Component thay vùng (definePlugin → regions): priority nhỏ nhất thắng, bằng nhau thì plugin trước theme. */
162
+ export async function findRegion(name, site) {
163
+ let best = null;
164
+ for (const d of await getActiveExtensions(site)) {
165
+ const raw = d.regions?.[name];
166
+ if (!raw)
167
+ continue;
168
+ const item = typeof raw === "function" ? { Component: raw, priority: 10 } : { Component: raw.component, priority: raw.priority ?? 10 };
169
+ if (item.Component && (!best || item.priority < best.priority))
170
+ best = item;
171
+ }
172
+ return best?.Component ?? null;
173
+ }
174
+ export async function getSlotItems(name, site) {
175
+ const defs = await getActiveExtensions(site);
176
+ const items = [];
177
+ for (const d of defs) {
178
+ const raw = d.slots?.[name];
179
+ if (!raw)
180
+ continue;
181
+ const list = Array.isArray(raw) ? raw : [raw];
182
+ for (const item of list) {
183
+ if (!item)
184
+ continue;
185
+ if (typeof item === "function") {
186
+ items.push({ Component: item, priority: 10 });
187
+ }
188
+ else if (typeof item === "object" && "component" in item) {
189
+ items.push({ Component: item.component, priority: item.priority ?? 10 });
190
+ }
191
+ }
192
+ }
193
+ return items.sort((a, b) => a.priority - b.priority);
194
+ }
195
+ /** Lấy các component gắn vào slot, đã sắp xếp theo priority */
196
+ export async function getSlotComponents(name, site) {
197
+ const items = await getSlotItems(name, site);
198
+ return items.map((x) => x.Component);
199
+ }
200
+ export async function applyFilters(name, value, ctx, site) {
201
+ let v = value;
202
+ for (const d of await getActiveExtensions(site)) {
203
+ const fn = d.filters?.[name];
204
+ if (!fn)
205
+ continue;
206
+ try {
207
+ v = await fn(v, ctx);
208
+ }
209
+ catch (e) {
210
+ console.error(`[cms] filter ${String(name)} lỗi:`, e);
211
+ }
212
+ }
213
+ return v;
214
+ }
215
+ /** Phát action tới các plugin/theme đang bật. */
216
+ export async function doAction(name, arg, site) {
217
+ for (const d of await getActiveExtensions(site)) {
218
+ const raw = d.actions?.[name];
219
+ if (!raw)
220
+ continue;
221
+ const list = Array.isArray(raw) ? raw : [raw];
222
+ for (const item of list) {
223
+ const fn = typeof item === "function" ? item : item?.handler;
224
+ if (!fn)
225
+ continue;
226
+ try {
227
+ await fn(arg);
228
+ }
229
+ catch (e) {
230
+ console.error(`[cms] action ${name} lỗi:`, e);
231
+ }
232
+ }
233
+ }
234
+ }
235
+ /** Dùng trong file entry của plugin/theme: export default definePlugin({...}). */
236
+ export function definePlugin(def) {
237
+ return def;
238
+ }
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Biểu tượng mạng xã hội (khối socialLinks): path SVG 24×24 trích từ simple-icons 16.33.0 (CC0-1.0, https://simpleicons.org).
3
+ * email, website, linkedin: biểu tượng chung tự vẽ. Sinh lại: lấy `.path` của gói simple-icons cùng tên.
4
+ */
5
+ export declare const SOCIAL_ICONS: Record<string, string>;
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Biểu tượng mạng xã hội (khối socialLinks): path SVG 24×24 trích từ simple-icons 16.33.0 (CC0-1.0, https://simpleicons.org).
3
+ * email, website, linkedin: biểu tượng chung tự vẽ. Sinh lại: lấy `.path` của gói simple-icons cùng tên.
4
+ */
5
+ export const SOCIAL_ICONS = {
6
+ facebook: "M9.101 23.691v-7.98H6.627v-3.667h2.474v-1.58c0-4.085 1.848-5.978 5.858-5.978.401 0 .955.042 1.468.103a8.68 8.68 0 0 1 1.141.195v3.325a8.623 8.623 0 0 0-.653-.036 26.805 26.805 0 0 0-.733-.009c-.707 0-1.259.096-1.675.309a1.686 1.686 0 0 0-.679.622c-.258.42-.374.995-.374 1.752v1.297h3.919l-.386 2.103-.287 1.564h-3.246v8.245C19.396 23.238 24 18.179 24 12.044c0-6.627-5.373-12-12-12s-12 5.373-12 12c0 5.628 3.874 10.35 9.101 11.647Z",
7
+ x: "M14.234 10.162 22.977 0h-2.072l-7.591 8.824L7.251 0H.258l9.168 13.343L.258 24H2.33l8.016-9.318L16.749 24h6.993zm-2.837 3.299-.929-1.329L3.076 1.56h3.182l5.965 8.532.929 1.329 7.754 11.09h-3.182z",
8
+ twitter: "M14.234 10.162 22.977 0h-2.072l-7.591 8.824L7.251 0H.258l9.168 13.343L.258 24H2.33l8.016-9.318L16.749 24h6.993zm-2.837 3.299-.929-1.329L3.076 1.56h3.182l5.965 8.532.929 1.329 7.754 11.09h-3.182z",
9
+ instagram: "M7.0301.084c-1.2768.0602-2.1487.264-2.911.5634-.7888.3075-1.4575.72-2.1228 1.3877-.6652.6677-1.075 1.3368-1.3802 2.127-.2954.7638-.4956 1.6365-.552 2.914-.0564 1.2775-.0689 1.6882-.0626 4.947.0062 3.2586.0206 3.6671.0825 4.9473.061 1.2765.264 2.1482.5635 2.9107.308.7889.72 1.4573 1.388 2.1228.6679.6655 1.3365 1.0743 2.1285 1.38.7632.295 1.6361.4961 2.9134.552 1.2773.056 1.6884.069 4.9462.0627 3.2578-.0062 3.668-.0207 4.9478-.0814 1.28-.0607 2.147-.2652 2.9098-.5633.7889-.3086 1.4578-.72 2.1228-1.3881.665-.6682 1.0745-1.3378 1.3795-2.1284.2957-.7632.4966-1.636.552-2.9124.056-1.2809.0692-1.6898.063-4.948-.0063-3.2583-.021-3.6668-.0817-4.9465-.0607-1.2797-.264-2.1487-.5633-2.9117-.3084-.7889-.72-1.4568-1.3876-2.1228C21.2982 1.33 20.628.9208 19.8378.6165 19.074.321 18.2017.1197 16.9244.0645 15.6471.0093 15.236-.005 11.977.0014 8.718.0076 8.31.0215 7.0301.0839m.1402 21.6932c-1.17-.0509-1.8053-.2453-2.2287-.408-.5606-.216-.96-.4771-1.3819-.895-.422-.4178-.6811-.8186-.9-1.378-.1644-.4234-.3624-1.058-.4171-2.228-.0595-1.2645-.072-1.6442-.079-4.848-.007-3.2037.0053-3.583.0607-4.848.05-1.169.2456-1.805.408-2.2282.216-.5613.4762-.96.895-1.3816.4188-.4217.8184-.6814 1.3783-.9003.423-.1651 1.0575-.3614 2.227-.4171 1.2655-.06 1.6447-.072 4.848-.079 3.2033-.007 3.5835.005 4.8495.0608 1.169.0508 1.8053.2445 2.228.408.5608.216.96.4754 1.3816.895.4217.4194.6816.8176.9005 1.3787.1653.4217.3617 1.056.4169 2.2263.0602 1.2655.0739 1.645.0796 4.848.0058 3.203-.0055 3.5834-.061 4.848-.051 1.17-.245 1.8055-.408 2.2294-.216.5604-.4763.96-.8954 1.3814-.419.4215-.8181.6811-1.3783.9-.4224.1649-1.0577.3617-2.2262.4174-1.2656.0595-1.6448.072-4.8493.079-3.2045.007-3.5825-.006-4.848-.0608M16.953 5.5864A1.44 1.44 0 1 0 18.39 4.144a1.44 1.44 0 0 0-1.437 1.4424M5.8385 12.012c.0067 3.4032 2.7706 6.1557 6.173 6.1493 3.4026-.0065 6.157-2.7701 6.1506-6.1733-.0065-3.4032-2.771-6.1565-6.174-6.1498-3.403.0067-6.156 2.771-6.1496 6.1738M8 12.0077a4 4 0 1 1 4.008 3.9921A3.9996 3.9996 0 0 1 8 12.0077",
10
+ youtube: "M23.498 6.186a3.016 3.016 0 0 0-2.122-2.136C19.505 3.545 12 3.545 12 3.545s-7.505 0-9.377.505A3.017 3.017 0 0 0 .502 6.186C0 8.07 0 12 0 12s0 3.93.502 5.814a3.016 3.016 0 0 0 2.122 2.136c1.871.505 9.376.505 9.376.505s7.505 0 9.377-.505a3.015 3.015 0 0 0 2.122-2.136C24 15.93 24 12 24 12s0-3.93-.502-5.814zM9.545 15.568V8.432L15.818 12l-6.273 3.568z",
11
+ tiktok: "M12.525.02c1.31-.02 2.61-.01 3.91-.02.08 1.53.63 3.09 1.75 4.17 1.12 1.11 2.7 1.62 4.24 1.79v4.03c-1.44-.05-2.89-.35-4.2-.97-.57-.26-1.1-.59-1.62-.93-.01 2.92.01 5.84-.02 8.75-.08 1.4-.54 2.79-1.35 3.94-1.31 1.92-3.58 3.17-5.91 3.21-1.43.08-2.86-.31-4.08-1.03-2.02-1.19-3.44-3.37-3.65-5.71-.02-.5-.03-1-.01-1.49.18-1.9 1.12-3.72 2.58-4.96 1.66-1.44 3.98-2.13 6.15-1.72.02 1.48-.04 2.96-.04 4.44-.99-.32-2.15-.23-3.02.37-.63.41-1.11 1.04-1.36 1.75-.21.51-.15 1.07-.14 1.61.24 1.64 1.82 3.02 3.5 2.87 1.12-.01 2.19-.66 2.77-1.61.19-.33.4-.67.41-1.06.1-1.79.06-3.57.07-5.36.01-4.03-.01-8.05.02-12.07z",
12
+ zalo: "M12.49 10.2722v-.4496h1.3467v6.3218h-.7704a.576.576 0 01-.5763-.5729l-.0006.0005a3.273 3.273 0 01-1.9372.6321c-1.8138 0-3.2844-1.4697-3.2844-3.2823 0-1.8125 1.4706-3.2822 3.2844-3.2822a3.273 3.273 0 011.9372.6321l.0006.0005zM6.9188 7.7896v.205c0 .3823-.051.6944-.2995 1.0605l-.03.0343c-.0542.0615-.1815.206-.2421.2843L2.024 14.8h4.8948v.7682a.5764.5764 0 01-.5767.5761H0v-.3622c0-.4436.1102-.6414.2495-.8476L4.8582 9.23H.1922V7.7896h6.7266zm8.5513 8.3548a.4805.4805 0 01-.4803-.4798v-7.875h1.4416v8.3548H15.47zM20.6934 9.6C22.52 9.6 24 11.0807 24 12.9044c0 1.8252-1.4801 3.306-3.3066 3.306-1.8264 0-3.3066-1.4808-3.3066-3.306 0-1.8237 1.4802-3.3044 3.3066-3.3044zm-10.1412 5.253c1.0675 0 1.9324-.8645 1.9324-1.9312 0-1.065-.865-1.9295-1.9324-1.9295s-1.9324.8644-1.9324 1.9295c0 1.0667.865 1.9312 1.9324 1.9312zm10.1412-.0033c1.0737 0 1.945-.8707 1.945-1.9453 0-1.073-.8713-1.9436-1.945-1.9436-1.0753 0-1.945.8706-1.945 1.9436 0 1.0746.8697 1.9453 1.945 1.9453z",
13
+ github: "M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12",
14
+ threads: "M18.263 11.097c-.03-3.486-1.92-5.586-5.111-5.586-2.13 0-3.922.963-4.863 2.499l2.062 1.438c.535-.843 1.272-1.543 2.628-1.543 1.528 0 2.318.85 2.544 2.431a15 15 0 0 0-2.236-.173c-4.125 0-6.068 1.867-6.068 4.336s1.943 3.99 4.804 3.99c3.139 0 5.013-2.115 5.781-4.735.798.361 1.348 1.204 1.348 2.47 0 3.387-3.907 5.232-7.22 5.232-4.885 0-8.077-3.207-8.077-8.424 0-6.392 4.223-10.487 9.9-10.487 3.808 0 5.69 1.671 6.97 3.914l2.108-1.475C21.44 2.078 18.331 0 13.663 0 6.227 0 1.168 5.277 1.168 12.934c0 7 4.953 11.066 10.856 11.066 4.878 0 9.809-2.846 9.809-7.716 0-2.545-1.46-4.231-3.569-5.187m-6.33 4.855c-1.077 0-2.026-.512-2.026-1.453 0-1.483 1.822-1.934 3.606-1.934.678 0 1.34.045 1.927.173-.422 1.927-1.671 3.215-3.508 3.214Z",
15
+ pinterest: "M12.017 0C5.396 0 .029 5.367.029 11.987c0 5.079 3.158 9.417 7.618 11.162-.105-.949-.199-2.403.041-3.439.219-.937 1.406-5.957 1.406-5.957s-.359-.72-.359-1.781c0-1.663.967-2.911 2.168-2.911 1.024 0 1.518.769 1.518 1.688 0 1.029-.653 2.567-.992 3.992-.285 1.193.6 2.165 1.775 2.165 2.128 0 3.768-2.245 3.768-5.487 0-2.861-2.063-4.869-5.008-4.869-3.41 0-5.409 2.562-5.409 5.199 0 1.033.394 2.143.889 2.741.099.12.112.225.085.345-.09.375-.293 1.199-.334 1.363-.053.225-.172.271-.401.165-1.495-.69-2.433-2.878-2.433-4.646 0-3.776 2.748-7.252 7.92-7.252 4.158 0 7.392 2.967 7.392 6.923 0 4.135-2.607 7.462-6.233 7.462-1.214 0-2.354-.629-2.758-1.379l-.749 2.848c-.269 1.045-1.004 2.352-1.498 3.146 1.123.345 2.306.535 3.55.535 6.607 0 11.985-5.365 11.985-11.987C23.97 5.39 18.592.026 11.985.026L12.017 0z",
16
+ telegram: "M11.944 0A12 12 0 0 0 0 12a12 12 0 0 0 12 12 12 12 0 0 0 12-12A12 12 0 0 0 12 0a12 12 0 0 0-.056 0zm4.962 7.224c.1-.002.321.023.465.14a.506.506 0 0 1 .171.325c.016.093.036.306.02.472-.18 1.898-.962 6.502-1.36 8.627-.168.9-.499 1.201-.82 1.23-.696.065-1.225-.46-1.9-.902-1.056-.693-1.653-1.124-2.678-1.8-1.185-.78-.417-1.21.258-1.91.177-.184 3.247-2.977 3.307-3.23.007-.032.014-.15-.056-.212s-.174-.041-.249-.024c-.106.024-1.793 1.14-5.061 3.345-.48.33-.913.49-1.302.48-.428-.008-1.252-.241-1.865-.44-.752-.245-1.349-.374-1.297-.789.027-.216.325-.437.893-.663 3.498-1.524 5.83-2.529 6.998-3.014 3.332-1.386 4.025-1.627 4.476-1.635z",
17
+ messenger: "M12 0C5.24 0 0 4.952 0 11.64c0 3.499 1.434 6.521 3.769 8.61a.96.96 0 0 1 .323.683l.065 2.135a.96.96 0 0 0 1.347.85l2.381-1.053a.96.96 0 0 1 .641-.046A13 13 0 0 0 12 23.28c6.76 0 12-4.952 12-11.64S18.76 0 12 0m6.806 7.44c.522-.03.971.567.63 1.094l-4.178 6.457a.707.707 0 0 1-.977.208l-3.87-2.504a.44.44 0 0 0-.49.007l-4.363 3.01c-.637.438-1.415-.317-.995-.966l4.179-6.457a.706.706 0 0 1 .977-.21l3.87 2.505c.15.097.344.094.491-.007l4.362-3.008a.7.7 0 0 1 .364-.13",
18
+ linkedin: "M4 3h16a1 1 0 0 1 1 1v16a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1Zm3 7v8h2.5v-8H7Zm1.25-1.25a1.4 1.4 0 1 0 0-2.8 1.4 1.4 0 0 0 0 2.8ZM11 10v8h2.5v-4.2c0-1.1.7-1.8 1.6-1.8.9 0 1.4.7 1.4 1.8V18H19v-4.8c0-2.2-1.2-3.4-3-3.4-1.1 0-1.9.5-2.5 1.2V10H11Z",
19
+ email: "M3 5h18a1 1 0 0 1 1 1v12a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V6a1 1 0 0 1 1-1Zm1 2.4V17h16V7.4l-8 5.3-8-5.3ZM5.8 7 12 11.1 18.2 7H5.8Z",
20
+ website: "M12 2a10 10 0 1 1 0 20 10 10 0 0 1 0-20Zm-1.6 2.2A8 8 0 0 0 4.06 11h3.98c.13-2.5.95-4.98 2.36-6.8Zm3.2 0c1.41 1.82 2.23 4.3 2.36 6.8h3.98a8 8 0 0 0-6.34-6.8ZM12 4.6c-1.3 1.6-2.1 3.9-2.24 6.4h4.48C14.1 8.5 13.3 6.2 12 4.6ZM4.06 13a8 8 0 0 0 6.34 6.8c-1.41-1.82-2.23-4.3-2.36-6.8H4.06Zm5.7 0c.14 2.5.94 4.8 2.24 6.4 1.3-1.6 2.1-3.9 2.24-6.4H9.76Zm6.2 0c-.13 2.5-.95 4.98-2.36 6.8a8 8 0 0 0 6.34-6.8h-3.98Z",
21
+ };
@@ -0,0 +1,3 @@
1
+ import type { TemplateProps } from "./types.js";
2
+ /** Template dựng bằng khối (theme `"editing": "blocks"`): bản sửa trong Trình dựng, không có thì `templates/{tên}.json` của theme. */
3
+ export default function BlockTemplate({ data, site, template }: TemplateProps): Promise<import("react").JSX.Element | null>;
@@ -0,0 +1,11 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { getTemplates } from "./api.js";
3
+ import { contentContext } from "./content.js";
4
+ import { renderContent } from "./rich.js";
5
+ /** Template dựng bằng khối (theme `"editing": "blocks"`): bản sửa trong Trình dựng, không có thì `templates/{tên}.json` của theme. */
6
+ export default async function BlockTemplate({ data, site, template }) {
7
+ const doc = (await getTemplates()).templates[template];
8
+ if (!doc)
9
+ return null;
10
+ return _jsx("div", { className: `ecx-template ecx-template-${template} ecx-content`, children: await renderContent(doc, await contentContext(site, data.post, data)) });
11
+ }