@orion-studios/payload-studio 0.5.0-beta.98 → 0.6.0-beta.1

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.
Files changed (63) hide show
  1. package/README.md +58 -68
  2. package/dist/admin/client.d.mts +5 -0
  3. package/dist/admin/client.d.ts +5 -0
  4. package/dist/admin/client.js +4491 -736
  5. package/dist/admin/client.mjs +3367 -752
  6. package/dist/admin/index.d.mts +2 -1
  7. package/dist/admin/index.d.ts +2 -1
  8. package/dist/admin/index.js +498 -53
  9. package/dist/admin/index.mjs +2 -1
  10. package/dist/admin-app/client.d.mts +1 -0
  11. package/dist/admin-app/client.d.ts +1 -0
  12. package/dist/admin-app/client.js +285 -109
  13. package/dist/admin-app/client.mjs +59 -871
  14. package/dist/admin-app/index.d.mts +2 -1
  15. package/dist/admin-app/index.d.ts +2 -1
  16. package/dist/admin-app/index.mjs +5 -3
  17. package/dist/admin-app/styles.css +1708 -56
  18. package/dist/admin.css +158 -35
  19. package/dist/blocks/index.js +415 -200
  20. package/dist/blocks/index.mjs +2 -2
  21. package/dist/{chunk-XK3K5GRP.mjs → chunk-JQAHXYAM.mjs} +271 -67
  22. package/dist/chunk-KPIX7OSV.mjs +1051 -0
  23. package/dist/chunk-OQSEJXC4.mjs +166 -0
  24. package/dist/{chunk-XHWQJUX5.mjs → chunk-OTHERBGX.mjs} +3 -3
  25. package/dist/chunk-PF3EBZXF.mjs +326 -0
  26. package/dist/chunk-Q2HGC67S.mjs +904 -0
  27. package/dist/{chunk-XVH5SCBD.mjs → chunk-RKTIFEUY.mjs} +4 -19
  28. package/dist/chunk-W2UOCJDX.mjs +32 -0
  29. package/dist/{chunk-C4J35SPJ.mjs → chunk-XKUTZ7IU.mjs} +257 -452
  30. package/dist/{index-ZbOx4OCF.d.ts → index-52HdVLQq.d.ts} +12 -22
  31. package/dist/index-BMitiKK8.d.ts +435 -0
  32. package/dist/index-Crx_MtPw.d.ts +223 -0
  33. package/dist/index-Cv-6qnrw.d.mts +223 -0
  34. package/dist/{index-ZbOx4OCF.d.mts → index-DEQC3Dwj.d.mts} +12 -22
  35. package/dist/{index-BIwu3qIH.d.mts → index-DWmudwDm.d.mts} +2 -1
  36. package/dist/{index-BIwu3qIH.d.ts → index-DWmudwDm.d.ts} +2 -1
  37. package/dist/index-D_b24Gef.d.mts +435 -0
  38. package/dist/index.d.mts +5 -4
  39. package/dist/index.d.ts +5 -4
  40. package/dist/index.js +1968 -1198
  41. package/dist/index.mjs +10 -8
  42. package/dist/nextjs/index.js +5 -684
  43. package/dist/nextjs/index.mjs +2 -3
  44. package/dist/sitePreviewTypes-BkHCWxNW.d.mts +58 -0
  45. package/dist/sitePreviewTypes-BkHCWxNW.d.ts +58 -0
  46. package/dist/studio/index.d.mts +1 -1
  47. package/dist/studio/index.d.ts +1 -1
  48. package/dist/studio-pages/builder.css +125 -83
  49. package/dist/studio-pages/client.d.mts +58 -1
  50. package/dist/studio-pages/client.d.ts +58 -1
  51. package/dist/studio-pages/client.js +450 -241
  52. package/dist/studio-pages/client.mjs +455 -247
  53. package/dist/studio-pages/index.d.mts +3 -2
  54. package/dist/studio-pages/index.d.ts +3 -2
  55. package/dist/studio-pages/index.js +418 -183
  56. package/dist/studio-pages/index.mjs +15 -6
  57. package/package.json +19 -5
  58. package/dist/chunk-2FO2ROW4.mjs +0 -468
  59. package/dist/chunk-SIL2J5MF.mjs +0 -155
  60. package/dist/index-BFXZue5i.d.ts +0 -178
  61. package/dist/index-CoYRBbf6.d.mts +0 -178
  62. package/dist/index-R7hA134j.d.mts +0 -140
  63. package/dist/index-vjrjy0P4.d.ts +0 -140
