@bison-lab/payload-core 4.35.0 → 4.36.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.
- package/README.md +23 -1
- package/dist/admin.mjs +5 -2
- package/dist/admin.mjs.map +1 -1
- package/dist/block-library.d.mts +1 -1
- package/dist/{block-thumbnails-VRxpSXw1.mjs → block-thumbnails-DXOUzGjY.mjs} +1 -1
- package/dist/{block-thumbnails-VRxpSXw1.mjs.map → block-thumbnails-DXOUzGjY.mjs.map} +1 -1
- package/dist/block-thumbnails-cli.mjs +1 -1
- package/dist/block-thumbnails.mjs +1 -1
- package/dist/{catalogue-CEfYwTSK.d.mts → catalogue-PvKGCih7.d.mts} +1 -1
- package/dist/{catalogue-CEfYwTSK.d.mts.map → catalogue-PvKGCih7.d.mts.map} +1 -1
- package/dist/{facet-field-BvQp8Hzh.d.mts → facet-field-CZbLDAQz.d.mts} +1 -1
- package/dist/{facet-field-BvQp8Hzh.d.mts.map → facet-field-CZbLDAQz.d.mts.map} +1 -1
- package/dist/index.d.mts +6 -6
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +113 -6
- package/dist/index.mjs.map +1 -1
- package/dist/locale-CFWfB4wP.mjs +12 -0
- package/dist/locale-CFWfB4wP.mjs.map +1 -0
- package/dist/locale-CxFNy8ex.d.mts +15 -0
- package/dist/locale-CxFNy8ex.d.mts.map +1 -0
- package/dist/metadata.d.mts +1 -1
- package/dist/navigation.d.mts +3 -2
- package/dist/navigation.mjs +1 -1
- package/dist/og.d.mts +2 -2
- package/dist/og.mjs +1 -1
- package/dist/{preview-Cgbh9eAq.d.mts → preview-v-GlYuqa.d.mts} +2 -2
- package/dist/{preview-Cgbh9eAq.d.mts.map → preview-v-GlYuqa.d.mts.map} +1 -1
- package/dist/{published-Dsg-HX-v.d.mts → published-B3IYStMQ.d.mts} +7 -4
- package/dist/published-B3IYStMQ.d.mts.map +1 -0
- package/dist/{published-BLXCep6Z.d.mts → published-Cow49CSZ.d.mts} +7 -3
- package/dist/published-Cow49CSZ.d.mts.map +1 -0
- package/dist/{published-CEuK5ym6.mjs → published-DACERo16.mjs} +13 -5
- package/dist/published-DACERo16.mjs.map +1 -0
- package/dist/{published-DgAzpDSG.mjs → published-DefZv9na.mjs} +8 -3
- package/dist/published-DefZv9na.mjs.map +1 -0
- package/dist/taxonomy.d.mts +1 -1
- package/dist/theme.d.mts +5 -4
- package/dist/theme.d.mts.map +1 -1
- package/dist/theme.mjs +1 -1
- package/dist/{title-C8ppEDlc.d.mts → title-DFKu53nG.d.mts} +1 -1
- package/dist/{title-C8ppEDlc.d.mts.map → title-DFKu53nG.d.mts.map} +1 -1
- package/dist/{types-D6jQql5Z.d.mts → types-B7Hy1Ho-.d.mts} +1 -1
- package/dist/{types-D6jQql5Z.d.mts.map → types-B7Hy1Ho-.d.mts.map} +1 -1
- package/dist/wireframe-cli.mjs +1 -1
- package/dist/{wireframe-sJW8Q4NS.mjs → wireframe-xcJNJzBf.mjs} +1 -1
- package/dist/{wireframe-sJW8Q4NS.mjs.map → wireframe-xcJNJzBf.mjs.map} +1 -1
- package/dist/wireframe.mjs +1 -1
- package/package.json +3 -3
- package/dist/published-BLXCep6Z.d.mts.map +0 -1
- package/dist/published-CEuK5ym6.mjs.map +0 -1
- package/dist/published-DgAzpDSG.mjs.map +0 -1
- package/dist/published-Dsg-HX-v.d.mts.map +0 -1
package/README.md
CHANGED
|
@@ -693,7 +693,9 @@ Postgres's 63-character identifier cap the same way `nav` did. Both sit
|
|
|
693
693
|
in `admin.group: "Navigation"` until a Developer moves them from Admin
|
|
694
694
|
nav. One Features tick (`navigation`, passed as a `createFeatures`
|
|
695
695
|
extra). Publish still needs the Publish tick. `getNavigation({ payload,
|
|
696
|
-
draft })` finds both and returns `{ header, footer, bar }
|
|
696
|
+
draft })` finds both and returns `{ header, footer, bar }`; a site with
|
|
697
|
+
more than one locale adds `locale` (and `fallbackLocale`) so the labels
|
|
698
|
+
read in it.
|
|
697
699
|
|
|
698
700
|
```ts
|
|
699
701
|
import { createNavigation } from "@bison-lab/payload-core";
|
|
@@ -813,6 +815,26 @@ list (Media) wraps the same `Page`. Run `payload generate:importmap` and
|
|
|
813
815
|
`{ slug: "questions", label: "FAQ Library" }` the same way Navigation is
|
|
814
816
|
added.
|
|
815
817
|
|
|
818
|
+
## Multiple locales
|
|
819
|
+
|
|
820
|
+
The words fields are `localized` (#277): a page's `title`, the SEO meta
|
|
821
|
+
title and description (and the plugin's share image, its own setting), a
|
|
822
|
+
FAQ Library `question`, `answer` and `answerText`, a taxonomy term's
|
|
823
|
+
`name`, Header and Footer link labels, footer section headings and the
|
|
824
|
+
text below the logo, and a Media `alt`. Slugs, links, social URLs and
|
|
825
|
+
settings are shared. A single-locale site sees no schema change: the
|
|
826
|
+
adapters only add `_locales` tables when the config has `localization`.
|
|
827
|
+
`getNavigation` and `getPublishedIdentity` take the request's `locale` and
|
|
828
|
+
`fallbackLocale` (`LocaleRead`, exported from `./navigation` and
|
|
829
|
+
`./theme`). `src/__tests__/localized.test.ts` lists the localized paths.
|
|
830
|
+
Header and Footer carry `fillFromOwnLocale` (`src/own-locale.ts`) as a
|
|
831
|
+
`beforeOperation` hook: Payload reads a global's original document with
|
|
832
|
+
the request's fallback locale, so without it a second-locale save copies
|
|
833
|
+
every label the editor left empty from the default locale and `required`
|
|
834
|
+
never refuses (#285). It fills omitted values from the saved locale
|
|
835
|
+
only, and a value that locale never had becomes `null`.
|
|
836
|
+
See [Multiple locales](https://payload.bisonlab.ai/site/localization/).
|
|
837
|
+
|
|
816
838
|
## No generated types
|
|
817
839
|
|
|
818
840
|
The package cannot import a site's `payload-types`, so the shapes it reads
|
package/dist/admin.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { a as pageEditorLooks, c as colorDocFromState, n as clampIslandHeight, o as pageEditorTokens, r as islandHeightOf, s as SYSTEM_COLOR_KEYS, u as stateFromColorDoc } from "./island-97l5VY8l.mjs";
|
|
3
|
-
import { ArrayField, Button, CheckboxInput, DefaultCell, FieldDescription, FieldError, FieldLabel, Link, Logout, NavGroup, NavToggler, SelectField, fieldBaseClass, useAllFormFields, useAuth, useBulkUpload, useConfig, useDocumentInfo, useEntityVisibility, useField, useForm, useFormFields, useListDrawerContext, useListQuery, useModal, useNav, useRowLabel, useStepNav } from "@payloadcms/ui";
|
|
3
|
+
import { ArrayField, Button, CheckboxInput, DefaultCell, FieldDescription, FieldError, FieldLabel, Link, Logout, NavGroup, NavToggler, SelectField, fieldBaseClass, useAllFormFields, useAuth, useBulkUpload, useConfig, useDocumentInfo, useEntityVisibility, useField, useForm, useFormFields, useListDrawerContext, useListQuery, useLocale, useModal, useNav, useRowLabel, useStepNav } from "@payloadcms/ui";
|
|
4
4
|
import { GREY_SCALES, SHADE_STEPS, contrastForeground, contrastRatio, createColorScale, deriveDarkPalette, deriveLightPalette, hexToHSL, hslToString, includedShadeSteps, isThemeHex, presetHints, regenerateColorScale, setColorScaleInclude, updateColorScale } from "@bison-lab/tokens";
|
|
5
5
|
import { useCallback, useEffect, useId, useLayoutEffect, useMemo, useRef, useState } from "react";
|
|
6
6
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -3239,13 +3239,16 @@ const SlugField = ({ field, path, readOnly }) => {
|
|
|
3239
3239
|
const [active, setActive] = useState(-1);
|
|
3240
3240
|
const [leafDraft, setLeafDraft] = useState(null);
|
|
3241
3241
|
const creatingFolder = parent.value === NEW_FOLDER_PARENT;
|
|
3242
|
+
const { code: locale } = useLocale();
|
|
3243
|
+
const followsTitle = !config.localization || locale === config.localization.defaultLocale;
|
|
3242
3244
|
const setSlug = slug.setValue;
|
|
3243
3245
|
const slugValue = slug.value ?? "";
|
|
3244
3246
|
useEffect(() => {
|
|
3245
|
-
if (root || slugLocked || typeof title !== "string") return;
|
|
3247
|
+
if (root || slugLocked || !followsTitle || typeof title !== "string") return;
|
|
3246
3248
|
const next = composeSlug(parent.value, title, newFolder.value);
|
|
3247
3249
|
if (next !== slugValue) setSlug(next);
|
|
3248
3250
|
}, [
|
|
3251
|
+
followsTitle,
|
|
3249
3252
|
newFolder.value,
|
|
3250
3253
|
parent.value,
|
|
3251
3254
|
root,
|