@bison-lab/payload-core 3.10.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 is one Global with field tabs: Colors, Typography, Appearance,
129
- and Identity. Publish in the document Save slot writes the open tab only.
130
- Theme has no draft mode and no preview pane. Contrast is the automatic label
131
- on editable fills at 7:1; it is never enforced. `bison.config.json` is the seed
132
- a site 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
@@ -12,15 +12,17 @@ declare const ColorField: TextFieldClientComponent;
12
12
  //#endregion
13
13
  //#region src/admin/color-scale-field.d.ts
14
14
  /**
15
- * One system (or library row) color: hex, source step, regenerate, stale,
16
- * 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.
17
17
  */
18
18
  declare const ColorScaleField: GroupFieldClientComponent;
19
19
  //#endregion
20
20
  //#region src/admin/library-field.d.ts
21
21
  /**
22
- * Custom colors: the same scale controls as system colors, plus add and
23
- * 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.
24
26
  */
25
27
  declare const LibraryField: ArrayFieldClientComponent;
26
28
  //#endregion
@@ -56,9 +58,8 @@ declare const GreyScaleField: SelectFieldClientComponent;
56
58
  //#endregion
57
59
  //#region src/admin/contrast-report.d.ts
58
60
  /**
59
- * Contrast used to be a Colors-tab list. Readability now lives on each
60
- * color card: Needs attention opens a popup. This field stays in the
61
- * schema so `contrastTarget` is still a Theme option; it paints nothing.
61
+ * Fill + automatic label only. Target 7:1, Light and Dark. No gray
62
+ * ContrastStrip. Warnings do not block save.
62
63
  */
63
64
  declare const ContrastReport: UIFieldClientComponent;
64
65
  //#endregion
@@ -69,18 +70,22 @@ declare const ContrastReport: UIFieldClientComponent;
69
70
  declare const SectionHeading: UIFieldClientComponent;
70
71
  //#endregion
71
72
  //#region src/admin/publish-child.d.ts
72
- /** @deprecated Theme publish is the document Save button */
73
73
  declare const PublishChild: UIFieldClientComponent;
74
74
  //#endregion
75
75
  //#region src/admin/save-button.d.ts
76
76
  /**
77
- * Payload's document Save slot the same control row as Pages'
78
- * "Publish changes". Theme has no drafts; this publishes only the
79
- * open field tab. The tab is read after mount so SSR matches.
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`.
80
85
  */
81
86
  declare function ThemeSaveButton(): react_jsx_runtime0.JSX.Element;
82
- /** Import-map alias — Theme still points `SaveButton` at this name. */
83
- declare const HiddenSaveButton: typeof ThemeSaveButton;
87
+ /** @deprecated Import map alias — ThemeDocumentControls is the Save-adjacent slot. */
88
+ declare function HiddenSaveButton(): react_jsx_runtime0.JSX.Element;
84
89
  //#endregion
85
90
  //#region src/admin/identity-fallback.d.ts
86
91
  /**
@@ -89,5 +94,12 @@ declare const HiddenSaveButton: typeof ThemeSaveButton;
89
94
  */
90
95
  declare const IdentityFallback: UIFieldClientComponent;
91
96
  //#endregion
92
- export { AppearanceField, ColorField, ColorScaleField, ContrastReport, FontField, GreyScaleField, HiddenSaveButton, IdentityFallback, LibraryField, PairingField, PublishChild, SectionHeading, ThemeSaveButton };
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.
101
+ */
102
+ declare const LookField: TextFieldClientComponent;
103
+ //#endregion
104
+ export { AppearanceField, ColorField, ColorScaleField, ContrastReport, FontField, GreyScaleField, HiddenSaveButton, IdentityFallback, LibraryField, LookField, PairingField, PublishChild, SectionHeading, ThemeDocumentControls, ThemeSaveButton };
93
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","../src/admin/identity-fallback.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;;;;;;;;cCtDhB,cAAA,EAAgB,sBAAA;;;;;;cCFhB,cAAA,EAAgB,sBAAA;;;;cCmIhB,YAAA,EAAc,sBAAA;;;;;;;;iBC7HX,eAAA,CAAA,GAAe,kBAAA,CAAA,GAAA,CAAA,OAAA;AVA/B;AAAA,cU0Ba,gBAAA,SAAgB,eAAA;;;;;;;cC7BhB,gBAAA,EAAkB,sBAAA"}
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"}