@@ -1,24 +1,33 @@
1
1
  import {
2
- createDefaultStudioDocument,
3
- defaultBuilderThemeTokens,
4
- layoutToStudioDocument,
2
+ createStudioPageService,
3
+ getStudioDocumentFromPage,
5
4
  pageInspectorPanels,
6
5
  pageNodeTypes,
7
6
  pagePaletteGroups,
8
7
  pageStudioModuleManifest,
9
8
  resolveBuilderThemeTokens,
9
+ toEditorInitialDoc
10
+ } from "../chunk-XKUTZ7IU.mjs";
11
+ import "../chunk-OQSEJXC4.mjs";
12
+ import {
13
+ createDefaultStudioDocument,
14
+ defaultBuilderThemeTokens,
15
+ layoutToStudioDocument,
10
16
  studioDocumentToLayout
11
- } from "../chunk-C4J35SPJ.mjs";
12
- import "../chunk-SIL2J5MF.mjs";
17
+ } from "../chunk-PF3EBZXF.mjs";
18
+ import "../chunk-ADIIWIYL.mjs";
13
19
  import "../chunk-6BWS3CLP.mjs";
14
20
  export {
15
21
  createDefaultStudioDocument,
22
+ createStudioPageService,
16
23
  defaultBuilderThemeTokens,
24
+ getStudioDocumentFromPage,
17
25
  layoutToStudioDocument,
18
26
  pageInspectorPanels,
19
27
  pageNodeTypes,
20
28
  pagePaletteGroups,
21
29
  pageStudioModuleManifest,
22
30
  resolveBuilderThemeTokens,
23
- studioDocumentToLayout
31
+ studioDocumentToLayout,
32
+ toEditorInitialDoc
24
33
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@orion-studios/payload-studio",
3
- "version": "0.5.0-beta.98",
4
- "description": "Unified Payload CMS toolkit for Orion Studios",
3
+ "version": "0.6.0-beta.1",
4
+ "description": "Base CMS, builder, and custom admin toolkit for Orion Studios websites",
5
5
  "types": "./dist/index.d.ts",
6
6
  "main": "./dist/index.js",
7
7
  "module": "./dist/index.mjs",
@@ -75,11 +75,19 @@
75
75
  "dist"
76
76
  ],
77
77
  "scripts": {
78
- "build": "tsup && node -e \"const fs=require('fs'); fs.copyFileSync('src/admin/styles/admin.css','dist/admin.css'); fs.mkdirSync('dist/admin-app',{recursive:true}); fs.copyFileSync('src/admin-app/styles/admin-app.css','dist/admin-app/styles.css'); fs.mkdirSync('dist/studio-pages',{recursive:true}); fs.copyFileSync('src/studio-pages/styles/builder.css','dist/studio-pages/builder.css'); fs.mkdirSync('dist/admin',{recursive:true}); fs.copyFileSync('src/admin/client.d.ts','dist/admin/client.d.ts'); fs.copyFileSync('src/admin/client.d.ts','dist/admin/client.d.mts'); fs.copyFileSync('src/admin-app/client.d.ts','dist/admin-app/client.d.ts'); fs.copyFileSync('src/admin-app/client.d.ts','dist/admin-app/client.d.mts'); fs.copyFileSync('src/studio-pages/client.d.ts','dist/studio-pages/client.d.ts'); fs.copyFileSync('src/studio-pages/client.d.ts','dist/studio-pages/client.d.mts')\"",
78
+ "build": "tsup && node scripts/copy-assets.mjs",
79
79
  "dev": "tsup --watch",
80
- "test": "tsx --test src/studio-pages/builder/settings-v2/__tests__/*.test.ts src/studio-pages/__tests__/*.test.ts",
80
+ "test": "tsx --test src/shared/__tests__/*.test.ts src/studio-pages/builder/settings-v2/__tests__/*.test.ts src/studio-pages/__tests__/*.test.ts",
81
81
  "typecheck": "tsc --noEmit"
82
82
  },
