@bison-lab/payload-core 5.12.0 → 5.13.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 +125 -10
- package/dist/admin-branding-CEKdfYah.mjs +178 -0
- package/dist/admin-branding-CEKdfYah.mjs.map +1 -0
- package/dist/admin-head-CcpH7P4C.mjs +187 -0
- package/dist/admin-head-CcpH7P4C.mjs.map +1 -0
- package/dist/admin-head-QfW81bDy.d.mts +63 -0
- package/dist/admin-head-QfW81bDy.d.mts.map +1 -0
- package/dist/admin-server.d.mts +52 -0
- package/dist/admin-server.d.mts.map +1 -0
- package/dist/admin-server.mjs +94 -0
- package/dist/admin-server.mjs.map +1 -0
- package/dist/admin.d.mts.map +1 -1
- package/dist/admin.mjs +12 -4
- package/dist/admin.mjs.map +1 -1
- package/dist/{alternates-DxBTUXHh.mjs → alternates-Tv5-ccza.mjs} +1 -1
- package/dist/{alternates-DxBTUXHh.mjs.map → alternates-Tv5-ccza.mjs.map} +1 -1
- package/dist/{alternates-DlRTsaVe.d.mts → alternates-aRncEUBI.d.mts} +1 -1
- package/dist/{alternates-DlRTsaVe.d.mts.map → alternates-aRncEUBI.d.mts.map} +1 -1
- package/dist/block-library.d.mts +1 -1
- package/dist/block-library.mjs +1 -1
- package/dist/{block-thumbnails-DC34uFtE.mjs → block-thumbnails-DvILqW_e.mjs} +1 -1
- package/dist/{block-thumbnails-DC34uFtE.mjs.map → block-thumbnails-DvILqW_e.mjs.map} +1 -1
- package/dist/block-thumbnails-cli.mjs +1 -1
- package/dist/block-thumbnails.mjs +1 -1
- package/dist/{capability-Kd5LgQpm.mjs → capability-B4FLx4OX.mjs} +4 -159
- package/dist/capability-B4FLx4OX.mjs.map +1 -0
- package/dist/{capability-NlorUIta.d.mts → capability-DonuHSPG.d.mts} +1 -1
- package/dist/{capability-NlorUIta.d.mts.map → capability-DonuHSPG.d.mts.map} +1 -1
- package/dist/{catalogue-CJ0RlTg4.d.mts → catalogue-tVovXWp9.d.mts} +1 -1
- package/dist/{catalogue-CJ0RlTg4.d.mts.map → catalogue-tVovXWp9.d.mts.map} +1 -1
- package/dist/{facet-field-DO3VT_Cz.mjs → facet-field-7p6_MhsT.mjs} +1 -1
- package/dist/{facet-field-DO3VT_Cz.mjs.map → facet-field-7p6_MhsT.mjs.map} +1 -1
- package/dist/{facet-field-Cd6lffed.d.mts → facet-field-Dbcu1L91.d.mts} +1 -1
- package/dist/{facet-field-Cd6lffed.d.mts.map → facet-field-Dbcu1L91.d.mts.map} +1 -1
- package/dist/{types-B1MmE-L3.d.mts → identity-B4Lew8Fu.d.mts} +40 -24
- package/dist/identity-B4Lew8Fu.d.mts.map +1 -0
- package/dist/{identity-CN6EOeDM.mjs → identity-CkUE_uN2.mjs} +11 -3
- package/dist/{identity-CN6EOeDM.mjs.map → identity-CkUE_uN2.mjs.map} +1 -1
- package/dist/index.d.mts +58 -16
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +150 -60
- package/dist/index.mjs.map +1 -1
- package/dist/island-97l5VY8l.mjs.map +1 -1
- package/dist/languages-B_iiWwxE.mjs +179 -0
- package/dist/languages-B_iiWwxE.mjs.map +1 -0
- package/dist/languages-cDe9Lznx.d.mts +86 -0
- package/dist/languages-cDe9Lznx.d.mts.map +1 -0
- package/dist/{locale-tnKLkutC.d.mts → locale-CTT3nn6T.d.mts} +1 -1
- package/dist/locale-CTT3nn6T.d.mts.map +1 -0
- package/dist/{locale-B6rUVwpg.mjs → locale-DaEJ1d2O.mjs} +1 -1
- package/dist/{locale-B6rUVwpg.mjs.map → locale-DaEJ1d2O.mjs.map} +1 -1
- package/dist/locale-routing.d.mts +129 -0
- package/dist/locale-routing.d.mts.map +1 -0
- package/dist/locale-routing.mjs +256 -0
- package/dist/locale-routing.mjs.map +1 -0
- package/dist/lookup-DiOCro-_.mjs +165 -0
- package/dist/lookup-DiOCro-_.mjs.map +1 -0
- package/dist/lookup-uyEKHlLX.d.mts +41 -0
- package/dist/lookup-uyEKHlLX.d.mts.map +1 -0
- package/dist/{messages-XFoL9RtF.mjs → messages-Bv6JIEiG.mjs} +2 -2
- package/dist/{messages-XFoL9RtF.mjs.map → messages-Bv6JIEiG.mjs.map} +1 -1
- package/dist/metadata.d.mts +2 -2
- package/dist/metadata.mjs +1 -1
- package/dist/navigation.d.mts +2 -2
- package/dist/navigation.mjs +1 -1
- package/dist/og.d.mts +2 -2
- package/dist/og.mjs +2 -2
- package/dist/{preview-Br1SQCKn.mjs → preview-BE7P1ezl.mjs} +5 -120
- package/dist/preview-BE7P1ezl.mjs.map +1 -0
- package/dist/{preview-B69Dhi8T.d.mts → preview-DSQN4uYa.d.mts} +2 -2
- package/dist/{preview-B69Dhi8T.d.mts.map → preview-DSQN4uYa.d.mts.map} +1 -1
- package/dist/{published-Vu_QX2Vv.mjs → published-BF2F3od_.mjs} +2 -2
- package/dist/{published-Vu_QX2Vv.mjs.map → published-BF2F3od_.mjs.map} +1 -1
- package/dist/{published-hqtvmVUD.mjs → published-BzihgcSf.mjs} +1 -1
- package/dist/{published-hqtvmVUD.mjs.map → published-BzihgcSf.mjs.map} +1 -1
- package/dist/{published-B80KqlcU.mjs → published-C8bW5jvC.mjs} +3 -3
- package/dist/{published-B80KqlcU.mjs.map → published-C8bW5jvC.mjs.map} +1 -1
- package/dist/{published-2I-k6zEo.d.mts → published-DYpXTy84.d.mts} +3 -3
- package/dist/{published-2I-k6zEo.d.mts.map → published-DYpXTy84.d.mts.map} +1 -1
- package/dist/{published-BhYTEAK_.d.mts → published-VTz_aYaQ.d.mts} +2 -2
- package/dist/{published-BhYTEAK_.d.mts.map → published-VTz_aYaQ.d.mts.map} +1 -1
- package/dist/{root-page-key-kx3C1eyp.mjs → root-page-key-ywNz2k4L.mjs} +1 -1
- package/dist/{root-page-key-kx3C1eyp.mjs.map → root-page-key-ywNz2k4L.mjs.map} +1 -1
- package/dist/seo.d.mts +1 -1
- package/dist/seo.mjs +2 -2
- package/dist/{strings-Fd7kUCT7.mjs → strings-_9n8BefX.mjs} +1 -1
- package/dist/{strings-Fd7kUCT7.mjs.map → strings-_9n8BefX.mjs.map} +1 -1
- package/dist/taxonomy.d.mts +1 -1
- package/dist/taxonomy.mjs +1 -1
- package/dist/theme.d.mts +6 -5
- package/dist/theme.d.mts.map +1 -1
- package/dist/theme.mjs +6 -63
- package/dist/{title-BVV3o329.d.mts → title-DBSLJfrW.d.mts} +1 -1
- package/dist/{title-BVV3o329.d.mts.map → title-DBSLJfrW.d.mts.map} +1 -1
- package/dist/translate-messages-cli.mjs +2 -2
- package/dist/translate.d.mts +2 -77
- package/dist/translate.d.mts.map +1 -1
- package/dist/translate.mjs +4 -3
- package/dist/translate.mjs.map +1 -1
- package/dist/{wireframe-Ba65SOj8.mjs → wireframe-DjPHSACa.mjs} +1 -1
- package/dist/{wireframe-Ba65SOj8.mjs.map → wireframe-DjPHSACa.mjs.map} +1 -1
- package/dist/wireframe-cli.mjs +1 -1
- package/dist/wireframe.mjs +1 -1
- package/package.json +11 -3
- package/dist/capability-Kd5LgQpm.mjs.map +0 -1
- package/dist/locale-tnKLkutC.d.mts.map +0 -1
- package/dist/preview-Br1SQCKn.mjs.map +0 -1
- package/dist/theme.mjs.map +0 -1
- package/dist/types-B1MmE-L3.d.mts.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"alternates-
|
|
1
|
+
{"version":3,"file":"alternates-Tv5-ccza.mjs","names":[],"sources":["../src/seo/alternates.ts"],"sourcesContent":["/**\n * The locale options `pageMetadata` and `pageSitemap` share. Omit them and a\n * single-locale site's output is what it was before (#281); pass `locales`\n * and `pathFor` together, or neither.\n */\nexport type LocaleAlternatesOptions<P> =\n | { locales?: undefined; pathFor?: undefined; defaultLocale?: undefined }\n | {\n /**\n * The locales the page has a URL in, in order: on a site that can switch\n * a language off, the live ones only (`activeLocales(payload).active`\n * from `./translate`), so a language with no URL gets no hreflang.\n */\n locales: readonly string[];\n /** The page's public path in a locale: the site's own route helper. */\n pathFor: (page: P, locale: string) => string;\n /** The locale `x-default` points at. Default: the first of `locales`. */\n defaultLocale?: string;\n };\n\n/**\n * `hreflang` URLs for a page: one per locale plus `x-default`, made absolute\n * so they mean the same thing in `<head>` and in `/sitemap.xml`. `undefined`\n * when no locales were given.\n */\nexport function languageAlternates<P>(\n page: P,\n options: LocaleAlternatesOptions<P>,\n absoluteUrl: (path: string) => string,\n): Record<string, string> | undefined {\n const { locales, pathFor } = options;\n if (!locales?.length || !pathFor) return undefined;\n const defaultLocale = options.defaultLocale ?? locales[0]!;\n const languages: Record<string, string> = {};\n for (const locale of locales) languages[locale] = absoluteUrl(pathFor(page, locale));\n languages[\"x-default\"] = absoluteUrl(pathFor(page, defaultLocale));\n return languages;\n}\n"],"mappings":";;;;;;AAyBA,SAAgB,mBACd,MACA,SACA,aACoC;CACpC,MAAM,EAAE,SAAS,YAAY;AAC7B,KAAI,CAAC,SAAS,UAAU,CAAC,QAAS,QAAO,KAAA;CACzC,MAAM,gBAAgB,QAAQ,iBAAiB,QAAQ;CACvD,MAAM,YAAoC,EAAE;AAC5C,MAAK,MAAM,UAAU,QAAS,WAAU,UAAU,YAAY,QAAQ,MAAM,OAAO,CAAC;AACpF,WAAU,eAAe,YAAY,QAAQ,MAAM,cAAc,CAAC;AAClE,QAAO"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"alternates-
|
|
1
|
+
{"version":3,"file":"alternates-aRncEUBI.d.mts","names":[],"sources":["../src/seo/alternates.ts"],"mappings":";;AAKA;;;;KAAY,uBAAA;EACN,OAAA;EAAqB,OAAA;EAAqB,aAAA;AAAA;EAS1C;;;;;EAFA,OAAA,qBAIa;EAFb,OAAA,GAAU,IAAA,EAAM,CAAA,EAAG,MAAA;EAEnB,aAAA;AAAA"}
|
package/dist/block-library.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as PACKAGE_BLOCK_SLUGS, C as BlockLibraryDoc, D as BlockLibraryKind, O as BlockLibraryRow, T as BlockLibraryEntry, _ as SectionControls, a as sectionControlsFromLibrary, c as BlockLibraryReader, d as DEFAULT_SECTION_CONTROLS, f as HERO_SECTION_CONTROLS, g as SectionControlKey, h as SECTION_CONTROL_LABELS, i as defaultBlockLibraryValue, j as PackageBlockSlug, l as blockLibraryEntriesFromConfig, m as SECTION_CONTROL_KEYS, n as BlockLibraryOptions, o as stampBlockLibrary, p as NO_SECTION_CONTROLS, r as blockLibraryCatalogue, s as validateBlockLibrary, t as BlockLibraryCheck, u as getSectionControls, v as defaultSectionControls, x as BLOCK_LIBRARY_SLUG, y as sectionControlsOf } from "./catalogue-
|
|
1
|
+
import { A as PACKAGE_BLOCK_SLUGS, C as BlockLibraryDoc, D as BlockLibraryKind, O as BlockLibraryRow, T as BlockLibraryEntry, _ as SectionControls, a as sectionControlsFromLibrary, c as BlockLibraryReader, d as DEFAULT_SECTION_CONTROLS, f as HERO_SECTION_CONTROLS, g as SectionControlKey, h as SECTION_CONTROL_LABELS, i as defaultBlockLibraryValue, j as PackageBlockSlug, l as blockLibraryEntriesFromConfig, m as SECTION_CONTROL_KEYS, n as BlockLibraryOptions, o as stampBlockLibrary, p as NO_SECTION_CONTROLS, r as blockLibraryCatalogue, s as validateBlockLibrary, t as BlockLibraryCheck, u as getSectionControls, v as defaultSectionControls, x as BLOCK_LIBRARY_SLUG, y as sectionControlsOf } from "./catalogue-tVovXWp9.mjs";
|
|
2
2
|
|
|
3
3
|
//#region src/block-library/island.d.ts
|
|
4
4
|
/**
|
package/dist/block-library.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { _ as sectionControlsOf, a as sectionControlsFromLibrary, d as DEFAULT_SECTION_CONTROLS, f as HERO_SECTION_CONTROLS, g as defaultSectionControls, h as SECTION_CONTROL_LABELS, i as defaultBlockLibraryValue, l as BLOCK_LIBRARY_SLUG, m as SECTION_CONTROL_KEYS, n as getSectionControls, o as stampBlockLibrary, p as NO_SECTION_CONTROLS, r as blockLibraryCatalogue, s as validateBlockLibrary, t as blockLibraryEntriesFromConfig, u as PACKAGE_BLOCK_SLUGS } from "./published-
|
|
1
|
+
import { _ as sectionControlsOf, a as sectionControlsFromLibrary, d as DEFAULT_SECTION_CONTROLS, f as HERO_SECTION_CONTROLS, g as defaultSectionControls, h as SECTION_CONTROL_LABELS, i as defaultBlockLibraryValue, l as BLOCK_LIBRARY_SLUG, m as SECTION_CONTROL_KEYS, n as getSectionControls, o as stampBlockLibrary, p as NO_SECTION_CONTROLS, r as blockLibraryCatalogue, s as validateBlockLibrary, t as blockLibraryEntriesFromConfig, u as PACKAGE_BLOCK_SLUGS } from "./published-BzihgcSf.mjs";
|
|
2
2
|
//#region src/block-library/island.ts
|
|
3
3
|
/**
|
|
4
4
|
* How a Block library island tells its card how tall it is (BIS-147).
|
|
@@ -127,4 +127,4 @@ function thumbnailVersion(data) {
|
|
|
127
127
|
//#endregion
|
|
128
128
|
export { THUMBNAIL_VIEWPORT as a, thumbnailCss as c, THUMBNAIL_SCALE as i, thumbnailVersion as l, THUMBNAIL_HEIGHT as n, THUMBNAIL_WIDTH as o, THUMBNAIL_ROOT as r, captureThumbnails as s, NEUTRAL_THEME as t };
|
|
129
129
|
|
|
130
|
-
//# sourceMappingURL=block-thumbnails-
|
|
130
|
+
//# sourceMappingURL=block-thumbnails-DvILqW_e.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"block-thumbnails-
|
|
1
|
+
{"version":3,"file":"block-thumbnails-DvILqW_e.mjs","names":[],"sources":["../src/block-thumbnails.ts"],"sourcesContent":["/**\n * Screenshots of Block library samples for Payload's Add Block drawer\n * (`admin.images.thumbnail`). React-free and Payload-free: a script drives\n * a browser to each block's preview (`previewPath(slug)`), lays a neutral\n * theme over the site's, and captures the block as a 3:2 JPEG. The samples\n * carry generic copy and photos (`@bison-lab/payload-blocks`), so the card\n * reads as no particular site or industry. Rerun it when a block's layout\n * or sample changes.\n */\nimport { buildThemeCss, type ThemeConfig } from \"@bison-lab/tokens\";\n\n/** Payload's drawer card is 3:2. */\nexport const THUMBNAIL_WIDTH = 960;\nexport const THUMBNAIL_HEIGHT = 640;\n\n/** Desktop width, so the picture is the layout most visitors see; scaled down to 960. */\nexport const THUMBNAIL_VIEWPORT = { width: 1280, height: 900 } as const;\nexport const THUMBNAIL_SCALE = THUMBNAIL_WIDTH / THUMBNAIL_VIEWPORT.width;\n\n/** The element the Block library preview wraps each sample in (`BlockLibraryIsland`). */\nexport const THUMBNAIL_ROOT = \"[data-block-library-island]\";\n\n/**\n * Slate greys with a slate primary: no site's brand, and a contrast every\n * block was designed to read in. Fonts are the system stack (below), so no\n * font file has to be served for the capture.\n */\nexport const NEUTRAL_THEME: ThemeConfig = {\n brandPrimary: \"#334155\",\n brandSecondary: \"#64748b\",\n brandAccent: \"#475569\",\n brandHighlight: \"#94a3b8\",\n brandSuccess: \"#3f6212\",\n greyScale: \"slate\",\n defaultTheme: \"light\",\n radius: \"subtle\",\n shadow: \"subtle\",\n motion: \"minimal\",\n density: \"default\",\n fontBody: \"Inter\",\n fontHeading: null,\n fontWeights: { normal: 400, medium: 500, semibold: 600, bold: 700 },\n};\n\nconst SYSTEM_FONTS = 'ui-sans-serif, system-ui, -apple-system, \"Segoe UI\", Roboto, \"Helvetica Neue\", Arial, sans-serif';\n\n/**\n * The stylesheet a capture adds to the preview: the neutral theme's tokens\n * (light, whatever the viewer's setting), the system font stack, no motion,\n * and the island as a column that centers its block, so a short band sits in\n * the middle of the card (`islandClip` sets the 3:2 height).\n */\nexport function thumbnailCss(selector = THUMBNAIL_ROOT): string {\n return [\n buildThemeCss(NEUTRAL_THEME, { attribute: \"data-theme\" }),\n `:root,[data-theme]{--font-body:${SYSTEM_FONTS};--font-heading:${SYSTEM_FONTS};color-scheme:light}`,\n `*,*::before,*::after{transition:none!important;animation:none!important;caret-color:transparent!important}`,\n // Dev-server chrome (Next's dev tools badge) is not part of the block.\n `nextjs-portal,[data-nextjs-toast],[data-next-badge-root]{display:none!important}`,\n `${selector}{box-sizing:border-box;display:flex!important;flex-direction:column;justify-content:center}`,\n ].join(\"\\n\");\n}\n\n/** The slice of Playwright's `Page` this needs; a site passes its own. */\nexport interface ThumbnailPage {\n goto(\n url: string,\n options?: { waitUntil?: \"load\" | \"domcontentloaded\" | \"networkidle\" },\n ): Promise<{ status(): number } | null | void>;\n evaluate<R, A>(fn: (arg: A) => R | Promise<R>, arg: A): Promise<R>;\n addStyleTag(options: { content: string }): Promise<unknown>;\n waitForTimeout(ms: number): Promise<void>;\n screenshot(options: {\n clip: { x: number; y: number; width: number; height: number };\n type: \"jpeg\";\n quality: number;\n scale: \"device\";\n }): Promise<Buffer | Uint8Array>;\n}\n\n/**\n * The box a capture takes: the island's top, its full width, 3:2. The\n * island is held at least that tall first, so a short block is centered in\n * the card and a tall one keeps its top. Runs in the page, so it closes over\n * nothing.\n */\nfunction islandClip(selector: string): { x: number; y: number; width: number; height: number } | null {\n const island = document.querySelector<HTMLElement>(selector);\n if (!island) return null;\n const width = Math.round(island.getBoundingClientRect().width);\n const height = Math.round((width * 2) / 3);\n island.style.minHeight = `${height}px`;\n const rect = island.getBoundingClientRect();\n return { x: Math.round(rect.left + window.scrollX), y: Math.round(rect.top + window.scrollY), width, height };\n}\n\n/**\n * Opens each preview, forces the light neutral theme, waits for its fonts\n * and images, and returns one JPEG per slug. The page's context should use\n * `THUMBNAIL_VIEWPORT` and `deviceScaleFactor: THUMBNAIL_SCALE`, so the\n * file comes out at 960 × 640. A preview that answers 400 or more, or\n * renders nothing `selector` matches, throws: nothing is written for a page\n * that did not draw its sample.\n */\nexport async function captureThumbnails(\n page: ThumbnailPage,\n previews: readonly { slug: string; url: string }[],\n { selector = THUMBNAIL_ROOT, quality = 68 }: { selector?: string; quality?: number } = {},\n): Promise<Record<string, Uint8Array>> {\n const out: Record<string, Uint8Array> = {};\n for (const { slug, url } of previews) {\n const response = await page.goto(url, { waitUntil: \"networkidle\" });\n const status = response ? response.status() : 200;\n if (status >= 400) throw new Error(`${slug}: ${url} answered ${status}; is the server up, the slug right, and the login one the route accepts?`);\n await page.evaluate(() => {\n document.documentElement.setAttribute(\"data-theme\", \"light\");\n document.documentElement.classList.remove(\"dark\");\n }, undefined);\n await page.addStyleTag({ content: thumbnailCss(selector) });\n await page.evaluate(\n () =>\n Promise.all([\n document.fonts.ready,\n ...Array.from(document.images).map((image) => (image.complete ? null : image.decode().catch(() => null))),\n ]).then(() => undefined),\n undefined,\n );\n await page.waitForTimeout(400);\n const clip = await page.evaluate(islandClip, selector);\n if (!clip) throw new Error(`${slug}: ${url} has no ${selector}; it did not render the sample`);\n out[slug] = new Uint8Array(await page.screenshot({ clip, type: \"jpeg\", quality, scale: \"device\" }));\n }\n return out;\n}\n\n/** A short, stable hash for a thumbnail's cache-busting `?v=`. */\nexport function thumbnailVersion(data: string | Uint8Array): string {\n let hash = 0x811c9dc5;\n const bytes = typeof data === \"string\" ? new TextEncoder().encode(data) : data;\n for (const byte of bytes) {\n hash ^= byte;\n hash = Math.imul(hash, 0x01000193) >>> 0;\n }\n return hash.toString(36);\n}\n"],"mappings":";;;;;;;;;;;;AAYA,MAAa,kBAAkB;AAC/B,MAAa,mBAAmB;;AAGhC,MAAa,qBAAqB;CAAE,OAAO;CAAM,QAAQ;CAAK;AAC9D,MAAa,kBAAA,MAAoC,mBAAmB;;AAGpE,MAAa,iBAAiB;;;;;;AAO9B,MAAa,gBAA6B;CACxC,cAAc;CACd,gBAAgB;CAChB,aAAa;CACb,gBAAgB;CAChB,cAAc;CACd,WAAW;CACX,cAAc;CACd,QAAQ;CACR,QAAQ;CACR,QAAQ;CACR,SAAS;CACT,UAAU;CACV,aAAa;CACb,aAAa;EAAE,QAAQ;EAAK,QAAQ;EAAK,UAAU;EAAK,MAAM;EAAK;CACpE;AAED,MAAM,eAAe;;;;;;;AAQrB,SAAgB,aAAa,WAAW,gBAAwB;AAC9D,QAAO;EACL,cAAc,eAAe,EAAE,WAAW,cAAc,CAAC;EACzD,kCAAkC,aAAa,kBAAkB,aAAa;EAC9E;EAEA;EACA,GAAG,SAAS;EACb,CAAC,KAAK,KAAK;;;;;;;;AA0Bd,SAAS,WAAW,UAAkF;CACpG,MAAM,SAAS,SAAS,cAA2B,SAAS;AAC5D,KAAI,CAAC,OAAQ,QAAO;CACpB,MAAM,QAAQ,KAAK,MAAM,OAAO,uBAAuB,CAAC,MAAM;CAC9D,MAAM,SAAS,KAAK,MAAO,QAAQ,IAAK,EAAE;AAC1C,QAAO,MAAM,YAAY,GAAG,OAAO;CACnC,MAAM,OAAO,OAAO,uBAAuB;AAC3C,QAAO;EAAE,GAAG,KAAK,MAAM,KAAK,OAAO,OAAO,QAAQ;EAAE,GAAG,KAAK,MAAM,KAAK,MAAM,OAAO,QAAQ;EAAE;EAAO;EAAQ;;;;;;;;;;AAW/G,eAAsB,kBACpB,MACA,UACA,EAAE,WAAW,gBAAgB,UAAU,OAAgD,EAAE,EACpD;CACrC,MAAM,MAAkC,EAAE;AAC1C,MAAK,MAAM,EAAE,MAAM,SAAS,UAAU;EACpC,MAAM,WAAW,MAAM,KAAK,KAAK,KAAK,EAAE,WAAW,eAAe,CAAC;EACnE,MAAM,SAAS,WAAW,SAAS,QAAQ,GAAG;AAC9C,MAAI,UAAU,IAAK,OAAM,IAAI,MAAM,GAAG,KAAK,IAAI,IAAI,YAAY,OAAO,0EAA0E;AAChJ,QAAM,KAAK,eAAe;AACxB,YAAS,gBAAgB,aAAa,cAAc,QAAQ;AAC5D,YAAS,gBAAgB,UAAU,OAAO,OAAO;KAChD,KAAA,EAAU;AACb,QAAM,KAAK,YAAY,EAAE,SAAS,aAAa,SAAS,EAAE,CAAC;AAC3D,QAAM,KAAK,eAEP,QAAQ,IAAI,CACV,SAAS,MAAM,OACf,GAAG,MAAM,KAAK,SAAS,OAAO,CAAC,KAAK,UAAW,MAAM,WAAW,OAAO,MAAM,QAAQ,CAAC,YAAY,KAAK,CAAE,CAC1G,CAAC,CAAC,WAAW,KAAA,EAAU,EAC1B,KAAA,EACD;AACD,QAAM,KAAK,eAAe,IAAI;EAC9B,MAAM,OAAO,MAAM,KAAK,SAAS,YAAY,SAAS;AACtD,MAAI,CAAC,KAAM,OAAM,IAAI,MAAM,GAAG,KAAK,IAAI,IAAI,UAAU,SAAS,gCAAgC;AAC9F,MAAI,QAAQ,IAAI,WAAW,MAAM,KAAK,WAAW;GAAE;GAAM,MAAM;GAAQ;GAAS,OAAO;GAAU,CAAC,CAAC;;AAErG,QAAO;;;AAIT,SAAgB,iBAAiB,MAAmC;CAClE,IAAI,OAAO;CACX,MAAM,QAAQ,OAAO,SAAS,WAAW,IAAI,aAAa,CAAC,OAAO,KAAK,GAAG;AAC1E,MAAK,MAAM,QAAQ,OAAO;AACxB,UAAQ;AACR,SAAO,KAAK,KAAK,MAAM,SAAW,KAAK;;AAEzC,QAAO,KAAK,SAAS,GAAG"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { a as THUMBNAIL_VIEWPORT, i as THUMBNAIL_SCALE, s as captureThumbnails } from "./block-thumbnails-
|
|
2
|
+
import { a as THUMBNAIL_VIEWPORT, i as THUMBNAIL_SCALE, s as captureThumbnails } from "./block-thumbnails-DvILqW_e.mjs";
|
|
3
3
|
import { createRequire } from "node:module";
|
|
4
4
|
import { mkdirSync, writeFileSync } from "node:fs";
|
|
5
5
|
import { dirname, join, resolve } from "node:path";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as THUMBNAIL_VIEWPORT, c as thumbnailCss, i as THUMBNAIL_SCALE, l as thumbnailVersion, n as THUMBNAIL_HEIGHT, o as THUMBNAIL_WIDTH, r as THUMBNAIL_ROOT, s as captureThumbnails, t as NEUTRAL_THEME } from "./block-thumbnails-
|
|
1
|
+
import { a as THUMBNAIL_VIEWPORT, c as thumbnailCss, i as THUMBNAIL_SCALE, l as thumbnailVersion, n as THUMBNAIL_HEIGHT, o as THUMBNAIL_WIDTH, r as THUMBNAIL_ROOT, s as captureThumbnails, t as NEUTRAL_THEME } from "./block-thumbnails-DvILqW_e.mjs";
|
|
2
2
|
export { NEUTRAL_THEME, THUMBNAIL_HEIGHT, THUMBNAIL_ROOT, THUMBNAIL_SCALE, THUMBNAIL_VIEWPORT, THUMBNAIL_WIDTH, captureThumbnails, thumbnailCss, thumbnailVersion };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { f as resolveActiveTargets, i as LIBRARY_LOCALES, l as invalidateActiveLocales, n as DEFAULT_ACTIVE_LOCALES, p as withLibraryLocales, s as activeLocales } from "./languages-B_iiWwxE.mjs";
|
|
2
|
+
import { c as estimateCost, f as verifyAnthropicKey, i as ECONOMY_TRANSLATE_MODEL, n as translateStrings, o as anthropicTranslator, r as DEFAULT_TRANSLATE_MODEL, s as containsWord, t as isTranslatorConfigured } from "./strings-_9n8BefX.mjs";
|
|
2
3
|
import { APIError, Forbidden } from "payload";
|
|
3
4
|
import { createCipheriv, createDecipheriv, createHash, createHmac, randomBytes, randomUUID, timingSafeEqual } from "node:crypto";
|
|
4
5
|
//#region src/features/types.ts
|
|
@@ -1163,162 +1164,6 @@ function resolveApiKey(input) {
|
|
|
1163
1164
|
};
|
|
1164
1165
|
}
|
|
1165
1166
|
//#endregion
|
|
1166
|
-
//#region src/translate/languages.ts
|
|
1167
|
-
/**
|
|
1168
|
-
* The languages every Bison site carries. The library owns this list: a new
|
|
1169
|
-
* language is a library release that sites take by updating the package
|
|
1170
|
-
* (and running the migration it brings). The first entry is the default
|
|
1171
|
-
* locale of a site that declares no localization of its own.
|
|
1172
|
-
*/
|
|
1173
|
-
const LIBRARY_LOCALES = [{
|
|
1174
|
-
code: "en",
|
|
1175
|
-
label: "English"
|
|
1176
|
-
}, {
|
|
1177
|
-
code: "es",
|
|
1178
|
-
label: "Español"
|
|
1179
|
-
}];
|
|
1180
|
-
const LIBRARY_DEFAULT_LOCALE = "en";
|
|
1181
|
-
/** The codes of `LIBRARY_LOCALES`, in order. */
|
|
1182
|
-
const LIBRARY_LOCALE_CODES = LIBRARY_LOCALES.map((locale) => locale.code);
|
|
1183
|
-
function codeOf(entry) {
|
|
1184
|
-
return typeof entry === "string" ? entry : entry.code;
|
|
1185
|
-
}
|
|
1186
|
-
/**
|
|
1187
|
-
* A config's `localization` with every library language in it. A site with
|
|
1188
|
-
* none gets the library's (English default, `fallback: true`, so an empty
|
|
1189
|
-
* Spanish field reads as English). A site with its own keeps its locales,
|
|
1190
|
-
* labels and default, and gains any library language it lacks.
|
|
1191
|
-
*/
|
|
1192
|
-
function withLibraryLocales(localization) {
|
|
1193
|
-
if (!localization) return {
|
|
1194
|
-
locales: LIBRARY_LOCALES.map((locale) => ({ ...locale })),
|
|
1195
|
-
defaultLocale: "en",
|
|
1196
|
-
fallback: true
|
|
1197
|
-
};
|
|
1198
|
-
const own = localization.locales;
|
|
1199
|
-
const have = new Set(own.map(codeOf));
|
|
1200
|
-
const missing = LIBRARY_LOCALES.filter((locale) => !have.has(locale.code));
|
|
1201
|
-
if (missing.length === 0) return localization;
|
|
1202
|
-
const locales = [...own.map((entry) => typeof entry === "string" ? {
|
|
1203
|
-
code: entry,
|
|
1204
|
-
label: entry
|
|
1205
|
-
} : entry), ...missing.map((locale) => ({ ...locale }))];
|
|
1206
|
-
return {
|
|
1207
|
-
...localization,
|
|
1208
|
-
locales
|
|
1209
|
-
};
|
|
1210
|
-
}
|
|
1211
|
-
/** How long `activeLocales` reuses one read. A save of Settings → Translation in the same process clears it at once. */
|
|
1212
|
-
const ACTIVE_LOCALES_CACHE_MS = 6e4;
|
|
1213
|
-
const cache$2 = /* @__PURE__ */ new WeakMap();
|
|
1214
|
-
/** The last answer read from the database, kept for when a later read fails. */
|
|
1215
|
-
const lastGood = /* @__PURE__ */ new WeakMap();
|
|
1216
|
-
/** After a failed read, how soon to try the database again. */
|
|
1217
|
-
const ACTIVE_LOCALES_RETRY_MS = 5e3;
|
|
1218
|
-
/** Drops the cached answer, so the next `activeLocales` reads again. */
|
|
1219
|
-
function invalidateActiveLocales(payload) {
|
|
1220
|
-
cache$2.delete(payload);
|
|
1221
|
-
}
|
|
1222
|
-
/**
|
|
1223
|
-
* The ticked target languages, as the Translation screen stores them.
|
|
1224
|
-
* `null` or absent (never saved) means the defaults: the target locales the
|
|
1225
|
-
* site declared itself before the library's were added.
|
|
1226
|
-
*/
|
|
1227
|
-
function resolveActiveTargets(stored, targets, defaults) {
|
|
1228
|
-
const chosen = Array.isArray(stored) ? stored : defaults;
|
|
1229
|
-
return targets.filter((code) => chosen.includes(code));
|
|
1230
|
-
}
|
|
1231
|
-
/**
|
|
1232
|
-
* The site's active languages, for routing and middleware: the default
|
|
1233
|
-
* locale plus each target language ticked on Settings → Translation. Cached
|
|
1234
|
-
* per process for `ttlMs` (60s by default): a request reads memory, and the
|
|
1235
|
-
* database is read only when the cache refreshes, or after a save of the
|
|
1236
|
-
* screen in the same process. Never throws. When a read fails it answers
|
|
1237
|
-
* with the last good read (or, before the first one, the defaults) and
|
|
1238
|
-
* tries the database again after `ACTIVE_LOCALES_RETRY_MS`, so one timeout
|
|
1239
|
-
* never stands in for the Admin's ticks for a whole cache period, which
|
|
1240
|
-
* would send a ticked language's visitors permanent redirects.
|
|
1241
|
-
*/
|
|
1242
|
-
function activeLocales(payload, options = {}) {
|
|
1243
|
-
const ttl = options.ttlMs ?? 6e4;
|
|
1244
|
-
const hit = cache$2.get(payload);
|
|
1245
|
-
if (hit && Date.now() - hit.at < (hit.ttl ?? ttl)) return hit.value;
|
|
1246
|
-
const entry = {
|
|
1247
|
-
at: Date.now(),
|
|
1248
|
-
value: void 0
|
|
1249
|
-
};
|
|
1250
|
-
entry.value = readActiveLocales(payload).then((read) => {
|
|
1251
|
-
if (read.ok) {
|
|
1252
|
-
lastGood.set(payload, read.value);
|
|
1253
|
-
return read.value;
|
|
1254
|
-
}
|
|
1255
|
-
entry.ttl = ACTIVE_LOCALES_RETRY_MS;
|
|
1256
|
-
return lastGood.get(payload) ?? read.value;
|
|
1257
|
-
});
|
|
1258
|
-
cache$2.set(payload, entry);
|
|
1259
|
-
return entry.value;
|
|
1260
|
-
}
|
|
1261
|
-
/** The slug `activeLocales` reads; the Translation screen's. */
|
|
1262
|
-
const SETTINGS_SLUG = "translation-settings";
|
|
1263
|
-
/** Where `applyTranslation` leaves the default ticks: the site's own target locales. */
|
|
1264
|
-
const DEFAULT_ACTIVE_LOCALES = "bisonDefaultActiveLocales";
|
|
1265
|
-
async function readActiveLocales(payload) {
|
|
1266
|
-
const localization = payload.config.localization;
|
|
1267
|
-
const codes = localization ? localization.locales.map(codeOf) : ["en"];
|
|
1268
|
-
const defaultLocale = localization ? localization.defaultLocale : "en";
|
|
1269
|
-
const targets = codes.filter((code) => code !== defaultLocale);
|
|
1270
|
-
const defaults = payload.config.custom?.["bisonDefaultActiveLocales"] ?? targets;
|
|
1271
|
-
let stored;
|
|
1272
|
-
let ok = true;
|
|
1273
|
-
try {
|
|
1274
|
-
const doc = await payload.findGlobal({
|
|
1275
|
-
slug: SETTINGS_SLUG,
|
|
1276
|
-
depth: 0,
|
|
1277
|
-
overrideAccess: true
|
|
1278
|
-
});
|
|
1279
|
-
stored = doc?.languagesChosen ? doc.languages ?? [] : void 0;
|
|
1280
|
-
} catch {
|
|
1281
|
-
stored = void 0;
|
|
1282
|
-
ok = false;
|
|
1283
|
-
}
|
|
1284
|
-
const ticked = resolveActiveTargets(stored, targets, defaults);
|
|
1285
|
-
return {
|
|
1286
|
-
ok,
|
|
1287
|
-
value: {
|
|
1288
|
-
defaultLocale,
|
|
1289
|
-
active: codes.filter((code) => code === defaultLocale || ticked.includes(code)),
|
|
1290
|
-
inactive: targets.filter((code) => !ticked.includes(code))
|
|
1291
|
-
}
|
|
1292
|
-
};
|
|
1293
|
-
}
|
|
1294
|
-
/**
|
|
1295
|
-
* Where a request for an inactive language goes: the same path without
|
|
1296
|
-
* its locale prefix, for a 308. `null` when the path is not under an
|
|
1297
|
-
* inactive locale. In a site's middleware:
|
|
1298
|
-
*
|
|
1299
|
-
* ```ts
|
|
1300
|
-
* const to = inactiveLocaleRedirect(url.pathname, await activeLocales(payload));
|
|
1301
|
-
* if (to) {
|
|
1302
|
-
* const response = NextResponse.redirect(new URL(to + url.search, url), 308);
|
|
1303
|
-
* response.headers.set("Cache-Control", "no-store"); // so ticking the language again works for these visitors
|
|
1304
|
-
* return response;
|
|
1305
|
-
* }
|
|
1306
|
-
* ```
|
|
1307
|
-
*/
|
|
1308
|
-
function inactiveLocaleRedirect(pathname, locales) {
|
|
1309
|
-
const [, first, ...rest] = pathname.split("/");
|
|
1310
|
-
if (!first || !locales.inactive.includes(first)) return null;
|
|
1311
|
-
return `/${rest.join("/").replace(/^[\\/]+/, "")}`;
|
|
1312
|
-
}
|
|
1313
|
-
/**
|
|
1314
|
-
* A page's language alternates (for hreflang and a language switcher),
|
|
1315
|
-
* keeping only active languages. `paths` maps each locale to that
|
|
1316
|
-
* language's URL for the page.
|
|
1317
|
-
*/
|
|
1318
|
-
function activeAlternates(paths, locales) {
|
|
1319
|
-
return Object.fromEntries(Object.entries(paths).filter(([code]) => locales.active.includes(code)));
|
|
1320
|
-
}
|
|
1321
|
-
//#endregion
|
|
1322
1167
|
//#region src/translate/cas.ts
|
|
1323
1168
|
/**
|
|
1324
1169
|
* An atomic compare-and-set on one row: write `set` only where the row's
|
|
@@ -4233,6 +4078,6 @@ function withJobsOnSwitch(global) {
|
|
|
4233
4078
|
};
|
|
4234
4079
|
}
|
|
4235
4080
|
//#endregion
|
|
4236
|
-
export {
|
|
4081
|
+
export { encryptApiKey as $, featureCatalogue as $t, TRANSLATE_NOW as A, storedRoles as At, TRANSLATION_STATUS_BAR as B, ROLES_SLUG as Bt, isAutosave as C, RELEASE_ONLY_NOTE as Cn, hideUnlessDeveloper as Ct, shouldSkipUndraftedTranslation as D, isPackageFeatureSlug as Dn, isDeveloper as Dt, shouldSkipDraftedTranslation as E, isLockedFeature as En, isAuthenticated as Et, TRANSLATION_ACTIVITY_PANEL as F, INVALID_ROLE_NAME_MESSAGE as Ft, FAILURE_ADVICE as G, parseRolesMatrix as Gt, readTranslationSettings as H, defaultRolesFieldValue as Ht, TRANSLATION_GRANT as I, LAST_USERS_TICK_MESSAGE as It, monthKey as J, roleSelectOptions as Jt, RATE_LIMIT_STREAK as K, resetRolesMatrix as Kt, TRANSLATION_KEY_PANEL as L, MISSING_SEED_ROLES_MESSAGE as Lt, BISON_TRANSLATION_CONTEXT as M, DEVELOPER_DESCRIPTION as Mt, readTranslateState as N, DUPLICATE_ROLE_NAME_MESSAGE as Nt, TRANSACTION_TIMEOUT_MS as O, isDeveloperTab as Ot, withTranslator as P, DUPLICATE_ROLE_SLUG_MESSAGE as Pt, decryptApiKey as Q, defaultFeaturesFieldValue as Qt, TRANSLATION_SETTINGS_SLUG as R, ROLES_FIELD_DESCRIPTION as Rt, startJob as S, PACKAGE_FEATURE_SLUGS as Sn, hasRole as St, localizedCopyUnchanged as T, isFeatureSlug as Tn, isAdminOrSelf as Tt, resolveModel as U, grantsFromStoredRole as Ut, invalidateTranslationSettings as V, applyRoleSlugsFromNames as Vt, siteFromInstructions as W, normalizeStoredRoles as Wt, usageHistory as X, validateRolesMatrix as Xt, recordUsage as Y, seedRoleRows as Yt, usageThisMonth as Z, MISSING_PACKAGE_FEATURES_MESSAGE as Zt, frozenWordForce as _, slugifyRoleName as _n, canPublish as _t, MESSAGES_CACHE_MS as a, validateFeaturesMatrix as an, refusePublishWithoutGrant as at, runJobSlice as b, FEATURE_GROUP_LABELS as bn, hasCapability as bt, importMessages as c, DEFAULT_ROLE_GRANTS as cn, canUseFeature as ct, unflattenMessages as d, THEME_FEATURE_SLUGS as dn, hasFeature as dt, featureGroupLabel as en, resolveApiKey as et, translationSettingsEndpoints as f, isRole as fn, hideUnlessFeature as ft, estimateJob as g, sanitizeRoleNameInput as gn, canManageContent as gt, claimJob as h, roleLabel as hn, canManageBrand as ht, INTERFACE_TEXT_SLUG as i, stampFeatureCatalogue as in, draftSavesOnlyWithoutPublish as it, translateDocument as j, DEFAULT_ROLE_MATRIX as jt, runAfterCommit as k, isPrivilegedRole as kt, interfaceTextGlobal as l, ROLES as ln, featureReleased as lt, TRANSLATION_JOBS_SLUG as m, isRoleSlug as mn, authenticatedOrPublished as mt, hasLocalizedFields as n, parseFeaturesMatrix as nn, sameRow as nt, flattenMessages as o, CAPABILITIES as on, updateUnlessPublishing as ot, LEASE_MS as p, isRoleName as pn, readFeatureReleased as pt, TRANSLATION_USAGE_SLUG as q, roleDescription as qt, translation as r, releaseOnlyFeatureSlugs as rn, translationJob as rt, getMessages as s, CAPABILITY_FEATURES as sn, allowedFeaturesForUser as st, applyTranslation as t, markReleaseOnlyRows as tn, collectLocalizedStrings as tt, invalidateMessages as u, ROLE_LABELS as un, getFeaturesMatrix as ut, jobView as v, FEATURES_SLUG as vn, developerOnlyAccess as vt, draftedTranslationDecision as w, isFeatureGroupId as wn, isAdmin as wt, startBackfill as x, PACKAGE_FEATURES as xn, hasGrant as xt, resumeStaleJobs as y, FEATURE_GROUPS as yn, getRolesMatrix as yt, TRANSLATION_STATE_SLUG as z, ROLES_GLOBAL_DESCRIPTION as zt };
|
|
4237
4082
|
|
|
4238
|
-
//# sourceMappingURL=capability-
|
|
4083
|
+
//# sourceMappingURL=capability-B4FLx4OX.mjs.map
|