@bison-lab/payload-core 3.14.0 → 3.15.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
@@ -25,7 +25,7 @@ lockstep.
25
25
  | `@bison-lab/payload-core` | `seoPlugin`, `createTheme`, `createBrandAssets`, `createRoles`, `createFeatures`, `createPages`, `createUsers`, `createMedia`, `adminOnlyApiTab`, `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
- | `@bison-lab/payload-core/admin` | Theme child fields, the Roles and Features matrices, and the Users Roles checklist | Admin. Referenced by import-map string; `generate:importmap` writes it. |
28
+ | `@bison-lab/payload-core/admin` | Theme fields, the Roles and Features matrices, and the Users Roles checklist | Admin. Referenced by import-map string; `generate:importmap` writes it. |
29
29
  | `@bison-lab/payload-core/react` | `ThemePreview` (legacy; Theme has no preview pane) | Client. Kept so an older site import does not break. |
30
30
 
31
31
  ## What editors get
@@ -125,13 +125,13 @@ The sitemap is the site's: filter `meta.noIndex` out of it.
125
125
 
126
126
  ## Adopting the Theme global
127
127
 
128
- Theme in the admin nav is a group like Content and Settings: Colors,
129
- Typography, Appearance, and Identity. Those are ordinary Payload Globals
130
- (`admin.group: "Theme"`), not custom views. `createTheme` returns them plus
131
- a hidden store (`theme`) that `getPublishedTheme` already reads. Save on a
132
- page is Payload's Save; it writes that slice onto the store. Document
133
- locking is off — these are settings forms. Theme has no draft mode and
134
- no preview pane. Contrast is the automatic label on editable fills at 7:1; it
128
+ Theme in the admin nav is one Global (`theme`) in `admin.group: "Theme"`.
129
+ Colors, Typography, Appearance, and Identity are field tabs on that
130
+ document, not custom views and not extra Globals. Save is Payload's Save
131
+ on the whole form every tab is hydrated from the live row, so an
132
+ untouched tab does not revert. `getPublishedTheme` reads that same row.
133
+ Document locking is off. Theme has no draft mode and no preview pane.
134
+ Contrast is the automatic label on editable fills at 7:1; it
135
135
  is never enforced and lives in the Needs-attention modal, not on the page.
136
136
  `bison.config.json` is the seed a site starts from, not the source of truth.
137
137
  Pass `destructive` (or `seed.brandDestructive`); otherwise Theme uses the
@@ -194,7 +194,7 @@ or pass empty arrays, and every additional color is unused and deletes
194
194
  immediately. A new look surface is added to `colorUsages`, not copied
195
195
  into a site helper. Site adopt names the slugs (SPI-93).
196
196
 
197
- Then `payload generate:importmap` (the Theme child fields resolve from
197
+ Then `payload generate:importmap` (the Theme fields resolve from
198
198
  `@bison-lab/payload-core/admin`), `payload generate:types`, and
199
199
  `payload migrate:create`.
200
200
 
@@ -284,33 +284,54 @@ createRoles({
284
284
  Settings → Features is a Developer-only release valve: one switch per
285
285
  catalogue row. Off hides the tick on Roles; Developer still has the
286
286
  feature. The catalogue is code, grouped for the UI: Pages (Content,
287
- Publish, API tab), Media, Theme (Colors, Typography, Appearance,
288
- Identity, Brand assets), and Users (Users, Roles). Features itself is
289
- not a row. A site may pass `extras` into `createFeatures` those rows
290
- appear only there. `canUseFeature(slug)` is true when the row is
291
- released and a held role is granted it, or when the login is Developer.
292
- An empty Global falls back to the catalogue defaults. Group slugs
293
- `pages` and `theme` are true when any child is. `createPages` /
294
- `createMedia` use `canUseFeature` for create and update (and
295
- `admin.hidden`). Theme and brand-assets still take `access` arguments —
296
- pass `canUseFeature("theme")` / `canUseFeature("brand-assets")` as
297
- `update`.
287
+ Publish), Media, Theme (Colors, Typography, Appearance, Identity, Brand
288
+ assets), and Users (Users, Roles). Features itself is not a row. The
289
+ document API tab and Better Editor overlay settings are not rows either
290
+ they stay code-locked to Developer (`adminOnlyApiTab`,
291
+ `developerOnlyAccess` / `hideUnlessDeveloper`). A site may pass `extras`
292
+ into `createFeatures` those rows appear only there, including a
293
+ future Navigation global:
298
294
 
299
295
  ```ts