83
+ "overrides": {
84
+ "ajv": "^8.18.0",
85
+ "dompurify": "^3.3.3",
86
+ "file-type": "^21.3.3",
87
+ "immutable": "^4.3.8",
88
+ "rollup": "^4.59.0",
89
+ "undici": "^7.24.4"
90
+ },
83
91
  "keywords": [
84
92
  "payload",
85
93
  "cms",
@@ -90,6 +98,11 @@
90
98
  ],
91
99
  "author": "Orion Studios",
92
100
  "license": "MIT",
101
+ "sideEffects": [
102
+ "./dist/admin.css",
103
+ "./dist/admin-app/styles.css",
104
+ "./dist/studio-pages/builder.css"
105
+ ],
93
106
  "peerDependencies": {
94
107
  "@payloadcms/richtext-lexical": "^3.0.0",
95
108
  "@payloadcms/ui": "^3.0.0",
@@ -101,9 +114,10 @@
101
114
  "devDependencies": {
102
115
  "@payloadcms/richtext-lexical": "3.75.0",
103
116
  "@payloadcms/ui": "3.75.0",
117
+ "@types/node": "^22.0.0",
104
118
  "@types/react": "^19.0.0",
105
119
  "@types/react-dom": "^19.0.0",
106
- "next": "16.1.6",
120
+ "next": "16.2.0",
107
121
  "payload": "3.75.0",
108
122
  "tsx": "^4.21.0",
109
123
  "tsup": "^8.0.0",
@@ -1,468 +0,0 @@
1
- import {
2
- SOCIAL_MEDIA_DEFAULT_ICON_BY_PLATFORM,
3
- SOCIAL_MEDIA_ICON_OPTIONS,
4
- SOCIAL_MEDIA_PLATFORMS,
5
- SOCIAL_MEDIA_PLATFORM_LABELS
6
- } from "./chunk-ZTXJG4K5.mjs";
7
- import {
8
- __export,
9
- __require
10
- } from "./chunk-6BWS3CLP.mjs";
11
-
12
- // src/admin/index.ts
13
- var admin_exports = {};
14
- __export(admin_exports, {
15
- SOCIAL_MEDIA_DEFAULT_ICON_BY_PLATFORM: () => SOCIAL_MEDIA_DEFAULT_ICON_BY_PLATFORM,
16
- SOCIAL_MEDIA_ICON_OPTIONS: () => SOCIAL_MEDIA_ICON_OPTIONS,
17
- SOCIAL_MEDIA_PLATFORMS: () => SOCIAL_MEDIA_PLATFORMS,
18
- SOCIAL_MEDIA_PLATFORM_LABELS: () => SOCIAL_MEDIA_PLATFORM_LABELS,
19
- configureAdmin: () => configureAdmin,
20
- createHeaderNavItemsField: () => createHeaderNavItemsField,
21
- createSocialMediaConnectionsField: () => createSocialMediaConnectionsField,
22
- createSocialMediaGlobal: () => createSocialMediaGlobal,
23
- createThemePreferenceField: () => createThemePreferenceField,
24
- socialMediaConnectionsField: () => socialMediaConnectionsField,
25
- themePreferenceField: () => themePreferenceField,
26
- withTooltips: () => withTooltips
27
- });
28
-
29
- // src/admin/helpers/configureAdmin.ts
30
- import fs from "fs";
31
- import path from "path";
32
- import { fileURLToPath } from "url";
33
-
34
- // src/admin/fields/themePreference.ts
35
- var createThemePreferenceField = (defaultTheme = "brand-light") => ({
36
- name: "themePreference",
37
- type: "select",
38
- defaultValue: defaultTheme,
39
- options: [
40
- { label: "Light", value: "light" },
41
- { label: "Dark", value: "dark" },
42
- { label: "Brand Light", value: "brand-light" },
43
- { label: "Brand Dark", value: "brand-dark" }
44
- ],
45
- admin: {
46
- position: "sidebar",
47
- condition: () => false
48
- }
49
- });
50
- var themePreferenceField = createThemePreferenceField("brand-light");
51
-
52
- // src/admin/helpers/configureAdmin.ts
53
- function getPkgDistDir() {
54
- try {
55
- if (typeof import.meta?.url === "string") {
56
- return path.dirname(fileURLToPath(import.meta.url));
57
- }
58
- } catch {
59
- }
60
- if (typeof __dirname === "string") {
61
- return __dirname;
62
- }
63
- try {
64
- const pkgJson = __require.resolve("@orion-studios/payload-studio/package.json");
65
- return path.resolve(path.dirname(pkgJson), "dist");
66
- } catch {
67
- return process.cwd();
68
- }
69
- }
70
- function configureAdmin(config) {
71
- const {
72
- brandName,
73
- brandPrimary = "#3b82f6",
74
- brandSecondary = "#8b5cf6",
75
- defaultTheme = "brand-light",
76
- logoUrl
77
- } = config;
78
- const studioEnabled = config.studio?.enabled ?? true;
79
- const pagesCollectionSlug = config.studio?.pages?.collectionSlug || "pages";
80
- const mediaCollectionSlug = config.studio?.media?.collectionSlug || "media";
81
- const contactFormStudioPath = "/studio-contact-form";
82
- const configuredGlobals = config.studio?.globals || [
83
- { slug: "site-settings", label: "Website Settings" },
84
- { slug: "header", label: "Header & Navigation" },
85
- { slug: "footer", label: "Footer" },
86
- { slug: "contact-form", label: "Contact Form" }
87
- ];
88
- const globals = configuredGlobals.map((global) => {
89
- if (global.slug !== "contact-form" || global.href) {
90
- return global;
91
- }
92
- return {
93
- ...global,
94
- href: contactFormStudioPath
95
- };
96
- });
97
- let cssPath;
98
- const pkgDist = getPkgDistDir();
99
- const sourceCssPath = path.resolve(pkgDist, "admin.css");
100
- if (config.basePath && fs.existsSync(sourceCssPath)) {
101
- let css = fs.readFileSync(sourceCssPath, "utf-8");
102
- css = css.replace("--brand-primary: #3b82f6;", `--brand-primary: ${brandPrimary};`);
103
- css = css.replace("--brand-secondary: #8b5cf6;", `--brand-secondary: ${brandSecondary};`);
104
- const genDir = path.resolve(config.basePath, ".generated");
105
- if (!fs.existsSync(genDir)) {
106
- fs.mkdirSync(genDir, { recursive: true });
107
- }
108
- const genPath = path.resolve(genDir, "admin.css");
109
- fs.writeFileSync(genPath, css);
110
- cssPath = genPath;
111
- } else {
112
- cssPath = sourceCssPath;
113
- }
114
- const clientPath = "@orion-studios/payload-studio/admin/client";
115
- return {
116
- admin: {
117
- css: cssPath,
118
- components: {
119
- ...studioEnabled ? {
120
- Nav: {
121
- exportName: "AdminStudioNav",
122
- path: clientPath,
123
- clientProps: {
124
- brandName,
125
- logoUrl,
126
- globalsBasePath: "/studio-globals",
127
- globalsExtraMatchPrefixes: [contactFormStudioPath],
128
- mediaCollectionSlug,
129
- pagesCollectionSlug
130
- }
131
- }
132
- } : {},
133
- graphics: {
134
- Logo: {
135
- exportName: "Logo",
136
- path: clientPath,
137
- clientProps: {
138
- brandName,
139
- logoUrl
140
- }
141
- },
142
- Icon: {
143
- exportName: "Icon",
144
- path: clientPath,
145
- clientProps: {
146
- brandName,
147
- logoUrl
148
- }
149
- }
150
- },
151
- views: {
152
- dashboard: {
153
- Component: {
154
- exportName: studioEnabled ? "AdminStudioDashboard" : "Dashboard",
155
- path: clientPath,
156
- clientProps: {
157
- brandName,
158
- logoUrl,
159
- globalsBasePath: "/studio-globals",
160
- globalsExtraMatchPrefixes: [contactFormStudioPath],
161
- mediaCollectionSlug,
162
- pagesCollectionSlug
163
- }
164
- }
165
- },
166
- ...studioEnabled ? {
167
- studioGlobals: {
168
- path: "/studio-globals",
169
- Component: {
170
- exportName: "AdminStudioGlobalsView",
171
- path: clientPath,
172
- clientProps: {
173
- globals,
174
- globalsBasePath: "/studio-globals"
175
- }
176
- }
177
- },
178
- studioContactForm: {
179
- path: "/studio-contact-form",
180
- Component: {
181
- exportName: "AdminStudioContactFormView",
182
- path: clientPath,
183
- clientProps: {
184
- globalSlug: "contact-form",
185
- globalsBasePath: "/studio-globals"
186
- }
187
- }
188
- }
189
- } : {}
190
- },
191
- providers: [
192
- {
193
- exportName: "ThemeProvider",
194
- path: clientPath,
195
- clientProps: {
196
- defaultTheme
197
- }
198
- }
199
- ],
200
- afterNavLinks: [
201
- {
202
- exportName: "ThemeSwitcher",
203
- path: clientPath,
204
- clientProps: {
205
- defaultTheme
206
- }
207
- }
208
- ]
209
- },
210
- meta: {
211
- titleSuffix: ` \u2014 ${brandName}`
212
- }
213
- },
214
- brandName,
215
- brandPrimary,
216
- brandSecondary,
217
- defaultTheme,
218
- wrapUsers(usersCollection) {
219
- const existingFields = usersCollection.fields || [];
220
- const hasThemePreference = existingFields.some(
221
- (field) => typeof field === "object" && field !== null && "name" in field && field.name === "themePreference"
222
- );
223
- return {
224
- ...usersCollection,
225
- fields: hasThemePreference ? existingFields : [...existingFields, createThemePreferenceField(defaultTheme)]
226
- };
227
- },
228
- wrapGlobals(globals2) {
229
- const labelMap = {
230
- header: { group: "Site Design", label: "Header & Navigation" },
231
- footer: { group: "Site Design", label: "Footer" },
232
- "site-settings": { group: "Site Design", label: "Website Settings" },
233
- "social-media": { group: "Site Design", label: "Social Media" },
234
- "contact-form": { group: "Lead Forms", label: "Contact Form" }
235
- };
236
- return globals2.map((global) => {
237
- const mapping = labelMap[global.slug];
238
- if (!mapping) return global;
239
- const shouldAttachContactFormRedirect = studioEnabled && global.slug === "contact-form";
240
- const existingViews = global.admin?.components?.views;
241
- const existingEditViews = existingViews?.edit;
242
- const hasCustomContactFormEditView = Boolean(
243
- existingEditViews?.root || existingEditViews?.default && typeof existingEditViews.default === "object" && existingEditViews.default.Component
244
- );
245
- const contactFormEditViews = shouldAttachContactFormRedirect && !hasCustomContactFormEditView ? {
246
- ...existingEditViews,
247
- default: {
248
- ...typeof existingEditViews?.default === "object" ? existingEditViews.default : {},
249
- Component: {
250
- exportName: "StudioContactFormRedirect",
251
- path: clientPath,
252
- clientProps: {
253
- studioContactFormPath: contactFormStudioPath
254
- }
255
- }
256
- }
257
- } : existingEditViews;
258
- return {
259
- ...global,
260
- admin: {
261
- ...global.admin,
262
- group: mapping.group,
263
- components: {
264
- ...global.admin?.components,
265
- ...shouldAttachContactFormRedirect ? {
266
- views: {
267
- ...existingViews,
268
- ...contactFormEditViews ? {
269
- edit: contactFormEditViews
270
- } : {}
271
- }
272
- } : {}
273
- }
274
- },
275
- label: mapping.label
276
- };
277
- });
278
- }
279
- };
280
- }
281
-
282
- // src/admin/helpers/withTooltips.ts
283
- var defaultTooltips = {
284
- title: "The main title displayed on this page.",
285
- slug: 'The URL-friendly name for this page (e.g., "about-us"). This appears in the web address.',
286
- template: "Choose a layout template. This controls the overall structure of the page.",
287
- parent: "Select a parent page to nest this page under. This affects the URL path.",
288
- path: "The full URL path for this page. This is automatically generated from the slug and parent.",
289
- layout: "Add and arrange content sections on your page. Each section is a building block.",
290
- metaTitle: "The title shown in search engine results and browser tabs. Keep under 60 characters.",
291
- metaDescription: "A brief summary shown in search results. Keep under 160 characters for best results.",
292
- canonicalUrl: "The preferred URL for this page. Used to prevent duplicate content in search engines.",
293
- ogImage: "The image shown when this page is shared on social media (Facebook, LinkedIn, etc.).",
294
- noIndex: "When enabled, search engines will not list this page in results.",
295
- noFollow: "When enabled, search engines will not follow links on this page.",
296
- publishedAt: "The date and time this page was first published.",
297
- alt: "Describe this image for screen readers and search engines. Be specific and concise.",
298
- navItems: "The links shown in your website's navigation menu.",
299
- copyright: "The copyright text displayed in your website footer.",
300
- contactEmail: "The email address displayed in your footer and contact sections.",
301
- contactPhone: "The phone number displayed in your footer and contact sections.",
302
- siteName: "Your website's name. Appears in browser tabs and search results.",
303
- tagline: "A short phrase describing your business. Used in SEO and site metadata.",
304
- canonicalBaseUrl: 'The base URL of your website (e.g., "https://example.com"). Used for generating canonical URLs.'
305
- };
306
- function withTooltips(fields, customTooltips) {
307
- const tooltips = { ...defaultTooltips, ...customTooltips };
308
- return fields.map((field) => addTooltipToField(field, tooltips));
309
- }
310
- function addTooltipToField(field, tooltips) {
311
- if ("name" in field && field.name && tooltips[field.name]) {
312
- const tooltip = tooltips[field.name];
313
- const admin = field.admin;
314
- if (!admin?.description) {
315
- return {
316
- ...field,
317
- admin: {
318
- ...admin,
319
- description: tooltip
320
- }
321
- };
322
- }
323
- }
324
- if ("fields" in field && Array.isArray(field.fields)) {
325
- return {
326
- ...field,
327
- fields: field.fields.map((f) => addTooltipToField(f, tooltips))
328
- };
329
- }
330
- if ("tabs" in field && Array.isArray(field.tabs)) {
331
- return {
332
- ...field,
333
- tabs: field.tabs.map((tab) => ({
334
- ...tab,
335
- fields: tab.fields ? tab.fields.map((f) => addTooltipToField(f, tooltips)) : tab.fields
336
- }))
337
- };
338
- }
339
- return field;
340
- }
341
-
342
- // src/admin/fields/headerNav.ts
343
- var createHeaderNavItemsField = () => ({
344
- name: "navItems",
345
- type: "array",
346
- labels: { singular: "Navigation Link", plural: "Navigation Links" },
347
- admin: {
348
- description: "The links displayed in your website's main navigation menu."
349
- },
350
- fields: [
351
- {
352
- name: "label",
353
- type: "text",
354
- required: true,
355
- admin: {
356
- description: "The text shown for this navigation link."
357
- }
358
- },
359
- {
360
- name: "href",
361
- type: "text",
362
- required: true,
363
- admin: {
364
- description: 'The URL this link points to (e.g., "/about" or "https://example.com").'
365
- }
366
- },
367
- {
368
- name: "parentHref",
369
- type: "text",
370
- admin: {
371
- description: "Optional parent link URL. If set to another nav item href, this item appears in that dropdown."
372
- }
373
- }
374
- ]
375
- });
376
-
377
- // src/admin/fields/socialMedia.ts
378
- 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.";
379
- function validateOptionalHttpsUrl(value) {
380
- if (value === null || value === void 0 || value === "") {
381
- return true;
382
- }
383
- if (typeof value !== "string") {
384
- return "Enter a valid URL.";
385
- }
386
- try {
387
- const url = new URL(value);
388
- if (url.protocol !== "http:" && url.protocol !== "https:") {
389
- return "Use an http:// or https:// URL.";
390
- }
391
- return true;
392
- } catch {
393
- return "Enter a valid URL (for example: https://instagram.com/yourbrand).";
394
- }
395
- }
396
- function createPlatformField(platform) {
397
- const platformLabel = SOCIAL_MEDIA_PLATFORM_LABELS[platform];
398
- const iconOptions = SOCIAL_MEDIA_ICON_OPTIONS[platform].map((option) => ({
399
- label: option.label,
400
- value: option.value
401
- }));
402
- return {
403
- name: platform,
404
- type: "group",
405
- label: platformLabel,
406
- fields: [
407
- {
408
- name: "url",
409
- type: "text",
410
- admin: {
411
- description: `Full ${platformLabel} profile URL. Leave blank to hide ${platformLabel}.`
412
- },
413
- validate: validateOptionalHttpsUrl
414
- },
415
- {
416
- name: "icon",
417
- type: "select",
418
- defaultValue: SOCIAL_MEDIA_DEFAULT_ICON_BY_PLATFORM[platform],
419
- options: iconOptions,
420
- admin: {
421
- description: "Pick which icon style to display for this platform."
422
- }
423
- }
424
- ]
425
- };
426
- }
427
- var createSocialMediaConnectionsField = (options = {}) => {
428
- const selectedPlatforms = Array.isArray(options.platforms) && options.platforms.length > 0 ? options.platforms : SOCIAL_MEDIA_PLATFORMS;
429
- return {
430
- name: options.name || "profiles",
431
- type: "group",
432
- label: options.label || "Social Media Profiles",
433
- admin: {
434
- description: options.description || DEFAULT_DESCRIPTION
435
- },
436
- fields: selectedPlatforms.map((platform) => createPlatformField(platform))
437
- };
438
- };
439
- var socialMediaConnectionsField = createSocialMediaConnectionsField();
440
-
441
- // src/admin/globals/socialMedia.ts
442
- var createSocialMediaGlobal = (options = {}) => ({
443
- slug: options.slug || "social-media",
444
- label: "Social Media",
445
- admin: {
446
- description: options.description || "Manage social profile links and icon variants used across your website.",
447
- group: "Site Design"
448
- },
449
- fields: [
450
- createSocialMediaConnectionsField({
451
- ...options.fieldOptions,
452
- label: "Profiles",
453
- name: "profiles"
454
- })
455
- ]
456
- });
457
-
458
- export {
459
- createThemePreferenceField,
460
- themePreferenceField,
461
- configureAdmin,
462
- withTooltips,
463
- createHeaderNavItemsField,
464
- createSocialMediaConnectionsField,
465
- socialMediaConnectionsField,
466
- createSocialMediaGlobal,
467
- admin_exports
468
- };