@orion-studios/payload-studio 0.5.0-beta.11 → 0.5.0-beta.111
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +54 -0
- package/dist/admin/client.d.mts +3 -0
- package/dist/admin/client.d.ts +3 -0
- package/dist/admin/client.js +1745 -200
- package/dist/admin/client.mjs +1756 -214
- package/dist/admin/index.d.mts +2 -1
- package/dist/admin/index.d.ts +2 -1
- package/dist/admin/index.js +424 -11
- package/dist/admin/index.mjs +19 -1
- package/dist/admin-app/client.d.mts +7 -0
- package/dist/admin-app/client.d.ts +7 -0
- package/dist/admin-app/client.js +1270 -3
- package/dist/admin-app/client.mjs +1172 -2
- package/dist/admin-app/index.d.mts +1 -1
- package/dist/admin-app/index.d.ts +1 -1
- package/dist/admin-app/index.js +167 -0
- package/dist/admin-app/index.mjs +13 -1
- package/dist/admin-app/styles.css +247 -0
- package/dist/admin.css +8 -0
- package/dist/blocks/index.js +1011 -191
- package/dist/blocks/index.mjs +2 -2
- package/dist/chunk-ADIIWIYL.mjs +322 -0
- package/dist/{chunk-ZLLNO5FM.mjs → chunk-BET2YLAS.mjs} +104 -15
- package/dist/chunk-DAIZDGHL.mjs +614 -0
- package/dist/chunk-GKMBYYXF.mjs +776 -0
- package/dist/chunk-JQAHXYAM.mjs +1829 -0
- package/dist/chunk-OQSEJXC4.mjs +166 -0
- package/dist/chunk-PF3EBZXF.mjs +326 -0
- package/dist/chunk-ROTPP5CU.mjs +99 -0
- package/dist/chunk-XVH5SCBD.mjs +234 -0
- package/dist/chunk-ZTXJG4K5.mjs +85 -0
- package/dist/index-7lxTrxSG.d.mts +128 -0
- package/dist/index-7lxTrxSG.d.ts +128 -0
- package/dist/index-B7QvY3yF.d.mts +245 -0
- package/dist/index-BK03FiEM.d.ts +245 -0
- package/dist/{index-CmR6NInu.d.ts → index-BzKOThsI.d.mts} +30 -3
- package/dist/{index-CmR6NInu.d.mts → index-BzKOThsI.d.ts} +30 -3
- package/dist/{index-DbH0Ljwp.d.mts → index-D8BNfUJb.d.mts} +17 -2
- package/dist/{index-DbH0Ljwp.d.ts → index-DD_E2UfJ.d.ts} +17 -2
- package/dist/index-DUi_XND6.d.ts +193 -0
- package/dist/index-gLl_358v.d.mts +193 -0
- package/dist/index.d.mts +6 -5
- package/dist/index.d.ts +6 -5
- package/dist/index.js +2876 -460
- package/dist/index.mjs +12 -10
- package/dist/nextjs/index.d.mts +2 -1
- package/dist/nextjs/index.d.ts +2 -1
- package/dist/nextjs/index.js +497 -16
- package/dist/nextjs/index.mjs +8 -3
- package/dist/socialMedia-C05Iy-SV.d.mts +21 -0
- package/dist/socialMedia-C05Iy-SV.d.ts +21 -0
- package/dist/studio/index.d.mts +2 -1
- package/dist/studio/index.d.ts +2 -1
- package/dist/studio/index.js +171 -5
- package/dist/studio/index.mjs +7 -3
- package/dist/studio-pages/builder.css +517 -32
- package/dist/studio-pages/client.d.mts +75 -1
- package/dist/studio-pages/client.d.ts +75 -1
- package/dist/studio-pages/client.js +5662 -2759
- package/dist/studio-pages/client.mjs +5578 -2767
- package/dist/studio-pages/index.d.mts +4 -2
- package/dist/studio-pages/index.d.ts +4 -2
- package/dist/studio-pages/index.js +859 -71
- package/dist/studio-pages/index.mjs +10 -4
- package/package.json +35 -13
- package/dist/chunk-AAOHJDNS.mjs +0 -67
- package/dist/chunk-ETRRXURT.mjs +0 -141
- package/dist/chunk-J7W5EE3B.mjs +0 -278
- package/dist/chunk-N67KVM2S.mjs +0 -156
- package/dist/chunk-NESLJZFE.mjs +0 -303
- package/dist/chunk-U5BSPWAD.mjs +0 -1034
- package/dist/index-B9N5MyjF.d.mts +0 -39
- package/dist/index-BallJs-K.d.mts +0 -43
- package/dist/index-BallJs-K.d.ts +0 -43
- package/dist/index-DJFhANvJ.d.mts +0 -128
- package/dist/index-DJFhANvJ.d.ts +0 -128
- package/dist/index-g8tBHLKD.d.ts +0 -39
package/dist/admin/index.d.mts
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
export { A as AdminConfig, c as configureAdmin,
|
|
1
|
+
export { A as AdminConfig, C as CreateSocialMediaConnectionsFieldOptions, a as CreateSocialMediaGlobalOptions, R as ResolvedStudioSection, S as StudioSection, b as StudioSectionCard, c as StudioSectionComponent, d as StudioSectionRole, e as StudioSectionView, f as configureAdmin, g as createHeaderNavItemsField, h as createSocialMediaConnectionsField, j as createSocialMediaGlobal, k as createThemePreferenceField, s as socialMediaConnectionsField, t as themePreferenceField, w as withTooltips } from '../index-B7QvY3yF.mjs';
|
|
2
|
+
export { b as SOCIAL_MEDIA_DEFAULT_ICON_BY_PLATFORM, c as SOCIAL_MEDIA_ICON_OPTIONS, d as SOCIAL_MEDIA_PLATFORMS, e as SOCIAL_MEDIA_PLATFORM_LABELS, S as SocialMediaGlobalData, f as SocialMediaIconLibrary, g as SocialMediaIconOption, a as SocialMediaPlatform, h as SocialMediaProfileData, i as SocialMediaProfilesData } from '../socialMedia-C05Iy-SV.mjs';
|
|
2
3
|
import 'payload';
|
package/dist/admin/index.d.ts
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
export { A as AdminConfig, c as configureAdmin,
|
|
1
|
+
export { A as AdminConfig, C as CreateSocialMediaConnectionsFieldOptions, a as CreateSocialMediaGlobalOptions, R as ResolvedStudioSection, S as StudioSection, b as StudioSectionCard, c as StudioSectionComponent, d as StudioSectionRole, e as StudioSectionView, f as configureAdmin, g as createHeaderNavItemsField, h as createSocialMediaConnectionsField, j as createSocialMediaGlobal, k as createThemePreferenceField, s as socialMediaConnectionsField, t as themePreferenceField, w as withTooltips } from '../index-BK03FiEM.js';
|
|
2
|
+
export { b as SOCIAL_MEDIA_DEFAULT_ICON_BY_PLATFORM, c as SOCIAL_MEDIA_ICON_OPTIONS, d as SOCIAL_MEDIA_PLATFORMS, e as SOCIAL_MEDIA_PLATFORM_LABELS, S as SocialMediaGlobalData, f as SocialMediaIconLibrary, g as SocialMediaIconOption, a as SocialMediaPlatform, h as SocialMediaProfileData, i as SocialMediaProfilesData } from '../socialMedia-C05Iy-SV.js';
|
|
2
3
|
import 'payload';
|
package/dist/admin/index.js
CHANGED
|
@@ -30,8 +30,16 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
30
30
|
// src/admin/index.ts
|
|
31
31
|
var admin_exports = {};
|
|
32
32
|
__export(admin_exports, {
|
|
33
|
+
SOCIAL_MEDIA_DEFAULT_ICON_BY_PLATFORM: () => SOCIAL_MEDIA_DEFAULT_ICON_BY_PLATFORM,
|
|
34
|
+
SOCIAL_MEDIA_ICON_OPTIONS: () => SOCIAL_MEDIA_ICON_OPTIONS,
|
|
35
|
+
SOCIAL_MEDIA_PLATFORMS: () => SOCIAL_MEDIA_PLATFORMS,
|
|
36
|
+
SOCIAL_MEDIA_PLATFORM_LABELS: () => SOCIAL_MEDIA_PLATFORM_LABELS,
|
|
33
37
|
configureAdmin: () => configureAdmin,
|
|
38
|
+
createHeaderNavItemsField: () => createHeaderNavItemsField,
|
|
39
|
+
createSocialMediaConnectionsField: () => createSocialMediaConnectionsField,
|
|
40
|
+
createSocialMediaGlobal: () => createSocialMediaGlobal,
|
|
34
41
|
createThemePreferenceField: () => createThemePreferenceField,
|
|
42
|
+
socialMediaConnectionsField: () => socialMediaConnectionsField,
|
|
35
43
|
themePreferenceField: () => themePreferenceField,
|
|
36
44
|
withTooltips: () => withTooltips
|
|
37
45
|
});
|
|
@@ -60,6 +68,113 @@ var createThemePreferenceField = (defaultTheme = "brand-light") => ({
|
|
|
60
68
|
});
|
|
61
69
|
var themePreferenceField = createThemePreferenceField("brand-light");
|
|
62
70
|
|
|
71
|
+
// src/shared/studioSections.ts
|
|
72
|
+
var studioRoles = /* @__PURE__ */ new Set(["admin", "editor", "client"]);
|
|
73
|
+
var isRecord = (value) => Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
74
|
+
var isAbsoluteExternalURL = (value) => /^[a-zA-Z][a-zA-Z\d+\-.]*:/.test(value) || value.startsWith("//");
|
|
75
|
+
var normalizePathLikeValue = (value) => {
|
|
76
|
+
const trimmed = value.trim();
|
|
77
|
+
if (!trimmed) {
|
|
78
|
+
return "";
|
|
79
|
+
}
|
|
80
|
+
if (isAbsoluteExternalURL(trimmed)) {
|
|
81
|
+
return trimmed;
|
|
82
|
+
}
|
|
83
|
+
const withLeadingSlash = trimmed.startsWith("/") ? trimmed : `/${trimmed}`;
|
|
84
|
+
const normalized = withLeadingSlash.replace(/\/+$/, "");
|
|
85
|
+
return normalized || "/";
|
|
86
|
+
};
|
|
87
|
+
var normalizeStringArray = (value) => {
|
|
88
|
+
if (!Array.isArray(value)) {
|
|
89
|
+
return [];
|
|
90
|
+
}
|
|
91
|
+
return value.filter((entry) => typeof entry === "string").map((entry) => normalizePathLikeValue(entry)).filter((entry) => entry.length > 0);
|
|
92
|
+
};
|
|
93
|
+
var normalizeRoles = (value) => {
|
|
94
|
+
if (!Array.isArray(value)) {
|
|
95
|
+
return void 0;
|
|
96
|
+
}
|
|
97
|
+
const roles = value.filter((entry) => typeof entry === "string" && studioRoles.has(entry));
|
|
98
|
+
return roles.length > 0 ? roles : void 0;
|
|
99
|
+
};
|
|
100
|
+
var normalizeCard = (value) => {
|
|
101
|
+
if (!isRecord(value) || typeof value.title !== "string") {
|
|
102
|
+
return void 0;
|
|
103
|
+
}
|
|
104
|
+
const title = value.title.trim();
|
|
105
|
+
if (!title) {
|
|
106
|
+
return void 0;
|
|
107
|
+
}
|
|
108
|
+
return {
|
|
109
|
+
title,
|
|
110
|
+
...typeof value.description === "string" && value.description.trim().length > 0 ? { description: value.description.trim() } : {}
|
|
111
|
+
};
|
|
112
|
+
};
|
|
113
|
+
var resolveStudioSections = (value) => {
|
|
114
|
+
if (!Array.isArray(value)) {
|
|
115
|
+
return [];
|
|
116
|
+
}
|
|
117
|
+
const sections = [];
|
|
118
|
+
const seen = /* @__PURE__ */ new Set();
|
|
119
|
+
for (const entry of value) {
|
|
120
|
+
if (!isRecord(entry) || typeof entry.id !== "string" || typeof entry.label !== "string") {
|
|
121
|
+
continue;
|
|
122
|
+
}
|
|
123
|
+
const id = entry.id.trim();
|
|
124
|
+
const label = entry.label.trim();
|
|
125
|
+
if (!id || !label || seen.has(id)) {
|
|
126
|
+
continue;
|
|
127
|
+
}
|
|
128
|
+
const href = typeof entry.href === "string" && entry.href.trim().length > 0 ? normalizePathLikeValue(entry.href) : isRecord(entry.view) && typeof entry.view.path === "string" ? normalizePathLikeValue(entry.view.path) : "";
|
|
129
|
+
if (!href) {
|
|
130
|
+
continue;
|
|
131
|
+
}
|
|
132
|
+
const matchPrefixes = Array.from(/* @__PURE__ */ new Set([href, ...normalizeStringArray(entry.matchPrefixes)]));
|
|
133
|
+
sections.push({
|
|
134
|
+
id,
|
|
135
|
+
label,
|
|
136
|
+
href,
|
|
137
|
+
matchPrefixes,
|
|
138
|
+
...normalizeRoles(entry.roles) ? { roles: normalizeRoles(entry.roles) } : {},
|
|
139
|
+
...normalizeCard(entry.card) ? { card: normalizeCard(entry.card) } : {}
|
|
140
|
+
});
|
|
141
|
+
seen.add(id);
|
|
142
|
+
}
|
|
143
|
+
return sections;
|
|
144
|
+
};
|
|
145
|
+
var resolveStudioSectionViews = (value) => {
|
|
146
|
+
if (!Array.isArray(value)) {
|
|
147
|
+
return {};
|
|
148
|
+
}
|
|
149
|
+
const views = {};
|
|
150
|
+
for (const entry of value) {
|
|
151
|
+
if (!isRecord(entry) || typeof entry.id !== "string" || !isRecord(entry.view)) {
|
|
152
|
+
continue;
|
|
153
|
+
}
|
|
154
|
+
const id = entry.id.trim();
|
|
155
|
+
const view = entry.view;
|
|
156
|
+
const component = isRecord(view.Component) ? view.Component : null;
|
|
157
|
+
if (!id || typeof view.path !== "string" || !component || typeof component.exportName !== "string" || typeof component.path !== "string") {
|
|
158
|
+
continue;
|
|
159
|
+
}
|
|
160
|
+
const path2 = normalizePathLikeValue(view.path);
|
|
161
|
+
const componentPath = component.path.trim();
|
|
162
|
+
const exportName = component.exportName.trim();
|
|
163
|
+
if (!path2 || !componentPath || !exportName) {
|
|
164
|
+
continue;
|
|
165
|
+
}
|
|
166
|
+
views[id] = {
|
|
167
|
+
path: path2,
|
|
168
|
+
Component: {
|
|
169
|
+
exportName,
|
|
170
|
+
path: componentPath,
|
|
171
|
+
...isRecord(component.clientProps) ? { clientProps: component.clientProps } : {}
|
|
172
|
+
}
|
|
173
|
+
};
|
|
174
|
+
}
|
|
175
|
+
return views;
|
|
176
|
+
};
|
|
177
|
+
|
|
63
178
|
// src/admin/helpers/configureAdmin.ts
|
|
64
179
|
var import_meta = {};
|
|
65
180
|
function getPkgDistDir() {
|
|
@@ -87,14 +202,31 @@ function configureAdmin(config) {
|
|
|
87
202
|
defaultTheme = "brand-light",
|
|
88
203
|
logoUrl
|
|
89
204
|
} = config;
|
|
90
|
-
const studioEnabled =
|
|
205
|
+
const studioEnabled = config.studio?.enabled ?? true;
|
|
206
|
+
const formsEnabled = config.studio?.forms?.enabled ?? false;
|
|
207
|
+
const formsCollectionSlug = config.studio?.forms?.collectionSlug || "forms";
|
|
208
|
+
const formSubmissionsCollectionSlug = config.studio?.forms?.submissionsCollectionSlug || "form-submissions";
|
|
209
|
+
const formUploadsCollectionSlug = config.studio?.forms?.uploadsCollectionSlug || "form-uploads";
|
|
91
210
|
const pagesCollectionSlug = config.studio?.pages?.collectionSlug || "pages";
|
|
92
211
|
const mediaCollectionSlug = config.studio?.media?.collectionSlug || "media";
|
|
93
|
-
const
|
|
212
|
+
const contactFormStudioPath = "/studio-contact-form";
|
|
213
|
+
const configuredGlobals = config.studio?.globals || [
|
|
94
214
|
{ slug: "site-settings", label: "Website Settings" },
|
|
95
215
|
{ slug: "header", label: "Header & Navigation" },
|
|
96
|
-
{ slug: "footer", label: "Footer" }
|
|
216
|
+
{ slug: "footer", label: "Footer" },
|
|
217
|
+
{ slug: "contact-form", label: "Contact Form" }
|
|
97
218
|
];
|
|
219
|
+
const globals = configuredGlobals.map((global) => {
|
|
220
|
+
if (global.slug !== "contact-form" || global.href) {
|
|
221
|
+
return global;
|
|
222
|
+
}
|
|
223
|
+
return {
|
|
224
|
+
...global,
|
|
225
|
+
href: contactFormStudioPath
|
|
226
|
+
};
|
|
227
|
+
});
|
|
228
|
+
const studioSections = resolveStudioSections(config.studio?.sections || []);
|
|
229
|
+
const studioSectionViews = resolveStudioSectionViews(config.studio?.sections || []);
|
|
98
230
|
let cssPath;
|
|
99
231
|
const pkgDist = getPkgDistDir();
|
|
100
232
|
const sourceCssPath = import_path.default.resolve(pkgDist, "admin.css");
|
|
@@ -124,9 +256,15 @@ function configureAdmin(config) {
|
|
|
124
256
|
clientProps: {
|
|
125
257
|
brandName,
|
|
126
258
|
logoUrl,
|
|
127
|
-
globalsBasePath: "/
|
|
259
|
+
globalsBasePath: "/studio-globals",
|
|
260
|
+
globalsExtraMatchPrefixes: [contactFormStudioPath],
|
|
261
|
+
formSubmissionsCollectionSlug,
|
|
262
|
+
formsCollectionSlug,
|
|
263
|
+
formsEnabled,
|
|
264
|
+
formUploadsCollectionSlug,
|
|
128
265
|
mediaCollectionSlug,
|
|
129
|
-
pagesCollectionSlug
|
|
266
|
+
pagesCollectionSlug,
|
|
267
|
+
sections: studioSections
|
|
130
268
|
}
|
|
131
269
|
}
|
|
132
270
|
} : {},
|
|
@@ -156,9 +294,15 @@ function configureAdmin(config) {
|
|
|
156
294
|
clientProps: {
|
|
157
295
|
brandName,
|
|
158
296
|
logoUrl,
|
|
159
|
-
globalsBasePath: "/
|
|
297
|
+
globalsBasePath: "/studio-globals",
|
|
298
|
+
globalsExtraMatchPrefixes: [contactFormStudioPath],
|
|
299
|
+
formSubmissionsCollectionSlug,
|
|
300
|
+
formsCollectionSlug,
|
|
301
|
+
formsEnabled,
|
|
302
|
+
formUploadsCollectionSlug,
|
|
160
303
|
mediaCollectionSlug,
|
|
161
|
-
pagesCollectionSlug
|
|
304
|
+
pagesCollectionSlug,
|
|
305
|
+
sections: studioSections
|
|
162
306
|
}
|
|
163
307
|
}
|
|
164
308
|
},
|
|
@@ -170,10 +314,44 @@ function configureAdmin(config) {
|
|
|
170
314
|
path: clientPath,
|
|
171
315
|
clientProps: {
|
|
172
316
|
globals,
|
|
173
|
-
globalsBasePath: "/
|
|
317
|
+
globalsBasePath: "/studio-globals"
|
|
174
318
|
}
|
|
175
319
|
}
|
|
176
|
-
}
|
|
320
|
+
},
|
|
321
|
+
studioContactForm: {
|
|
322
|
+
path: "/studio-contact-form",
|
|
323
|
+
Component: {
|
|
324
|
+
exportName: "AdminStudioContactFormView",
|
|
325
|
+
path: clientPath,
|
|
326
|
+
clientProps: {
|
|
327
|
+
globalSlug: "contact-form",
|
|
328
|
+
globalsBasePath: "/studio-globals"
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
},
|
|
332
|
+
...formsEnabled ? {
|
|
333
|
+
studioForms: {
|
|
334
|
+
path: "/studio-forms",
|
|
335
|
+
Component: {
|
|
336
|
+
exportName: "AdminStudioFormsView",
|
|
337
|
+
path: clientPath,
|
|
338
|
+
clientProps: {
|
|
339
|
+
formsCollectionSlug,
|
|
340
|
+
formSubmissionsCollectionSlug,
|
|
341
|
+
formUploadsCollectionSlug
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
} : {},
|
|
346
|
+
...Object.fromEntries(
|
|
347
|
+
Object.entries(studioSectionViews).map(([id, view]) => [
|
|
348
|
+
id,
|
|
349
|
+
{
|
|
350
|
+
path: view.path,
|
|
351
|
+
Component: view.Component
|
|
352
|
+
}
|
|
353
|
+
])
|
|
354
|
+
)
|
|
177
355
|
} : {}
|
|
178
356
|
},
|
|
179
357
|
providers: [
|
|
@@ -217,16 +395,48 @@ function configureAdmin(config) {
|
|
|
217
395
|
const labelMap = {
|
|
218
396
|
header: { group: "Site Design", label: "Header & Navigation" },
|
|
219
397
|
footer: { group: "Site Design", label: "Footer" },
|
|
220
|
-
"site-settings": { group: "Site Design", label: "Website Settings" }
|
|
398
|
+
"site-settings": { group: "Site Design", label: "Website Settings" },
|
|
399
|
+
"social-media": { group: "Site Design", label: "Social Media" },
|
|
400
|
+
"contact-form": { group: "Lead Forms", label: "Contact Form" }
|
|
221
401
|
};
|
|
222
402
|
return globals2.map((global) => {
|
|
223
403
|
const mapping = labelMap[global.slug];
|
|
224
404
|
if (!mapping) return global;
|
|
405
|
+
const shouldAttachContactFormRedirect = studioEnabled && global.slug === "contact-form";
|
|
406
|
+
const existingViews = global.admin?.components?.views;
|
|
407
|
+
const existingEditViews = existingViews?.edit;
|
|
408
|
+
const hasCustomContactFormEditView = Boolean(
|
|
409
|
+
existingEditViews?.root || existingEditViews?.default && typeof existingEditViews.default === "object" && existingEditViews.default.Component
|
|
410
|
+
);
|
|
411
|
+
const contactFormEditViews = shouldAttachContactFormRedirect && !hasCustomContactFormEditView ? {
|
|
412
|
+
...existingEditViews,
|
|
413
|
+
default: {
|
|
414
|
+
...typeof existingEditViews?.default === "object" ? existingEditViews.default : {},
|
|
415
|
+
Component: {
|
|
416
|
+
exportName: "StudioContactFormRedirect",
|
|
417
|
+
path: clientPath,
|
|
418
|
+
clientProps: {
|
|
419
|
+
studioContactFormPath: contactFormStudioPath
|
|
420
|
+
}
|
|
421
|
+
}
|
|
422
|
+
}
|
|
423
|
+
} : existingEditViews;
|
|
225
424
|
return {
|
|
226
425
|
...global,
|
|
227
426
|
admin: {
|
|
228
427
|
...global.admin,
|
|
229
|
-
group: mapping.group
|
|
428
|
+
group: mapping.group,
|
|
429
|
+
components: {
|
|
430
|
+
...global.admin?.components,
|
|
431
|
+
...shouldAttachContactFormRedirect ? {
|
|
432
|
+
views: {
|
|
433
|
+
...existingViews,
|
|
434
|
+
...contactFormEditViews ? {
|
|
435
|
+
edit: contactFormEditViews
|
|
436
|
+
} : {}
|
|
437
|
+
}
|
|
438
|
+
} : {}
|
|
439
|
+
}
|
|
230
440
|
},
|
|
231
441
|
label: mapping.label
|
|
232
442
|
};
|
|
@@ -294,10 +504,213 @@ function addTooltipToField(field, tooltips) {
|
|
|
294
504
|
}
|
|
295
505
|
return field;
|
|
296
506
|
}
|
|
507
|
+
|
|
508
|
+
// src/admin/fields/headerNav.ts
|
|
509
|
+
var createHeaderNavItemsField = () => ({
|
|
510
|
+
name: "navItems",
|
|
511
|
+
type: "array",
|
|
512
|
+
labels: { singular: "Navigation Link", plural: "Navigation Links" },
|
|
513
|
+
admin: {
|
|
514
|
+
description: "The links displayed in your website's main navigation menu."
|
|
515
|
+
},
|
|
516
|
+
fields: [
|
|
517
|
+
{
|
|
518
|
+
name: "label",
|
|
519
|
+
type: "text",
|
|
520
|
+
required: true,
|
|
521
|
+
admin: {
|
|
522
|
+
description: "The text shown for this navigation link."
|
|
523
|
+
}
|
|
524
|
+
},
|
|
525
|
+
{
|
|
526
|
+
name: "href",
|
|
527
|
+
type: "text",
|
|
528
|
+
required: true,
|
|
529
|
+
admin: {
|
|
530
|
+
description: 'The URL this link points to (e.g., "/about" or "https://example.com").'
|
|
531
|
+
}
|
|
532
|
+
},
|
|
533
|
+
{
|
|
534
|
+
name: "parentHref",
|
|
535
|
+
type: "text",
|
|
536
|
+
admin: {
|
|
537
|
+
description: "Optional parent link URL. If set to another nav item href, this item appears in that dropdown."
|
|
538
|
+
}
|
|
539
|
+
}
|
|
540
|
+
]
|
|
541
|
+
});
|
|
542
|
+
|
|
543
|
+
// src/shared/socialMedia.ts
|
|
544
|
+
var SOCIAL_MEDIA_PLATFORM_LABELS = {
|
|
545
|
+
facebook: "Facebook",
|
|
546
|
+
instagram: "Instagram",
|
|
547
|
+
x: "X (Twitter)",
|
|
548
|
+
linkedin: "LinkedIn",
|
|
549
|
+
youtube: "YouTube",
|
|
550
|
+
tiktok: "TikTok",
|
|
551
|
+
pinterest: "Pinterest",
|
|
552
|
+
snapchat: "Snapchat"
|
|
553
|
+
};
|
|
554
|
+
var SOCIAL_MEDIA_PLATFORMS = [
|
|
555
|
+
"facebook",
|
|
556
|
+
"instagram",
|
|
557
|
+
"x",
|
|
558
|
+
"linkedin",
|
|
559
|
+
"youtube",
|
|
560
|
+
"tiktok",
|
|
561
|
+
"pinterest",
|
|
562
|
+
"snapchat"
|
|
563
|
+
];
|
|
564
|
+
var SOCIAL_MEDIA_ICON_OPTIONS = {
|
|
565
|
+
facebook: [
|
|
566
|
+
{ label: "Simple Icons", library: "simple-icons", value: "simple-icons:facebook" },
|
|
567
|
+
{ label: "Font Awesome Brands", library: "font-awesome-brands", value: "fa6-brands:facebook-f" },
|
|
568
|
+
{ label: "Tabler Brands", library: "tabler-brands", value: "tabler:brand-facebook" },
|
|
569
|
+
{ label: "Remix Icons", library: "remix-icons", value: "ri:facebook-fill" }
|
|
570
|
+
],
|
|
571
|
+
instagram: [
|
|
572
|
+
{ label: "Simple Icons", library: "simple-icons", value: "simple-icons:instagram" },
|
|
573
|
+
{ label: "Font Awesome Brands", library: "font-awesome-brands", value: "fa6-brands:instagram" },
|
|
574
|
+
{ label: "Tabler Brands", library: "tabler-brands", value: "tabler:brand-instagram" },
|
|
575
|
+
{ label: "Remix Icons", library: "remix-icons", value: "ri:instagram-fill" }
|
|
576
|
+
],
|
|
577
|
+
x: [
|
|
578
|
+
{ label: "Simple Icons", library: "simple-icons", value: "simple-icons:x" },
|
|
579
|
+
{ label: "Font Awesome Brands", library: "font-awesome-brands", value: "fa6-brands:x-twitter" },
|
|
580
|
+
{ label: "Tabler Brands", library: "tabler-brands", value: "tabler:brand-x" },
|
|
581
|
+
{ label: "Remix Icons", library: "remix-icons", value: "ri:twitter-x-fill" }
|
|
582
|
+
],
|
|
583
|
+
linkedin: [
|
|
584
|
+
{ label: "Simple Icons", library: "simple-icons", value: "simple-icons:linkedin" },
|
|
585
|
+
{ label: "Font Awesome Brands", library: "font-awesome-brands", value: "fa6-brands:linkedin-in" },
|
|
586
|
+
{ label: "Tabler Brands", library: "tabler-brands", value: "tabler:brand-linkedin" },
|
|
587
|
+
{ label: "Remix Icons", library: "remix-icons", value: "ri:linkedin-fill" }
|
|
588
|
+
],
|
|
589
|
+
youtube: [
|
|
590
|
+
{ label: "Simple Icons", library: "simple-icons", value: "simple-icons:youtube" },
|
|
591
|
+
{ label: "Font Awesome Brands", library: "font-awesome-brands", value: "fa6-brands:youtube" },
|
|
592
|
+
{ label: "Tabler Brands", library: "tabler-brands", value: "tabler:brand-youtube" },
|
|
593
|
+
{ label: "Remix Icons", library: "remix-icons", value: "ri:youtube-fill" }
|
|
594
|
+
],
|
|
595
|
+
tiktok: [
|
|
596
|
+
{ label: "Simple Icons", library: "simple-icons", value: "simple-icons:tiktok" },
|
|
597
|
+
{ label: "Font Awesome Brands", library: "font-awesome-brands", value: "fa6-brands:tiktok" },
|
|
598
|
+
{ label: "Tabler Brands", library: "tabler-brands", value: "tabler:brand-tiktok" },
|
|
599
|
+
{ label: "Remix Icons", library: "remix-icons", value: "ri:tiktok-fill" }
|
|
600
|
+
],
|
|
601
|
+
pinterest: [
|
|
602
|
+
{ label: "Simple Icons", library: "simple-icons", value: "simple-icons:pinterest" },
|
|
603
|
+
{ label: "Font Awesome Brands", library: "font-awesome-brands", value: "fa6-brands:pinterest-p" },
|
|
604
|
+
{ label: "Tabler Brands", library: "tabler-brands", value: "tabler:brand-pinterest" },
|
|
605
|
+
{ label: "Remix Icons", library: "remix-icons", value: "ri:pinterest-fill" }
|
|
606
|
+
],
|
|
607
|
+
snapchat: [
|
|
608
|
+
{ label: "Simple Icons", library: "simple-icons", value: "simple-icons:snapchat" },
|
|
609
|
+
{ label: "Font Awesome Brands", library: "font-awesome-brands", value: "fa6-brands:snapchat" },
|
|
610
|
+
{ label: "Tabler Brands", library: "tabler-brands", value: "tabler:brand-snapchat" },
|
|
611
|
+
{ label: "Remix Icons", library: "remix-icons", value: "ri:snapchat-fill" }
|
|
612
|
+
]
|
|
613
|
+
};
|
|
614
|
+
var SOCIAL_MEDIA_DEFAULT_ICON_BY_PLATFORM = SOCIAL_MEDIA_PLATFORMS.reduce(
|
|
615
|
+
(acc, platform) => {
|
|
616
|
+
acc[platform] = SOCIAL_MEDIA_ICON_OPTIONS[platform][0].value;
|
|
617
|
+
return acc;
|
|
618
|
+
},
|
|
619
|
+
{}
|
|
620
|
+
);
|
|
621
|
+
|
|
622
|
+
// src/admin/fields/socialMedia.ts
|
|
623
|
+
var DEFAULT_DESCRIPTION = "Add profile URLs and choose one of two icon styles for each platform. Leave a URL blank to hide that profile on your site.";
|
|
624
|
+
function validateOptionalHttpsUrl(value) {
|
|
625
|
+
if (value === null || value === void 0 || value === "") {
|
|
626
|
+
return true;
|
|
627
|
+
}
|
|
628
|
+
if (typeof value !== "string") {
|
|
629
|
+
return "Enter a valid URL.";
|
|
630
|
+
}
|
|
631
|
+
try {
|
|
632
|
+
const url = new URL(value);
|
|
633
|
+
if (url.protocol !== "http:" && url.protocol !== "https:") {
|
|
634
|
+
return "Use an http:// or https:// URL.";
|
|
635
|
+
}
|
|
636
|
+
return true;
|
|
637
|
+
} catch {
|
|
638
|
+
return "Enter a valid URL (for example: https://instagram.com/yourbrand).";
|
|
639
|
+
}
|
|
640
|
+
}
|
|
641
|
+
function createPlatformField(platform) {
|
|
642
|
+
const platformLabel = SOCIAL_MEDIA_PLATFORM_LABELS[platform];
|
|
643
|
+
const iconOptions = SOCIAL_MEDIA_ICON_OPTIONS[platform].map((option) => ({
|
|
644
|
+
label: option.label,
|
|
645
|
+
value: option.value
|
|
646
|
+
}));
|
|
647
|
+
return {
|
|
648
|
+
name: platform,
|
|
649
|
+
type: "group",
|
|
650
|
+
label: platformLabel,
|
|
651
|
+
fields: [
|
|
652
|
+
{
|
|
653
|
+
name: "url",
|
|
654
|
+
type: "text",
|
|
655
|
+
admin: {
|
|
656
|
+
description: `Full ${platformLabel} profile URL. Leave blank to hide ${platformLabel}.`
|
|
657
|
+
},
|
|
658
|
+
validate: validateOptionalHttpsUrl
|
|
659
|
+
},
|
|
660
|
+
{
|
|
661
|
+
name: "icon",
|
|
662
|
+
type: "select",
|
|
663
|
+
defaultValue: SOCIAL_MEDIA_DEFAULT_ICON_BY_PLATFORM[platform],
|
|
664
|
+
options: iconOptions,
|
|
665
|
+
admin: {
|
|
666
|
+
description: "Pick which icon style to display for this platform."
|
|
667
|
+
}
|
|
668
|
+
}
|
|
669
|
+
]
|
|
670
|
+
};
|
|
671
|
+
}
|
|
672
|
+
var createSocialMediaConnectionsField = (options = {}) => {
|
|
673
|
+
const selectedPlatforms = Array.isArray(options.platforms) && options.platforms.length > 0 ? options.platforms : SOCIAL_MEDIA_PLATFORMS;
|
|
674
|
+
return {
|
|
675
|
+
name: options.name || "profiles",
|
|
676
|
+
type: "group",
|
|
677
|
+
label: options.label || "Social Media Profiles",
|
|
678
|
+
admin: {
|
|
679
|
+
description: options.description || DEFAULT_DESCRIPTION
|
|
680
|
+
},
|
|
681
|
+
fields: selectedPlatforms.map((platform) => createPlatformField(platform))
|
|
682
|
+
};
|
|
683
|
+
};
|
|
684
|
+
var socialMediaConnectionsField = createSocialMediaConnectionsField();
|
|
685
|
+
|
|
686
|
+
// src/admin/globals/socialMedia.ts
|
|
687
|
+
var createSocialMediaGlobal = (options = {}) => ({
|
|
688
|
+
slug: options.slug || "social-media",
|
|
689
|
+
label: "Social Media",
|
|
690
|
+
admin: {
|
|
691
|
+
description: options.description || "Manage social profile links and icon variants used across your website.",
|
|
692
|
+
group: "Site Design"
|
|
693
|
+
},
|
|
694
|
+
fields: [
|
|
695
|
+
createSocialMediaConnectionsField({
|
|
696
|
+
...options.fieldOptions,
|
|
697
|
+
label: "Profiles",
|
|
698
|
+
name: "profiles"
|
|
699
|
+
})
|
|
700
|
+
]
|
|
701
|
+
});
|
|
297
702
|
// Annotate the CommonJS export names for ESM import in node:
|
|
298
703
|
0 && (module.exports = {
|
|
704
|
+
SOCIAL_MEDIA_DEFAULT_ICON_BY_PLATFORM,
|
|
705
|
+
SOCIAL_MEDIA_ICON_OPTIONS,
|
|
706
|
+
SOCIAL_MEDIA_PLATFORMS,
|
|
707
|
+
SOCIAL_MEDIA_PLATFORM_LABELS,
|
|
299
708
|
configureAdmin,
|
|
709
|
+
createHeaderNavItemsField,
|
|
710
|
+
createSocialMediaConnectionsField,
|
|
711
|
+
createSocialMediaGlobal,
|
|
300
712
|
createThemePreferenceField,
|
|
713
|
+
socialMediaConnectionsField,
|
|
301
714
|
themePreferenceField,
|
|
302
715
|
withTooltips
|
|
303
716
|
});
|
package/dist/admin/index.mjs
CHANGED
|
@@ -1,13 +1,31 @@
|
|
|
1
1
|
import {
|
|
2
2
|
configureAdmin,
|
|
3
|
+
createHeaderNavItemsField,
|
|
4
|
+
createSocialMediaConnectionsField,
|
|
5
|
+
createSocialMediaGlobal,
|
|
3
6
|
createThemePreferenceField,
|
|
7
|
+
socialMediaConnectionsField,
|
|
4
8
|
themePreferenceField,
|
|
5
9
|
withTooltips
|
|
6
|
-
} from "../chunk-
|
|
10
|
+
} from "../chunk-DAIZDGHL.mjs";
|
|
11
|
+
import {
|
|
12
|
+
SOCIAL_MEDIA_DEFAULT_ICON_BY_PLATFORM,
|
|
13
|
+
SOCIAL_MEDIA_ICON_OPTIONS,
|
|
14
|
+
SOCIAL_MEDIA_PLATFORMS,
|
|
15
|
+
SOCIAL_MEDIA_PLATFORM_LABELS
|
|
16
|
+
} from "../chunk-ZTXJG4K5.mjs";
|
|
7
17
|
import "../chunk-6BWS3CLP.mjs";
|
|
8
18
|
export {
|
|
19
|
+
SOCIAL_MEDIA_DEFAULT_ICON_BY_PLATFORM,
|
|
20
|
+
SOCIAL_MEDIA_ICON_OPTIONS,
|
|
21
|
+
SOCIAL_MEDIA_PLATFORMS,
|
|
22
|
+
SOCIAL_MEDIA_PLATFORM_LABELS,
|
|
9
23
|
configureAdmin,
|
|
24
|
+
createHeaderNavItemsField,
|
|
25
|
+
createSocialMediaConnectionsField,
|
|
26
|
+
createSocialMediaGlobal,
|
|
10
27
|
createThemePreferenceField,
|
|
28
|
+
socialMediaConnectionsField,
|
|
11
29
|
themePreferenceField,
|
|
12
30
|
withTooltips
|
|
13
31
|
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { AdminShellClient } from './components/AdminShellClient'
|
|
2
|
+
export { HeaderNavItemsEditor } from './components/HeaderNavItemsEditor'
|
|
3
|
+
export { HeaderNavEditorWithPreview } from './components/HeaderNavEditorWithPreview'
|
|
4
|
+
export { MediaDetailPanel } from './components/MediaDetailPanel'
|
|
5
|
+
export { MediaListItem } from './components/MediaListItem'
|
|
6
|
+
export { MediaUploadForm } from './components/MediaUploadForm'
|
|
7
|
+
export { PageEditorFrame } from './components/PageEditorFrame'
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { AdminShellClient } from './components/AdminShellClient'
|
|
2
|
+
export { HeaderNavItemsEditor } from './components/HeaderNavItemsEditor'
|
|
3
|
+
export { HeaderNavEditorWithPreview } from './components/HeaderNavEditorWithPreview'
|
|
4
|
+
export { MediaDetailPanel } from './components/MediaDetailPanel'
|
|
5
|
+
export { MediaListItem } from './components/MediaListItem'
|
|
6
|
+
export { MediaUploadForm } from './components/MediaUploadForm'
|
|
7
|
+
export { PageEditorFrame } from './components/PageEditorFrame'
|