@ecomcx/ecomweb-editor 1.19.0 → 1.21.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/README.md +15 -0
- package/package.json +3 -3
- package/src/i18n/index.ts +74 -0
- package/src/index.ts +3 -1
- package/src/legacy/basic.tsx +8 -30
- package/src/legacy/dynamic.tsx +7 -35
- package/src/locales/en/attrs.ts +72 -0
- package/src/locales/en/bindings.ts +26 -0
- package/src/locales/en/block-desc.ts +53 -0
- package/src/locales/en/block-titles.ts +43 -0
- package/src/locales/en/blocks.ts +39 -0
- package/src/locales/en/controls.ts +18 -0
- package/src/locales/en/hints.ts +142 -0
- package/src/locales/en/index.ts +20 -0
- package/src/locales/en/layout.ts +37 -0
- package/src/locales/en/legacy-basic.ts +54 -0
- package/src/locales/en/legacy-dynamic.ts +73 -0
- package/src/locales/en/legacy.ts +67 -0
- package/src/locales/en/motion.ts +33 -0
- package/src/locales/en/pattern-lib.ts +151 -0
- package/src/locales/en/patterns.ts +45 -0
- package/src/locales/en/shortcuts.ts +19 -0
- package/src/locales/en/v2.ts +177 -0
- package/src/locales/vi/attrs.ts +72 -0
- package/src/locales/vi/bindings.ts +26 -0
- package/src/locales/vi/block-desc.ts +53 -0
- package/src/locales/vi/block-titles.ts +43 -0
- package/src/locales/vi/blocks.ts +39 -0
- package/src/locales/vi/controls.ts +18 -0
- package/src/locales/vi/hints.ts +142 -0
- package/src/locales/vi/index.ts +24 -0
- package/src/locales/vi/layout.ts +37 -0
- package/src/locales/vi/legacy-basic.ts +54 -0
- package/src/locales/vi/legacy-dynamic.ts +73 -0
- package/src/locales/vi/legacy.ts +67 -0
- package/src/locales/vi/motion.ts +33 -0
- package/src/locales/vi/pattern-lib.ts +151 -0
- package/src/locales/vi/patterns.ts +45 -0
- package/src/locales/vi/shortcuts.ts +19 -0
- package/src/locales/vi/v2.ts +177 -0
- package/src/shared/animation-store.ts +38 -0
- package/src/shared/labels.ts +11 -134
- package/src/shared/patterns-kit.ts +7 -0
- package/src/shared/patterns-library.ts +152 -0
- package/src/shared/patterns.ts +6 -32
- package/src/v2/blocks/index.ts +5 -11
- package/src/v2/blocks/inline-style.ts +30 -0
- package/src/v2/blocks/layout.tsx +19 -14
- package/src/v2/blocks/media.tsx +22 -18
- package/src/v2/blocks/text.tsx +2 -1
- package/src/v2/blocks/theme.tsx +22 -19
- package/src/v2/canvas/canvas.tsx +9 -1
- package/src/v2/core/bindings.ts +9 -8
- package/src/v2/editor.css +15 -1
- package/src/v2/editor.tsx +7 -4
- package/src/v2/i18n.ts +14 -0
- package/src/v2/index.ts +3 -1
- package/src/v2/labels.ts +11 -340
- package/src/v2/ui/attr-form.tsx +14 -29
- package/src/v2/ui/attr-hints.ts +84 -54
- package/src/v2/ui/bindings.tsx +10 -12
- package/src/v2/ui/block-descriptions.ts +6 -33
- package/src/v2/ui/inserter.tsx +2 -2
- package/src/v2/ui/inspector.tsx +7 -5
- package/src/v2/ui/layout-panel.tsx +3 -14
- package/src/v2/ui/motion-panel.tsx +99 -0
- package/src/v2/ui/options.tsx +6 -13
- package/src/v2/ui/style-controls.tsx +7 -6
- package/src/v2/ui/style-tab.tsx +9 -4
- package/src/v2/ui/toolbar.tsx +10 -5
- package/src/v2/ui/unit-controls.tsx +6 -5
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/** Kho hiệu ứng chuyển động do plugin thêm (registerAnimation) — không phụ thuộc trình soạn: bản 1.x và v2 cùng đọc. */
|
|
2
|
+
|
|
3
|
+
export interface MotionEffect {
|
|
4
|
+
/** Mã hiệu ứng `[a-z][a-z0-9-]{0,39}` (nên có tiền tố plugin: "acme-bounce"). Lưu vào `style.motion.in`; website dùng `@keyframes ecx-in-<mã>`. */
|
|
5
|
+
id: string;
|
|
6
|
+
/** Nhãn hiện ở bảng Chuyển động (nhận "%khoá%" — admin dịch theo plugin). */
|
|
7
|
+
label: string;
|
|
8
|
+
/** Nhóm trong danh sách chọn (vd "Nảy", "Chữ"); không có = "Plugin". */
|
|
9
|
+
group?: string;
|
|
10
|
+
/**
|
|
11
|
+
* CSS chứa `@keyframes ecx-in-<mã>` để xem trước trong trình soạn. Website không đọc cái này — plugin nạp CSS cho website
|
|
12
|
+
* riêng (slot "head"); dùng chung một chuỗi cho cả hai là đơn giản nhất.
|
|
13
|
+
*/
|
|
14
|
+
css?: string;
|
|
15
|
+
/** Thứ tự (nhỏ đứng trước, mặc định 10). */
|
|
16
|
+
order?: number;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const ID = /^[a-z][a-z0-9-]{0,39}$/;
|
|
20
|
+
/** Mã của hiệu ứng lõi (@ecomcx/ecomweb-content `MOTION_IN`): plugin không được trùng. */
|
|
21
|
+
const CORE = new Set(["fade", "slide-up", "slide-down", "slide-left", "slide-right", "zoom-in", "zoom-out", "blur-in", "none"]);
|
|
22
|
+
|
|
23
|
+
const effects = new Map<string, MotionEffect>();
|
|
24
|
+
const listeners = new Set<() => void>();
|
|
25
|
+
let snapshot: MotionEffect[] = [];
|
|
26
|
+
const changed = () => { snapshot = [...effects.values()].sort((a, b) => (a.order ?? 10) - (b.order ?? 10)); listeners.forEach((l) => l()); };
|
|
27
|
+
|
|
28
|
+
/** Thêm hiệu ứng vào danh sách chọn của mọi khối. Mã sai dạng / trùng hiệu ứng lõi bị bỏ qua (có cảnh báo). */
|
|
29
|
+
export function storeAnimation(effect: MotionEffect) {
|
|
30
|
+
if (!ID.test(effect.id) || CORE.has(effect.id)) { console.warn(`[ecomweb-editor] registerAnimation: mã "${effect.id}" không hợp lệ hoặc trùng hiệu ứng lõi`); return; }
|
|
31
|
+
effects.set(effect.id, effect);
|
|
32
|
+
changed();
|
|
33
|
+
}
|
|
34
|
+
export function dropAnimation(id: string) { if (effects.delete(id)) changed(); }
|
|
35
|
+
|
|
36
|
+
/** Hiệu ứng của plugin (đã sắp thứ tự); tham chiếu đổi khi danh sách đổi → dùng được với useSyncExternalStore. */
|
|
37
|
+
export const pluginAnimations = () => snapshot;
|
|
38
|
+
export function onAnimationsChange(l: () => void) { listeners.add(l); return () => { listeners.delete(l); }; }
|
package/src/shared/labels.ts
CHANGED
|
@@ -1,135 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
heading: "Tiêu đề", taskList: "Danh sách việc", columnsBlock: "Bộ cột", column: "Cột",
|
|
4
|
-
inspectorEmpty: "Chọn một khối trong bài để xem cài đặt của nó.", noSettings: "Khối này không có cài đặt riêng.", blockActions: "Thao tác",
|
|
5
|
-
textAlign: "Căn chữ", alignJustify: "Căn đều", headingLevel: "Cấp tiêu đề", showPdf: "Hiện PDF ngay trong trang", allowDownload: "Cho tải xuống",
|
|
6
|
-
startAt: "Bắt đầu từ giây", codeLanguage: "Ngôn ngữ (vd js, php)", listStart: "Bắt đầu từ số",
|
|
7
|
-
inserter: "Thêm khối", searchBlocks: "Tìm khối…", noBlocks: "Không có khối phù hợp", dragToInsert: "Bấm để chèn dưới khối đang chọn, hoặc kéo vào bài",
|
|
8
|
-
groupText: "Văn bản", groupMedia: "Media", groupDesign: "Bố cục", groupEmbed: "Nhúng", groupWidgets: "Tiện ích", groupTheme: "Giao diện", groupPlugin: "Plugin",
|
|
9
|
-
outline: "Cấu trúc", outlineEmpty: "Bài chưa có khối nào", outlineHint: "Bấm để chọn khối, kéo để đổi chỗ",
|
|
10
|
-
columns2: "2 cột", columns3: "3 cột", columnsHint: "Chia nội dung thành cột", group: "Nhóm", groupHint: "Khung bao nhiều khối (nền, khoảng đệm)",
|
|
11
|
-
callout: "Hộp lưu ý", calloutHint: "Thông tin, cảnh báo…", button: "Nút", buttonHint: "Nút liên kết", buttonEmpty: "Nút", buttonText: "Chữ trên nút", buttonUrl: "Liên kết",
|
|
12
|
-
embed: "Nhúng", embedHint: "YouTube, Vimeo, Spotify, TikTok, X…", embedUrl: "Đường dẫn (YouTube, Vimeo, Spotify, TikTok, X, Instagram…)",
|
|
13
|
-
embedUnsupported: "Không nhúng được — website hiện thành liên kết", edit: "Sửa", blockSettings: "Cài đặt khối", layout: "Bố cục",
|
|
14
|
-
addColumn: "+ cột", removeColumn: "− cột", vAlign: "Căn dọc", vTop: "Trên", vCenter: "Giữa", vBottom: "Dưới", stack: "Xếp dọc trên điện thoại",
|
|
15
|
-
background: "Nền", textColor: "Chữ", noColor: "Bỏ màu", padding: "Khoảng đệm", padNone: "Không", padSmall: "Nhỏ", padMedium: "Vừa", padLarge: "Lớn",
|
|
16
|
-
tone: "Kiểu", toneInfo: "Thông tin", toneSuccess: "Thành công", toneWarning: "Cảnh báo", toneDanger: "Nguy hiểm", calloutTitle: "Tiêu đề hộp",
|
|
17
|
-
variant: "Kiểu nút", variantPrimary: "Chính", variantSecondary: "Phụ", variantOutline: "Viền",
|
|
18
|
-
blockToolbar: "Thanh công cụ khối", transformTo: "đổi loại khối", moreOptions: "Tuỳ chọn khác", insertBefore: "Thêm khối phía trên",
|
|
19
|
-
listIndent: "Thụt lề danh sách", indent: "Thụt vào", outdent: "Thụt ra", formatting: "Định dạng chữ", headerRow: "Hàng tiêu đề",
|
|
20
|
-
blockVariant: "Biến thể", variant_default: "Mặc định", variant_stripes: "Sọc", variant_rounded: "Bo góc", variant_circle: "Tròn", variant_plain: "Trơn",
|
|
21
|
-
variant_dots: "Chấm", variant_wide: "Đậm", variant_pill: "Bo tròn", variant_card: "Thẻ", advanced: "Nâng cao", anchor: "Neo HTML", anchorHint: "Liên kết tới khối bằng #neo (chữ, số, gạch ngang)",
|
|
22
|
-
cssClass: "Class CSS riêng", cssClassHint: "Tối đa 5 class, cách nhau bởi dấu cách",
|
|
23
|
-
settingsTab: "Cài đặt", styleTab: "Kiểu dáng", device: "Khổ màn hình", device_base: "Máy tính", device_tablet: "Máy tính bảng", device_mobile: "Điện thoại",
|
|
24
|
-
inherited: "Đang dùng", default: "Mặc định", custom: "tuỳ chỉnh", customColor: "màu tuỳ chỉnh", resetAll: "Đặt lại tất cả", none: "Không",
|
|
25
|
-
linkSides: "Một giá trị cho cả 4 cạnh", unlinkSides: "Chỉnh từng cạnh", side_top: "Trên", side_right: "Phải", side_bottom: "Dưới", side_left: "Trái",
|
|
26
|
-
resizeColumns: "Kéo để đổi độ rộng cột", dragPadding: "Kéo để đổi khoảng đệm",
|
|
27
|
-
style_typography: "Kiểu chữ", style_fontFamily: "Phông chữ", style_fontSize: "Cỡ chữ", style_appearance: "Giao diện", style_lineHeight: "Giãn dòng",
|
|
28
|
-
style_letterSpacing: "Giãn cách ký tự", style_decoration: "Trang trí", style_transform: "Viết hoa chữ cái", style_textAlign: "Căn chữ",
|
|
29
|
-
style_color: "Màu", style_text: "Chữ", style_background: "Nền", style_spacing: "Kích thước & khoảng cách", style_padding: "Khoảng đệm (padding)",
|
|
30
|
-
style_margin: "Lề ngoài (margin)", style_gap: "Khoảng cách giữa khối con", style_width: "Chiều rộng", style_maxWidth: "Rộng tối đa", style_minHeight: "Cao tối thiểu",
|
|
31
|
-
style_border: "Viền & bo góc", style_borderWidth: "Độ dày viền", style_borderStyle: "Kiểu viền", style_borderColor: "Màu viền", style_radius: "Bo góc",
|
|
32
|
-
style_visibility: "Hiển thị", style_hide: "Ẩn theo khổ màn hình", hide_desktop: "Ẩn trên máy tính", hide_tablet: "Ẩn trên máy tính bảng", hide_mobile: "Ẩn trên điện thoại",
|
|
33
|
-
font_body: "Chữ thân bài", font_heading: "Chữ tiêu đề", font_mono: "Chữ đều (mono)", italicSuffix: "nghiêng",
|
|
34
|
-
weight_300: "Mảnh", weight_400: "Thường", weight_500: "Vừa", weight_600: "Đậm vừa", weight_700: "Đậm", weight_800: "Rất đậm", weight_900: "Đen",
|
|
35
|
-
underlineText: "Gạch chân", strikeText: "Gạch ngang", upper: "VIẾT HOA", lower: "viết thường", capitalize: "Viết Hoa Đầu Từ",
|
|
36
|
-
border_solid: "Liền", border_dashed: "Gạch", border_dotted: "Chấm",
|
|
37
|
-
preformattedBlock: "Văn bản định dạng sẵn", tableHint: "Chọn số cột × số hàng", tableCols: "Số cột", tableRows: "Số hàng", footerRow: "Hàng chân bảng", fixedLayout: "Cố định độ rộng cột", tabBlocks: "Khối", tabPatterns: "Mẫu", noPatterns: "Không có mẫu phù hợp", cat_mine: "Mẫu của tôi", syncedPattern: "Mẫu đồng bộ", syncedBadge: "Đồng bộ", syncedLoading: "Đang tải mẫu…", syncedMissing: "Mẫu không còn (đã xoá hoặc chưa xuất bản)", syncedEdit: "Sửa mẫu gốc", syncedDetach: "Tách ra", createPattern: "Tạo mẫu", cat_hero: "Ảnh bìa & giới thiệu", cat_features: "Tính năng", cat_cta: "Kêu gọi hành động",
|
|
38
|
-
cat_pricing: "Bảng giá", cat_testimonials: "Cảm nhận", cat_faq: "Hỏi đáp", cat_team: "Đội ngũ", cat_contact: "Liên hệ", cat_text: "Nội dung", cat_gallery: "Thư viện ảnh", cat_header: "Đầu trang", cat_footer: "Chân trang",
|
|
39
|
-
stats: "Thống kê nội dung", words: "{n} từ", chars: "{n} ký tự", readingTime: "~{n} phút đọc",
|
|
40
|
-
editorLabel: "Nội dung bài viết", apply: "Áp dụng", insert: "Chèn", cancel: "Huỷ", removeLink: "Gỡ liên kết", linkNewTab: "Mở trong tab mới",
|
|
41
|
-
blockOptions: "Tuỳ chọn khối (kéo để di chuyển)", addBelow: "Thêm khối bên dưới", moveUp: "Lên trên", moveDown: "Xuống dưới",
|
|
42
|
-
duplicate: "Nhân bản", deleteBlock: "Xoá khối", selectParent: "Chọn khối cha",
|
|
43
|
-
placeholder: "Gõ “/” để chèn ảnh, bảng, tiêu đề… hoặc bắt đầu viết",
|
|
44
|
-
unknownBlock: "Khối không xác định", unknownBlockHint: "— plugin tạo khối này chưa bật; dữ liệu được giữ nguyên",
|
|
45
|
-
headingPlaceholder: "Tiêu đề",
|
|
46
|
-
undo: "Hoàn tác (⌘Z)", redo: "Làm lại (⌘⇧Z)",
|
|
47
|
-
paragraph: "Đoạn văn", paragraphHint: "Văn bản thường",
|
|
48
|
-
h2: "Tiêu đề lớn", h3: "Tiêu đề vừa", h4: "Tiêu đề nhỏ",
|
|
49
|
-
bulletList: "Danh sách", bulletListHint: "Gạch đầu dòng", orderedList: "Danh sách số",
|
|
50
|
-
quote: "Trích dẫn", codeBlock: "Khối mã",
|
|
51
|
-
image: "Ảnh", imageHint: "Từ thư viện media", gallery: "Bộ sưu tập ảnh", galleryHint: "Nhiều ảnh dạng lưới",
|
|
52
|
-
video: "Video", videoHint: "Tải lên hoặc từ thư viện", audio: "Âm thanh", audioHint: "MP3, WAV",
|
|
53
|
-
file: "Tệp tải xuống", fileHint: "PDF, Word, Excel…",
|
|
54
|
-
table: "Bảng", youtube: "Video YouTube", youtubeHint: "Dán link", youtubePrompt: "Link YouTube",
|
|
55
|
-
hr: "Đường kẻ", hrHint: "Phân cách", shortcode: "Shortcode", shortcodePrompt: "Tên shortcode (vd: contact-form)",
|
|
56
|
-
imageUrlPrompt: "Địa chỉ (URL)",
|
|
57
|
-
bold: "Đậm (⌘B)", italic: "Nghiêng (⌘I)", underline: "Gạch chân (⌘U)", strike: "Gạch ngang", code: "Mã", link: "Liên kết (⌘K)",
|
|
58
|
-
linkPrompt: "Địa chỉ liên kết",
|
|
59
|
-
alignLeft: "Căn trái", alignCenter: "Căn giữa", alignRight: "Căn phải",
|
|
60
|
-
insertImage: "Chèn ảnh", insertTable: "Chèn bảng", insertVideo: "Chèn video YouTube",
|
|
61
|
-
addRow: "+ hàng", addCol: "+ cột", delRow: "− hàng", delCol: "− cột", delTable: "Xoá bảng",
|
|
62
|
-
slashHint: "Gõ / để chèn nhanh", noCommand: "Không có lệnh phù hợp",
|
|
63
|
-
size: "Cỡ ảnh", sizeMedium: "Vừa (300px)", sizeMediumLarge: "Lớn vừa (768px)", sizeLarge: "Lớn (1024px)", sizeFull: "Gốc",
|
|
64
|
-
floatLeft: "Căn trái (chữ bao quanh)", floatRight: "Căn phải (chữ bao quanh)", center: "Giữa", wide: "Rộng / tràn khung",
|
|
65
|
-
alt: "Alt", altPrompt: "Mô tả ảnh (alt) cho người khiếm thị và SEO", caption: "Chú thích", captionPrompt: "Chú thích hiển thị dưới ảnh",
|
|
66
|
-
replace: "Thay ảnh", resetSize: "Cỡ gốc", columns: "Số cột:", galleryLabel: "Bộ sưu tập · {n} ảnh", videoLabel: "Video", audioLabel: "Âm thanh", fileLabel: "Tệp",
|
|
67
|
-
};
|
|
68
|
-
export type EditorLabels = typeof viLabels;
|
|
1
|
+
import { messages } from "../i18n";
|
|
2
|
+
import type { vi } from "../locales/vi";
|
|
69
3
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
callout: "Callout", calloutHint: "Info, warning…", button: "Button", buttonHint: "Link button", buttonEmpty: "Button", buttonText: "Button text", buttonUrl: "Link",
|
|
80
|
-
embed: "Embed", embedHint: "YouTube, Vimeo, Spotify, TikTok, X…", embedUrl: "URL (YouTube, Vimeo, Spotify, TikTok, X, Instagram…)",
|
|
81
|
-
embedUnsupported: "Cannot embed — shown as a link on the website", edit: "Edit", blockSettings: "Block settings", layout: "Layout",
|
|
82
|
-
addColumn: "+ column", removeColumn: "− column", vAlign: "Vertical align", vTop: "Top", vCenter: "Middle", vBottom: "Bottom", stack: "Stack on mobile",
|
|
83
|
-
background: "Background", textColor: "Text", noColor: "Clear", padding: "Padding", padNone: "None", padSmall: "Small", padMedium: "Medium", padLarge: "Large",
|
|
84
|
-
tone: "Style", toneInfo: "Info", toneSuccess: "Success", toneWarning: "Warning", toneDanger: "Danger", calloutTitle: "Callout title",
|
|
85
|
-
variant: "Button style", variantPrimary: "Primary", variantSecondary: "Secondary", variantOutline: "Outline",
|
|
86
|
-
blockToolbar: "Block toolbar", transformTo: "change block type", moreOptions: "More options", insertBefore: "Add block above",
|
|
87
|
-
listIndent: "List indentation", indent: "Indent", outdent: "Outdent", formatting: "Formatting", headerRow: "Header row",
|
|
88
|
-
blockVariant: "Variant", variant_default: "Default", variant_stripes: "Stripes", variant_rounded: "Rounded", variant_circle: "Circle", variant_plain: "Plain",
|
|
89
|
-
variant_dots: "Dots", variant_wide: "Wide", variant_pill: "Pill", variant_card: "Card", advanced: "Advanced", anchor: "HTML anchor", anchorHint: "Link to this block with #anchor (letters, digits, hyphens)",
|
|
90
|
-
cssClass: "Additional CSS class", cssClassHint: "Up to 5 classes, separated by spaces",
|
|
91
|
-
settingsTab: "Settings", styleTab: "Styles", device: "Device", device_base: "Desktop", device_tablet: "Tablet", device_mobile: "Mobile",
|
|
92
|
-
inherited: "Using", default: "Default", custom: "custom", customColor: "custom color", resetAll: "Reset all", none: "None",
|
|
93
|
-
linkSides: "One value for all 4 sides", unlinkSides: "Edit each side", side_top: "Top", side_right: "Right", side_bottom: "Bottom", side_left: "Left",
|
|
94
|
-
resizeColumns: "Drag to resize columns", dragPadding: "Drag to change padding",
|
|
95
|
-
style_typography: "Typography", style_fontFamily: "Font", style_fontSize: "Font size", style_appearance: "Appearance", style_lineHeight: "Line height",
|
|
96
|
-
style_letterSpacing: "Letter spacing", style_decoration: "Decoration", style_transform: "Letter case", style_textAlign: "Text align",
|
|
97
|
-
style_color: "Color", style_text: "Text", style_background: "Background", style_spacing: "Dimensions & spacing", style_padding: "Padding",
|
|
98
|
-
style_margin: "Margin", style_gap: "Block spacing", style_width: "Width", style_maxWidth: "Max width", style_minHeight: "Min height",
|
|
99
|
-
style_border: "Border & radius", style_borderWidth: "Border width", style_borderStyle: "Border style", style_borderColor: "Border color", style_radius: "Radius",
|
|
100
|
-
style_visibility: "Visibility", style_hide: "Hide per device", hide_desktop: "Hide on desktop", hide_tablet: "Hide on tablet", hide_mobile: "Hide on mobile",
|
|
101
|
-
font_body: "Body font", font_heading: "Heading font", font_mono: "Monospace", italicSuffix: "italic",
|
|
102
|
-
weight_300: "Light", weight_400: "Regular", weight_500: "Medium", weight_600: "Semibold", weight_700: "Bold", weight_800: "Extra bold", weight_900: "Black",
|
|
103
|
-
underlineText: "Underline", strikeText: "Strikethrough", upper: "UPPERCASE", lower: "lowercase", capitalize: "Capitalize",
|
|
104
|
-
border_solid: "Solid", border_dashed: "Dashed", border_dotted: "Dotted",
|
|
105
|
-
preformattedBlock: "Preformatted", tableHint: "Choose columns × rows", tableCols: "Columns", tableRows: "Rows", footerRow: "Footer row", fixedLayout: "Fixed column widths", tabBlocks: "Blocks", tabPatterns: "Patterns", noPatterns: "No matching patterns", cat_mine: "My patterns", syncedPattern: "Synced pattern", syncedBadge: "Synced", syncedLoading: "Loading pattern…", syncedMissing: "Pattern not available (deleted or unpublished)", syncedEdit: "Edit original", syncedDetach: "Detach", createPattern: "Create pattern", cat_hero: "Hero", cat_features: "Features", cat_cta: "Call to action",
|
|
106
|
-
cat_pricing: "Pricing", cat_testimonials: "Testimonials", cat_faq: "FAQ", cat_team: "Team", cat_contact: "Contact", cat_text: "Text", cat_gallery: "Gallery", cat_header: "Header", cat_footer: "Footer",
|
|
107
|
-
stats: "Content statistics", words: "{n} words", chars: "{n} characters", readingTime: "~{n} min read",
|
|
108
|
-
editorLabel: "Post content", apply: "Apply", insert: "Insert", cancel: "Cancel", removeLink: "Remove link", linkNewTab: "Open in new tab",
|
|
109
|
-
blockOptions: "Block options (drag to move)", addBelow: "Add block below", moveUp: "Move up", moveDown: "Move down",
|
|
110
|
-
duplicate: "Duplicate", deleteBlock: "Delete block", selectParent: "Select parent block",
|
|
111
|
-
placeholder: "Type “/” to insert images, tables, headings… or start writing",
|
|
112
|
-
unknownBlock: "Unknown block", unknownBlockHint: "— the plugin that made this block is not active; its data is kept",
|
|
113
|
-
headingPlaceholder: "Heading",
|
|
114
|
-
undo: "Undo (⌘Z)", redo: "Redo (⌘⇧Z)",
|
|
115
|
-
paragraph: "Paragraph", paragraphHint: "Plain text",
|
|
116
|
-
h2: "Large heading", h3: "Medium heading", h4: "Small heading",
|
|
117
|
-
bulletList: "Bulleted list", bulletListHint: "Bullets", orderedList: "Numbered list",
|
|
118
|
-
quote: "Quote", codeBlock: "Code block",
|
|
119
|
-
image: "Image", imageHint: "From media library", gallery: "Gallery", galleryHint: "Grid of images",
|
|
120
|
-
video: "Video", videoHint: "Upload or from library", audio: "Audio", audioHint: "MP3, WAV",
|
|
121
|
-
file: "Download file", fileHint: "PDF, Word, Excel…",
|
|
122
|
-
table: "Table", youtube: "YouTube video", youtubeHint: "Paste a link", youtubePrompt: "YouTube link",
|
|
123
|
-
hr: "Divider", hrHint: "Separator", shortcode: "Shortcode", shortcodePrompt: "Shortcode name (e.g. contact-form)",
|
|
124
|
-
imageUrlPrompt: "URL",
|
|
125
|
-
bold: "Bold (⌘B)", italic: "Italic (⌘I)", underline: "Underline (⌘U)", strike: "Strikethrough", code: "Code", link: "Link (⌘K)",
|
|
126
|
-
linkPrompt: "Link URL",
|
|
127
|
-
alignLeft: "Align left", alignCenter: "Align center", alignRight: "Align right",
|
|
128
|
-
insertImage: "Insert image", insertTable: "Insert table", insertVideo: "Insert YouTube video",
|
|
129
|
-
addRow: "+ row", addCol: "+ column", delRow: "− row", delCol: "− column", delTable: "Delete table",
|
|
130
|
-
slashHint: "Type / for quick insert", noCommand: "No matching command",
|
|
131
|
-
size: "Image size", sizeMedium: "Medium (300px)", sizeMediumLarge: "Medium large (768px)", sizeLarge: "Large (1024px)", sizeFull: "Full",
|
|
132
|
-
floatLeft: "Float left", floatRight: "Float right", center: "Center", wide: "Wide",
|
|
133
|
-
alt: "Alt", altPrompt: "Image description (alt) for screen readers and SEO", caption: "Caption", captionPrompt: "Caption shown under the image",
|
|
134
|
-
replace: "Replace", resetSize: "Original size", columns: "Columns:", galleryLabel: "Gallery · {n} images", videoLabel: "Video", audioLabel: "Audio", fileLabel: "File",
|
|
135
|
-
};
|
|
4
|
+
/** Chữ giao diện của trình soạn 1.x và bảng Kiểu dáng dùng chung (nhóm "legacy" trong src/locales). */
|
|
5
|
+
export type EditorLabels = (typeof vi)["legacy"];
|
|
6
|
+
|
|
7
|
+
/** Chữ của một ngôn ngữ (khoá thiếu rơi về ngôn ngữ gốc rồi tiếng Anh). */
|
|
8
|
+
export const labelsLegacy = (lang?: string | null): EditorLabels => messages("legacy", lang) as EditorLabels;
|
|
9
|
+
|
|
10
|
+
/** Giữ tên cũ cho ứng dụng đang dùng: `labels={enLabels}`. */
|
|
11
|
+
export const viLabels = labelsLegacy("vi");
|
|
12
|
+
export const enLabels = labelsLegacy("en");
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/** Hàm dựng khối dùng chung cho mẫu của lõi (patterns.ts, patterns-library.ts). */
|
|
2
|
+
export const text = (s: string, marks?: Array<{ type: string }>) => (marks ? { type: "text", text: s, marks } : { type: "text", text: s });
|
|
3
|
+
export const p = (s: string, attrs?: Record<string, unknown>) => ({ type: "paragraph", ...(attrs ? { attrs } : {}), content: [text(s)] });
|
|
4
|
+
export const h = (level: number, s: string, attrs: Record<string, unknown> = {}) => ({ type: "heading", attrs: { level, ...attrs }, content: [text(s)] });
|
|
5
|
+
export const btn = (s: string, variant = "primary") => ({ type: "button", attrs: { text: s, href: "#", variant } });
|
|
6
|
+
export const buttons = (align: string, ...list: object[]) => ({ type: "buttons", attrs: { align }, content: list });
|
|
7
|
+
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
import { msgs } from "../i18n";
|
|
2
|
+
import type { Pattern } from "./patterns";
|
|
3
|
+
import { btn, buttons, h, p, text } from "./patterns-kit";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Thư viện mẫu section của lõi (ngoài 8 mẫu cơ bản trong patterns.ts): hero, tính năng, số liệu, quy trình, bảng giá, cảm nhận,
|
|
7
|
+
* hỏi đáp, kêu gọi, đội ngũ, đối tác, liên hệ, nội dung, chân trang. Chỉ dùng khối và kiểu dáng của @ecomcx/ecomweb-content nên
|
|
8
|
+
* mọi theme hiển thị được; người soạn chèn một cú bấm rồi chỉ sửa chữ. Hiệu ứng chuyển động (1.16) có sẵn ở các mẫu hợp lý.
|
|
9
|
+
*/
|
|
10
|
+
type L = Record<string, string>;
|
|
11
|
+
|
|
12
|
+
// ---------------------------------------------------------------------------
|
|
13
|
+
// Khối dựng sẵn dùng lại
|
|
14
|
+
// ---------------------------------------------------------------------------
|
|
15
|
+
type Node = Record<string, unknown>;
|
|
16
|
+
const GRADIENT = "linear-gradient(135deg, #2563eb 0%, #7c3aed 100%)";
|
|
17
|
+
const WHITE_BTN = (s: string) => ({ type: "button", attrs: { text: s, href: "#", variant: "primary", style: { color: { background: "#ffffff", text: "#1e3a8a" } } } });
|
|
18
|
+
const GHOST_BTN = (s: string) => ({ type: "button", attrs: { text: s, href: "#", variant: "outline", style: { color: { text: "#ffffff" }, border: { color: "#ffffff" } } } });
|
|
19
|
+
const center = { textAlign: { base: "center" } };
|
|
20
|
+
const section = (content: Node[], style: Record<string, unknown> = {}): Node => ({ type: "group", attrs: { style: { padding: { base: "2xl", mobile: "xl" }, ...style } }, content });
|
|
21
|
+
const grid = (cols: number, content: Node[], style: Record<string, unknown> = {}): Node => ({ type: "group", attrs: { style: { layout: { type: "grid", columns: { base: cols, tablet: Math.min(cols, 2), mobile: 1 } }, gap: "lg", ...style } }, content });
|
|
22
|
+
const card = (content: Node[], style: Record<string, unknown> = {}): Node => ({ type: "group", attrs: { blockStyle: "card", style: { motion: { hover: "lift" }, ...style } }, content });
|
|
23
|
+
const eyebrow = (s: string, c = false): Node => p(s, { style: { textTransform: "uppercase", letterSpacing: "0.1em", fontSize: { base: "sm" }, fontWeight: "700", color: { text: "primary" }, ...(c ? center : {}) } });
|
|
24
|
+
const muted = (s: string, extra: Record<string, unknown> = {}): Node => p(s, { style: { color: { text: "muted" }, ...extra } });
|
|
25
|
+
const big = (s: string): Node => ({ type: "heading", attrs: { level: 2, style: { fontSize: { base: "3xl" }, ...center } }, content: [text(s)] });
|
|
26
|
+
const link = (s: string, href = "#") => text(s, [{ type: "link", attrs: { href } } as never]);
|
|
27
|
+
const li = (s: string): Node => ({ type: "listItem", content: [p(s)] });
|
|
28
|
+
const img = (alt: string): Node => ({ type: "image", attrs: { src: "", alt } });
|
|
29
|
+
const slideUp = (extra: Record<string, unknown> = {}) => ({ motion: { in: "slide-up", stagger: true }, ...extra });
|
|
30
|
+
const table = (rows: string[][]): Node => ({ type: "table", content: rows.map((r, i) => ({ type: "tableRow", content: r.map((c) => ({ type: i === 0 ? "tableHeader" : "tableCell", content: [p(c)] })) })) });
|
|
31
|
+
|
|
32
|
+
function library(t: L): Pattern[] {
|
|
33
|
+
const feat = (title: string): Node => card([h(3, title), muted(t.fText)], { padding: { base: "lg" } });
|
|
34
|
+
const stat = (n: string, l: string): Node => ({ type: "group", attrs: { style: center }, content: [h(2, n, { style: { fontSize: { base: "4xl" }, color: { text: "primary" } } }), muted(l, center)] });
|
|
35
|
+
const step = (n: number, title: string): Node => card([h(2, String(n), { style: { color: { text: "primary" } } }), h(3, title), muted(t.sText)], { padding: { base: "lg" } });
|
|
36
|
+
const plan = (name: string, price: string, highlight: boolean): Node => card([
|
|
37
|
+
...(highlight ? [eyebrow(t.popular)] : []), h(3, name), h(2, price, { style: { fontSize: { base: "3xl" } } }),
|
|
38
|
+
{ type: "bulletList", content: [1, 2, 3, 4].map((n) => li(`${t.item} ${n}`)) },
|
|
39
|
+
buttons("left", btn(t.choose, highlight ? "primary" : "outline")),
|
|
40
|
+
], { padding: { base: "lg" }, ...(highlight ? { shadow: "lg", border: { width: "2px", style: "solid", color: "primary" } } : {}) });
|
|
41
|
+
const quoteCard = (q: string, who: string): Node => card([{ type: "blockquote", attrs: { citation: who }, content: [p(q)] }], { padding: { base: "lg" } });
|
|
42
|
+
const member = (): Node => card([img(t.member), h(3, t.member), muted(t.role), p(t.bio)], { padding: { base: "lg" }, textAlign: { base: "center" } });
|
|
43
|
+
const info = (label: string, value: string): Node => card([h(3, label), p(value)], { padding: { base: "lg" } });
|
|
44
|
+
const links = (title: string, items: string[]): Node => ({ type: "column", content: [h(4, title), { type: "bulletList", content: items.map((s) => ({ type: "listItem", content: [{ type: "paragraph", content: [link(s)] }] })) }] });
|
|
45
|
+
const m = (id: string, category: string, keywords: string, content: Node[]): Pattern => ({ name: `core/${id}`, category, title: t[id.replace(/-/g, "_")], description: t[`${id.replace(/-/g, "_")}D`], keywords, content });
|
|
46
|
+
|
|
47
|
+
return [
|
|
48
|
+
// ---------------- hero ----------------
|
|
49
|
+
m("hero-split", "hero", "hero banner anh chu split", [
|
|
50
|
+
section([{ type: "mediaText", attrs: { position: "right", width: 45, verticalAlign: "center" }, content: [
|
|
51
|
+
eyebrow(t.eyebrow), h(1, t.title), p(t.sub), buttons("left", btn(t.start), btn(t.demo, "outline"))] }], { motion: { in: "fade" } })]),
|
|
52
|
+
m("hero-gradient", "hero", "hero gradient nen chuyen mau gradient", [
|
|
53
|
+
section([h(1, t.title, { style: { ...center, color: { text: "#ffffff" } } }), p(t.sub, { style: { ...center, color: { text: "#ffffff" } } }), buttons("center", WHITE_BTN(t.start), GHOST_BTN(t.learn))],
|
|
54
|
+
{ gradient: GRADIENT, padding: { base: "3xl", mobile: "2xl" }, radius: "16px", motion: { in: "slide-up" } })]),
|
|
55
|
+
m("hero-minimal", "hero", "hero toi gian minimal", [
|
|
56
|
+
section([eyebrow(t.eyebrow), h(1, t.title, { style: { fontSize: { base: "4xl", mobile: "3xl" } } }), muted(t.sub, { fontSize: { base: "lg" } }), buttons("left", btn(t.start), btn(t.learn, "outline"))],
|
|
57
|
+
{ padding: { base: "3xl", mobile: "2xl" }, maxWidth: { base: "720px" }, motion: { in: "fade" } })]),
|
|
58
|
+
m("hero-bottom", "hero", "hero anh bia cover chu duoi", [
|
|
59
|
+
{ type: "cover", attrs: { overlay: "#000000", opacity: 45, minHeight: "75vh", contentAlign: "bottom" }, content: [
|
|
60
|
+
h(1, t.title), p(t.sub), buttons("left", btn(t.start))] }]),
|
|
61
|
+
m("hero-badge", "hero", "hero nhan badge moi", [
|
|
62
|
+
section([p(`● ${t.badge}`, { style: { ...center, fontWeight: "700", color: { text: "primary" } } }), h(1, t.title, { style: center }), muted(t.sub, center), buttons("center", btn(t.start), btn(t.learn, "outline"))],
|
|
63
|
+
{ padding: { base: "3xl", mobile: "2xl" }, motion: { in: "slide-up" } })]),
|
|
64
|
+
|
|
65
|
+
// ---------------- features ----------------
|
|
66
|
+
m("feat-grid6", "features", "tinh nang luoi features grid 6", [
|
|
67
|
+
section([eyebrow(t.eyebrow, true), big(t.title), { type: "spacer", attrs: { height: "md" } }, grid(3, [t.f1, t.f2, t.f3, t.f4, t.f5, t.f6].map(feat), slideUp())])]),
|
|
68
|
+
m("feat-cards4", "features", "the noi hover card 4", [
|
|
69
|
+
section([big(t.title), { type: "spacer", attrs: { height: "md" } }, grid(4, [t.f1, t.f2, t.f3, t.f4].map(feat), slideUp())])]),
|
|
70
|
+
m("feat-list", "features", "tinh nang danh sach list diem manh", [
|
|
71
|
+
section([{ type: "columns", content: [
|
|
72
|
+
{ type: "column", content: [eyebrow(t.eyebrow), h(2, t.title), muted(t.sub)] },
|
|
73
|
+
{ type: "column", content: [{ type: "bulletList", content: [t.f1, t.f2, t.f3, t.f4, t.f5].map((s) => li(`${s} — ${t.fText}`)) }] }] }])]),
|
|
74
|
+
m("feat-alt", "features", "tinh nang xen ke anh alternating", [
|
|
75
|
+
section([
|
|
76
|
+
{ type: "mediaText", attrs: { position: "left", width: 45, verticalAlign: "center" }, content: [h(2, t.f1), p(t.fText), buttons("left", btn(t.more, "outline"))] },
|
|
77
|
+
{ type: "spacer", attrs: { height: "xl" } },
|
|
78
|
+
{ type: "mediaText", attrs: { position: "right", width: 45, verticalAlign: "center" }, content: [h(2, t.f2), p(t.fText), buttons("left", btn(t.more, "outline"))] }])]),
|
|
79
|
+
|
|
80
|
+
// ---------------- stats / steps ----------------
|
|
81
|
+
m("stats4", "stats", "so lieu con so stats numbers", [
|
|
82
|
+
section([grid(4, [stat(t.n1, t.l1), stat(t.n2, t.l2), stat(t.n3, t.l3), stat(t.n4, t.l4)], { motion: { in: "zoom-in", stagger: true } })])]),
|
|
83
|
+
m("stats-band", "stats", "dai so lieu stats band", [
|
|
84
|
+
section([grid(3, [stat(t.n1, t.l1), stat(t.n2, t.l2), stat(t.n3, t.l3)], { motion: { in: "fade", stagger: true } })], { color: { background: "surface" }, radius: "16px" })]),
|
|
85
|
+
m("steps3", "steps", "quy trinh buoc process steps", [
|
|
86
|
+
section([big(t.title), { type: "spacer", attrs: { height: "md" } }, grid(3, [step(1, t.s1), step(2, t.s2), step(3, t.s3)], slideUp())])]),
|
|
87
|
+
m("steps-v", "steps", "quy trinh doc timeline vertical", [
|
|
88
|
+
section([h(2, t.title), { type: "orderedList", content: [t.s1, t.s2, t.s3, t.s4].map((s) => ({ type: "listItem", content: [{ type: "paragraph", content: [text(s, [{ type: "bold" }])] }, p(t.sText)] })) }], { maxWidth: { base: "720px" } })]),
|
|
89
|
+
|
|
90
|
+
// ---------------- pricing ----------------
|
|
91
|
+
m("price2", "pricing", "bang gia 2 goi pricing", [
|
|
92
|
+
section([big(t.title), { type: "spacer", attrs: { height: "md" } }, grid(2, [plan(t.plan1, "199k", false), plan(t.plan2, `499k${t.perMonth}`, true)], { maxWidth: { base: "860px" }, margin: { base: { left: "auto", right: "auto" } } })])]),
|
|
93
|
+
m("price-table", "pricing", "bang so sanh goi comparison table", [
|
|
94
|
+
section([h(2, t.title, center), table([[t.feature, t.plan1, t.plan2, t.plan3], [`${t.item} 1`, t.yes, t.yes, t.yes], [`${t.item} 2`, t.no, t.yes, t.yes], [`${t.item} 3`, t.no, t.no, t.yes]])])]),
|
|
95
|
+
|
|
96
|
+
// ---------------- testimonials ----------------
|
|
97
|
+
m("test3", "testimonials", "cam nhan khach hang testimonials 3", [
|
|
98
|
+
section([big(t.title), { type: "spacer", attrs: { height: "md" } }, grid(3, [quoteCard(t.quote1, t.who1), quoteCard(t.quote2, t.who2), quoteCard(t.quote3, t.who3)], slideUp())])]),
|
|
99
|
+
m("test-big", "testimonials", "cam nhan lon trich dan quote big", [
|
|
100
|
+
section([{ type: "pullquote", attrs: { citation: t.who1, style: { fontSize: { base: "xl" } } }, content: [text(t.bigQuote)] }], { padding: { base: "2xl" }, motion: { in: "fade" } })]),
|
|
101
|
+
|
|
102
|
+
// ---------------- faq ----------------
|
|
103
|
+
m("faq2", "faq", "hoi dap 2 cot faq", [
|
|
104
|
+
section([{ type: "columns", content: [
|
|
105
|
+
{ type: "column", content: [eyebrow(t.eyebrow), h(2, t.title), muted(t.sub)] },
|
|
106
|
+
{ type: "column", content: [t.q1, t.q2, t.q3].map((q) => ({ type: "details", attrs: { summary: q }, content: [p(t.a)] })) }] }])]),
|
|
107
|
+
m("faq5", "faq", "hoi dap thuong gap faq 5", [
|
|
108
|
+
section([h(2, t.title, center), ...[t.q1, t.q2, t.q3, t.q4, t.q5].map((q) => ({ type: "details", attrs: { summary: q }, content: [p(t.a)] }))], { maxWidth: { base: "760px" } })]),
|
|
109
|
+
|
|
110
|
+
// ---------------- cta ----------------
|
|
111
|
+
m("cta-band", "cta", "keu goi nen mau cta band gradient", [
|
|
112
|
+
section([h(2, t.title, { style: { ...center, color: { text: "#ffffff" } } }), p(t.sub, { style: { ...center, color: { text: "#ffffff" } } }), buttons("center", WHITE_BTN(t.start))],
|
|
113
|
+
{ gradient: GRADIENT, radius: "16px", padding: { base: "2xl", mobile: "xl" }, motion: { in: "zoom-in" } })]),
|
|
114
|
+
m("cta-split", "cta", "keu goi chia doi cta split", [
|
|
115
|
+
section([{ type: "columns", attrs: { verticalAlign: "center" }, content: [
|
|
116
|
+
{ type: "column", attrs: { width: 65 }, content: [h(2, t.title), muted(t.sub)] },
|
|
117
|
+
{ type: "column", attrs: { width: 35 }, content: [buttons("right", btn(t.start))] }] }], { color: { background: "surface" }, radius: "16px" })]),
|
|
118
|
+
m("cta-contact", "cta", "goi dien zalo lien he nhanh cta", [
|
|
119
|
+
section([h(2, t.title, center), muted(t.sub, center), buttons("center", btn(t.call), btn(t.chat, "outline"))], { motion: { in: "slide-up" } })]),
|
|
120
|
+
|
|
121
|
+
// ---------------- team / logos ----------------
|
|
122
|
+
m("team4", "team", "doi ngu thanh vien team 4", [
|
|
123
|
+
section([big(t.title), { type: "spacer", attrs: { height: "md" } }, grid(4, [member(), member(), member(), member()], slideUp())])]),
|
|
124
|
+
m("team-intro", "team", "gioi thieu doi ngu anh nhom team intro", [
|
|
125
|
+
section([{ type: "mediaText", attrs: { position: "left", width: 50, verticalAlign: "center" }, content: [eyebrow(t.eyebrow), h(2, t.title), p(t.sub), buttons("left", btn(t.more, "outline"))] }])]),
|
|
126
|
+
m("logos", "logos", "doi tac logo khach hang logos", [
|
|
127
|
+
section([muted(t.trusted, { ...center, textTransform: "uppercase", letterSpacing: "0.08em", fontSize: { base: "sm" } }), grid(5, [1, 2, 3, 4, 5].map(() => img(t.logo)), { motion: { in: "fade", stagger: true } })])]),
|
|
128
|
+
|
|
129
|
+
// ---------------- contact ----------------
|
|
130
|
+
m("contact-split", "contact", "lien he chia doi contact split", [
|
|
131
|
+
section([{ type: "columns", content: [
|
|
132
|
+
{ type: "column", content: [h(2, t.contactTitle), muted(t.contactSub), p(`${t.address}: ${t.addressV}`), p(`${t.phone}: ${t.phoneV}`), p(`${t.email}: ${t.emailV}`)] },
|
|
133
|
+
{ type: "column", content: [buttons("left", btn(t.call), btn(t.chat, "outline")), { type: "socialLinks", attrs: { links: [{ service: "facebook", url: "https://facebook.com" }, { service: "zalo", url: "https://zalo.me" }, { service: "email", url: "mailto:hello@example.com" }] } }] }] }])]),
|
|
134
|
+
m("contact-cards", "contact", "the lien he dia chi dien thoai email contact cards", [
|
|
135
|
+
section([h(2, t.contactTitle, center), muted(t.contactSub, center), { type: "spacer", attrs: { height: "md" } }, grid(3, [info(t.address, t.addressV), info(t.phone, t.phoneV), info(t.email, t.emailV)], slideUp())])]),
|
|
136
|
+
|
|
137
|
+
// ---------------- text ----------------
|
|
138
|
+
m("text-cols", "text", "hai cot chu text columns", [
|
|
139
|
+
section([h(2, t.title), { type: "columns", content: [{ type: "column", content: [h(3, t.twoColA), p(t.body), p(t.body)] }, { type: "column", content: [h(3, t.twoColB), p(t.body), p(t.body)] }] }])]),
|
|
140
|
+
m("text-note", "text", "ghi chu luu y callout note", [
|
|
141
|
+
section([{ type: "callout", attrs: { tone: "info", title: t.note }, content: [p(t.noteText)] }, p(t.body)], { maxWidth: { base: "760px" } })]),
|
|
142
|
+
|
|
143
|
+
// ---------------- footer ----------------
|
|
144
|
+
m("footer-simple", "footer", "chan trang gon footer", [
|
|
145
|
+
section([p(t.copyright, { style: { ...center, color: { text: "muted" }, fontSize: { base: "sm" } } }), { type: "socialLinks", attrs: { align: "center", links: [{ service: "facebook", url: "https://facebook.com" }, { service: "youtube", url: "https://youtube.com" }, { service: "zalo", url: "https://zalo.me" }] } }], { padding: { base: "xl" } })]),
|
|
146
|
+
m("footer-cols", "footer", "chan trang 3 cot footer links", [
|
|
147
|
+
section([{ type: "columns", content: [links(t.footerAbout, [t.l_about, t.l_news, t.l_jobs]), links(t.footerHelp, [t.l_faq, t.l_guide, t.l_contact]), links(t.footerLegal, [t.l_terms, t.l_privacy, t.l_refund])] },
|
|
148
|
+
p(t.copyright, { style: { color: { text: "muted" }, fontSize: { base: "sm" } } })], { padding: { base: "xl" } })]),
|
|
149
|
+
];
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
export const libraryPatterns = (locale: string): Pattern[] => library(msgs("patternLib", locale));
|
package/src/shared/patterns.ts
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import { normalizeContent } from "@ecomcx/ecomweb-content";
|
|
2
|
+
import { btn, buttons, h, p, text } from "./patterns-kit";
|
|
3
|
+
import { msgs } from "../i18n";
|
|
4
|
+
import { libraryPatterns } from "./patterns-library";
|
|
2
5
|
|
|
3
6
|
/**
|
|
4
7
|
* Mẫu (pattern): đoạn nội dung dựng sẵn (giới thiệu, tính năng, bảng giá, kêu gọi hành động…) — chèn = chép khối vào bài,
|
|
@@ -42,35 +45,6 @@ export function patternNodes(p: Pattern): Array<Record<string, unknown>> {
|
|
|
42
45
|
// Mẫu có sẵn của lõi (dựng bằng bộ khối cơ bản — mọi theme hiển thị được)
|
|
43
46
|
// ---------------------------------------------------------------------------
|
|
44
47
|
type L = Record<string, string>;
|
|
45
|
-
const vi: L = {
|
|
46
|
-
hero: "Ảnh bìa giới thiệu", heroD: "Tiêu đề lớn trên ảnh nền + 2 nút", heroTitle: "Tiêu đề thật ấn tượng", heroText: "Một câu ngắn nói rõ bạn mang lại điều gì cho khách hàng.",
|
|
47
|
-
start: "Bắt đầu ngay", learn: "Tìm hiểu thêm",
|
|
48
|
-
features: "Ba tính năng", featuresD: "Tiêu đề + 3 cột tính năng", featuresTitle: "Vì sao chọn chúng tôi", f1: "Nhanh", f2: "An toàn", f3: "Dễ dùng", fText: "Mô tả ngắn về lợi ích này.",
|
|
49
|
-
cta: "Kêu gọi hành động", ctaD: "Khung nổi bật với nút", ctaTitle: "Sẵn sàng bắt đầu?", ctaText: "Đăng ký hôm nay để nhận ưu đãi.", ctaBtn: "Liên hệ ngay",
|
|
50
|
-
pricing: "Bảng giá 3 gói", pricingD: "3 gói dạng thẻ, có danh sách quyền lợi", basic: "Cơ bản", pro: "Chuyên nghiệp", biz: "Doanh nghiệp", perMonth: "/tháng", choose: "Chọn gói", item: "Quyền lợi",
|
|
51
|
-
faq: "Câu hỏi thường gặp", faqD: "Tiêu đề + các câu hỏi thu gọn", q: "Câu hỏi", a: "Câu trả lời ngắn gọn.",
|
|
52
|
-
testimonial: "Cảm nhận khách hàng", testimonialD: "Trích dẫn nổi bật kèm tên", quote: "Dịch vụ tuyệt vời, tôi sẽ giới thiệu cho bạn bè.", who: "Nguyễn Văn A, Giám đốc",
|
|
53
|
-
intro: "Ảnh + giới thiệu", introD: "Ảnh một bên, chữ và nút bên kia", introTitle: "Về chúng tôi", introText: "Giới thiệu ngắn về công ty, sứ mệnh và giá trị.",
|
|
54
|
-
contact: "Liên hệ", contactD: "Thông tin liên hệ + mạng xã hội", contactTitle: "Liên hệ với chúng tôi", contactText: "Địa chỉ · Số điện thoại · Email",
|
|
55
|
-
};
|
|
56
|
-
const en: L = {
|
|
57
|
-
hero: "Hero cover", heroD: "Big heading over a background image + 2 buttons", heroTitle: "A headline that stands out", heroText: "One short sentence about what you offer your customers.",
|
|
58
|
-
start: "Get started", learn: "Learn more",
|
|
59
|
-
features: "Three features", featuresD: "Heading + 3 feature columns", featuresTitle: "Why choose us", f1: "Fast", f2: "Secure", f3: "Easy", fText: "A short description of this benefit.",
|
|
60
|
-
cta: "Call to action", ctaD: "Highlighted box with a button", ctaTitle: "Ready to start?", ctaText: "Sign up today for a special offer.", ctaBtn: "Contact us",
|
|
61
|
-
pricing: "Pricing — 3 plans", pricingD: "3 plan cards with a feature list", basic: "Basic", pro: "Pro", biz: "Business", perMonth: "/month", choose: "Choose plan", item: "Feature",
|
|
62
|
-
faq: "FAQ", faqD: "Heading + collapsible questions", q: "Question", a: "A short answer.",
|
|
63
|
-
testimonial: "Testimonial", testimonialD: "Pullquote with a name", quote: "Great service, I will recommend it to my friends.", who: "Jane Doe, CEO",
|
|
64
|
-
intro: "Media + intro", introD: "Image on one side, text and button on the other", introTitle: "About us", introText: "A short introduction to the company, its mission and values.",
|
|
65
|
-
contact: "Contact", contactD: "Contact details + social links", contactTitle: "Get in touch", contactText: "Address · Phone · Email",
|
|
66
|
-
};
|
|
67
|
-
|
|
68
|
-
const text = (s: string, marks?: Array<{ type: string }>) => (marks ? { type: "text", text: s, marks } : { type: "text", text: s });
|
|
69
|
-
const p = (s: string, attrs?: Record<string, unknown>) => ({ type: "paragraph", ...(attrs ? { attrs } : {}), content: [text(s)] });
|
|
70
|
-
const h = (level: number, s: string, attrs: Record<string, unknown> = {}) => ({ type: "heading", attrs: { level, ...attrs }, content: [text(s)] });
|
|
71
|
-
const btn = (s: string, variant = "primary") => ({ type: "button", attrs: { text: s, href: "#", variant } });
|
|
72
|
-
const buttons = (align: string, ...list: object[]) => ({ type: "buttons", attrs: { align }, content: list });
|
|
73
|
-
|
|
74
48
|
function corePatterns(t: L): Pattern[] {
|
|
75
49
|
const plan = (name: string, price: string, variant: string) => ({ type: "group", attrs: { blockStyle: "card" }, content: [
|
|
76
50
|
h(3, name), h(2, price, { style: { fontSize: { base: "2xl" } } }),
|
|
@@ -107,11 +81,11 @@ function corePatterns(t: L): Pattern[] {
|
|
|
107
81
|
|
|
108
82
|
let coreLocale: string | null = null;
|
|
109
83
|
/** Mẫu có sẵn của lõi (gọi lại với ngôn ngữ khác để đổi chữ trong mẫu). */
|
|
110
|
-
export function registerCorePatterns(locale
|
|
84
|
+
export function registerCorePatterns(locale = "vi") {
|
|
111
85
|
if (coreLocale === locale) return;
|
|
112
86
|
coreLocale = locale;
|
|
113
|
-
for (const pattern of corePatterns(
|
|
87
|
+
for (const pattern of [...corePatterns(msgs("patterns", locale)), ...libraryPatterns(locale)]) patterns.set(pattern.name, pattern);
|
|
114
88
|
changed();
|
|
115
89
|
}
|
|
116
90
|
|
|
117
|
-
export const PATTERN_CATEGORIES = ["hero", "features", "cta", "pricing", "testimonials", "faq", "team", "contact", "text", "gallery", "header", "footer"];
|
|
91
|
+
export const PATTERN_CATEGORIES = ["hero", "features", "stats", "steps", "cta", "pricing", "testimonials", "faq", "team", "logos", "contact", "text", "gallery", "header", "footer"];
|
package/src/v2/blocks/index.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { messages } from "../../i18n";
|
|
1
2
|
import type { V2Labels } from "../labels";
|
|
2
3
|
import type { BlockType, BlockTypeRegistry } from "../core/registry";
|
|
3
4
|
import { layoutBlocks } from "./layout";
|
|
@@ -13,21 +14,14 @@ const TITLE_KEYS: Partial<Record<string, keyof V2Labels>> = {
|
|
|
13
14
|
pullquote: "pullquote", cover: "cover", customHtml: "html", embed: "embed",
|
|
14
15
|
};
|
|
15
16
|
|
|
16
|
-
const EN_TITLES: Record<string, string> = {
|
|
17
|
-
taskList: "To-do list", taskItem: "To-do", listItem: "List item", mediaText: "Media & text", tableRow: "Row", tableCell: "Cell", tableHeader: "Header cell",
|
|
18
|
-
gallery: "Gallery", video: "Video", audio: "Audio", file: "File", youtube: "YouTube", socialLinks: "Social links", tableOfContents: "Table of contents",
|
|
19
|
-
siteTitle: "Site title", siteLogo: "Site logo", siteTagline: "Tagline", navigation: "Navigation", search: "Search", languageSwitcher: "Language switcher",
|
|
20
|
-
copyright: "Copyright", postTitle: "Post title", postContent: "Post content", postExcerpt: "Excerpt", featuredImage: "Featured image", postDate: "Date",
|
|
21
|
-
postAuthor: "Author", postTerms: "Terms", comments: "Comments", query: "Query loop", postTemplate: "Post template", pagination: "Pagination", queryEmpty: "No results",
|
|
22
|
-
};
|
|
23
|
-
|
|
24
17
|
export function coreBlockTypes(labels: V2Labels): BlockType[] {
|
|
18
|
+
const names = messages("blockTitles", labels.lang);
|
|
25
19
|
return [...textBlocks(), ...layoutBlocks(), ...mediaBlocks(), ...themeBlocks()].map((t) => {
|
|
26
20
|
const key = TITLE_KEYS[t.name];
|
|
27
|
-
const
|
|
21
|
+
const str = (v: unknown) => (typeof v === "string" ? v : undefined);
|
|
22
|
+
const title = key ? String(labels[key]) : str(names[t.name]) ?? t.title;
|
|
28
23
|
// Biến thể đứng riêng (Hàng ngang / Xếp dọc / Lưới) theo ngôn ngữ
|
|
29
|
-
const
|
|
30
|
-
const variations = labels.lang === "en" && t.variations ? t.variations.map((v) => (VAR_EN[`${t.name}/${v.name}`] ? { ...v, title: VAR_EN[`${t.name}/${v.name}`] } : v)) : t.variations;
|
|
24
|
+
const variations = t.variations?.map((v) => { const vt = str(names[`${t.name}/${v.name}`]); return vt ? { ...v, title: vt } : v; });
|
|
31
25
|
return { ...t, title, variations };
|
|
32
26
|
});
|
|
33
27
|
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { normalizeStyle } from "@ecomcx/ecomweb-content";
|
|
2
|
+
import type { CSSProperties } from "react";
|
|
3
|
+
|
|
4
|
+
const SIDES = ["", "Top", "Right", "Bottom", "Left"];
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Bỏ thuộc tính inline của khối mà kiểu dáng (attrs.style) đã thay thế. Inline luôn thắng class `ecx-s-…`, nên không bỏ thì khung
|
|
8
|
+
* soạn hiện sai (vd nút đặt nền trắng ở Kiểu dáng vẫn đen). Cùng danh sách với `overridden()` của renderer website (theme-sdk rich.tsx)
|
|
9
|
+
* để khung soạn và website khớp nhau.
|
|
10
|
+
*/
|
|
11
|
+
export function withoutOverridden(inline: CSSProperties, rawStyle: unknown): CSSProperties {
|
|
12
|
+
const style = normalizeStyle(rawStyle);
|
|
13
|
+
if (!style) return inline;
|
|
14
|
+
const drop = new Set<string>();
|
|
15
|
+
if (style.padding) SIDES.forEach((x) => drop.add(`padding${x}`));
|
|
16
|
+
if (style.margin) SIDES.forEach((x) => drop.add(`margin${x}`));
|
|
17
|
+
if (style.gap) drop.add("gap");
|
|
18
|
+
if (style.width) drop.add("width");
|
|
19
|
+
if (style.maxWidth) drop.add("maxWidth");
|
|
20
|
+
if (style.minHeight) drop.add("minHeight");
|
|
21
|
+
if (style.fontSize) drop.add("fontSize");
|
|
22
|
+
if (style.lineHeight) drop.add("lineHeight");
|
|
23
|
+
if (style.fontWeight) drop.add("fontWeight");
|
|
24
|
+
if (style.textAlign) drop.add("textAlign");
|
|
25
|
+
if (style.color?.text) drop.add("color");
|
|
26
|
+
if (style.color?.background) { drop.add("background"); drop.add("backgroundColor"); }
|
|
27
|
+
if (style.border) SIDES.forEach((x) => drop.add(`border${x}`));
|
|
28
|
+
if (style.radius) drop.add("borderRadius");
|
|
29
|
+
return Object.fromEntries(Object.entries(inline).filter(([k]) => !drop.has(k))) as CSSProperties;
|
|
30
|
+
}
|