@oktis-works/admin 0.23.2 → 0.24.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client/_astro/{ActivityWidget.Dzoi-bq3.js → ActivityWidget.ZVWCvrxL.js} +1 -1
- package/dist/client/_astro/{AdminBar.eT1ch_B6.js → AdminBar.Cp3-f-Na.js} +1 -1
- package/dist/client/_astro/{ApiKeysManager.kbTE1CPk.js → ApiKeysManager.CpgNjjZm.js} +1 -1
- package/dist/client/_astro/{AtGlanceWidget.w23IIv06.js → AtGlanceWidget.B4v1yrwI.js} +1 -1
- package/dist/client/_astro/BaseLayout.Ceb72bti.css +1 -0
- package/dist/client/_astro/{CommentsManager.BN7i1RHa.js → CommentsManager.Da4veAPJ.js} +1 -1
- package/dist/client/_astro/ContentEditor.CSin5EHw.js +1 -0
- package/dist/client/_astro/ContentTypeWorkspace.CjOEvGzy.js +1 -0
- package/dist/client/_astro/{DashboardHome.DXzu_IXZ.js → DashboardHome.C40YVSiB.js} +1 -1
- package/dist/client/_astro/{DashboardLayout.astro_astro_type_script_index_0_lang.DmNSzErX.js → DashboardLayout.astro_astro_type_script_index_0_lang.DEsBqJww.js} +1 -1
- package/dist/client/_astro/{FieldGroupEditor.DsqphEgt.js → FieldGroupEditor.9WZ-czWM.js} +3 -3
- package/dist/client/_astro/{FieldGroupList.pW2Um9om.js → FieldGroupList.BG9Wq5_L.js} +1 -1
- package/dist/client/_astro/FieldRenderer.DrX12H8L.js +3 -0
- package/dist/client/_astro/{Footer.5Lcn2VXz.js → Footer.D7L9WAh7.js} +1 -1
- package/dist/client/_astro/{GeneralSettings.B-H8Rzy7.js → GeneralSettings.udEZdv-v.js} +1 -1
- package/dist/client/_astro/{LogsManager.Crd8q2te.js → LogsManager.B5TC9xQ_.js} +1 -1
- package/dist/client/_astro/{MediaLibrary.Cv6Ry3u9.js → MediaLibrary.D2v__yUO.js} +1 -1
- package/dist/client/_astro/{MenuManager.D25ika09.js → MenuManager.glKVLQiP.js} +1 -1
- package/dist/client/_astro/{Modal.572hmVvb.js → Modal.DijYhpj_.js} +1 -1
- package/dist/client/_astro/PluginManager.BGdxyG-e.js +112 -0
- package/dist/client/_astro/PluginPageHost.CEDOBtUT.js +1 -0
- package/dist/client/_astro/{PostTypesManager.C3RbmOZT.js → PostTypesManager.DTbeJSyc.js} +1 -1
- package/dist/client/_astro/{QuickDraftWidget.BtSGzhKq.js → QuickDraftWidget.wRkEcf8k.js} +1 -1
- package/dist/client/_astro/{ReadingSettings.ZFDaeo5U.js → ReadingSettings.CD8voAVk.js} +1 -1
- package/dist/client/_astro/{ResourceHubs.Cx9fbCv1.js → ResourceHubs.Cpu4lcaN.js} +1 -1
- package/dist/client/_astro/{TaxonomiesManager.BLsvmjaL.js → TaxonomiesManager.gPoogAar.js} +1 -1
- package/dist/client/_astro/TaxonomyTermsManager.B3TphEaE.js +1 -0
- package/dist/client/_astro/{ThemeCustomizer.BrDHVXLk.js → ThemeCustomizer.BKKTlRC5.js} +1 -1
- package/dist/client/_astro/{ThemeManager.BpS3m7Qc.js → ThemeManager.KDwxbVIq.js} +1 -1
- package/dist/client/_astro/{UserCreateForm.BYwgAqKk.js → UserCreateForm.IAFj7Afs.js} +1 -1
- package/dist/client/_astro/{UsersManager.DODMr48D.js → UsersManager.BfVYX6D5.js} +1 -1
- package/dist/client/_astro/{WebhooksManager.DmWIW272.js → WebhooksManager.Bp3Zp4vO.js} +1 -1
- package/dist/client/_astro/{api.53l1ob4Z.js → api.C1uUawnK.js} +1 -1
- package/dist/client/_astro/extensions.XVI9Kud6.js +1 -0
- package/dist/client/_astro/i18n.TTF80CEw.js +1 -0
- package/dist/client/_astro/{login.astro_astro_type_script_index_0_lang.BLf2Iun3.js → login.astro_astro_type_script_index_0_lang.C_Lrwk3I.js} +1 -1
- package/dist/client/_astro/{pt-BR.zZcF2v3X.js → pt-BR.C041vzOT.js} +1 -1
- package/dist/client/_astro/slots.CSARb9TW.js +1 -0
- package/dist/client/_astro/{src.CYKGYEyR.js → src.DoHIZU0i.js} +1 -1
- package/dist/client/_astro/store.BUgA6DSh.js +1 -0
- package/dist/server/chunks/{404_BAOD9OCa.mjs → 404_CouGE9Mj.mjs} +1 -1
- package/dist/server/chunks/{BaseLayout_BE8O-LS4.mjs → BaseLayout_DRJ6-Y9z.mjs} +5 -5
- package/dist/server/chunks/ContentEditor_DIjqVt5v.mjs +324 -0
- package/dist/server/chunks/{DashboardLayout_D6zphdT0.mjs → DashboardLayout_Bz8ZBDme.mjs} +102 -17
- package/dist/server/chunks/{FieldRenderer_D4dcZjgt.mjs → FieldRenderer_RlFoxao4.mjs} +574 -66
- package/dist/server/chunks/{MediaLibrary_DGmYSSZH.mjs → MediaLibrary_Dh6dBT17.mjs} +2 -2
- package/dist/server/chunks/{Modal_BmuvdwoB.mjs → Modal_CpojFoyP.mjs} +1 -1
- package/dist/server/chunks/_.._C1o1V5X_.mjs +76 -0
- package/dist/server/chunks/{_id__XEnJ5nS2.mjs → _id__BKZ7vD0U.mjs} +4 -4
- package/dist/server/chunks/{access_B5npG273.mjs → access_COyC7DxO.mjs} +3 -3
- package/dist/server/chunks/{api-keys_Bs6zIXYm.mjs → api-keys_D2TJYRAW.mjs} +3 -3
- package/dist/server/chunks/{comments_zJrnFEjl.mjs → comments_CySyBx_l.mjs} +2 -2
- package/dist/server/chunks/{custom-fields_C5EBkR02.mjs → custom-fields_Clivf3ew.mjs} +2 -2
- package/dist/server/chunks/{customize_CKqMX14y.mjs → customize_XWQyyFCl.mjs} +3 -3
- package/dist/server/chunks/{edit_QKBYgFkJ.mjs → edit_CYlskXjG.mjs} +2 -2
- package/dist/server/chunks/{i18n_C-sgJSi1.mjs → i18n_Bp0_xO2v.mjs} +27 -8
- package/dist/server/chunks/{index_CDwohy44.mjs → index_BufAjUfw.mjs} +2 -2
- package/dist/server/chunks/{index_DenKi4a3.mjs → index_CJOIvqZF.mjs} +2 -2
- package/dist/server/chunks/{index_BM_-WBYo.mjs → index_DBmNvPut.mjs} +2 -2
- package/dist/server/chunks/{index_BletZ9T6.mjs → index_Z5USLJCo.mjs} +3 -3
- package/dist/server/chunks/{index_Btvmuytk.mjs → index_pSSu8X0A.mjs} +2 -2
- package/dist/server/chunks/{login_CtIWLqC2.mjs → login_BbReGd7a.mjs} +1 -1
- package/dist/server/chunks/{logs_DlTldv5b.mjs → logs_D_xRW_Dm.mjs} +2 -2
- package/dist/server/chunks/{menus_z2d_K44p.mjs → menus_t0aZuQCI.mjs} +2 -2
- package/dist/server/chunks/{new_CYvLScge.mjs → new_CkSJ-S3h.mjs} +2 -2
- package/dist/server/chunks/{new_Cxp8Mdw4.mjs → new_DFA50r2h.mjs} +2 -2
- package/dist/server/chunks/{plugins_4g6EEkCb.mjs → plugins_rehiATzz.mjs} +13 -5
- package/dist/server/chunks/{post-types_7cW4BLBV.mjs → post-types_Dx4bmkB7.mjs} +2 -2
- package/dist/server/chunks/{pt-BR_AVNE88MZ.mjs → pt-BR_B8bZo1Id.mjs} +7 -1
- package/dist/server/chunks/{reading_2DqfBhj_.mjs → reading_DVMggOZa.mjs} +2 -2
- package/dist/server/chunks/{taxonomies_D7mMKpNX.mjs → taxonomies_BKVuy-kF.mjs} +2 -2
- package/dist/server/chunks/{taxonomy_64ggDTF9.mjs → taxonomy_CsnDSlD1.mjs} +31 -18
- package/dist/server/chunks/{themes_Dscq-5uk.mjs → themes_c2vDYHy-.mjs} +2 -2
- package/dist/server/chunks/{upload_B-DdqpaQ.mjs → upload_DYFOxmHE.mjs} +2 -2
- package/dist/server/chunks/{webhooks_D05B4_Rs.mjs → webhooks_CjBMAJt2.mjs} +2 -2
- package/dist/server/entry.mjs +43 -43
- package/dist/server/virtual_astro_middleware.mjs +1 -1
- package/package.json +5 -5
- package/dist/client/_astro/BaseLayout.Rpr86VwM.css +0 -1
- package/dist/client/_astro/ContentEditor.BlsJ2bwD.js +0 -1
- package/dist/client/_astro/ContentTypeWorkspace.BPVuQgzA.js +0 -1
- package/dist/client/_astro/FieldRenderer.AYtSBfHZ.js +0 -3
- package/dist/client/_astro/PluginManager.DLfgQFPF.js +0 -112
- package/dist/client/_astro/TaxonomyTermsManager.C_xEh8Ab.js +0 -1
- package/dist/client/_astro/extensions.DzQcQsO9.js +0 -1
- package/dist/client/_astro/i18n.A82w5XQu.js +0 -1
- package/dist/client/_astro/preload-helper.oCYlU9a4.js +0 -1
- package/dist/client/_astro/store.DLCqLxBR.js +0 -1
- package/dist/server/chunks/ContentEditor_DPy3I4HM.mjs +0 -690
- package/dist/server/chunks/_slug__BkXrukGe.mjs +0 -34
|
@@ -0,0 +1,324 @@
|
|
|
1
|
+
import { n as useTranslation, r as apiClient } from "./i18n_Bp0_xO2v.mjs";
|
|
2
|
+
import { a as MetaBoxesSlot, n as emptyExtensionsState, o as PluginComponentHost, r as loadExtensions, x as normalizeLogicalValues } from "./DashboardLayout_Bz8ZBDme.mjs";
|
|
3
|
+
import { t as FieldRenderer } from "./FieldRenderer_RlFoxao4.mjs";
|
|
4
|
+
import { t as expandCloneFields } from "./clone_FT3Zf-Bf.mjs";
|
|
5
|
+
import { createComponent, escape, ssr, ssrAttribute, ssrHydrationKey } from "solid-js/web";
|
|
6
|
+
import { For, Show, createMemo, createSignal, onMount } from "solid-js";
|
|
7
|
+
//#region src/components/content/ContentEditor.tsx
|
|
8
|
+
var _tmpl$ = [
|
|
9
|
+
"<div",
|
|
10
|
+
" class=\"notice notice--success\">",
|
|
11
|
+
"</div>"
|
|
12
|
+
];
|
|
13
|
+
var _tmpl$2 = [
|
|
14
|
+
"<div",
|
|
15
|
+
" class=\"plugin-editor plugin-editor--replace-body\"",
|
|
16
|
+
">",
|
|
17
|
+
"</div>"
|
|
18
|
+
];
|
|
19
|
+
var _tmpl$3 = [
|
|
20
|
+
"<div",
|
|
21
|
+
" class=\"plugin-editor plugin-editor--below\"",
|
|
22
|
+
">",
|
|
23
|
+
"</div>"
|
|
24
|
+
];
|
|
25
|
+
var _tmpl$4 = [
|
|
26
|
+
"<section",
|
|
27
|
+
" class=\"card classic-editor__panel\"><h3>",
|
|
28
|
+
"</h3><label><!--$-->",
|
|
29
|
+
"<!--/--><select class=\"input\"",
|
|
30
|
+
"><option value>",
|
|
31
|
+
"</option><!--$-->",
|
|
32
|
+
"<!--/--></select></label></section>"
|
|
33
|
+
];
|
|
34
|
+
var _tmpl$5 = [
|
|
35
|
+
"<section",
|
|
36
|
+
" class=\"card classic-editor__panel plugin-catalog-panel\"><h3>Plugin blocks and patterns</h3><!--$-->",
|
|
37
|
+
"<!--/--><!--$-->",
|
|
38
|
+
"<!--/--></section>"
|
|
39
|
+
];
|
|
40
|
+
var _tmpl$6 = [
|
|
41
|
+
"<form",
|
|
42
|
+
" class=\"content-editor classic-editor\"><!--$-->",
|
|
43
|
+
"<!--/--><!--$-->",
|
|
44
|
+
"<!--/--><div class=\"classic-editor__topbar\"><div><span class=\"classic-editor__eyebrow\">",
|
|
45
|
+
"</span><h2>",
|
|
46
|
+
"</h2></div><div class=\"classic-editor__actions\"><a class=\"btn btn-secondary\" href=\"",
|
|
47
|
+
"\">",
|
|
48
|
+
"</a><button type=\"submit\" class=\"btn btn-primary\"",
|
|
49
|
+
">",
|
|
50
|
+
"</button></div></div><div class=\"classic-editor__columns\"><main class=\"classic-editor__main\"><section class=\"card classic-editor__canvas-card\"><p class=\"field-renderer__instructions\">All standard and custom values use the same resolved field schema.</p><!--$-->",
|
|
51
|
+
"<!--/--><!--$-->",
|
|
52
|
+
"<!--/--></section><!--$-->",
|
|
53
|
+
"<!--/--><!--$-->",
|
|
54
|
+
"<!--/--></main><aside class=\"classic-editor__sidebar\"><section class=\"card classic-editor__panel\"><h3>",
|
|
55
|
+
"</h3><p class=\"muted\">Status and all other values are edited in the resolved field groups.</p><button type=\"submit\" class=\"btn btn-primary classic-editor__full-button\"",
|
|
56
|
+
">",
|
|
57
|
+
"</button></section><!--$-->",
|
|
58
|
+
"<!--/--><!--$-->",
|
|
59
|
+
"<!--/--><!--$-->",
|
|
60
|
+
"<!--/--></aside></div><!--$-->",
|
|
61
|
+
"<!--/--></form>"
|
|
62
|
+
];
|
|
63
|
+
var _tmpl$7 = [
|
|
64
|
+
"<div",
|
|
65
|
+
" class=\"notice notice--error\">",
|
|
66
|
+
"</div>"
|
|
67
|
+
];
|
|
68
|
+
var _tmpl$8 = [
|
|
69
|
+
"<section",
|
|
70
|
+
" class=\"card custom-fields\"",
|
|
71
|
+
"><h3>",
|
|
72
|
+
"</h3><!--$-->",
|
|
73
|
+
"<!--/--></section>"
|
|
74
|
+
];
|
|
75
|
+
var _tmpl$9 = [
|
|
76
|
+
"<option",
|
|
77
|
+
">",
|
|
78
|
+
"</option>"
|
|
79
|
+
];
|
|
80
|
+
var _tmpl$0 = [
|
|
81
|
+
"<button",
|
|
82
|
+
" type=\"button\" class=\"btn btn-secondary\">+ <!--$-->",
|
|
83
|
+
"<!--/--></button>"
|
|
84
|
+
];
|
|
85
|
+
function ContentEditor(props) {
|
|
86
|
+
const { t } = useTranslation();
|
|
87
|
+
const [types, setTypes] = createSignal([]);
|
|
88
|
+
const [groups, setGroups] = createSignal([]);
|
|
89
|
+
const [themes, setThemes] = createSignal([]);
|
|
90
|
+
const [data, setData] = createSignal({});
|
|
91
|
+
const [errors, setErrors] = createSignal([]);
|
|
92
|
+
const [saving, setSaving] = createSignal(false);
|
|
93
|
+
const [message, setMessage] = createSignal("");
|
|
94
|
+
const [extensions, setExtensions] = createSignal(emptyExtensionsState());
|
|
95
|
+
const [blocks, setBlocks] = createSignal([]);
|
|
96
|
+
const [patterns, setPatterns] = createSignal([]);
|
|
97
|
+
const [draft, setDraft] = createSignal({
|
|
98
|
+
type: props.initialType || "post",
|
|
99
|
+
title: "",
|
|
100
|
+
status: "DRAFT"
|
|
101
|
+
});
|
|
102
|
+
const activeEditor = createMemo(() => {
|
|
103
|
+
const screen = draft().type;
|
|
104
|
+
return (extensions().editors ?? []).filter((editor) => editor.screens.includes("*") || editor.screens.includes(screen)).sort((a, b) => (a.priority ?? 0) - (b.priority ?? 0))[0] ?? null;
|
|
105
|
+
});
|
|
106
|
+
const editorSlotProps = () => ({
|
|
107
|
+
editorId: activeEditor().id,
|
|
108
|
+
contentType: draft().type,
|
|
109
|
+
contentId: draft().id ?? "",
|
|
110
|
+
body: editorContent(),
|
|
111
|
+
setBody: (html) => setData({
|
|
112
|
+
...data(),
|
|
113
|
+
content: html
|
|
114
|
+
}),
|
|
115
|
+
disabled: saving()
|
|
116
|
+
});
|
|
117
|
+
const typeListFallback = (available, requested) => requested || available[0]?.slug || "post";
|
|
118
|
+
const availableLayouts = () => {
|
|
119
|
+
const layouts = /* @__PURE__ */ new Set();
|
|
120
|
+
for (const theme of themes()) for (const layout of theme.manifest?.provides?.layouts ?? []) layouts.add(layout);
|
|
121
|
+
return [...layouts].sort();
|
|
122
|
+
};
|
|
123
|
+
const loadGroups = async (context) => {
|
|
124
|
+
try {
|
|
125
|
+
const query = typeof context === "string" ? { type: context } : context;
|
|
126
|
+
if (!query.type) {
|
|
127
|
+
setGroups([]);
|
|
128
|
+
return;
|
|
129
|
+
}
|
|
130
|
+
const resolved = await apiClient.getFieldGroups(query);
|
|
131
|
+
setGroups(resolved.filter((group) => group.active !== false).map((group) => ({
|
|
132
|
+
...group,
|
|
133
|
+
fields: expandCloneFields(group.fields ?? [])
|
|
134
|
+
})));
|
|
135
|
+
} catch (err) {
|
|
136
|
+
setErrors([err instanceof Error ? err.message : String(err)]);
|
|
137
|
+
}
|
|
138
|
+
};
|
|
139
|
+
onMount(async () => {
|
|
140
|
+
loadExtensions().then(setExtensions);
|
|
141
|
+
let typeList = [];
|
|
142
|
+
try {
|
|
143
|
+
const [typeCatalog, themeList, blockCatalog, patternCatalog] = await Promise.all([
|
|
144
|
+
apiClient.getContentTypes(),
|
|
145
|
+
apiClient.getThemes().catch(() => []),
|
|
146
|
+
apiClient.getBlocks().catch(() => []),
|
|
147
|
+
apiClient.getPatterns().catch(() => [])
|
|
148
|
+
]);
|
|
149
|
+
typeList = typeCatalog;
|
|
150
|
+
setTypes(typeCatalog);
|
|
151
|
+
setThemes(themeList);
|
|
152
|
+
setBlocks(blockCatalog);
|
|
153
|
+
setPatterns(patternCatalog);
|
|
154
|
+
} catch (err) {
|
|
155
|
+
setErrors([err instanceof Error ? err.message : String(err)]);
|
|
156
|
+
}
|
|
157
|
+
const editId = new URLSearchParams(window.location.search).get("id");
|
|
158
|
+
if (editId || props.singleton) try {
|
|
159
|
+
const existing = editId ? await apiClient.getContentById(editId) : await apiClient.getSingletonContent(draft().type);
|
|
160
|
+
if (!existing) {
|
|
161
|
+
await loadGroups({
|
|
162
|
+
type: draft().type,
|
|
163
|
+
status: draft().status
|
|
164
|
+
});
|
|
165
|
+
return;
|
|
166
|
+
}
|
|
167
|
+
const rawRow = existing;
|
|
168
|
+
const logical = normalizeLogicalValues({
|
|
169
|
+
body: existing.body,
|
|
170
|
+
data: rawRow["data"],
|
|
171
|
+
native: rawRow
|
|
172
|
+
});
|
|
173
|
+
setDraft({
|
|
174
|
+
id: existing.id,
|
|
175
|
+
type: existing.type,
|
|
176
|
+
title: String(logical["title"] ?? existing.title),
|
|
177
|
+
slug: String(logical["slug"] ?? existing.slug),
|
|
178
|
+
excerpt: typeof logical["excerpt"] === "string" ? logical["excerpt"] : void 0,
|
|
179
|
+
featuredImageId: typeof logical["featured_image"] === "string" ? logical["featured_image"] : void 0,
|
|
180
|
+
status: String(logical["status"] ?? existing.status),
|
|
181
|
+
layout: existing.layout
|
|
182
|
+
});
|
|
183
|
+
setData(logical);
|
|
184
|
+
} catch (err) {
|
|
185
|
+
setErrors([err instanceof Error ? err.message : String(err)]);
|
|
186
|
+
}
|
|
187
|
+
else if (!typeList.some((type) => type.slug === draft().type)) setDraft({
|
|
188
|
+
...draft(),
|
|
189
|
+
type: typeListFallback(typeList, props.initialType)
|
|
190
|
+
});
|
|
191
|
+
await loadGroups({
|
|
192
|
+
type: draft().type,
|
|
193
|
+
slug: draft().slug,
|
|
194
|
+
status: draft().status
|
|
195
|
+
});
|
|
196
|
+
});
|
|
197
|
+
const editorContent = () => {
|
|
198
|
+
const value = data()["content"];
|
|
199
|
+
return typeof value === "string" ? value : "";
|
|
200
|
+
};
|
|
201
|
+
return ssr(_tmpl$6, ssrHydrationKey(), escape(createComponent(Show, {
|
|
202
|
+
get when() {
|
|
203
|
+
return errors().length > 0;
|
|
204
|
+
},
|
|
205
|
+
get children() {
|
|
206
|
+
return createComponent(For, {
|
|
207
|
+
get each() {
|
|
208
|
+
return errors();
|
|
209
|
+
},
|
|
210
|
+
children: (err) => ssr(_tmpl$7, ssrHydrationKey(), escape(err))
|
|
211
|
+
});
|
|
212
|
+
}
|
|
213
|
+
})), escape(createComponent(Show, {
|
|
214
|
+
get when() {
|
|
215
|
+
return message();
|
|
216
|
+
},
|
|
217
|
+
get children() {
|
|
218
|
+
return ssr(_tmpl$, ssrHydrationKey(), escape(message()));
|
|
219
|
+
}
|
|
220
|
+
})), escape(types().find((type) => type.slug === draft().type)?.singularLabel || draft().type), draft().id ? escape(t("content.editor.editing")) : escape(t("content.editor.adding")), `/content/${escape(encodeURIComponent(draft().type), true)}`, escape(t("content.editor.backToList")), ssrAttribute("disabled", saving(), true), saving() ? escape(t("content.editor.saving")) : escape(t("content.editor.save")), escape(createComponent(Show, {
|
|
221
|
+
get when() {
|
|
222
|
+
return activeEditor()?.mode === "replace-body";
|
|
223
|
+
},
|
|
224
|
+
get children() {
|
|
225
|
+
return ssr(_tmpl$2, ssrHydrationKey(), ssrAttribute("data-plugin-editor", escape(activeEditor().id, true), false), escape(createComponent(PluginComponentHost, {
|
|
226
|
+
get componentId() {
|
|
227
|
+
return activeEditor().componentId;
|
|
228
|
+
},
|
|
229
|
+
get extraProps() {
|
|
230
|
+
return editorSlotProps();
|
|
231
|
+
}
|
|
232
|
+
})));
|
|
233
|
+
}
|
|
234
|
+
})), escape(createComponent(Show, {
|
|
235
|
+
get when() {
|
|
236
|
+
return activeEditor()?.mode === "below";
|
|
237
|
+
},
|
|
238
|
+
get children() {
|
|
239
|
+
return ssr(_tmpl$3, ssrHydrationKey(), ssrAttribute("data-plugin-editor", escape(activeEditor().id, true), false), escape(createComponent(PluginComponentHost, {
|
|
240
|
+
get componentId() {
|
|
241
|
+
return activeEditor().componentId;
|
|
242
|
+
},
|
|
243
|
+
get extraProps() {
|
|
244
|
+
return editorSlotProps();
|
|
245
|
+
}
|
|
246
|
+
})));
|
|
247
|
+
}
|
|
248
|
+
})), escape(createComponent(For, {
|
|
249
|
+
get each() {
|
|
250
|
+
return groups();
|
|
251
|
+
},
|
|
252
|
+
children: (group) => ssr(_tmpl$8, ssrHydrationKey(), ssrAttribute("data-field-group", escape(group.key, true), false) + ssrAttribute("data-position", escape(group.position ?? "normal", true), false) + ssrAttribute("data-display-style", escape(group.displayStyle ?? "standard", true), false), escape(group.title), escape(createComponent(For, {
|
|
253
|
+
get each() {
|
|
254
|
+
return group.fields;
|
|
255
|
+
},
|
|
256
|
+
children: (field) => createComponent(FieldRenderer, {
|
|
257
|
+
field,
|
|
258
|
+
get values() {
|
|
259
|
+
return data();
|
|
260
|
+
},
|
|
261
|
+
onChange: (name, value) => setData({
|
|
262
|
+
...data(),
|
|
263
|
+
[name]: value
|
|
264
|
+
}),
|
|
265
|
+
t
|
|
266
|
+
})
|
|
267
|
+
})))
|
|
268
|
+
})), escape(createComponent(MetaBoxesSlot, {
|
|
269
|
+
get extensions() {
|
|
270
|
+
return extensions();
|
|
271
|
+
},
|
|
272
|
+
get screen() {
|
|
273
|
+
return draft().type;
|
|
274
|
+
},
|
|
275
|
+
context: "normal"
|
|
276
|
+
})), escape(t("content.editor.publishPanel")), ssrAttribute("disabled", saving(), true), saving() ? escape(t("content.editor.saving")) : escape(t("content.editor.save")), escape(createComponent(Show, {
|
|
277
|
+
get when() {
|
|
278
|
+
return availableLayouts().length > 0;
|
|
279
|
+
},
|
|
280
|
+
get children() {
|
|
281
|
+
return ssr(_tmpl$4, ssrHydrationKey(), escape(t("content.editor.pageAttributes")), escape(t("content.editor.layout")), ssrAttribute("value", escape(draft().layout ?? "", true), false), escape(t("content.editor.layoutAuto")), escape(createComponent(For, {
|
|
282
|
+
get each() {
|
|
283
|
+
return availableLayouts();
|
|
284
|
+
},
|
|
285
|
+
children: (layout) => ssr(_tmpl$9, ssrHydrationKey() + ssrAttribute("value", escape(layout, true), false), escape(layout))
|
|
286
|
+
})));
|
|
287
|
+
}
|
|
288
|
+
})), escape(createComponent(Show, {
|
|
289
|
+
get when() {
|
|
290
|
+
return blocks().length > 0 || patterns().length > 0;
|
|
291
|
+
},
|
|
292
|
+
get children() {
|
|
293
|
+
return ssr(_tmpl$5, ssrHydrationKey(), escape(createComponent(For, {
|
|
294
|
+
get each() {
|
|
295
|
+
return blocks();
|
|
296
|
+
},
|
|
297
|
+
children: (block) => ssr(_tmpl$0, ssrHydrationKey(), escape(block.label))
|
|
298
|
+
})), escape(createComponent(For, {
|
|
299
|
+
get each() {
|
|
300
|
+
return patterns();
|
|
301
|
+
},
|
|
302
|
+
children: (pattern) => ssr(_tmpl$0, ssrHydrationKey(), escape(pattern.label))
|
|
303
|
+
})));
|
|
304
|
+
}
|
|
305
|
+
})), escape(createComponent(MetaBoxesSlot, {
|
|
306
|
+
get extensions() {
|
|
307
|
+
return extensions();
|
|
308
|
+
},
|
|
309
|
+
get screen() {
|
|
310
|
+
return draft().type;
|
|
311
|
+
},
|
|
312
|
+
context: "side"
|
|
313
|
+
})), escape(createComponent(MetaBoxesSlot, {
|
|
314
|
+
get extensions() {
|
|
315
|
+
return extensions();
|
|
316
|
+
},
|
|
317
|
+
get screen() {
|
|
318
|
+
return draft().type;
|
|
319
|
+
},
|
|
320
|
+
context: "advanced"
|
|
321
|
+
})));
|
|
322
|
+
}
|
|
323
|
+
//#endregion
|
|
324
|
+
export { ContentEditor as t };
|
|
@@ -1,13 +1,95 @@
|
|
|
1
1
|
import "./rolldown-runtime_BMI-E3GI.mjs";
|
|
2
2
|
import { S as createAstro, d as maybeRenderHead, i as renderComponent, p as addAttribute, s as renderSlot, u as renderTemplate } from "./server_B5N27szj.mjs";
|
|
3
3
|
import { t as createComponent$1 } from "./compiler_O7J1rlsi.mjs";
|
|
4
|
-
import { n as renderScript, t as $$BaseLayout } from "./
|
|
5
|
-
import { a as LOCALE_LABELS, i as LOCALE_FLAGS, n as useTranslation, o as SUPPORTED_LOCALES, r as apiClient } from "./
|
|
4
|
+
import { n as renderScript, t as $$BaseLayout } from "./BaseLayout_DRJ6-Y9z.mjs";
|
|
5
|
+
import { a as LOCALE_LABELS, i as LOCALE_FLAGS, n as useTranslation, o as SUPPORTED_LOCALES, r as apiClient } from "./i18n_Bp0_xO2v.mjs";
|
|
6
6
|
import { t as require_semver } from "./semver_WbqCUY_o.mjs";
|
|
7
7
|
import { Dynamic, createComponent, escape, memo, mergeProps, ssr, ssrAttribute, ssrHydrationKey, ssrStyle, ssrStyleProperty } from "solid-js/web";
|
|
8
8
|
import { For, For as For2, Match, Show, Show as Show2, Switch, createEffect, createMemo as createMemo$1, createSignal, createSignal as createSignal$1, onCleanup, onMount, onMount as onMount$1 } from "solid-js";
|
|
9
9
|
require_semver();
|
|
10
10
|
//#endregion
|
|
11
|
+
//#region ../../packages/validation/dist/field-values.js
|
|
12
|
+
var CANONICAL_CORE_FIELDS = [
|
|
13
|
+
"title",
|
|
14
|
+
"slug",
|
|
15
|
+
"content",
|
|
16
|
+
"excerpt",
|
|
17
|
+
"featured_image",
|
|
18
|
+
"seo_title",
|
|
19
|
+
"seo_description",
|
|
20
|
+
"status",
|
|
21
|
+
"author"
|
|
22
|
+
];
|
|
23
|
+
/**
|
|
24
|
+
* Compatibility aliases are accepted only at the storage boundary. Themes,
|
|
25
|
+
* editors, and validators should use the canonical logical names above.
|
|
26
|
+
*/
|
|
27
|
+
var CANONICAL_FIELD_ALIASES = {
|
|
28
|
+
title: ["title"],
|
|
29
|
+
slug: ["slug"],
|
|
30
|
+
content: ["content", "html"],
|
|
31
|
+
excerpt: ["excerpt"],
|
|
32
|
+
featured_image: [
|
|
33
|
+
"featured_image",
|
|
34
|
+
"featuredImageId",
|
|
35
|
+
"featured_image_id"
|
|
36
|
+
],
|
|
37
|
+
seo_title: ["seo_title", "seoTitle"],
|
|
38
|
+
seo_description: ["seo_description", "seoDescription"],
|
|
39
|
+
status: ["status"],
|
|
40
|
+
author: [
|
|
41
|
+
"author",
|
|
42
|
+
"authorId",
|
|
43
|
+
"author_id"
|
|
44
|
+
]
|
|
45
|
+
};
|
|
46
|
+
var LEGACY_FIELD_ALIASES = new Map(Object.entries(CANONICAL_FIELD_ALIASES).flatMap(([canonical, aliases]) => aliases.map((alias) => [alias, canonical])));
|
|
47
|
+
function asRecord(value) {
|
|
48
|
+
if (value && typeof value === "object" && !Array.isArray(value)) return { ...value };
|
|
49
|
+
if (typeof value === "string") try {
|
|
50
|
+
return asRecord(JSON.parse(value));
|
|
51
|
+
} catch {
|
|
52
|
+
return {};
|
|
53
|
+
}
|
|
54
|
+
return {};
|
|
55
|
+
}
|
|
56
|
+
function firstDefined(sources, aliases) {
|
|
57
|
+
for (const source of sources) for (const alias of aliases) if (source[alias] !== void 0) return source[alias];
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Normalizes all legacy storage sources into one logical value document.
|
|
61
|
+
* Precedence is body, data, relational values, then native columns. Body is
|
|
62
|
+
* the only canonical JSON document for new writes; the other sources are
|
|
63
|
+
* read-only compatibility inputs.
|
|
64
|
+
*/
|
|
65
|
+
function normalizeLogicalValues(sources) {
|
|
66
|
+
const body = asRecord(sources.body);
|
|
67
|
+
const data = asRecord(sources.data);
|
|
68
|
+
const relational = asRecord(sources.relational);
|
|
69
|
+
const { body: _legacyBody, data: _legacyData, ...native } = asRecord(sources.native);
|
|
70
|
+
const orderedSources = [
|
|
71
|
+
body,
|
|
72
|
+
data,
|
|
73
|
+
relational,
|
|
74
|
+
native
|
|
75
|
+
];
|
|
76
|
+
const result = {
|
|
77
|
+
...relational,
|
|
78
|
+
...data,
|
|
79
|
+
...body
|
|
80
|
+
};
|
|
81
|
+
for (const field of CANONICAL_CORE_FIELDS) {
|
|
82
|
+
const value = firstDefined(orderedSources, CANONICAL_FIELD_ALIASES[field]);
|
|
83
|
+
if (value !== void 0) result[field] = value;
|
|
84
|
+
}
|
|
85
|
+
if (result["content"] === void 0 && result["html"] !== void 0) result["content"] = result["html"];
|
|
86
|
+
for (const [key, value] of Object.entries(result)) {
|
|
87
|
+
const canonical = LEGACY_FIELD_ALIASES.get(key);
|
|
88
|
+
if (canonical && result[canonical] === void 0) result[canonical] = value;
|
|
89
|
+
}
|
|
90
|
+
return result;
|
|
91
|
+
}
|
|
92
|
+
//#endregion
|
|
11
93
|
//#region ../../packages/ui/dist/server.js
|
|
12
94
|
var _tmpl$$7 = ["<span", " class=\"spinner\" aria-label=\"Carregando\"></span>"];
|
|
13
95
|
var _tmpl$2$5 = [
|
|
@@ -396,6 +478,8 @@ var _tmpl$12 = [
|
|
|
396
478
|
" class=\"action-link\">",
|
|
397
479
|
"</a>"
|
|
398
480
|
];
|
|
481
|
+
var PLUGIN_ROOT = "../../../plugins";
|
|
482
|
+
var pluginModules = /* #__PURE__ */ Object.assign({});
|
|
399
483
|
/**
|
|
400
484
|
* Resolve o componentId declarado num caminho de import dinâmico (alias Vite
|
|
401
485
|
* `@/plugins/` aponta para a raiz dos plugins; o componente vive em
|
|
@@ -406,18 +490,26 @@ var _tmpl$12 = [
|
|
|
406
490
|
* - `plugin` explícito tem prioridade sobre o prefixo do componentId.
|
|
407
491
|
*/
|
|
408
492
|
function resolvePluginComponentPath(componentId, plugin) {
|
|
409
|
-
if (componentId.startsWith("
|
|
493
|
+
if (!componentId || componentId.includes("..") || componentId.includes("://") || componentId.startsWith("/")) throw new Error(`Invalid plugin component reference: ${componentId}`);
|
|
494
|
+
if (componentId.startsWith("@/plugins/")) return `${PLUGIN_ROOT}/${componentId.slice(10)}`;
|
|
410
495
|
const separator = componentId.indexOf(":");
|
|
411
496
|
if (separator === -1) {
|
|
412
497
|
const owner = plugin ?? "";
|
|
498
|
+
if (!/^[a-z0-9][a-z0-9._-]*$/i.test(owner)) throw new Error(`Invalid plugin name: ${owner}`);
|
|
413
499
|
const relative = componentId.replace(/^\/+/, "");
|
|
414
|
-
return owner ?
|
|
500
|
+
return owner ? `${PLUGIN_ROOT}/${owner}/${relative}` : componentId;
|
|
415
501
|
}
|
|
416
502
|
const owner = plugin ?? componentId.slice(0, separator);
|
|
503
|
+
if (!/^[a-z0-9][a-z0-9._-]*$/i.test(owner)) throw new Error(`Invalid plugin name: ${owner}`);
|
|
417
504
|
const rest = componentId.slice(separator + 1);
|
|
418
|
-
if (rest.startsWith("@/")) return rest
|
|
419
|
-
if (rest.includes("/")) return
|
|
420
|
-
return
|
|
505
|
+
if (rest.startsWith("@/plugins/")) return `${PLUGIN_ROOT}/${rest.slice(10)}`;
|
|
506
|
+
if (rest.includes("/")) return `${PLUGIN_ROOT}/${owner}/${rest.replace(/^\/+/, "")}`;
|
|
507
|
+
return `${PLUGIN_ROOT}/${owner}/admin/components/${rest}.tsx`;
|
|
508
|
+
}
|
|
509
|
+
async function loadPluginComponent(componentId, plugin) {
|
|
510
|
+
const loader = pluginModules[resolvePluginComponentPath(componentId, plugin)];
|
|
511
|
+
if (!loader) throw new Error(`Plugin component is not included in the admin build: ${componentId}`);
|
|
512
|
+
return loader();
|
|
421
513
|
}
|
|
422
514
|
/**
|
|
423
515
|
* Monta um componente de plugin via import dinâmico (lazy — chunk separado).
|
|
@@ -430,11 +522,7 @@ function PluginComponentHost(props) {
|
|
|
430
522
|
const [loading, setLoading] = createSignal(true);
|
|
431
523
|
onMount(async () => {
|
|
432
524
|
try {
|
|
433
|
-
const
|
|
434
|
-
/* @vite-ignore */
|
|
435
|
-
resolvePluginComponentPath(props.componentId, props.plugin)
|
|
436
|
-
);
|
|
437
|
-
const candidate = module["default"] ?? Object.values(module).find((value) => typeof value === "function");
|
|
525
|
+
const candidate = (await loadPluginComponent(props.componentId, props.plugin))["default"];
|
|
438
526
|
if (!candidate) throw new Error("componente default ausente no módulo");
|
|
439
527
|
setComponent(() => candidate);
|
|
440
528
|
} catch (err) {
|
|
@@ -610,10 +698,7 @@ function prefetchPluginChunks(state) {
|
|
|
610
698
|
if (!componentId || prefetchedChunks.has(componentId)) continue;
|
|
611
699
|
prefetchedChunks.add(componentId);
|
|
612
700
|
schedule(() => {
|
|
613
|
-
|
|
614
|
-
/* @vite-ignore */
|
|
615
|
-
resolvePluginComponentPath(componentId)
|
|
616
|
-
).catch(() => {});
|
|
701
|
+
loadPluginComponent(componentId).catch(() => {});
|
|
617
702
|
});
|
|
618
703
|
}
|
|
619
704
|
}
|
|
@@ -1299,4 +1384,4 @@ var $$DashboardLayout = createComponent$1(($$result, $$props, $$slots) => {
|
|
|
1299
1384
|
})}</div>` })}${renderScript($$result, "/home/runner/work/cms/cms/apps/admin/src/layouts/DashboardLayout.astro?astro&type=script&index=0&lang.ts")}`;
|
|
1300
1385
|
}, "/home/runner/work/cms/cms/apps/admin/src/layouts/DashboardLayout.astro", void 0);
|
|
1301
1386
|
//#endregion
|
|
1302
|
-
export {
|
|
1387
|
+
export { Table as _, MetaBoxesSlot as a, onMount$1 as b, Badge as c, For2 as d, Input as f, Show2 as g, Select as h, ActionLinksSlot as i, Button as l, Pagination as m, emptyExtensionsState as n, PluginComponentHost as o, Modal as p, loadExtensions as r, loadPluginComponent as s, $$DashboardLayout as t, Card as u, createMemo$1 as v, normalizeLogicalValues as x, createSignal$1 as y };
|