@bison-lab/payload-core 3.9.0 → 3.11.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
@@ -22,9 +22,9 @@ lockstep.
22
22
 
23
23
  | Import | Contents | Runs where |
24
24
  | ---------------------------------- | ------------------------------------------------------------------------------------------------ | -------------------------------------------------------------------------- |
25
- | `@bison-lab/payload-core` | `seoPlugin`, `createTheme`, `createBrandAssets`, `seedTheme`, 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`, `seedTheme`, `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
- | `@bison-lab/payload-core/theme` | `getPublishedTheme`, `getPublishedIdentity`, `themeConfigFromDoc`, `themeHead` | Server. What a root layout imports; it does not load the plugin or React. |
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/admin` | Theme child fields (color scale, library, gray family, fonts, appearance, publish) | 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
 
@@ -125,12 +125,17 @@ The sitemap is the site's: filter `meta.noIndex` out of it.
125
125
 
126
126
  ## Adopting the Theme global
127
127
 
128
- Settings Theme children: Colors, Typography, Appearance, and Identity. Each
129
- child has its own Publish publishing Colors updates colors only. Theme has
130
- no draft mode and no preview pane. Contrast is the automatic label on editable
131
- fills at 7:1; it is never enforced. `bison.config.json` is the seed a site
132
- starts from, not the source of truth. Pass `destructive` (or
133
- `seed.brandDestructive`); there is no package default.
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
135
+ is never enforced and lives in the Needs-attention modal, not on the page.
136
+ `bison.config.json` is the seed a site starts from, not the source of truth.
137
+ Pass `destructive` (or `seed.brandDestructive`); otherwise Theme uses the
138
+ library’s `DESTRUCTIVE_SCALE_HEX` (`#ef4444`). Success falls back to `#22c55e`.
134
139
 
135
140
  **1. Register the Global.** Access is required — the predicates live in the
136
141
  site's `src/platform` until they move here. Pass `canManageBrand` as
@@ -149,7 +154,7 @@ export default buildConfig({
149
154
  }),
150
155
  ],