300
296
  createFeatures({
301
- extras: [{ slug: "doctors", label: "Doctor search", group: "users" }],
297
+ extras: [
298
+ { slug: "doctors", label: "Doctor search", group: "users" },
299
+ { slug: "navigation", label: "Navigation" },
300
+ ],
302
301
  });
302
+
303
+ // On that Global:
304
+ // access: { update: canUseFeature("navigation") }
305
+ // Drafts use the same Publish tick as Pages to go live.
303
306
  ```
304
307
 
308
+ `canUseFeature(slug)` is true when the row is released and a held role
309
+ is granted it, or when the login is Developer. An empty Global falls
310
+ back to the catalogue defaults. Group slugs `pages` and `theme` are
311
+ true when any child is. `createPages` / `createMedia` use
312
+ `canUseFeature` for create and update (and `admin.hidden`). Theme and
313
+ brand-assets still take `access` arguments — pass
314
+ `canUseFeature("theme")` / `canUseFeature("brand-assets")` as `update`.
315
+ `admin.hidden` is presentation; Access Control is enforcement. Nav
316
+ hiding follows `user.allowedFeatures` on the JWT (computed at user
317
+ read from the live Features and Roles Globals) so Payload's
318
+ `admin.hidden({ user })` matches the API.
319
+
305
320
  ## Pages, users, and media
306
321
 
307
322
  `createPages`, `createUsers`, `createMedia`, `slugField`, and
308
323
  `adminOnlyApiTab` ship from the same React-free entry. Pages take the
309
324
  site's hero and layout blocks, reserved-slug predicate, and preview
310
- path. Users sit under Settings next to Roles, take `secureCookies`, and
311
- offer whatever rows the Global (or the seed plus the same `extras`) has.
312
- The checklist labels are the editable names. `adminOnlyApiTab` shows the
313
- document API tab only to Developer.
325
+ path. Create follows the Content tick. Update without Publish is
326
+ constrained to `_status: draft` an Author can save a draft and cannot
327
+ publish or edit a live page. Users sit under Settings next to Roles,
328
+ take `secureCookies`, and offer whatever rows the Global (or the seed
329
+ plus the same `extras`) has. `users.roles` and `users.allowedFeatures`
330
+ set `saveToJWT: true`. The checklist labels are the editable names.
331
+ `adminOnlyApiTab` shows the document API tab only to Developer. Overlay
332
+ settings (Better Editor) take `developerOnlyAccess` and
333
+ `hideUnlessDeveloper` on the site — the package does not add that
334
+ plugin as a peer.
314
335
 
315
336
  ## No generated types
316
337
 
package/dist/admin.mjs CHANGED
@@ -2546,12 +2546,6 @@ const PACKAGE_FEATURES = [
2546
2546
  group: "pages",
2547
2547
  defaultReleased: true
2548
2548
  },
2549
- {
2550
- slug: "api-tab",
2551
- label: "API tab",
2552
- group: "pages",
2553
- defaultReleased: false
2554
- },
2555
2549
  {
2556
2550
  slug: "media",
2557
2551
  label: "Media",
@@ -2609,7 +2603,7 @@ function isFeatureSlug(value) {
2609
2603
  }
2610
2604
  //#endregion
2611
2605
  //#region src/features/matrix.ts
2612
- const MISSING_PACKAGE_FEATURES_MESSAGE = "Features must include Content, Publish, API tab, Media, Theme screens, Brand assets, Users, and Roles.";
2606
+ const MISSING_PACKAGE_FEATURES_MESSAGE = "Features must include Content, Publish, Media, Theme screens, Brand assets, Users, and Roles.";
2613
2607
  function featureCatalogue(extras = []) {
2614
2608
  return [...PACKAGE_FEATURES.map((feature) => ({ ...feature })), ...extras.map((extra) => ({
2615
2609
  slug: extra.slug,
@@ -2736,7 +2730,7 @@ function defaultGrantsForRole(role, extraGrants) {
2736
2730
  const ROLES_SLUG = "roles";
2737
2731
  /**
2738
2732
  * Default rank and grants. Developer is implicit (empty grants). Brand
2739
- * screens default to Designer. The API tab is not granted until released.
2733
+ * screens default to Designer.
2740
2734
  */
2741
2735
  const DEFAULT_ROLE_MATRIX = ROLES.map((role) => ({
2742
2736
  role,