@bison-lab/payload-core 3.22.0 → 3.25.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/README.md CHANGED
@@ -8,10 +8,10 @@ are extracted.
8
8
  Full guide: <https://payload.bisonlab.ai/site/seo/>
9
9
 
10
10
  ```bash
11
- pnpm add @bison-lab/payload-core @payloadcms/plugin-seo @bison-lab/tokens @bison-lab/fonts
11
+ pnpm add @bison-lab/payload-core @payloadcms/plugin-seo @payloadcms/plugin-redirects @bison-lab/tokens @bison-lab/fonts
12
12
  ```
13
13
 
14
- Peers: `payload` and `@payloadcms/plugin-seo` are required. `@bison-lab/tokens`
14
+ Peers: `payload`, `@payloadcms/plugin-seo`, and `@payloadcms/plugin-redirects` are required. `@bison-lab/tokens`
15
15
  and `@bison-lab/fonts` are needed to adopt the Theme Global; `@payloadcms/ui`
16
16
  and `react` are needed for its admin fields; `@bison-lab/ui` and
17
17
  `@payloadcms/live-preview-react` are needed for the live theme preview.
@@ -22,7 +22,7 @@ lockstep.
22
22
 
23
23
  | Import | Contents | Runs where |
24
24
  | ---------------------------------- | ------------------------------------------------------------------------------------------------ | -------------------------------------------------------------------------- |
25
- | `@bison-lab/payload-core` | `seoPlugin`, `createTheme`, `createBrandAssets`, `createRoles`, `createFeatures`, `createPages`, `createUsers`, `createMedia`, `createAdminNav`, `adminNav`, `createNavigation`, `adminOnlyApiTab`, `documentTitleActions`, `seedTheme`, `seedRoles`, `seedFeatures`, predicates, `lookField`, `colorTokenField`, import-map strings, title and text helpers, types | Node. What `payload.config.ts` imports; it loads the plugin. |
25
+ | `@bison-lab/payload-core` | `seoPlugin`, `createTheme`, `createBrandAssets`, `createRoles`, `createFeatures`, `createPages`, `createUsers`, `createMedia`, `createRedirects`, `createAdminNav`, `adminNav`, `createNavigation`, `adminOnlyApiTab`, `documentTitleActions`, `seedTheme`, `seedRoles`, `seedFeatures`, predicates, `lookField`, `colorTokenField`, import-map strings, title and text helpers, types | Node. What `payload.config.ts` imports; it loads the plugin. |
26
26
  | `@bison-lab/payload-core/metadata` | `pageMetadata`, the title helpers, the same types | Server. What a page route imports; it does not load the plugin. |
27
27
  | `@bison-lab/payload-core/theme` | `getPublishedTheme`, `getPublishedIdentity`, `themeConfigFromDoc`, `themeHead`, `themeHeadFromDoc` | Server. What a root layout imports; it does not load the plugin or React. |
28
28
  | `@bison-lab/payload-core/navigation` | `getNavigation`, the Header and Footer slugs | Server. What a site header imports; it does not load the plugin or React. |
@@ -45,11 +45,12 @@ the site spells its name and its URL scheme once.
45
45
 
