@nextsparkjs/core 0.1.0-beta.67 → 0.1.0-beta.68
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/dashboard/block-editor/block-picker.d.ts +7 -2
- package/dist/components/dashboard/block-editor/block-picker.d.ts.map +1 -1
- package/dist/components/dashboard/block-editor/block-picker.js +27 -20
- package/dist/components/dashboard/block-editor/block-preview-canvas.d.ts.map +1 -1
- package/dist/components/dashboard/block-editor/block-preview-canvas.js +37 -37
- package/dist/components/dashboard/block-editor/block-settings-panel.js +3 -3
- package/dist/components/dashboard/block-editor/builder-editor-view.d.ts.map +1 -1
- package/dist/components/dashboard/block-editor/builder-editor-view.js +124 -82
- package/dist/components/dashboard/block-editor/config-panel.d.ts +18 -0
- package/dist/components/dashboard/block-editor/config-panel.d.ts.map +1 -0
- package/dist/components/dashboard/block-editor/config-panel.js +413 -0
- package/dist/components/dashboard/block-editor/floating-block-toolbar.js +1 -1
- package/dist/components/dashboard/block-editor/pattern-card.js +1 -1
- package/dist/components/dashboard/block-editor/pattern-reference-preview.js +1 -1
- package/dist/components/dashboard/block-editor/sortable-block.js +1 -1
- package/dist/components/dashboard/block-editor/tree-view-node.d.ts +11 -0
- package/dist/components/dashboard/block-editor/tree-view-node.d.ts.map +1 -0
- package/dist/components/dashboard/block-editor/tree-view-node.js +91 -0
- package/dist/components/dashboard/block-editor/tree-view.d.ts +17 -0
- package/dist/components/dashboard/block-editor/tree-view.d.ts.map +1 -0
- package/dist/components/dashboard/block-editor/tree-view.js +125 -0
- package/dist/components/dashboard/block-editor/viewport-toggle.d.ts +10 -0
- package/dist/components/dashboard/block-editor/viewport-toggle.d.ts.map +1 -0
- package/dist/components/dashboard/block-editor/viewport-toggle.js +55 -0
- package/dist/components/public/pageBuilder/PageRenderer.d.ts.map +1 -1
- package/dist/components/public/pageBuilder/PageRenderer.js +10 -1
- package/dist/components/ui/dynamic-icon.d.ts +12 -0
- package/dist/components/ui/dynamic-icon.d.ts.map +1 -0
- package/dist/components/ui/dynamic-icon.js +11 -0
- package/dist/lib/selectors/core-selectors.d.ts +98 -44
- package/dist/lib/selectors/core-selectors.d.ts.map +1 -1
- package/dist/lib/selectors/domains/block-editor.selectors.d.ts +136 -71
- package/dist/lib/selectors/domains/block-editor.selectors.d.ts.map +1 -1
- package/dist/lib/selectors/domains/block-editor.selectors.js +130 -60
- package/dist/lib/selectors/selectors.d.ts +196 -88
- package/dist/lib/selectors/selectors.d.ts.map +1 -1
- package/dist/messages/en/admin.json +15 -1
- package/dist/messages/en/index.d.ts +14 -0
- package/dist/messages/en/index.d.ts.map +1 -1
- package/dist/messages/es/admin.json +16 -1
- package/dist/messages/es/index.d.ts +15 -0
- package/dist/messages/es/index.d.ts.map +1 -1
- package/dist/presets/blocks/cta-section/component.tsx +4 -4
- package/dist/presets/blocks/features-grid/component.tsx +5 -5
- package/dist/presets/blocks/hero/component.tsx +2 -2
- package/dist/presets/blocks/testimonials/component.tsx +4 -4
- package/dist/presets/blocks/text-content/component.tsx +2 -2
- package/dist/presets/theme/blocks/hero/component.tsx +2 -2
- package/dist/presets/theme/tests/cypress/src/core/BlockEditorBasePOM.ts +123 -24
- package/dist/styles/classes.json +9 -2
- package/dist/styles/ui.css +1 -1
- package/dist/templates/features/blog/blocks/post-content/component.tsx +2 -2
- package/dist/templates/features/pages/blocks/hero/component.tsx +2 -2
- package/dist/templates/next.config.mjs +5 -3
- package/package.json +5 -4
- package/templates/features/blog/blocks/post-content/component.tsx +2 -2
- package/templates/features/pages/blocks/hero/component.tsx +2 -2
- package/templates/next.config.mjs +5 -3
|
@@ -0,0 +1,413 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useState, useCallback, useMemo } from "react";
|
|
4
|
+
import { useTranslations } from "next-intl";
|
|
5
|
+
import { useQuery } from "@tanstack/react-query";
|
|
6
|
+
import {
|
|
7
|
+
Collapsible,
|
|
8
|
+
CollapsibleContent,
|
|
9
|
+
CollapsibleTrigger
|
|
10
|
+
} from "../../ui/collapsible.js";
|
|
11
|
+
import { ScrollArea } from "../../ui/scroll-area.js";
|
|
12
|
+
import { Input } from "../../ui/input.js";
|
|
13
|
+
import { Textarea } from "../../ui/textarea.js";
|
|
14
|
+
import { Label } from "../../ui/label.js";
|
|
15
|
+
import { Badge } from "../../ui/badge.js";
|
|
16
|
+
import { Button } from "../../ui/button.js";
|
|
17
|
+
import { Checkbox } from "../../ui/checkbox.js";
|
|
18
|
+
import {
|
|
19
|
+
ChevronDown,
|
|
20
|
+
FileText,
|
|
21
|
+
Image,
|
|
22
|
+
Tag,
|
|
23
|
+
Search,
|
|
24
|
+
Settings2,
|
|
25
|
+
Plus,
|
|
26
|
+
Trash2,
|
|
27
|
+
Loader2
|
|
28
|
+
} from "lucide-react";
|
|
29
|
+
import { cn } from "../../../lib/utils.js";
|
|
30
|
+
import { sel } from "../../../lib/test/index.js";
|
|
31
|
+
function ConfigPanel({
|
|
32
|
+
entityConfig,
|
|
33
|
+
entityFields,
|
|
34
|
+
onEntityFieldChange,
|
|
35
|
+
pageSettings,
|
|
36
|
+
onPageSettingsChange
|
|
37
|
+
}) {
|
|
38
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
|
|
39
|
+
const t = useTranslations("admin.builder");
|
|
40
|
+
const tSettings = useTranslations("admin.pages.settings");
|
|
41
|
+
const [entityFieldsOpen, setEntityFieldsOpen] = useState(true);
|
|
42
|
+
const [seoMetaOpen, setSeoMetaOpen] = useState(true);
|
|
43
|
+
const sidebarFields = ((_a = entityConfig.builder) == null ? void 0 : _a.sidebarFields) || [];
|
|
44
|
+
const taxonomyTypes = ((_b = entityConfig.taxonomies) == null ? void 0 : _b.types) || [];
|
|
45
|
+
const taxonomiesEnabled = ((_c = entityConfig.taxonomies) == null ? void 0 : _c.enabled) && taxonomyTypes.length > 0;
|
|
46
|
+
const firstTaxonomy = taxonomyTypes[0];
|
|
47
|
+
const taxonomyApiPath = ((_d = firstTaxonomy == null ? void 0 : firstTaxonomy.type) == null ? void 0 : _d.replace("_", "-")) + "s";
|
|
48
|
+
const { data: taxonomyData, isLoading: taxonomyLoading } = useQuery({
|
|
49
|
+
queryKey: ["taxonomies", taxonomyApiPath],
|
|
50
|
+
queryFn: async () => {
|
|
51
|
+
const response = await fetch(`/api/v1/${taxonomyApiPath}`);
|
|
52
|
+
if (!response.ok) return { data: [] };
|
|
53
|
+
return response.json();
|
|
54
|
+
},
|
|
55
|
+
enabled: taxonomiesEnabled && !!taxonomyApiPath
|
|
56
|
+
});
|
|
57
|
+
const taxonomyItems = (taxonomyData == null ? void 0 : taxonomyData.data) || [];
|
|
58
|
+
const currentCategories = entityFields.categories || [];
|
|
59
|
+
const showEntityFieldsSection = useMemo(() => {
|
|
60
|
+
return sidebarFields.length > 0 || taxonomiesEnabled;
|
|
61
|
+
}, [sidebarFields.length, taxonomiesEnabled]);
|
|
62
|
+
const showSeoSection = ((_e = entityConfig.builder) == null ? void 0 : _e.seo) !== false;
|
|
63
|
+
const renderField = (fieldName) => {
|
|
64
|
+
const value = entityFields[fieldName];
|
|
65
|
+
const isTextarea = fieldName.toLowerCase().includes("excerpt") || fieldName.toLowerCase().includes("description") || fieldName.toLowerCase().includes("summary");
|
|
66
|
+
const isImage = fieldName.toLowerCase().includes("image") || fieldName.toLowerCase().includes("thumbnail") || fieldName.toLowerCase().includes("photo");
|
|
67
|
+
const fieldLabel = fieldName.charAt(0).toUpperCase() + fieldName.slice(1).replace(/([A-Z])/g, " $1");
|
|
68
|
+
if (isTextarea) {
|
|
69
|
+
return /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
|
|
70
|
+
/* @__PURE__ */ jsxs(Label, { htmlFor: fieldName, className: "flex items-center gap-2", children: [
|
|
71
|
+
/* @__PURE__ */ jsx(FileText, { className: "h-4 w-4 text-muted-foreground" }),
|
|
72
|
+
fieldLabel
|
|
73
|
+
] }),
|
|
74
|
+
/* @__PURE__ */ jsx(
|
|
75
|
+
Textarea,
|
|
76
|
+
{
|
|
77
|
+
id: fieldName,
|
|
78
|
+
value: value || "",
|
|
79
|
+
onChange: (e) => onEntityFieldChange(fieldName, e.target.value),
|
|
80
|
+
placeholder: t("placeholders.excerpt"),
|
|
81
|
+
rows: 4,
|
|
82
|
+
className: "resize-none",
|
|
83
|
+
"data-cy": sel("blockEditor.configPanel.entityFieldsSection.field", { name: fieldName })
|
|
84
|
+
}
|
|
85
|
+
)
|
|
86
|
+
] }, fieldName);
|
|
87
|
+
}
|
|
88
|
+
if (isImage) {
|
|
89
|
+
return /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
|
|
90
|
+
/* @__PURE__ */ jsxs(Label, { htmlFor: fieldName, className: "flex items-center gap-2", children: [
|
|
91
|
+
/* @__PURE__ */ jsx(Image, { className: "h-4 w-4 text-muted-foreground" }),
|
|
92
|
+
fieldLabel
|
|
93
|
+
] }),
|
|
94
|
+
/* @__PURE__ */ jsx(
|
|
95
|
+
Input,
|
|
96
|
+
{
|
|
97
|
+
id: fieldName,
|
|
98
|
+
type: "url",
|
|
99
|
+
value: value || "",
|
|
100
|
+
onChange: (e) => onEntityFieldChange(fieldName, e.target.value),
|
|
101
|
+
placeholder: t("placeholders.imageUrl"),
|
|
102
|
+
"data-cy": sel("blockEditor.configPanel.entityFieldsSection.field", { name: fieldName })
|
|
103
|
+
}
|
|
104
|
+
),
|
|
105
|
+
value && /* @__PURE__ */ jsx("div", { className: "mt-2 rounded-md border overflow-hidden", children: /* @__PURE__ */ jsx(
|
|
106
|
+
"img",
|
|
107
|
+
{
|
|
108
|
+
src: value,
|
|
109
|
+
alt: fieldLabel,
|
|
110
|
+
className: "w-full h-32 object-cover",
|
|
111
|
+
onError: (e) => {
|
|
112
|
+
e.target.style.display = "none";
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
) })
|
|
116
|
+
] }, fieldName);
|
|
117
|
+
}
|
|
118
|
+
return /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
|
|
119
|
+
/* @__PURE__ */ jsx(Label, { htmlFor: fieldName, children: fieldLabel }),
|
|
120
|
+
/* @__PURE__ */ jsx(
|
|
121
|
+
Input,
|
|
122
|
+
{
|
|
123
|
+
id: fieldName,
|
|
124
|
+
value: value || "",
|
|
125
|
+
onChange: (e) => onEntityFieldChange(fieldName, e.target.value),
|
|
126
|
+
"data-cy": sel("blockEditor.configPanel.entityFieldsSection.field", { name: fieldName })
|
|
127
|
+
}
|
|
128
|
+
)
|
|
129
|
+
] }, fieldName);
|
|
130
|
+
};
|
|
131
|
+
const handleCategoryClick = useCallback((categoryId) => {
|
|
132
|
+
const newCategories = currentCategories.includes(categoryId) ? currentCategories.filter((id) => id !== categoryId) : [...currentCategories, categoryId];
|
|
133
|
+
onEntityFieldChange("categories", newCategories);
|
|
134
|
+
}, [currentCategories, onEntityFieldChange]);
|
|
135
|
+
const handleSeoChange = useCallback((field, value) => {
|
|
136
|
+
onPageSettingsChange({
|
|
137
|
+
seo: { ...pageSettings.seo || {}, [field]: value },
|
|
138
|
+
customFields: pageSettings.customFields || []
|
|
139
|
+
});
|
|
140
|
+
}, [pageSettings, onPageSettingsChange]);
|
|
141
|
+
const handleAddCustomField = useCallback(() => {
|
|
142
|
+
onPageSettingsChange({
|
|
143
|
+
seo: pageSettings.seo || {},
|
|
144
|
+
customFields: [...pageSettings.customFields || [], { key: "", value: "" }]
|
|
145
|
+
});
|
|
146
|
+
}, [pageSettings, onPageSettingsChange]);
|
|
147
|
+
const handleUpdateCustomField = useCallback((index, field, value) => {
|
|
148
|
+
const newFields = (pageSettings.customFields || []).map(
|
|
149
|
+
(f, i) => i === index ? { ...f, [field]: value } : f
|
|
150
|
+
);
|
|
151
|
+
onPageSettingsChange({
|
|
152
|
+
seo: pageSettings.seo || {},
|
|
153
|
+
customFields: newFields
|
|
154
|
+
});
|
|
155
|
+
}, [pageSettings, onPageSettingsChange]);
|
|
156
|
+
const handleRemoveCustomField = useCallback((index) => {
|
|
157
|
+
onPageSettingsChange({
|
|
158
|
+
seo: pageSettings.seo || {},
|
|
159
|
+
customFields: (pageSettings.customFields || []).filter((_, i) => i !== index)
|
|
160
|
+
});
|
|
161
|
+
}, [pageSettings, onPageSettingsChange]);
|
|
162
|
+
return /* @__PURE__ */ jsx(
|
|
163
|
+
"div",
|
|
164
|
+
{
|
|
165
|
+
"data-cy": sel("blockEditor.configPanel.container"),
|
|
166
|
+
className: "h-full bg-background",
|
|
167
|
+
children: /* @__PURE__ */ jsx(
|
|
168
|
+
ScrollArea,
|
|
169
|
+
{
|
|
170
|
+
"data-cy": sel("blockEditor.configPanel.scroll"),
|
|
171
|
+
className: "h-full",
|
|
172
|
+
children: /* @__PURE__ */ jsxs("div", { className: "max-w-2xl mx-auto p-6 space-y-6", children: [
|
|
173
|
+
showEntityFieldsSection && /* @__PURE__ */ jsxs(
|
|
174
|
+
Collapsible,
|
|
175
|
+
{
|
|
176
|
+
open: entityFieldsOpen,
|
|
177
|
+
onOpenChange: setEntityFieldsOpen,
|
|
178
|
+
"data-cy": sel("blockEditor.configPanel.entityFieldsSection.container"),
|
|
179
|
+
children: [
|
|
180
|
+
/* @__PURE__ */ jsxs(
|
|
181
|
+
CollapsibleTrigger,
|
|
182
|
+
{
|
|
183
|
+
"data-cy": sel("blockEditor.configPanel.entityFieldsSection.trigger"),
|
|
184
|
+
className: "flex items-center justify-between w-full p-4 bg-card rounded-lg border hover:bg-accent/50 transition-colors",
|
|
185
|
+
children: [
|
|
186
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
187
|
+
/* @__PURE__ */ jsx(FileText, { className: "h-4 w-4 text-muted-foreground" }),
|
|
188
|
+
/* @__PURE__ */ jsx("h3", { className: "font-semibold", children: t("config.entityFields") })
|
|
189
|
+
] }),
|
|
190
|
+
/* @__PURE__ */ jsx(ChevronDown, { className: cn(
|
|
191
|
+
"h-4 w-4 text-muted-foreground transition-transform",
|
|
192
|
+
entityFieldsOpen && "rotate-180"
|
|
193
|
+
) })
|
|
194
|
+
]
|
|
195
|
+
}
|
|
196
|
+
),
|
|
197
|
+
/* @__PURE__ */ jsx(
|
|
198
|
+
CollapsibleContent,
|
|
199
|
+
{
|
|
200
|
+
"data-cy": sel("blockEditor.configPanel.entityFieldsSection.content"),
|
|
201
|
+
className: "pt-4",
|
|
202
|
+
children: /* @__PURE__ */ jsxs("div", { className: "space-y-6 p-4 bg-card rounded-lg border", children: [
|
|
203
|
+
sidebarFields.length > 0 && /* @__PURE__ */ jsx("div", { className: "space-y-4", children: sidebarFields.map((fieldName) => renderField(fieldName)) }),
|
|
204
|
+
taxonomiesEnabled && firstTaxonomy && /* @__PURE__ */ jsxs("div", { className: "space-y-3", children: [
|
|
205
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
206
|
+
/* @__PURE__ */ jsx(Tag, { className: "h-4 w-4 text-muted-foreground" }),
|
|
207
|
+
/* @__PURE__ */ jsx(Label, { children: firstTaxonomy.label || "Categories" })
|
|
208
|
+
] }),
|
|
209
|
+
taxonomyLoading ? /* @__PURE__ */ jsx("div", { className: "flex items-center justify-center py-4", children: /* @__PURE__ */ jsx(Loader2, { className: "h-4 w-4 animate-spin text-muted-foreground" }) }) : taxonomyItems.length === 0 ? /* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground", children: t("sidebar.noCategories") }) : /* @__PURE__ */ jsx("div", { className: "space-y-2", children: taxonomyItems.map((item) => /* @__PURE__ */ jsxs(
|
|
210
|
+
"div",
|
|
211
|
+
{
|
|
212
|
+
className: "flex items-center gap-2 rounded-md border p-2 hover:bg-accent transition-colors cursor-pointer",
|
|
213
|
+
onClick: () => handleCategoryClick(item.id),
|
|
214
|
+
children: [
|
|
215
|
+
/* @__PURE__ */ jsx(
|
|
216
|
+
Checkbox,
|
|
217
|
+
{
|
|
218
|
+
checked: currentCategories.includes(item.id),
|
|
219
|
+
onCheckedChange: () => handleCategoryClick(item.id)
|
|
220
|
+
}
|
|
221
|
+
),
|
|
222
|
+
/* @__PURE__ */ jsx("span", { className: "text-sm flex-1", children: item.name }),
|
|
223
|
+
item.color && /* @__PURE__ */ jsx(
|
|
224
|
+
"div",
|
|
225
|
+
{
|
|
226
|
+
className: "h-3 w-3 rounded-full",
|
|
227
|
+
style: { backgroundColor: item.color }
|
|
228
|
+
}
|
|
229
|
+
)
|
|
230
|
+
]
|
|
231
|
+
},
|
|
232
|
+
item.id
|
|
233
|
+
)) }),
|
|
234
|
+
currentCategories.length > 0 && /* @__PURE__ */ jsx("div", { className: "flex flex-wrap gap-1 pt-2", children: currentCategories.map((catId) => {
|
|
235
|
+
const cat = taxonomyItems.find((t2) => t2.id === catId);
|
|
236
|
+
return cat ? /* @__PURE__ */ jsxs(
|
|
237
|
+
Badge,
|
|
238
|
+
{
|
|
239
|
+
variant: "secondary",
|
|
240
|
+
className: "cursor-pointer",
|
|
241
|
+
onClick: () => handleCategoryClick(cat.id),
|
|
242
|
+
style: cat.color ? { backgroundColor: cat.color, color: "#fff" } : void 0,
|
|
243
|
+
children: [
|
|
244
|
+
cat.name,
|
|
245
|
+
" \xD7"
|
|
246
|
+
]
|
|
247
|
+
},
|
|
248
|
+
cat.id
|
|
249
|
+
) : null;
|
|
250
|
+
}) })
|
|
251
|
+
] })
|
|
252
|
+
] })
|
|
253
|
+
}
|
|
254
|
+
)
|
|
255
|
+
]
|
|
256
|
+
}
|
|
257
|
+
),
|
|
258
|
+
showSeoSection && /* @__PURE__ */ jsxs(
|
|
259
|
+
Collapsible,
|
|
260
|
+
{
|
|
261
|
+
open: seoMetaOpen,
|
|
262
|
+
onOpenChange: setSeoMetaOpen,
|
|
263
|
+
"data-cy": sel("blockEditor.configPanel.seoMetaSection.container"),
|
|
264
|
+
children: [
|
|
265
|
+
/* @__PURE__ */ jsxs(
|
|
266
|
+
CollapsibleTrigger,
|
|
267
|
+
{
|
|
268
|
+
"data-cy": sel("blockEditor.configPanel.seoMetaSection.trigger"),
|
|
269
|
+
className: "flex items-center justify-between w-full p-4 bg-card rounded-lg border hover:bg-accent/50 transition-colors",
|
|
270
|
+
children: [
|
|
271
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
272
|
+
/* @__PURE__ */ jsx(Search, { className: "h-4 w-4 text-muted-foreground" }),
|
|
273
|
+
/* @__PURE__ */ jsx("h3", { className: "font-semibold", children: t("config.seoMeta") })
|
|
274
|
+
] }),
|
|
275
|
+
/* @__PURE__ */ jsx(ChevronDown, { className: cn(
|
|
276
|
+
"h-4 w-4 text-muted-foreground transition-transform",
|
|
277
|
+
seoMetaOpen && "rotate-180"
|
|
278
|
+
) })
|
|
279
|
+
]
|
|
280
|
+
}
|
|
281
|
+
),
|
|
282
|
+
/* @__PURE__ */ jsx(
|
|
283
|
+
CollapsibleContent,
|
|
284
|
+
{
|
|
285
|
+
"data-cy": sel("blockEditor.configPanel.seoMetaSection.content"),
|
|
286
|
+
className: "pt-4",
|
|
287
|
+
children: /* @__PURE__ */ jsxs("div", { className: "space-y-6 p-4 bg-card rounded-lg border", children: [
|
|
288
|
+
/* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
|
|
289
|
+
/* @__PURE__ */ jsx(Label, { htmlFor: "meta-title", children: tSettings("seo.metaTitle") }),
|
|
290
|
+
/* @__PURE__ */ jsx(
|
|
291
|
+
Input,
|
|
292
|
+
{
|
|
293
|
+
id: "meta-title",
|
|
294
|
+
value: ((_f = pageSettings.seo) == null ? void 0 : _f.metaTitle) || "",
|
|
295
|
+
onChange: (e) => handleSeoChange("metaTitle", e.target.value),
|
|
296
|
+
placeholder: tSettings("seo.metaTitlePlaceholder"),
|
|
297
|
+
"data-cy": sel("blockEditor.configPanel.seoMetaSection.metaTitle")
|
|
298
|
+
}
|
|
299
|
+
),
|
|
300
|
+
/* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground", children: tSettings("seo.metaTitleHint") })
|
|
301
|
+
] }),
|
|
302
|
+
/* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
|
|
303
|
+
/* @__PURE__ */ jsx(Label, { htmlFor: "meta-description", children: tSettings("seo.metaDescription") }),
|
|
304
|
+
/* @__PURE__ */ jsx(
|
|
305
|
+
Textarea,
|
|
306
|
+
{
|
|
307
|
+
id: "meta-description",
|
|
308
|
+
value: ((_g = pageSettings.seo) == null ? void 0 : _g.metaDescription) || "",
|
|
309
|
+
onChange: (e) => handleSeoChange("metaDescription", e.target.value),
|
|
310
|
+
placeholder: tSettings("seo.metaDescriptionPlaceholder"),
|
|
311
|
+
rows: 3,
|
|
312
|
+
"data-cy": sel("blockEditor.configPanel.seoMetaSection.metaDescription")
|
|
313
|
+
}
|
|
314
|
+
),
|
|
315
|
+
/* @__PURE__ */ jsxs("p", { className: "text-xs text-muted-foreground", children: [
|
|
316
|
+
((_i = (_h = pageSettings.seo) == null ? void 0 : _h.metaDescription) == null ? void 0 : _i.length) || 0,
|
|
317
|
+
"/160 ",
|
|
318
|
+
tSettings("seo.characters")
|
|
319
|
+
] })
|
|
320
|
+
] }),
|
|
321
|
+
/* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
|
|
322
|
+
/* @__PURE__ */ jsx(Label, { htmlFor: "meta-keywords", children: tSettings("seo.metaKeywords") }),
|
|
323
|
+
/* @__PURE__ */ jsx(
|
|
324
|
+
Input,
|
|
325
|
+
{
|
|
326
|
+
id: "meta-keywords",
|
|
327
|
+
value: ((_j = pageSettings.seo) == null ? void 0 : _j.metaKeywords) || "",
|
|
328
|
+
onChange: (e) => handleSeoChange("metaKeywords", e.target.value),
|
|
329
|
+
placeholder: tSettings("seo.metaKeywordsPlaceholder"),
|
|
330
|
+
"data-cy": sel("blockEditor.configPanel.seoMetaSection.metaKeywords")
|
|
331
|
+
}
|
|
332
|
+
)
|
|
333
|
+
] }),
|
|
334
|
+
/* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
|
|
335
|
+
/* @__PURE__ */ jsx(Label, { htmlFor: "og-image", children: tSettings("seo.ogImage") }),
|
|
336
|
+
/* @__PURE__ */ jsx(
|
|
337
|
+
Input,
|
|
338
|
+
{
|
|
339
|
+
id: "og-image",
|
|
340
|
+
value: ((_k = pageSettings.seo) == null ? void 0 : _k.ogImage) || "",
|
|
341
|
+
onChange: (e) => handleSeoChange("ogImage", e.target.value),
|
|
342
|
+
placeholder: tSettings("seo.ogImagePlaceholder"),
|
|
343
|
+
"data-cy": sel("blockEditor.configPanel.seoMetaSection.ogImage")
|
|
344
|
+
}
|
|
345
|
+
)
|
|
346
|
+
] }),
|
|
347
|
+
/* @__PURE__ */ jsxs("div", { className: "space-y-4 pt-4 border-t", children: [
|
|
348
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
349
|
+
/* @__PURE__ */ jsx(Settings2, { className: "h-4 w-4 text-muted-foreground" }),
|
|
350
|
+
/* @__PURE__ */ jsx(Label, { children: tSettings("customFields.title") })
|
|
351
|
+
] }),
|
|
352
|
+
(pageSettings.customFields || []).length === 0 ? /* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground text-center py-4", children: tSettings("customFields.empty") }) : /* @__PURE__ */ jsx("div", { className: "space-y-3", children: (pageSettings.customFields || []).map((field, index) => /* @__PURE__ */ jsxs("div", { className: "flex gap-2 items-start", children: [
|
|
353
|
+
/* @__PURE__ */ jsx("div", { className: "flex-1", children: /* @__PURE__ */ jsx(
|
|
354
|
+
Input,
|
|
355
|
+
{
|
|
356
|
+
value: field.key,
|
|
357
|
+
onChange: (e) => handleUpdateCustomField(index, "key", e.target.value),
|
|
358
|
+
placeholder: tSettings("customFields.keyPlaceholder"),
|
|
359
|
+
className: "font-mono text-sm",
|
|
360
|
+
"data-cy": sel("blockEditor.configPanel.seoMetaSection.customFields.fieldKey", { index })
|
|
361
|
+
}
|
|
362
|
+
) }),
|
|
363
|
+
/* @__PURE__ */ jsx("div", { className: "flex-1", children: /* @__PURE__ */ jsx(
|
|
364
|
+
Input,
|
|
365
|
+
{
|
|
366
|
+
value: field.value,
|
|
367
|
+
onChange: (e) => handleUpdateCustomField(index, "value", e.target.value),
|
|
368
|
+
placeholder: tSettings("customFields.valuePlaceholder"),
|
|
369
|
+
"data-cy": sel("blockEditor.configPanel.seoMetaSection.customFields.fieldValue", { index })
|
|
370
|
+
}
|
|
371
|
+
) }),
|
|
372
|
+
/* @__PURE__ */ jsx(
|
|
373
|
+
Button,
|
|
374
|
+
{
|
|
375
|
+
variant: "ghost",
|
|
376
|
+
size: "icon",
|
|
377
|
+
className: "shrink-0 text-muted-foreground hover:text-destructive",
|
|
378
|
+
onClick: () => handleRemoveCustomField(index),
|
|
379
|
+
"data-cy": sel("blockEditor.configPanel.seoMetaSection.customFields.fieldRemove", { index }),
|
|
380
|
+
children: /* @__PURE__ */ jsx(Trash2, { className: "h-4 w-4" })
|
|
381
|
+
}
|
|
382
|
+
)
|
|
383
|
+
] }, index)) }),
|
|
384
|
+
/* @__PURE__ */ jsxs(
|
|
385
|
+
Button,
|
|
386
|
+
{
|
|
387
|
+
variant: "outline",
|
|
388
|
+
size: "sm",
|
|
389
|
+
onClick: handleAddCustomField,
|
|
390
|
+
className: "w-full",
|
|
391
|
+
"data-cy": sel("blockEditor.configPanel.seoMetaSection.customFields.addButton"),
|
|
392
|
+
children: [
|
|
393
|
+
/* @__PURE__ */ jsx(Plus, { className: "h-4 w-4 mr-2" }),
|
|
394
|
+
tSettings("customFields.add")
|
|
395
|
+
]
|
|
396
|
+
}
|
|
397
|
+
)
|
|
398
|
+
] })
|
|
399
|
+
] })
|
|
400
|
+
}
|
|
401
|
+
)
|
|
402
|
+
]
|
|
403
|
+
}
|
|
404
|
+
)
|
|
405
|
+
] })
|
|
406
|
+
}
|
|
407
|
+
)
|
|
408
|
+
}
|
|
409
|
+
);
|
|
410
|
+
}
|
|
411
|
+
export {
|
|
412
|
+
ConfigPanel
|
|
413
|
+
};
|
|
@@ -24,7 +24,7 @@ function FloatingBlockToolbar({
|
|
|
24
24
|
"bg-primary text-primary-foreground rounded-full",
|
|
25
25
|
"px-3 py-1 text-xs font-medium shadow-lg",
|
|
26
26
|
"flex items-center gap-3",
|
|
27
|
-
"transition-
|
|
27
|
+
"transition-[opacity,transform] duration-200",
|
|
28
28
|
isVisible ? "opacity-100 translate-y-0 pointer-events-auto" : "opacity-0 translate-y-2 pointer-events-none"
|
|
29
29
|
),
|
|
30
30
|
"data-cy": sel("blockEditor.previewCanvas.floatingToolbar.container", { id: blockId }),
|
|
@@ -8,7 +8,7 @@ function PatternCard({ pattern, onSelect }) {
|
|
|
8
8
|
return /* @__PURE__ */ jsxs(
|
|
9
9
|
"div",
|
|
10
10
|
{
|
|
11
|
-
className: "group relative bg-background border border-border rounded-lg p-3 hover:border-primary hover:shadow-md transition-
|
|
11
|
+
className: "group relative bg-background border border-border rounded-lg p-3 hover:border-primary hover:shadow-md transition-[border-color,box-shadow] cursor-pointer",
|
|
12
12
|
onClick: () => onSelect(pattern.id),
|
|
13
13
|
"data-cy": sel("blockEditor.blockPicker.patternCard", { id: pattern.id }),
|
|
14
14
|
children: [
|
|
@@ -94,7 +94,7 @@ function PatternReferencePreview({
|
|
|
94
94
|
"div",
|
|
95
95
|
{
|
|
96
96
|
className: cn(
|
|
97
|
-
"group relative cursor-pointer transition-
|
|
97
|
+
"group relative cursor-pointer transition-[border-color] duration-150",
|
|
98
98
|
"border-2 rounded-lg overflow-hidden",
|
|
99
99
|
isSelected ? "border-primary border-solid" : "border-dashed border-muted-foreground/30",
|
|
100
100
|
"hover:border-primary/50"
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { BlockInstance } from '../../../types/blocks';
|
|
2
|
+
import { type PatternReference } from '../../../types/pattern-reference';
|
|
3
|
+
interface TreeViewNodeProps {
|
|
4
|
+
block: BlockInstance | PatternReference;
|
|
5
|
+
isSelected: boolean;
|
|
6
|
+
onSelect: () => void;
|
|
7
|
+
isPartOfPattern?: boolean;
|
|
8
|
+
}
|
|
9
|
+
export declare function TreeViewNode({ block, isSelected, onSelect, isPartOfPattern }: TreeViewNodeProps): import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export {};
|
|
11
|
+
//# sourceMappingURL=tree-view-node.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tree-view-node.d.ts","sourceRoot":"","sources":["../../../../src/components/dashboard/block-editor/tree-view-node.tsx"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAA;AAC1D,OAAO,EAAsB,KAAK,gBAAgB,EAAE,MAAM,kCAAkC,CAAA;AAE5F,UAAU,iBAAiB;IACzB,KAAK,EAAE,aAAa,GAAG,gBAAgB,CAAA;IACvC,UAAU,EAAE,OAAO,CAAA;IACnB,QAAQ,EAAE,MAAM,IAAI,CAAA;IACpB,eAAe,CAAC,EAAE,OAAO,CAAA;CAC1B;AAED,wBAAgB,YAAY,CAAC,EAC3B,KAAK,EACL,UAAU,EACV,QAAQ,EACR,eAAuB,EACxB,EAAE,iBAAiB,2CA6EnB"}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useSortable } from "@dnd-kit/sortable";
|
|
4
|
+
import { CSS } from "@dnd-kit/utilities";
|
|
5
|
+
import { GripVertical } from "lucide-react";
|
|
6
|
+
import { cn } from "../../../lib/utils.js";
|
|
7
|
+
import { sel } from "../../../lib/test/index.js";
|
|
8
|
+
import { BlockService } from "../../../lib/services/block.service.js";
|
|
9
|
+
import { DynamicIcon } from "../../ui/dynamic-icon.js";
|
|
10
|
+
import { isPatternReference } from "../../../types/pattern-reference.js";
|
|
11
|
+
function TreeViewNode({
|
|
12
|
+
block,
|
|
13
|
+
isSelected,
|
|
14
|
+
onSelect,
|
|
15
|
+
isPartOfPattern = false
|
|
16
|
+
}) {
|
|
17
|
+
const {
|
|
18
|
+
attributes,
|
|
19
|
+
listeners,
|
|
20
|
+
setNodeRef,
|
|
21
|
+
transform,
|
|
22
|
+
transition,
|
|
23
|
+
isDragging
|
|
24
|
+
} = useSortable({
|
|
25
|
+
id: block.id,
|
|
26
|
+
disabled: isPartOfPattern
|
|
27
|
+
// Disable individual dragging for pattern blocks
|
|
28
|
+
});
|
|
29
|
+
const style = {
|
|
30
|
+
transform: CSS.Transform.toString(transform),
|
|
31
|
+
transition,
|
|
32
|
+
opacity: isDragging ? 0.5 : 1
|
|
33
|
+
};
|
|
34
|
+
const blockConfig = isPatternReference(block) ? null : BlockService.get(block.blockSlug);
|
|
35
|
+
const iconName = (blockConfig == null ? void 0 : blockConfig.icon) || "LayoutGrid";
|
|
36
|
+
const blockName = (blockConfig == null ? void 0 : blockConfig.name) || (isPatternReference(block) ? "Pattern" : "Unknown Block");
|
|
37
|
+
return /* @__PURE__ */ jsxs(
|
|
38
|
+
"div",
|
|
39
|
+
{
|
|
40
|
+
ref: setNodeRef,
|
|
41
|
+
style,
|
|
42
|
+
"data-cy": sel("blockEditor.treeView.node", { id: block.id }),
|
|
43
|
+
className: cn(
|
|
44
|
+
"group flex items-center gap-2 px-2 py-1.5 rounded-md cursor-pointer transition-colors",
|
|
45
|
+
"hover:bg-muted/80",
|
|
46
|
+
isSelected && "bg-primary/10 ring-1 ring-primary",
|
|
47
|
+
isPartOfPattern && "ml-4 border-l-2 border-muted-foreground/20",
|
|
48
|
+
isDragging && "z-50"
|
|
49
|
+
),
|
|
50
|
+
onClick: onSelect,
|
|
51
|
+
children: [
|
|
52
|
+
!isPartOfPattern && /* @__PURE__ */ jsx(
|
|
53
|
+
"div",
|
|
54
|
+
{
|
|
55
|
+
"data-cy": sel("blockEditor.treeView.nodeDragHandle", { id: block.id }),
|
|
56
|
+
className: cn(
|
|
57
|
+
"cursor-grab active:cursor-grabbing text-muted-foreground/50",
|
|
58
|
+
"opacity-0 group-hover:opacity-100 transition-opacity",
|
|
59
|
+
isSelected && "opacity-100"
|
|
60
|
+
),
|
|
61
|
+
...attributes,
|
|
62
|
+
...listeners,
|
|
63
|
+
children: /* @__PURE__ */ jsx(GripVertical, { className: "h-4 w-4" })
|
|
64
|
+
}
|
|
65
|
+
),
|
|
66
|
+
/* @__PURE__ */ jsx(
|
|
67
|
+
"div",
|
|
68
|
+
{
|
|
69
|
+
"data-cy": sel("blockEditor.treeView.nodeIcon", { id: block.id }),
|
|
70
|
+
className: "text-muted-foreground shrink-0",
|
|
71
|
+
children: /* @__PURE__ */ jsx(DynamicIcon, { name: iconName, className: "h-4 w-4" })
|
|
72
|
+
}
|
|
73
|
+
),
|
|
74
|
+
/* @__PURE__ */ jsx(
|
|
75
|
+
"span",
|
|
76
|
+
{
|
|
77
|
+
"data-cy": sel("blockEditor.treeView.nodeName", { id: block.id }),
|
|
78
|
+
className: cn(
|
|
79
|
+
"text-sm truncate flex-1",
|
|
80
|
+
isSelected && "font-medium"
|
|
81
|
+
),
|
|
82
|
+
children: blockName
|
|
83
|
+
}
|
|
84
|
+
)
|
|
85
|
+
]
|
|
86
|
+
}
|
|
87
|
+
);
|
|
88
|
+
}
|
|
89
|
+
export {
|
|
90
|
+
TreeViewNode
|
|
91
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type PatternReference } from '../../../types/pattern-reference';
|
|
2
|
+
import type { BlockInstance } from '../../../types/blocks';
|
|
3
|
+
interface TreeViewProps {
|
|
4
|
+
blocks: (BlockInstance | PatternReference)[];
|
|
5
|
+
selectedBlockId: string | null;
|
|
6
|
+
onSelectBlock: (id: string) => void;
|
|
7
|
+
onReorder: (blocks: (BlockInstance | PatternReference)[]) => void;
|
|
8
|
+
emptyMessage?: string;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* TreeView component for the Layout tab in the left sidebar.
|
|
12
|
+
* Displays a tree structure of all blocks with drag & drop reordering.
|
|
13
|
+
* Clicking a block selects it and scrolls to it in the preview.
|
|
14
|
+
*/
|
|
15
|
+
export declare function TreeView({ blocks, selectedBlockId, onSelectBlock, onReorder, emptyMessage }: TreeViewProps): import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
export {};
|
|
17
|
+
//# sourceMappingURL=tree-view.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tree-view.d.ts","sourceRoot":"","sources":["../../../../src/components/dashboard/block-editor/tree-view.tsx"],"names":[],"mappings":"AAwBA,OAAO,EAAsB,KAAK,gBAAgB,EAAE,MAAM,kCAAkC,CAAA;AAC5F,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAA;AAE1D,UAAU,aAAa;IACrB,MAAM,EAAE,CAAC,aAAa,GAAG,gBAAgB,CAAC,EAAE,CAAA;IAC5C,eAAe,EAAE,MAAM,GAAG,IAAI,CAAA;IAC9B,aAAa,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAA;IACnC,SAAS,EAAE,CAAC,MAAM,EAAE,CAAC,aAAa,GAAG,gBAAgB,CAAC,EAAE,KAAK,IAAI,CAAA;IACjE,YAAY,CAAC,EAAE,MAAM,CAAA;CACtB;AAED;;;;GAIG;AACH,wBAAgB,QAAQ,CAAC,EACvB,MAAM,EACN,eAAe,EACf,aAAa,EACb,SAAS,EACT,YAAY,EACb,EAAE,aAAa,2CA+Gf"}
|