151
156
  globals: [
152
- createTheme({
157
+ ...createTheme({
153
158
  access: { read: isAuthenticated, update: canManageBrand },
154
159
  seed: bisonConfig,
155
160
  logo: { collection: BRAND_ASSETS_SLUG },
@@ -201,6 +206,8 @@ const identity = await getPublishedIdentity(payload, {
201
206
  mark: { url: "/logo-mark.svg", alt: "Acme mark" },
202
207
  });
203
208
  const { css, preloads } = themeHead(theme, { identity });
209
+ // Custom Colors need the Theme document: themeHeadFromDoc(doc, bisonConfig, { identity })
210
+ // emits --coral-* and [data-look] so lookField keys paint.
204
211
 
205
212
  // <link rel="preload" as="font" type="font/woff2" crossOrigin="" href={href} />
206
213
  // <style dangerouslySetInnerHTML={{ __html: css }} />
package/dist/admin.d.mts CHANGED
@@ -1,4 +1,6 @@
1
1
 
2
+ import { ThemeConfig } from "@bison-lab/tokens";
3
+ import * as react_jsx_runtime0 from "react/jsx-runtime";
2
4
  import { ArrayFieldClientComponent, GroupFieldClientComponent, SelectFieldClientComponent, TextFieldClientComponent, UIFieldClientComponent } from "payload";
3
5
 
4
6
  //#region src/admin/color-field.d.ts
@@ -10,15 +12,17 @@ declare const ColorField: TextFieldClientComponent;
10
12
  //#endregion
11
13
  //#region src/admin/color-scale-field.d.ts
12
14
  /**
13
- * One system (or library row) color: hex, source step, regenerate, stale,
14
- * include/exclude, automatic label. Writes the group's stored fields.
15
+ * One system (or library row) color: hex, source step, include/exclude.
16
+ * Writes the group's stored fields. A committed hex or step rebuilds the scale.
15
17
  */
16
18
  declare const ColorScaleField: GroupFieldClientComponent;
17
19
  //#endregion
18
20
  //#region src/admin/library-field.d.ts
19
21
  /**
20
- * Custom colors: the same scale controls as system colors, plus add and
21
- * in-use delete (one replacement scale; unused rows delete immediately).
22
+ * Custom colors: the same scale controls as system colors. A row that is
23
+ * not referenced on a page deletes immediately. Rewriting in-use tokens
24
+ * (`rewriteColorToken`) waits on a site usage lookup — Theme cannot see
25
+ * page assignments by itself.
22
26
  */
23
27
  declare const LibraryField: ArrayFieldClientComponent;
24
28
  //#endregion
@@ -66,19 +70,36 @@ declare const ContrastReport: UIFieldClientComponent;
66
70
  declare const SectionHeading: UIFieldClientComponent;
67
71
  //#endregion
68
72
  //#region src/admin/publish-child.d.ts
69
- /**
70
- * Per-child Publish. Sets `publishChild` then submits; `beforeChange`
71
- * writes only that slice. Confirmation lists this child's changes and,
72
- * on Colors, remaining automatic-label shorts.
73
- */
74
73
  declare const PublishChild: UIFieldClientComponent;
75
74
  //#endregion
76
75
  //#region src/admin/save-button.d.ts
77
76
  /**
78
- * Theme children publish themselves. The stock Save would write every
79
- * dirty tab at once, so it is hidden.
77
+ * Light/Dark preview for Colors, Typography, and Appearance. Lives in
78
+ * `beforeDocumentControls` so Payload's Save stays in the Save slot.
79
+ * Save writes that page's slice onto the stored Theme row.
80
+ */
81
+ declare function ThemeDocumentControls(): react_jsx_runtime0.JSX.Element;
82
+ /**
83
+ * Import-map Save slot used by the older single-Global Theme. Theme pages
84
+ * keep Payload's Save and put Light/Dark in `ThemeDocumentControls`.
85
+ */
86
+ declare function ThemeSaveButton(): react_jsx_runtime0.JSX.Element;
87
+ /** @deprecated Import map alias — ThemeDocumentControls is the Save-adjacent slot. */
88
+ declare function HiddenSaveButton(): react_jsx_runtime0.JSX.Element;
89
+ //#endregion
90
+ //#region src/admin/identity-fallback.d.ts
91
+ /**
92
+ * Identity child when the site has not registered a cupboard yet.
93
+ * Shows the fallback lockup and mark; uploads wait on `logo.collection`.
94
+ */
95
+ declare const IdentityFallback: UIFieldClientComponent;
96
+ //#endregion
97
+ //#region src/admin/look-field.d.ts
98
+ /**
99
+ * Loads the Theme global and offers page-editor looks or included steps.
100
+ * A custom scale published on Colors appears here on the next load.
80
101
  */
81
- declare function HiddenSaveButton(): null;
102
+ declare const LookField: TextFieldClientComponent;
82
103
  //#endregion
83
- export { AppearanceField, ColorField, ColorScaleField, ContrastReport, FontField, GreyScaleField, HiddenSaveButton, LibraryField, PairingField, PublishChild, SectionHeading };
104
+ export { AppearanceField, ColorField, ColorScaleField, ContrastReport, FontField, GreyScaleField, HiddenSaveButton, IdentityFallback, LibraryField, LookField, PairingField, PublishChild, SectionHeading, ThemeDocumentControls, ThemeSaveButton };
84
105
  //# 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"],"mappings":";;;;;;;;cAWa,UAAA,EAAY,wBAAA;;;;;;;cCGZ,eAAA,EAAiB,yBAAA;;;;;;;cCQjB,YAAA,EAAc,yBAAA;;;;;;;AFX3B;;cGMa,SAAA,EAAW,0BAAA;;;;;;;cCNX,YAAA,EAAc,sBAAA;;;;;;;cCCd,eAAA,EAAiB,yBAAA;;;;;;;cCiDjB,cAAA,EAAgB,0BAAA;;;;;;;cC1ChB,cAAA,EAAgB,sBAAA;;;;;;cCdhB,cAAA,EAAgB,sBAAA;;;;;;;ARM7B;cS0Ea,YAAA,EAAc,sBAAA;;;;;;;iBCjFX,gBAAA,CAAA"}
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"],"mappings":";;;;;;;;;;cAWa,UAAA,EAAY,wBAAA;;;;;;;cCsBZ,eAAA,EAAiB,yBAAA;;;;;;;;ADtB9B;cEca,YAAA,EAAc,yBAAA;;;;;;;;AFd3B;cGOa,SAAA,EAAW,0BAAA;;;;;;;cCNX,YAAA,EAAc,sBAAA;;;;;;;cCCd,eAAA,EAAiB,yBAAA;;;;;;;cCuDjB,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;;;;AAAA,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"}