@ecomcx/ecomweb-editor 1.31.0 → 1.32.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/package.json +3 -3
- package/src/locales/en/attrs.ts +10 -0
- package/src/locales/en/background.ts +17 -0
- package/src/locales/en/block-desc.ts +1 -0
- package/src/locales/en/block-style.ts +7 -4
- package/src/locales/en/block-titles.ts +1 -0
- package/src/locales/en/blocks.ts +10 -2
- package/src/locales/en/columns.ts +12 -0
- package/src/locales/en/controls.ts +21 -0
- package/src/locales/en/hints.ts +215 -1
- package/src/locales/en/index.ts +5 -2
- package/src/locales/en/layout.ts +32 -0
- package/src/locales/en/legacy.ts +1 -1
- package/src/locales/en/library.ts +38 -0
- package/src/locales/en/parts.ts +12 -0
- package/src/locales/en/placeholders.ts +9 -1
- package/src/locales/en/presets.ts +6 -0
- package/src/locales/en/v2.ts +21 -0
- package/src/locales/vi/attrs.ts +10 -0
- package/src/locales/vi/background.ts +17 -0
- package/src/locales/vi/block-desc.ts +1 -0
- package/src/locales/vi/block-style.ts +7 -4
- package/src/locales/vi/block-titles.ts +1 -0
- package/src/locales/vi/blocks.ts +10 -2
- package/src/locales/vi/columns.ts +12 -0
- package/src/locales/vi/controls.ts +21 -0
- package/src/locales/vi/hints.ts +216 -2
- package/src/locales/vi/index.ts +5 -2
- package/src/locales/vi/layout.ts +32 -0
- package/src/locales/vi/legacy.ts +1 -1
- package/src/locales/vi/library.ts +38 -0
- package/src/locales/vi/parts.ts +12 -0
- package/src/locales/vi/placeholders.ts +9 -1
- package/src/locales/vi/presets.ts +6 -0
- package/src/locales/vi/v2.ts +21 -0
- package/src/shared/panel-store.ts +3 -3
- package/src/shared/patterns.ts +3 -52
- package/src/shared/style-panel.tsx +2 -2
- package/src/shared/types.ts +2 -0
- package/src/v2/blocks/columns-inspector.tsx +210 -0
- package/src/v2/blocks/form.tsx +4 -4
- package/src/v2/blocks/index.ts +10 -4
- package/src/v2/blocks/inline-style.ts +1 -1
- package/src/v2/blocks/layout.tsx +173 -42
- package/src/v2/blocks/media.tsx +22 -13
- package/src/v2/blocks/resize.tsx +172 -4
- package/src/v2/blocks/text.tsx +14 -7
- package/src/v2/blocks/theme.tsx +10 -5
- package/src/v2/blocks/tools.tsx +50 -5
- package/src/v2/blocks/widgets.tsx +44 -16
- package/src/v2/canvas/block-list.tsx +17 -2
- package/src/v2/canvas/canvas-css.ts +54 -4
- package/src/v2/canvas/canvas.tsx +20 -3
- package/src/v2/canvas/dnd.ts +34 -3
- package/src/v2/canvas/move-animation.ts +94 -0
- package/src/v2/canvas/spacing-viz.ts +51 -0
- package/src/v2/core/block-presets.ts +68 -0
- package/src/v2/core/host.ts +5 -0
- package/src/v2/core/structure.ts +2 -1
- package/src/v2/editor.css +238 -9
- package/src/v2/editor.tsx +8 -2
- package/src/v2/ui/attr-form.tsx +40 -11
- package/src/v2/ui/attr-hints.ts +104 -6
- package/src/v2/ui/background-panel.tsx +65 -21
- package/src/v2/ui/block-icons.tsx +152 -0
- package/src/v2/ui/block-menu.ts +22 -0
- package/src/v2/ui/block-style-panel.tsx +14 -3
- package/src/v2/ui/color-field.tsx +74 -9
- package/src/v2/ui/divider-panel.tsx +58 -0
- package/src/v2/ui/group-width.tsx +38 -0
- package/src/v2/ui/icon-picker.tsx +51 -0
- package/src/v2/ui/inserter.tsx +51 -7
- package/src/v2/ui/inspector.tsx +48 -16
- package/src/v2/ui/layout-panel.tsx +5 -47
- package/src/v2/ui/list-view.tsx +81 -7
- package/src/v2/ui/motion-panel.tsx +2 -1
- package/src/v2/ui/parts-panel.tsx +164 -0
- package/src/v2/ui/pattern-library.tsx +228 -0
- package/src/v2/ui/preset-bar.tsx +83 -0
- package/src/v2/ui/style-controls.tsx +65 -15
- package/src/v2/ui/style-supports.ts +1 -1
- package/src/v2/ui/style-tab.tsx +127 -41
- package/src/v2/ui/toolbar.tsx +52 -13
- package/src/v2/ui/unit-controls.tsx +88 -39
- package/src/locales/en/patterns.ts +0 -50
- package/src/locales/vi/patterns.ts +0 -50
- package/src/shared/patterns-kit.ts +0 -7
- package/src/shared/patterns-library.ts +0 -172
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { Check, ChevronDown, RotateCcw, Save, Star, Trash2 } from "lucide-react";
|
|
2
|
+
import { useEffect, useRef, useState, useSyncExternalStore } from "react";
|
|
3
|
+
import { blockControls } from "../../shared/panel-store";
|
|
4
|
+
import { applyStyle, ensurePresets, onPresetsChange, pickStyle, presetsSnapshot, sameStyle, setPresets, styleKeys, type BlockPresetMap } from "../core/block-presets";
|
|
5
|
+
import type { BNode } from "../core/model";
|
|
6
|
+
import { useEditor } from "../context";
|
|
7
|
+
import { useMsgs } from "../i18n";
|
|
8
|
+
import { cx } from "./style-controls";
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Hàng "Kiểu" dưới tên khối: chọn kiểu đặt sẵn của loại khối (toàn website), báo "(đã chỉnh)" khi kiểu đang dùng đã bị sửa,
|
|
12
|
+
* lưu kiểu hiện tại thành kiểu mới, đặt làm mặc định khi chèn khối mới, về mặc định. Chỉ đụng thuộc tính kiểu — nội dung giữ nguyên.
|
|
13
|
+
*/
|
|
14
|
+
export function PresetBar({ block, setAttrs }: { block: BNode; setAttrs(a: Record<string, unknown>): void }) {
|
|
15
|
+
const { host } = useEditor();
|
|
16
|
+
const t = useMsgs("presets");
|
|
17
|
+
const map = useSyncExternalStore(onPresetsChange, presetsSnapshot, presetsSnapshot);
|
|
18
|
+
useEffect(() => ensurePresets(host.blockPresets?.load), [host]);
|
|
19
|
+
const [open, setOpen] = useState(false);
|
|
20
|
+
const [naming, setNaming] = useState<string | null>(null);
|
|
21
|
+
const [busy, setBusy] = useState(false);
|
|
22
|
+
const ref = useRef<HTMLDivElement>(null);
|
|
23
|
+
useEffect(() => {
|
|
24
|
+
if (!open) return;
|
|
25
|
+
const out = (e: MouseEvent) => { if (!ref.current?.contains(e.target as Node)) { setOpen(false); setNaming(null); } };
|
|
26
|
+
document.addEventListener("mousedown", out, true);
|
|
27
|
+
return () => document.removeEventListener("mousedown", out, true);
|
|
28
|
+
}, [open]);
|
|
29
|
+
if (!host.blockPresets) return null;
|
|
30
|
+
const keys = styleKeys(block.type, blockControls());
|
|
31
|
+
const cur = pickStyle(block.attrs, keys);
|
|
32
|
+
const entry = map?.[block.type] ?? {};
|
|
33
|
+
const presets = entry.presets ?? [];
|
|
34
|
+
const def = entry.default ?? {};
|
|
35
|
+
const match = presets.find((p) => sameStyle(cur, pickStyle(p.attrs, keys)));
|
|
36
|
+
const isDefault = !match && sameStyle(cur, pickStyle(def, keys));
|
|
37
|
+
const label = match ? match.name : t.default;
|
|
38
|
+
const edited = !match && !isDefault;
|
|
39
|
+
const canSave = !!host.blockPresets.save;
|
|
40
|
+
|
|
41
|
+
const save = async (next: BlockPresetMap) => {
|
|
42
|
+
setBusy(true);
|
|
43
|
+
try { setPresets((await host.blockPresets!.save!(next as Record<string, unknown>)) as BlockPresetMap); }
|
|
44
|
+
finally { setBusy(false); }
|
|
45
|
+
};
|
|
46
|
+
const withEntry = (patch: Partial<typeof entry>) => ({ ...(map ?? {}), [block.type]: { ...entry, ...patch } });
|
|
47
|
+
const apply = (style: Record<string, unknown>) => { setAttrs(applyStyle(keys, pickStyle(style, keys))); setOpen(false); };
|
|
48
|
+
|
|
49
|
+
return (
|
|
50
|
+
<div className="ecx-preset" ref={ref}>
|
|
51
|
+
<span className="ecx-field-label">{t.label}</span>
|
|
52
|
+
<div className="ecx-preset-row">
|
|
53
|
+
<button type="button" className={cx("ecx-preset-btn", open && "is-open")} aria-haspopup="menu" aria-expanded={open} onClick={() => setOpen(!open)}>
|
|
54
|
+
<span>{label}{edited && <em className="ecx-preset-edited"> {t.edited}</em>}</span><ChevronDown className="ecx-icon" />
|
|
55
|
+
</button>
|
|
56
|
+
<button type="button" className="ecx-preset-reset" title={t.toDefault} aria-label={t.toDefault} disabled={isDefault} onClick={() => apply(def)}><RotateCcw className="ecx-icon" /></button>
|
|
57
|
+
</div>
|
|
58
|
+
{open && (
|
|
59
|
+
<div className="ecx-preset-menu" role="menu">
|
|
60
|
+
<div className="ecx-pop-title">{t.presets}</div>
|
|
61
|
+
<button type="button" role="menuitemradio" aria-checked={isDefault} className="ecx-preset-item" onClick={() => apply(def)}>{t.default}{isDefault && <Check className="ecx-icon" />}</button>
|
|
62
|
+
{presets.map((p) => (
|
|
63
|
+
<div key={p.name} className="ecx-preset-line">
|
|
64
|
+
<button type="button" role="menuitemradio" aria-checked={match === p} className="ecx-preset-item" onClick={() => apply(p.attrs)}>{p.name}{match === p && <Check className="ecx-icon" />}</button>
|
|
65
|
+
{canSave && <button type="button" className="ecx-preset-del" title={t.remove} aria-label={`${t.remove}: ${p.name}`} disabled={busy} onClick={() => save(withEntry({ presets: presets.filter((x) => x !== p) }))}><Trash2 className="ecx-icon" /></button>}
|
|
66
|
+
</div>
|
|
67
|
+
))}
|
|
68
|
+
{canSave && <>
|
|
69
|
+
<hr />
|
|
70
|
+
{naming === null
|
|
71
|
+
? <button type="button" className="ecx-preset-item" disabled={busy} onClick={() => setNaming("")}><Save className="ecx-icon" />{t.saveNew}</button>
|
|
72
|
+
: <form className="ecx-preset-name" onSubmit={(e) => { e.preventDefault(); const name = naming.trim().slice(0, 60); if (!name) return; save(withEntry({ presets: [...presets.filter((x) => x.name !== name), { name, attrs: cur }] })).then(() => { setNaming(null); setOpen(false); }); }}>
|
|
73
|
+
<input className="ecx-input" autoFocus value={naming} maxLength={60} placeholder={t.namePlaceholder} onChange={(e) => setNaming(e.target.value)} />
|
|
74
|
+
<button type="submit" className="ecx-btn ecx-btn-primary" disabled={busy || !naming.trim()}>{t.save}</button>
|
|
75
|
+
</form>}
|
|
76
|
+
<button type="button" className="ecx-preset-item" disabled={busy} onClick={() => save(withEntry({ default: Object.keys(cur).length ? cur : undefined })).then(() => setOpen(false))}><Star className="ecx-icon" />{t.makeDefault}</button>
|
|
77
|
+
<p className="ecx-pop-hint">{t.defaultHint}</p>
|
|
78
|
+
</>}
|
|
79
|
+
</div>
|
|
80
|
+
)}
|
|
81
|
+
</div>
|
|
82
|
+
);
|
|
83
|
+
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type { Device } from "@ecomcx/ecomweb-content";
|
|
2
|
-
import { ChevronRight } from "lucide-react";
|
|
3
|
-
import { useState, type ComponentType, type ReactNode } from "react";
|
|
2
|
+
import { ChevronRight, Monitor, RotateCcw, Smartphone, Tablet } from "lucide-react";
|
|
3
|
+
import { createContext, useContext, useState, type ComponentType, type ReactNode } from "react";
|
|
4
4
|
import { useEditor } from "../context";
|
|
5
5
|
import { useMsgs } from "../i18n";
|
|
6
6
|
|
|
7
|
-
/** Thành phần chung của
|
|
7
|
+
/** Thành phần chung của bảng cài đặt (cùng một giao diện cho mọi mục). */
|
|
8
8
|
export const cx = (...c: unknown[]) => c.filter((x): x is string => typeof x === "string" && x !== "").join(" ");
|
|
9
9
|
export type Icon = ComponentType<{ className?: string }>;
|
|
10
10
|
|
|
@@ -18,33 +18,84 @@ export function Seg<T extends string>({ value, options, onChange, label }: { val
|
|
|
18
18
|
</div>
|
|
19
19
|
);
|
|
20
20
|
}
|
|
21
|
-
|
|
21
|
+
|
|
22
|
+
/** Cụm 3 icon khổ màn hình cạnh nhãn: ô này chỉnh riêng theo khổ; bấm = đổi khổ của cả trình soạn (khung soạn co lại theo). */
|
|
23
|
+
export function DeviceSwitch() {
|
|
24
|
+
const { ui } = useEditor();
|
|
25
|
+
const t = useMsgs("controls");
|
|
26
|
+
const items: Array<["desktop" | "tablet" | "mobile", Icon, string]> = [["desktop", Monitor, t.desktop], ["tablet", Tablet, t.tablet], ["mobile", Smartphone, t.mobile]];
|
|
27
|
+
return (
|
|
28
|
+
<span className="ecx-row-devices" role="group" aria-label={t.device}>
|
|
29
|
+
{items.map(([d, I, title]) => (
|
|
30
|
+
<button key={d} type="button" title={title} aria-label={title} aria-pressed={ui.device === d} className={cx(ui.device === d && "is-active")} onClick={() => ui.setDevice(d)}><I className="ecx-icon" /></button>
|
|
31
|
+
))}
|
|
32
|
+
</span>
|
|
33
|
+
);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Một ô của bảng: nhãn bên trái; bên phải là cụm khổ màn hình (ô chỉnh theo khổ — có `device`) và nút ↶ về mặc định (khi đã đổi — có `onReset`).
|
|
38
|
+
* `extra`: nút nhỏ thêm cạnh nhãn (vd xích 4 cạnh).
|
|
39
|
+
*/
|
|
40
|
+
export function Row({ label, children, device, onReset, extra }: { label: ReactNode; children: ReactNode; device?: Device; onReset?(): void; extra?: ReactNode }) {
|
|
22
41
|
const t = useMsgs("controls");
|
|
23
42
|
return (
|
|
24
43
|
<div className="ecx-style-row">
|
|
25
|
-
<span className="ecx-
|
|
44
|
+
<span className="ecx-row-head">
|
|
45
|
+
<span className="ecx-field-label">{label}</span>
|
|
46
|
+
{onReset && <button type="button" className="ecx-row-reset" title={t.reset} aria-label={`${t.reset}: ${typeof label === "string" ? label : ""}`} onClick={onReset}><RotateCcw className="ecx-icon" /></button>}
|
|
47
|
+
<span className="ecx-row-tools">{extra}{device !== undefined && <DeviceSwitch />}</span>
|
|
48
|
+
</span>
|
|
26
49
|
{children}
|
|
27
50
|
</div>
|
|
28
51
|
);
|
|
29
52
|
}
|
|
53
|
+
|
|
54
|
+
/** Công tắc trạng thái ngay trong một mục (Thường / Rê chuột), như bảng của các bộ khối lớn. */
|
|
55
|
+
export function StateTabs({ value, onChange }: { value: "normal" | "hover"; onChange(v: "normal" | "hover"): void }) {
|
|
56
|
+
const t = useMsgs("controls");
|
|
57
|
+
return (
|
|
58
|
+
<div role="tablist" className="ecx-seg is-text ecx-state-tabs">
|
|
59
|
+
{(["normal", "hover"] as const).map((v) => (
|
|
60
|
+
<button key={v} type="button" role="tab" aria-selected={value === v} className={cx("ecx-seg-btn", value === v && "is-active")} onClick={() => onChange(v)}>{v === "normal" ? t.stateNormal : t.stateHover}</button>
|
|
61
|
+
))}
|
|
62
|
+
</div>
|
|
63
|
+
);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/** Đếm thứ tự mục trong một bảng: mục đầu mở sẵn, còn lại gập (như bảng của các bộ khối lớn: thấy hết tên mục trong một màn hình). */
|
|
67
|
+
const SectionIndex = createContext<{ n: number } | null>(null);
|
|
68
|
+
export function SectionGroup({ children }: { children: ReactNode }) {
|
|
69
|
+
return <SectionIndex.Provider value={{ n: 0 }}>{children}</SectionIndex.Provider>;
|
|
70
|
+
}
|
|
71
|
+
// Mục người dùng đã mở / gập: nhớ theo tên trong phiên soạn (đổi sang khối khác vẫn giữ)
|
|
72
|
+
const remembered = new Map<string, boolean>();
|
|
73
|
+
|
|
30
74
|
/**
|
|
31
|
-
* Một mục
|
|
32
|
-
*
|
|
75
|
+
* Một mục: tiêu đề bấm để thu / mở, chấm khi mục có giá trị, nút đặt lại, phần "Thêm tuỳ chọn" cho thiết lập ít dùng.
|
|
76
|
+
* Mặc định: mục đầu của bảng (trong SectionGroup) và mục đã có giá trị thì mở; còn lại gập. `summary`: một dòng hiện khi gập.
|
|
33
77
|
*/
|
|
34
|
-
export function Section({ title, children, more, defaultOpen
|
|
35
|
-
title: string; children?: ReactNode; more?: ReactNode; defaultOpen?: boolean; modified?: boolean; onReset?(): void; moreOpen?: boolean;
|
|
78
|
+
export function Section({ title, children, more, defaultOpen, modified, onReset, moreOpen, summary, head }: {
|
|
79
|
+
title: string; children?: ReactNode; more?: ReactNode; defaultOpen?: boolean; modified?: boolean; onReset?(): void; moreOpen?: boolean; summary?: ReactNode;
|
|
80
|
+
/** Phần tử đặt trước tiêu đề (vd công tắc "Hiện" của một phần khối). */
|
|
81
|
+
head?: ReactNode;
|
|
36
82
|
}) {
|
|
37
|
-
const
|
|
38
|
-
const [
|
|
83
|
+
const group = useContext(SectionIndex);
|
|
84
|
+
const [index] = useState(() => (group ? group.n++ : 0));
|
|
85
|
+
const [open, setOpenState] = useState(() => remembered.get(title) ?? defaultOpen ?? (!group || index === 0 || !!modified));
|
|
86
|
+
const setOpen = (v: boolean) => { remembered.set(title, v); setOpenState(v); };
|
|
39
87
|
const [showMore, setShowMore] = useState(!!moreOpen);
|
|
40
88
|
const t = useMsgs("controls");
|
|
41
89
|
return (
|
|
42
|
-
<section className="ecx-style-section">
|
|
90
|
+
<section className={cx("ecx-style-section", open && "is-open")}>
|
|
43
91
|
<div className="ecx-style-section-head">
|
|
92
|
+
{head}
|
|
44
93
|
<button type="button" className="ecx-style-section-toggle" aria-expanded={open} onClick={() => setOpen(!open)}>
|
|
45
|
-
<
|
|
94
|
+
<span className="ecx-style-section-title">{title}{modified && <span className="ecx-dot" aria-label={t.modified} />}</span>
|
|
95
|
+
{!open && summary && <span className="ecx-style-section-summary">{summary}</span>}
|
|
96
|
+
<ChevronRight className={cx("ecx-icon ecx-icon-sm ecx-chevron", open && "is-open")} aria-hidden />
|
|
46
97
|
</button>
|
|
47
|
-
{modified && onReset && <button type="button" className="ecx-link-btn" onClick={onReset}>{t.reset}</button>}
|
|
98
|
+
{open && modified && onReset && <button type="button" className="ecx-link-btn" onClick={onReset}>{t.reset}</button>}
|
|
48
99
|
</div>
|
|
49
100
|
{open && (
|
|
50
101
|
<div className="ecx-style-section-body">
|
|
@@ -55,4 +106,3 @@ export function Section({ title, children, more, defaultOpen = true, modified, o
|
|
|
55
106
|
</section>
|
|
56
107
|
);
|
|
57
108
|
}
|
|
58
|
-
|
|
@@ -13,7 +13,7 @@ const CORE: Record<string, StyleGroup[]> = {
|
|
|
13
13
|
spacer: MINIMAL, pageBreak: ["visibility"], customHtml: MINIMAL, shortcode: MINIMAL, audio: MINIMAL,
|
|
14
14
|
horizontalRule: ["color", "spacing", "border", "visibility"],
|
|
15
15
|
image: MEDIA, gallery: MEDIA, video: MEDIA, youtube: MEDIA, embed: MEDIA, featuredImage: MEDIA, siteLogo: MEDIA, avatar: MEDIA,
|
|
16
|
-
icon: ["color", "spacing", "motion", "visibility"],
|
|
16
|
+
icon: ["color", "spacing", "hover", "motion", "visibility"],
|
|
17
17
|
socialLinks: ["color", "spacing", "motion", "visibility"],
|
|
18
18
|
// Màu nút (Thường / Rê chuột) ở mục Nút riêng (core-controls) — không lặp nhóm Màu chung (dữ liệu cũ có màu vẫn hiện để sửa)
|
|
19
19
|
button: NO_BACKGROUND.filter((g) => g !== "color"),
|
package/src/v2/ui/style-tab.tsx
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { normalizeStyle, type BlockStyle, type Device } from "@ecomcx/ecomweb-content";
|
|
2
|
-
import { AlignCenter, AlignJustify, AlignLeft, AlignRight
|
|
2
|
+
import { AlignCenter, AlignJustify, AlignLeft, AlignRight } from "lucide-react";
|
|
3
3
|
import { useEffect, useState, type ReactNode } from "react";
|
|
4
4
|
import { labelsLegacy, type EditorLabels } from "../../shared/labels";
|
|
5
5
|
import { useEditor } from "../context";
|
|
6
6
|
import { ColorInput } from "./color-field";
|
|
7
|
-
import {
|
|
7
|
+
import { GradientField } from "./layout-panel";
|
|
8
8
|
import { MotionPanel } from "./motion-panel";
|
|
9
|
-
import { Section, Seg, cx } from "./style-controls";
|
|
9
|
+
import { Row, Section, Seg, StateTabs, cx } from "./style-controls";
|
|
10
10
|
import { styleGroups, type StyleGroup } from "./style-supports";
|
|
11
|
-
import { SpacingControl, UnitInput } from "./unit-controls";
|
|
11
|
+
import { FourInput, SpacingControl, UnitInput } from "./unit-controls";
|
|
12
12
|
import { useMsgs } from "../i18n";
|
|
13
13
|
|
|
14
14
|
/**
|
|
@@ -17,12 +17,18 @@ import { useMsgs } from "../i18n";
|
|
|
17
17
|
* chưa đặt cho khổ nhỏ thì hiện giá trị kế thừa từ khổ lớn hơn.
|
|
18
18
|
*/
|
|
19
19
|
type Style = BlockStyle & Record<string, any>;
|
|
20
|
-
const RESPONSIVE = new Set(["padding", "margin", "gap", "width", "maxWidth", "minHeight", "fontSize", "lineHeight", "letterSpacing", "textAlign"]);
|
|
20
|
+
const RESPONSIVE = new Set(["padding", "margin", "gap", "width", "maxWidth", "minHeight", "fontSize", "lineHeight", "letterSpacing", "textAlign", "order"]);
|
|
21
21
|
const SIZES = ["sm", "md", "lg", "xl", "2xl"];
|
|
22
22
|
const SPACES = ["0", "xs", "sm", "md", "lg", "xl", "2xl"];
|
|
23
23
|
const WEIGHTS = ["300", "400", "500", "600", "700", "800", "900"];
|
|
24
|
-
const TYPO = ["fontFamily", "fontSize", "lineHeight", "letterSpacing", "fontWeight", "fontStyle", "textDecoration", "textTransform", "textAlign"];
|
|
25
|
-
const SPACING = ["padding", "margin"
|
|
24
|
+
const TYPO = ["fontFamily", "fontSize", "lineHeight", "letterSpacing", "fontWeight", "fontStyle", "textDecoration", "textTransform", "textAlign", "textShadow", "writingMode"];
|
|
25
|
+
const SPACING = ["padding", "margin"];
|
|
26
|
+
const STRUCTURE = ["gap", "width", "maxWidth", "minHeight", "aspectRatio", "zIndex", "grow", "order"];
|
|
27
|
+
type State = "normal" | "hover";
|
|
28
|
+
|
|
29
|
+
/** Bậc preset theo cỡ tăng dần (theme có thể khai lộn thứ tự: lg trước md). Tên lạ giữ thứ tự khai, đứng sau. */
|
|
30
|
+
const STEP_ORDER = ["0", "none", "3xs", "2xs", "xxs", "xs", "sm", "md", "base", "lg", "xl", "2xl", "xxl", "3xl", "4xl", "5xl", "6xl"];
|
|
31
|
+
export const byStep = (keys: string[]) => [...keys].sort((a, b) => { const i = STEP_ORDER.indexOf(a), j = STEP_ORDER.indexOf(b); return (i < 0 ? 99 : i) - (j < 0 ? 99 : j); });
|
|
26
32
|
|
|
27
33
|
/** Ô giá trị (preset như `lg` hoặc `16px`, `1.5rem`…): lưu khi rời ô / Enter; sai thì viền đỏ, không lưu. */
|
|
28
34
|
function ValueInput({ value, onCommit, check, placeholder, label, inherited }: { value?: string | number; onCommit(v: string | null): void; check(v: string): boolean; placeholder?: string; label: string; inherited?: string }) {
|
|
@@ -44,18 +50,44 @@ function ValueInput({ value, onCommit, check, placeholder, label, inherited }: {
|
|
|
44
50
|
* `part`: "style" = biến thể, chữ, màu (tab Kiểu dáng); "advanced" = khoảng cách, viền, bố cục / hiệu ứng, hover, chuyển động, ẩn hiện
|
|
45
51
|
* (tab Nâng cao — lớp chung của mọi khối như Advanced của Elementor); bỏ trống = tất cả. Ô Nền vẽ ở BackgroundControl.
|
|
46
52
|
*/
|
|
47
|
-
|
|
53
|
+
function TextShadowRow({ style, set }: { style: BlockStyle; set(k: "textShadow", v: BlockStyle["textShadow"]): void }) {
|
|
54
|
+
const lt = useMsgs("layout") as Record<string, string>;
|
|
55
|
+
const sh = style.textShadow;
|
|
56
|
+
const put = (p: Partial<NonNullable<BlockStyle["textShadow"]>>) => set("textShadow", { x: 0, y: 2, blur: 4, color: "black/30", ...sh, ...p });
|
|
57
|
+
return (
|
|
58
|
+
<>
|
|
59
|
+
<label className="ecx-check-row"><input type="checkbox" role="switch" className="ecx-switch" aria-label={lt.textShadow} checked={!!sh} onChange={(e) => set("textShadow", e.target.checked ? { x: 0, y: 2, blur: 4, color: "black/30" } : undefined)} /> {lt.textShadow}</label>
|
|
60
|
+
{sh && (
|
|
61
|
+
<div className="ecx-textshadow">
|
|
62
|
+
{([["x", lt.tsX, -20, 20], ["y", lt.tsY, -20, 20], ["blur", lt.tsBlur, 0, 40]] as const).map(([k, label, min, max]) => (
|
|
63
|
+
<label key={k} className="ecx-textshadow-row"><span>{label}: {sh[k]}px</span><input type="range" className="ecx-range" min={min} max={max} aria-label={label} value={sh[k]} onChange={(e) => put({ [k]: Number(e.target.value) })} /></label>
|
|
64
|
+
))}
|
|
65
|
+
<ColorInput label={lt.tsColor} value={sh.color} onChange={(c) => put({ color: c ?? "black/30" })} />
|
|
66
|
+
</div>
|
|
67
|
+
)}
|
|
68
|
+
</>
|
|
69
|
+
);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export function StyleTab({ type, style: raw, onChange, device, onDeviceChange, variants, variant, onVariantChange, part, lead, parts, structure }: {
|
|
48
73
|
type: string; style: unknown; onChange(style: BlockStyle | null): void; device: Device; onDeviceChange(d: Device): void;
|
|
49
74
|
variants?: Array<{ name: string; label: string }>; variant?: string | null; onVariantChange?(v: string | null): void; part?: "style" | "advanced";
|
|
50
75
|
/** Mục vẽ sau Chữ / Màu (mục riêng của khối, ô Nền). */
|
|
51
76
|
lead?: ReactNode;
|
|
77
|
+
/** Ô đứng đầu mục Cấu trúc (vd thẻ HTML của khối chứa — là thuộc tính của khối, không nằm trong style). */
|
|
78
|
+
structure?: ReactNode;
|
|
79
|
+
/** Khối chia phần: các phần đứng đầu; Kiểu chữ / Màu chung của cả khối chỉ hiện khi đã có giá trị (nội dung cũ). */
|
|
80
|
+
parts?: boolean;
|
|
52
81
|
}) {
|
|
53
82
|
const { host, labels, registry } = useEditor();
|
|
54
83
|
const t = labelsLegacy(labels.lang);
|
|
55
84
|
const ct = useMsgs("controls");
|
|
85
|
+
const lt = useMsgs("layout");
|
|
86
|
+
const [colorState, setColorState] = useState<State>("normal");
|
|
87
|
+
const [borderState, setBorderState] = useState<State>("normal");
|
|
56
88
|
const presets = host.presets;
|
|
57
|
-
const sizes = presets?.fontSizes ? Object.keys(presets.fontSizes) : SIZES;
|
|
58
|
-
const spaces = presets?.spacing ? ["0", ...Object.keys(presets.spacing)] : SPACES;
|
|
89
|
+
const sizes = presets?.fontSizes ? byStep(Object.keys(presets.fontSizes)) : SIZES;
|
|
90
|
+
const spaces = presets?.spacing ? ["0", ...byStep(Object.keys(presets.spacing))] : SPACES;
|
|
59
91
|
const fonts = presets?.fonts ? Object.keys(presets.fonts) : ["body", "heading", "mono"];
|
|
60
92
|
const style: Style = (normalizeStyle(raw) ?? {}) as Style;
|
|
61
93
|
|
|
@@ -75,7 +107,7 @@ export function StyleTab({ type, style: raw, onChange, device, onDeviceChange, v
|
|
|
75
107
|
} else next[k] = v === "" ? undefined : v;
|
|
76
108
|
commit(next);
|
|
77
109
|
};
|
|
78
|
-
const setGroup = (k: "color" | "border", sub: string, v: unknown) => set(k, { ...(style[k] ?? {}), [sub]: v });
|
|
110
|
+
const setGroup = (k: "color" | "border" | "link", sub: string, v: unknown) => set(k, { ...(style[k] ?? {}), [sub]: v });
|
|
79
111
|
// Khoá theo khổ (cỡ chữ, khoảng cách…): chỉ bỏ giá trị của khổ đang chọn, không xoá các khổ khác
|
|
80
112
|
const reset = (keys: string[]) => {
|
|
81
113
|
const next: Style = { ...style };
|
|
@@ -89,23 +121,33 @@ export function StyleTab({ type, style: raw, onChange, device, onDeviceChange, v
|
|
|
89
121
|
};
|
|
90
122
|
const has = (keys: string[]) => keys.some((k) => RESPONSIVE.has(k) && device !== "base" ? style[k]?.[device] !== undefined : style[k] !== undefined);
|
|
91
123
|
const ok = (k: string) => (v: string) => !!normalizeStyle({ [k]: v });
|
|
92
|
-
|
|
93
|
-
const
|
|
94
|
-
|
|
95
|
-
|
|
124
|
+
// Ô chuẩn: cụm khổ màn hình nếu ô chỉnh theo khổ; nút ↶ khi ô (ở khổ đang xem) đã có giá trị
|
|
125
|
+
const KEYS: Record<string, string[]> = { appearance: ["fontWeight", "fontStyle"], decoration: ["textDecoration"], transform: ["textTransform"], borderWidth: [], borderStyle: [], borderColor: [] };
|
|
126
|
+
const row = (k: string, label: string, control: ReactNode) => {
|
|
127
|
+
const keys = KEYS[k] ?? [k];
|
|
128
|
+
return <Row key={k} label={label} device={RESPONSIVE.has(k) ? device : undefined} onReset={keys.length && has(keys) ? () => reset(keys) : undefined}>{control}</Row>;
|
|
129
|
+
};
|
|
96
130
|
// Nhóm khối hỗ trợ; nhóm đã có giá trị vẫn hiện để sửa / xoá (dữ liệu cũ, khối dán từ nơi khác)
|
|
97
131
|
const groups = styleGroups(type, registry.get(type));
|
|
98
|
-
|
|
99
|
-
const
|
|
132
|
+
// Như bộ khối lớn: Kiểu dáng = chữ, màu, viền, nền & hiệu ứng, khi rê chuột; Nâng cao = khoảng cách, bố cục, ghim, chuyển động, hiển thị
|
|
133
|
+
const inPart = (g: StyleGroup) => !part || (part === "style") === ["typography", "color", "border"].includes(g);
|
|
134
|
+
const show = (g: StyleGroup, keys: string[]) => inPart(g) && ((groups.has(g) && !(parts && (g === "typography" || g === "color"))) || keys.some((k) => style[k] !== undefined));
|
|
135
|
+
const container = registry.get(type)?.kind === "container";
|
|
136
|
+
// Trạng thái rê chuột nằm ngay trong mục Màu / Viền (công tắc Thường · Rê chuột), không còn mục "Khi rê chuột" riêng
|
|
137
|
+
const hoverOk = groups.has("hover") || style.hover !== undefined;
|
|
138
|
+
const fxOk = groups.has("effects") || ["gradient", "shadow", "aspectRatio", "position"].some((k) => style[k] !== undefined);
|
|
139
|
+
const setHover = (patch: NonNullable<BlockStyle["hover"]>) => set("hover", { ...style.hover, ...patch });
|
|
140
|
+
const shadows = ["sm", "md", "lg", "xl", ...Object.keys(presets?.shadows ?? {}).filter((x) => !["sm", "md", "lg", "xl"].includes(x))];
|
|
141
|
+
const shadowSelect = (value: string | undefined, onPick: (v: string | undefined) => void, label: string, none = true) => (
|
|
142
|
+
<select className="ecx-input" aria-label={label} value={value ?? ""} onChange={(e) => onPick(e.target.value || undefined)}>
|
|
143
|
+
<option value="">—</option>{none && <option value="none">{lt.none}</option>}
|
|
144
|
+
{shadows.map((x) => <option key={x} value={x}>{x.toUpperCase()}</option>)}
|
|
145
|
+
</select>
|
|
146
|
+
);
|
|
100
147
|
const appearance = `${style.fontWeight ?? ""}${style.fontStyle === "italic" ? "i" : ""}`;
|
|
101
148
|
|
|
102
149
|
return (
|
|
103
150
|
<div className="ecx-style-tab">
|
|
104
|
-
<div className="ecx-style-device">
|
|
105
|
-
<span className="ecx-field-label">{t.device}</span>
|
|
106
|
-
<Seg label={t.device} value={device} onChange={(d) => onDeviceChange(d ?? "base")}
|
|
107
|
-
options={[["base", Monitor, t.device_base], ["tablet", Tablet, t.device_tablet], ["mobile", Smartphone, t.device_mobile]]} />
|
|
108
|
-
</div>
|
|
109
151
|
|
|
110
152
|
{part !== "advanced" && variants && variants.length > 0 && (
|
|
111
153
|
<div className="ecx-style-row">
|
|
@@ -119,7 +161,9 @@ export function StyleTab({ type, style: raw, onChange, device, onDeviceChange, v
|
|
|
119
161
|
</div>
|
|
120
162
|
)}
|
|
121
163
|
|
|
122
|
-
{
|
|
164
|
+
{parts && lead}
|
|
165
|
+
|
|
166
|
+
{show("typography", TYPO) && <Section title={t.style_typography} modified={has(TYPO)} onReset={() => reset(TYPO)} moreOpen={has(["fontFamily", "letterSpacing", "textDecoration", "textTransform", "textShadow", "writingMode"])}
|
|
123
167
|
more={<>
|
|
124
168
|
{row("fontFamily", t.style_fontFamily,
|
|
125
169
|
<select className="ecx-input" value={style.fontFamily ?? ""} aria-label={t.style_fontFamily} onChange={(e) => set("fontFamily", e.target.value || undefined)}>
|
|
@@ -131,6 +175,9 @@ export function StyleTab({ type, style: raw, onChange, device, onDeviceChange, v
|
|
|
131
175
|
options={[["none", "—", t.none], ["underline", "U̲", t.underlineText], ["line-through", "S̶", t.strikeText]]} />)}
|
|
132
176
|
{row("transform", t.style_transform, <Seg label={t.style_transform} value={style.textTransform} onChange={(v) => set("textTransform", v)}
|
|
133
177
|
options={[["none", "—", t.none], ["uppercase", "AB", t.upper], ["lowercase", "ab", t.lower], ["capitalize", "Ab", t.capitalize]]} />)}
|
|
178
|
+
{row("writingMode", lt.writingMode, <Seg label={lt.writingMode} value={style.writingMode ?? "horizontal"} onChange={(v) => set("writingMode", v === "vertical" ? "vertical" : undefined)}
|
|
179
|
+
options={[["horizontal", lt.wmHorizontal, lt.wmHorizontal], ["vertical", lt.wmVertical, lt.wmVertical]]} />)}
|
|
180
|
+
<TextShadowRow style={style} set={set} />
|
|
134
181
|
</>}>
|
|
135
182
|
{row("fontSize", t.style_fontSize, <>
|
|
136
183
|
<Seg label={t.style_fontSize} value={get("fontSize")} onChange={(v) => set("fontSize", v)} options={sizes.map((v) => [v, v.toUpperCase(), presets?.fontSizes?.[v] ? `${v} · ${presets.fontSizes[v]}` : v] as [string, string, string])} />
|
|
@@ -150,31 +197,70 @@ export function StyleTab({ type, style: raw, onChange, device, onDeviceChange, v
|
|
|
150
197
|
options={[["left", AlignLeft, t.alignLeft], ["center", AlignCenter, t.alignCenter], ["right", AlignRight, t.alignRight], ["justify", AlignJustify, t.alignJustify]]} />)}
|
|
151
198
|
</Section>}
|
|
152
199
|
|
|
153
|
-
{show("color", ["color"]) && <Section title={t.style_color} modified={has(["color"])} onReset={() =>
|
|
154
|
-
{
|
|
155
|
-
{
|
|
156
|
-
|
|
200
|
+
{show("color", ["color", "textGradient", "link"]) && <Section title={t.style_color} modified={has(["color", "textGradient", "link"]) || !!style.hover?.color} onReset={() => commit({ ...style, color: undefined, textGradient: undefined, link: undefined, hover: style.hover && { ...style.hover, color: undefined } })}>
|
|
201
|
+
{hoverOk && <StateTabs value={colorState} onChange={setColorState} />}
|
|
202
|
+
{hoverOk && colorState === "hover" ? <>
|
|
203
|
+
<ColorInput label={t.style_text} value={style.hover?.color?.text} onChange={(v) => setHover({ color: { ...style.hover?.color, text: v } })} />
|
|
204
|
+
{!groups.has("background") && <ColorInput label={t.style_background} value={style.hover?.color?.background} onChange={(v) => setHover({ color: { ...style.hover?.color, background: v } })} />}
|
|
205
|
+
{container && <ColorInput label={t.style_linkHover} value={style.link?.hover} onChange={(v) => setGroup("link", "hover", v)} />}
|
|
206
|
+
</> : <>
|
|
207
|
+
<ColorInput label={t.style_text} value={style.color?.text} onChange={(v) => setGroup("color", "text", v)} />
|
|
208
|
+
{/* Khối có ô Nền: màu nền / nền chuyển màu sửa ở đó (một chỗ) */}
|
|
209
|
+
{!groups.has("background") && <ColorInput label={t.style_background} value={style.color?.background} onChange={(v) => setGroup("color", "background", v)} />}
|
|
210
|
+
{!groups.has("background") && fxOk && <Row label={lt.gradient} onReset={has(["gradient"]) ? () => reset(["gradient"]) : undefined}><GradientField value={style.gradient} onChange={(v) => set("gradient", v)} /></Row>}
|
|
211
|
+
<Row label={t.style_textGradient} onReset={has(["textGradient"]) ? () => reset(["textGradient"]) : undefined}><GradientField value={style.textGradient} onChange={(v) => set("textGradient", v)} /></Row>
|
|
212
|
+
{/* Khối chứa: màu liên kết của nội dung bên trong (Đoạn / Tiêu đề có mục Liên kết riêng) */}
|
|
213
|
+
{container && <ColorInput label={t.style_link} value={style.link?.color} onChange={(v) => setGroup("link", "color", v)} />}
|
|
214
|
+
{container && !hoverOk && <ColorInput label={t.style_linkHover} value={style.link?.hover} onChange={(v) => setGroup("link", "hover", v)} />}
|
|
215
|
+
</>}
|
|
157
216
|
</Section>}
|
|
158
217
|
|
|
159
|
-
{lead}
|
|
218
|
+
{!parts && lead}
|
|
160
219
|
|
|
161
|
-
{show("spacing", SPACING) && <Section title={t.style_spacing} modified={has(SPACING)} onReset={() => reset(SPACING)}
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
<SpacingControl label={t.style_padding} steps={spaces} value={get("padding")} inherited={inherited("padding")} onChange={(v) => set("padding", v)} labels={{ vertical: ct.vertical, horizontal: ct.horizontal, top: ct.sideTop, right: ct.sideRight, bottom: ct.sideBottom, left: ct.sideLeft, link: t.linkSides, unlink: t.unlinkSides }} />
|
|
165
|
-
<SpacingControl label={t.style_margin} steps={spaces} value={get("margin")} inherited={inherited("margin")} onChange={(v) => set("margin", v)} labels={{ vertical: ct.vertical, horizontal: ct.horizontal, top: ct.sideTop, right: ct.sideRight, bottom: ct.sideBottom, left: ct.sideLeft, link: t.linkSides, unlink: t.unlinkSides }} />
|
|
220
|
+
{show("spacing", SPACING) && <Section title={t.style_spacing} modified={has(SPACING)} onReset={() => reset(SPACING)}>
|
|
221
|
+
<SpacingControl kind="padding" device={device} onReset={has(["padding"]) ? () => reset(["padding"]) : undefined} label={t.style_padding} steps={spaces} value={get("padding")} inherited={inherited("padding")} onChange={(v) => set("padding", v)} labels={{ vertical: ct.vertical, horizontal: ct.horizontal, top: ct.sideTop, right: ct.sideRight, bottom: ct.sideBottom, left: ct.sideLeft, link: t.linkSides, unlink: t.unlinkSides }} />
|
|
222
|
+
<SpacingControl kind="margin" device={device} onReset={has(["margin"]) ? () => reset(["margin"]) : undefined} label={t.style_margin} steps={spaces} value={get("margin")} inherited={inherited("margin")} onChange={(v) => set("margin", v)} labels={{ vertical: ct.vertical, horizontal: ct.horizontal, top: ct.sideTop, right: ct.sideRight, bottom: ct.sideBottom, left: ct.sideLeft, link: t.linkSides, unlink: t.unlinkSides }} />
|
|
166
223
|
</Section>}
|
|
167
224
|
|
|
168
|
-
{
|
|
169
|
-
|
|
170
|
-
{
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
{
|
|
225
|
+
{/* Cấu trúc: kích thước khối (rộng, rộng tối đa, cao tối thiểu, tỉ lệ khung), khe giữa khối con */}
|
|
226
|
+
{inPart("spacing") && (groups.has("spacing") || has(STRUCTURE)) && <Section title={ct.structure} modified={has(STRUCTURE)} onReset={() => reset(STRUCTURE)} defaultOpen={has(STRUCTURE)}>
|
|
227
|
+
{structure}
|
|
228
|
+
{(["width", "maxWidth", "minHeight", ...(container ? ["gap" as const] : [])] as const).map((k) =>
|
|
229
|
+
row(k, t[`style_${k}`], <ValueInput label={t[`style_${k}`]} value={get(k)} inherited={inherited(k)} check={ok(k)} placeholder={k === "gap" ? "md, 24px" : "100%, 640px, 60vh"} onCommit={(v) => set(k, v)} />))}
|
|
230
|
+
{container && ([["zIndex", -1, 9999], ["grow", 0, 10], ["order", -10, 10]] as const).map(([k, min, max]) =>
|
|
231
|
+
row(k, ct[k], <input className="ecx-input" type="number" min={min} max={max} step={1} aria-label={ct[k]} value={get(k) ?? ""} placeholder={inherited(k)}
|
|
232
|
+
onChange={(e) => set(k, e.target.value === "" ? undefined : Number(e.target.value))} />))}
|
|
233
|
+
{container && <p className="ecx-field-help">{ct.orderHelp}</p>}
|
|
234
|
+
{fxOk && row("aspectRatio", lt.ratio,
|
|
235
|
+
<select className="ecx-input" aria-label={lt.ratio} value={style.aspectRatio ?? ""} onChange={(e) => set("aspectRatio", e.target.value || undefined)}>
|
|
236
|
+
<option value="">—</option>
|
|
237
|
+
{["1/1", "4/3", "3/2", "16/9", "21/9", "3/4", "2/3", "9/16"].map((r) => <option key={r} value={r}>{r.replace("/", ":")}</option>)}
|
|
238
|
+
</select>)}
|
|
174
239
|
</Section>}
|
|
175
240
|
|
|
176
|
-
{
|
|
177
|
-
|
|
241
|
+
{inPart("border") && (groups.has("border") || fxOk || has(["border", "radius"]) || !!(style.hover?.border || style.hover?.shadow || style.hover?.lift)) && <Section title={t.style_border} modified={has(["border", "radius", "shadow"]) || !!(style.hover?.border || style.hover?.shadow || style.hover?.lift)}
|
|
242
|
+
onReset={() => commit({ ...style, border: undefined, radius: undefined, shadow: undefined, hover: style.hover && { ...style.hover, border: undefined, shadow: undefined, lift: undefined } })}
|
|
243
|
+
defaultOpen={has(["border", "radius", "shadow"])}>
|
|
244
|
+
{hoverOk && <StateTabs value={borderState} onChange={setBorderState} />}
|
|
245
|
+
{hoverOk && borderState === "hover" ? <>
|
|
246
|
+
<ColorInput label={t.style_borderColor} value={style.hover?.border?.color} onChange={(v) => setHover({ border: v ? { color: v } : undefined })} />
|
|
247
|
+
<Row label={lt.shadow}>{shadowSelect(style.hover?.shadow, (v) => setHover({ shadow: v }), `${lt.hover} ${lt.shadow}`, false)}</Row>
|
|
248
|
+
<label className="ecx-check"><input type="checkbox" checked={!!style.hover?.lift} onChange={(e) => setHover({ lift: e.target.checked || undefined })} /> {lt.lift}</label>
|
|
249
|
+
</> : <>
|
|
250
|
+
{(groups.has("border") || has(["border", "radius"])) && <>
|
|
251
|
+
<FourInput label={t.style_borderWidth} keys={["top", "right", "bottom", "left"]} keyLabels={{ top: ct.sideTop, right: ct.sideRight, bottom: ct.sideBottom, left: ct.sideLeft }} value={style.border?.width} max={20} units={["px", "em", "rem"]} onChange={(v) => setGroup("border", "width", v)} />
|
|
252
|
+
{row("borderStyle", t.style_borderStyle, <Seg label={t.style_borderStyle} value={style.border?.style} onChange={(v) => setGroup("border", "style", v)}
|
|
253
|
+
options={[["solid", "—", t.border_solid], ["dashed", "- -", t.border_dashed], ["dotted", "···", t.border_dotted]]} />)}
|
|
254
|
+
<ColorInput label={t.style_borderColor} value={style.border?.color} onChange={(v) => setGroup("border", "color", v)} />
|
|
255
|
+
<FourInput label={t.style_radius} corners keys={["topLeft", "topRight", "bottomRight", "bottomLeft"]} keyLabels={{ topLeft: ct.cornerTopLeft, topRight: ct.cornerTopRight, bottomRight: ct.cornerBottomRight, bottomLeft: ct.cornerBottomLeft }} value={style.radius} max={60} units={["px", "%", "em", "rem"]} onReset={has(["radius"]) ? () => reset(["radius"]) : undefined} onChange={(v) => set("radius", v)} />
|
|
256
|
+
</>}
|
|
257
|
+
{fxOk && row("shadow", lt.shadow, shadowSelect(style.shadow, (v) => set("shadow", v), lt.shadow))}
|
|
258
|
+
</>}
|
|
259
|
+
</Section>}
|
|
260
|
+
|
|
261
|
+
{part === "advanced" && fxOk && <Section title={lt.sticky} modified={!!style.position} defaultOpen={!!style.position}>
|
|
262
|
+
<label className="ecx-check"><input type="checkbox" checked={!!style.position} onChange={(e) => set("position", e.target.checked ? { type: "sticky" } : undefined)} /> {lt.sticky}</label>
|
|
263
|
+
</Section>}
|
|
178
264
|
|
|
179
265
|
{show("motion", ["motion"]) && <MotionPanel type={type} style={raw} onChange={onChange} />}
|
|
180
266
|
|