46
46
  ```ts
47
47
  // payload.config.ts
48
- import { firstImageIn, seoPlugin } from "@bison-lab/payload-core";
48
+ import { createRedirects, firstImageIn, seoPlugin } from "@bison-lab/payload-core";
49
49
  import type { Page } from "@/payload-types";
50
50
 
51
51
  export default buildConfig({
52
52
  plugins: [
53
+ createRedirects(),
53
54
  seoPlugin<Page>({
54
55
  siteName: "Acme Clinics",
55
56
  urlFor: (doc) => (doc.slug ? absoluteUrl(pagePath(doc.slug)) : undefined),
@@ -318,10 +319,16 @@ read from the live Features and Roles Globals) so Payload's
318
319
  ## Pages, users, and media
319
320
 
320
321
  `createPages`, `createUsers`, `createMedia`, `slugField`,
321
- `adminOnlyApiTab`, and `documentTitleActions` ship from the same
322
+ `createRedirects`, `adminOnlyApiTab`, and `documentTitleActions` ship from the same
322
323
  React-free entry. Pages take the
323
324
  site's hero and layout blocks, reserved-slug predicate, and preview
324
- path. Create follows the Content tick. Update without Publish is
325
+ path. The slug follows the title until first publish, then locks. Unlock
326
+ warns in plain words and the same save writes a 308. `createRedirects()`
327
+ wraps `@payloadcms/plugin-redirects` for `pages` only (permanent 308) and
328
+ collapses chains when a published slug changes. The plugin stores the
329
+ rows; the site still has to serve them. Pin the plugin to the same
330
+ version as `payload`, then `payload generate:importmap`,
331
+ `payload generate:types`, and `payload migrate:create`. Create follows the Content tick. Update without Publish is
325
332
  constrained to `_status: draft` — an Author can save a draft and cannot
326
333
  publish or edit a live page. Users sit under Settings next to Roles,
327
334
  take `secureCookies`, and offer whatever rows the Global (or the seed
@@ -418,6 +425,7 @@ to a type that has one.
418
425
 
419
426
  `noIndexField`, the plugin's own fields, the Theme Global fields, the
420
427
  Roles Global fields, the Admin nav fields, the Header and Footer fields,
421
- and the brand-assets collection fields are columns
428
+ the Pages slug lock fields, the Redirects collection, and the
429
+ brand-assets collection fields are columns
422
430
  in every consuming site. A change to them is a schema change: say "run
423
431
  `payload migrate:create`" in the changeset.
package/dist/admin.d.mts CHANGED
@@ -75,11 +75,11 @@ declare const PublishChild: UIFieldClientComponent;
75
75
  //#endregion
76
76
  //#region src/admin/save-button.d.ts
77
77
  /**
78
- * Light/Dark preview for Colors, Typography, and Appearance. Lives in
79
- * `beforeDocumentControls` so Payload's Save stays in the Save slot.
80
- * Save writes that page's slice onto the stored Theme row.
78
+ * Theme used to put a Light/Dark pair here. Admin chrome now follows
79
+ * Payload's own theme from the header sun/moon, so this slot is empty
80
+ * and Save stays in the Save slot.
81
81
  */
82
- declare function ThemeDocumentControls(): react_jsx_runtime0.JSX.Element;
82
+ declare function ThemeDocumentControls(): null;
83
83
  /**
84
84
  * Import-map Save slot used by the older single-Global Theme. Theme pages
85
85
  * keep Payload's Save and put Light/Dark in `ThemeDocumentControls`.
@@ -88,6 +88,10 @@ declare function ThemeSaveButton(): react_jsx_runtime0.JSX.Element;
88
88
  /** @deprecated Import map alias — ThemeDocumentControls is the Save-adjacent slot. */
89
89
  declare function HiddenSaveButton(): react_jsx_runtime0.JSX.Element;
90
90
  //#endregion
91
+ //#region src/admin/preview-mode.d.ts
92
+ type ThemePreviewMode = "light" | "dark";
93
+ declare function setThemePreviewMode(mode: ThemePreviewMode): void;
94
+ //#endregion
91
95
  //#region src/admin/identity-fallback.d.ts
92
96
  /**
93
97
  * Identity child when the site has not registered a cupboard yet.
@@ -122,6 +126,13 @@ declare function RolesRowLabel(): react_jsx_runtime0.JSX.Element;
122
126
  */
123
127
  declare const RoleSlugField: TextFieldClientComponent;
124
128
  //#endregion
129
+ //#region src/admin/slug-field.d.ts
130
+ /**
131
+ * Slug follows the title until first publish. After that it is read-only
132
+ * until Unlock, which warns that the old address will redirect.
133
+ */
134
+ declare const SlugField: TextFieldClientComponent;
135
+ //#endregion
125
136
  //#region src/admin/role-name-field.d.ts
126
137
  /**
127
138
  * Role name. Letters and spaces only, so the hidden slug stays
@@ -210,5 +221,5 @@ declare function AdminNavItemRowLabel(): react_jsx_runtime0.JSX.Element;
210
221
  */
211
222
  declare const AdminNavEntityField: TextFieldClientComponent;
212
223
  //#endregion
213
- export { AdminNav, AdminNavEntityField, AdminNavItemRowLabel, AdminNavRowLabel, AppearanceField, ColorField, ColorScaleField, ContrastReport, DocumentCreateNew, DocumentTitleActions, FeaturesMatrixField, FontField, GreyScaleField, HiddenSaveButton, IdentityFallback, LibraryField, LookField, PairingField, PublishChild, RoleNameField, RoleSlugField, RolesField, RolesGrantsField, RolesMatrixField, RolesRowLabel, SectionHeading, ThemeDocumentControls, ThemeSaveButton };
224
+ export { AdminNav, AdminNavEntityField, AdminNavItemRowLabel, AdminNavRowLabel, AppearanceField, ColorField, ColorScaleField, ContrastReport, DocumentCreateNew, DocumentTitleActions, FeaturesMatrixField, FontField, GreyScaleField, HiddenSaveButton, IdentityFallback, LibraryField, LookField, PairingField, PublishChild, RoleNameField, RoleSlugField, RolesField, RolesGrantsField, RolesMatrixField, RolesRowLabel, SectionHeading, SlugField, ThemeDocumentControls, ThemeSaveButton, setThemePreviewMode };
214
225
  //# sourceMappingURL=admin.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"admin.d.mts","names":[],"sources":["../src/admin/color-field.tsx","../src/admin/color-scale-field.tsx","../src/admin/library-field.tsx","../src/admin/font-field.tsx","../src/admin/pairing-field.tsx","../src/admin/appearance-field.tsx","../src/admin/grey-scale-field.tsx","../src/admin/contrast-report.tsx","../src/admin/section-heading.tsx","../src/admin/publish-child.tsx","../src/admin/save-button.tsx","../src/admin/identity-fallback.tsx","../src/admin/look-field.tsx","../src/admin/roles-matrix-field.tsx","../src/admin/roles-row-label.tsx","../src/admin/role-slug-field.tsx","../src/admin/role-name-field.tsx","../src/admin/roles-field.tsx","../src/admin/roles-grants-field.tsx","../src/admin/features-matrix-field.tsx","../src/admin/document-title-actions.tsx","../src/admin/document-create-new.tsx","../src/admin-nav/types.ts","../src/admin/admin-nav.tsx","../src/admin/admin-nav-row-label.tsx","../src/admin/admin-nav-item-row-label.tsx","../src/admin/admin-nav-entity-field.tsx"],"mappings":";;;;;;;;;;;cAWa,UAAA,EAAY,wBAAA;;;;;;;cCsBZ,eAAA,EAAiB,yBAAA;;;;;;;;;cCNjB,YAAA,EAAc,yBAAA;;;;;;;;;cCTd,SAAA,EAAW,0BAAA;;;;;;;cCNX,YAAA,EAAc,sBAAA;;;;;;;cCCd,eAAA,EAAiB,yBAAA;;;ALF9B;;;;AAAA,cMyDa,cAAA,EAAgB,0BAAA;;;;;;;cChDhB,cAAA,EAAgB,sBAAA;;;;;;cCbhB,cAAA,EAAgB,sBAAA;;;cCgJhB,YAAA,EAAc,sBAAA;;;;;;;;iBC3IX,qBAAA,CAAA,GAAqB,kBAAA,CAAA,GAAA,CAAA,OAAA;;AVDrC;;;iBUgBgB,eAAA,CAAA,GAAe,kBAAA,CAAA,GAAA,CAAA,OAAA;;iBA0Bf,gBAAA,CAAA,GAAgB,kBAAA,CAAA,GAAA,CAAA,OAAA;;;;;;;cC7CnB,gBAAA,EAAkB,sBAAA;;;;;;;cCIlB,SAAA,EAAW,wBAAA;;;;;;;;cCqBX,gBAAA,EAAkB,yBAAA;;;;;;iBC1Bf,aAAA,CAAA,GAAa,kBAAA,CAAA,GAAA,CAAA,OAAA;;;;;;cCChB,aAAA,EAAe,wBAAA;;;;;;;cCCf,aAAA,EAAe,wBAAA;;;;;;;;cC8Cf,UAAA,EAAY,0BAAA;;;;;;;;cChCZ,gBAAA,EAAkB,wBAAA;;;;;;;;;AlBZ/B;;cmB0Ca,mBAAA,EAAqB,yBAAA;;;iBCjBlB,oBAAA,CAAA;EAAuB;AAAA;EAAc,QAAA,GAAW,SAAA;AAAA,IAAW,kBAAA,CAAA,GAAA,CAAA,OAAA;;;iBCtB3D,iBAAA,CAAA;EAAoB;AAAA;EAAU,IAAA;AAAA,IAAc,kBAAA,CAAA,GAAA,CAAA,OAAA;;;UCmB3C,uBAAA;EACf,WAAA;EACA,OAAA;AAAA;;;UC5Be,aAAA;EACf,eAAA,GAAkB,uBAAA;AAAA;;;;AvBGpB;;iBuBsCgB,QAAA,CAAA;EAAW;AAAA,GAAmB,aAAA,GAAa,kBAAA,CAAA,GAAA,CAAA,OAAA;;;;;;iBC5C3C,gBAAA,CAAA,GAAgB,kBAAA,CAAA,GAAA,CAAA,OAAA;;;;;;;iBCGhB,oBAAA,CAAA,GAAoB,kBAAA,CAAA,GAAA,CAAA,OAAA;;;;;;;;cCEvB,mBAAA,EAAqB,wBAAA"}
1
+ {"version":3,"file":"admin.d.mts","names":[],"sources":["../src/admin/color-field.tsx","../src/admin/color-scale-field.tsx","../src/admin/library-field.tsx","../src/admin/font-field.tsx","../src/admin/pairing-field.tsx","../src/admin/appearance-field.tsx","../src/admin/grey-scale-field.tsx","../src/admin/contrast-report.tsx","../src/admin/section-heading.tsx","../src/admin/publish-child.tsx","../src/admin/save-button.tsx","../src/admin/preview-mode.tsx","../src/admin/identity-fallback.tsx","../src/admin/look-field.tsx","../src/admin/roles-matrix-field.tsx","../src/admin/roles-row-label.tsx","../src/admin/role-slug-field.tsx","../src/admin/slug-field.tsx","../src/admin/role-name-field.tsx","../src/admin/roles-field.tsx","../src/admin/roles-grants-field.tsx","../src/admin/features-matrix-field.tsx","../src/admin/document-title-actions.tsx","../src/admin/document-create-new.tsx","../src/admin-nav/types.ts","../src/admin/admin-nav.tsx","../src/admin/admin-nav-row-label.tsx","../src/admin/admin-nav-item-row-label.tsx","../src/admin/admin-nav-entity-field.tsx"],"mappings":";;;;;;;;;;;cAWa,UAAA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