@bison-lab/payload-core 5.5.0 → 5.6.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 +10 -0
- package/dist/alternates-DlRTsaVe.d.mts +23 -0
- package/dist/alternates-DlRTsaVe.d.mts.map +1 -0
- package/dist/alternates-DxBTUXHh.mjs +19 -0
- package/dist/alternates-DxBTUXHh.mjs.map +1 -0
- package/dist/block-library.d.mts +1 -1
- package/dist/{capability-Dotbq58Q.d.mts → capability-NlorUIta.d.mts} +1 -1
- package/dist/{capability-Dotbq58Q.d.mts.map → capability-NlorUIta.d.mts.map} +1 -1
- package/dist/{catalogue-DWqHWVE5.d.mts → catalogue-CJ0RlTg4.d.mts} +1 -1
- package/dist/{catalogue-DWqHWVE5.d.mts.map → catalogue-CJ0RlTg4.d.mts.map} +1 -1
- package/dist/{facet-field-2K22iuWA.d.mts → facet-field-Cd6lffed.d.mts} +1 -1
- package/dist/{facet-field-2K22iuWA.d.mts.map → facet-field-Cd6lffed.d.mts.map} +1 -1
- package/dist/index.d.mts +7 -7
- package/dist/{locale-CTT3nn6T.d.mts → locale-tnKLkutC.d.mts} +1 -1
- package/dist/locale-tnKLkutC.d.mts.map +1 -0
- package/dist/{messages-dZV_aAnR.mjs → messages-XFoL9RtF.mjs} +1 -1
- package/dist/{messages-dZV_aAnR.mjs.map → messages-XFoL9RtF.mjs.map} +1 -1
- package/dist/metadata.d.mts +20 -6
- package/dist/metadata.d.mts.map +1 -1
- package/dist/metadata.mjs +12 -2
- package/dist/metadata.mjs.map +1 -1
- package/dist/navigation.d.mts +2 -2
- package/dist/og.d.mts +2 -2
- package/dist/og.mjs +1 -1
- package/dist/{preview-1vwxBgm5.d.mts → preview-B69Dhi8T.d.mts} +2 -2
- package/dist/{preview-1vwxBgm5.d.mts.map → preview-B69Dhi8T.d.mts.map} +1 -1
- package/dist/{published-B3etM6X5.d.mts → published-2I-k6zEo.d.mts} +3 -3
- package/dist/{published-B3etM6X5.d.mts.map → published-2I-k6zEo.d.mts.map} +1 -1
- package/dist/{published-CkqqY08H.mjs → published-B80KqlcU.mjs} +1 -1
- package/dist/{published-CkqqY08H.mjs.map → published-B80KqlcU.mjs.map} +1 -1
- package/dist/{published-QDNmDi02.d.mts → published-BhYTEAK_.d.mts} +2 -2
- package/dist/{published-QDNmDi02.d.mts.map → published-BhYTEAK_.d.mts.map} +1 -1
- package/dist/seo.d.mts +26 -11
- package/dist/seo.d.mts.map +1 -1
- package/dist/seo.mjs +19 -10
- package/dist/seo.mjs.map +1 -1
- package/dist/taxonomy.d.mts +1 -1
- package/dist/theme.d.mts +4 -4
- package/dist/theme.mjs +1 -1
- package/dist/{title-trhUexxM.d.mts → title-BVV3o329.d.mts} +1 -1
- package/dist/{title-trhUexxM.d.mts.map → title-BVV3o329.d.mts.map} +1 -1
- package/dist/translate-messages-cli.mjs +1 -1
- package/dist/translate.d.mts +1 -1
- package/dist/translate.mjs +1 -1
- package/dist/{types-DLBlHZUd.d.mts → types-B1MmE-L3.d.mts} +1 -1
- package/dist/{types-DLBlHZUd.d.mts.map → types-B1MmE-L3.d.mts.map} +1 -1
- package/dist/{wireframe-CXorKFU_.mjs → wireframe-Ba65SOj8.mjs} +1 -1
- package/dist/{wireframe-CXorKFU_.mjs.map → wireframe-Ba65SOj8.mjs.map} +1 -1
- package/dist/wireframe-cli.mjs +1 -1
- package/dist/wireframe.mjs +1 -1
- package/package.json +1 -1
- package/dist/locale-CTT3nn6T.d.mts.map +0 -1
package/README.md
CHANGED
|
@@ -153,6 +153,16 @@ hidden from search, and merges the routes the site still serves from code
|
|
|
153
153
|
after them: one entry per URL, the page's fields winning, and a code route at
|
|
154
154
|
the URL of a hidden page dropped with it.
|
|
155
155
|
|
|
156
|
+
**More than one locale (#281).** Both `pageMetadata` and `pageSitemap` take
|
|
157
|
+
`locales`, `pathFor(page, locale)` and an optional `defaultLocale` (default:
|
|
158
|
+
the first locale). `pageMetadata` then writes `alternates.languages` (each
|
|
159
|
+
locale plus `x-default`, absolute); `pageSitemap` takes them in place of
|
|
160
|
+
`path` and lists each page once per locale, each entry with the same
|
|
161
|
+
`alternates.languages`. Pass the live locales (`activeLocales(payload).active`)
|
|
162
|
+
so a language switched off gets no hreflang. Titles and descriptions are the
|
|
163
|
+
page's localized `meta`, so read the page with the request's `locale`. Without
|
|
164
|
+
`locales`, both return what they did before.
|
|
165
|
+
|
|
156
166
|
```tsx
|
|
157
167
|
import { JsonLd, breadcrumbListJsonLd, organizationJsonLd, websiteJsonLd } from "@bison-lab/payload-core/seo";
|
|
158
168
|
import { faqPageJsonLd } from "@bison-lab/payload-blocks";
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
//#region src/seo/alternates.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* The locale options `pageMetadata` and `pageSitemap` share. Omit them and a
|
|
4
|
+
* single-locale site's output is what it was before (#281); pass `locales`
|
|
5
|
+
* and `pathFor` together, or neither.
|
|
6
|
+
*/
|
|
7
|
+
type LocaleAlternatesOptions<P> = {
|
|
8
|
+
locales?: undefined;
|
|
9
|
+
pathFor?: undefined;
|
|
10
|
+
defaultLocale?: undefined;
|
|
11
|
+
} | {
|
|
12
|
+
/**
|
|
13
|
+
* The locales the page has a URL in, in order: on a site that can switch
|
|
14
|
+
* a language off, the live ones only (`activeLocales(payload).active`
|
|
15
|
+
* from `./translate`), so a language with no URL gets no hreflang.
|
|
16
|
+
*/
|
|
17
|
+
locales: readonly string[]; /** The page's public path in a locale: the site's own route helper. */
|
|
18
|
+
pathFor: (page: P, locale: string) => string; /** The locale `x-default` points at. Default: the first of `locales`. */
|
|
19
|
+
defaultLocale?: string;
|
|
20
|
+
};
|
|
21
|
+
//#endregion
|
|
22
|
+
export { LocaleAlternatesOptions as t };
|
|
23
|
+
//# sourceMappingURL=alternates-DlRTsaVe.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"alternates-DlRTsaVe.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"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
//#region src/seo/alternates.ts
|
|
2
|
+
/**
|
|
3
|
+
* `hreflang` URLs for a page: one per locale plus `x-default`, made absolute
|
|
4
|
+
* so they mean the same thing in `<head>` and in `/sitemap.xml`. `undefined`
|
|
5
|
+
* when no locales were given.
|
|
6
|
+
*/
|
|
7
|
+
function languageAlternates(page, options, absoluteUrl) {
|
|
8
|
+
const { locales, pathFor } = options;
|
|
9
|
+
if (!locales?.length || !pathFor) return void 0;
|
|
10
|
+
const defaultLocale = options.defaultLocale ?? locales[0];
|
|
11
|
+
const languages = {};
|
|
12
|
+
for (const locale of locales) languages[locale] = absoluteUrl(pathFor(page, locale));
|
|
13
|
+
languages["x-default"] = absoluteUrl(pathFor(page, defaultLocale));
|
|
14
|
+
return languages;
|
|
15
|
+
}
|
|
16
|
+
//#endregion
|
|
17
|
+
export { languageAlternates as t };
|
|
18
|
+
|
|
19
|
+
//# sourceMappingURL=alternates-DxBTUXHh.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"alternates-DxBTUXHh.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"}
|
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-CJ0RlTg4.mjs";
|
|
2
2
|
|
|
3
3
|
//#region src/block-library/island.d.ts
|
|
4
4
|
/**
|
|
@@ -497,4 +497,4 @@ declare function applyTranslation(config: Config, options?: TranslationOptions):
|
|
|
497
497
|
declare function translation(options?: TranslationOptions): (config: Config) => Config;
|
|
498
498
|
//#endregion
|
|
499
499
|
export { BisonTranslationKind as $, usageThisMonth as A, KeyCheck as B, RATE_LIMIT_STREAK as C, monthKey as D, UsageMonth as E, resolveApiKey as F, containsWord as G, TRANSLATE_MODEL_PRICES as H, AnthropicMessagesClient as I, parseJsonArray as J, estimateCost as K, AnthropicTranslatorOptions as L, ResolvedKey as M, decryptApiKey as N, recordUsage as O, encryptApiKey as P, BISON_TRANSLATION_CONTEXT as Q, DEFAULT_TRANSLATE_MODEL as R, FAILURE_ADVICE as S, TRANSLATION_USAGE_SLUG as T, TranslatorCallEvent as U, ModelPrice as V, anthropicTranslator as W, verifyAnthropicKey as X, translationSystemPrompt as Y, AutoTranslateOptions as Z, TranslationSettingsDoc as _, translation as a, TranslatedEntity as at, resolveModel as b, KeyStatus as c, classifyAnthropicError as ct, TRANSLATION_GRANT as d, BisonTranslationMarker as et, TRANSLATION_KEY_PANEL as f, TranslationModelChoice as g, TRANSLATION_STATUS_BAR as h, hasLocalizedFields as i, TranslateSite as it, KeySource as j, usageHistory as k, ResolvedTranslationSettings as l, TRANSLATION_STATE_SLUG as m, TranslationOptions as n, TranslateLocaleResult as nt, TranslationStatus as o, Translator as ot, TRANSLATION_SETTINGS_SLUG as p, modelPrice as q, applyTranslation as r, TranslateRequest as rt, translationSettingsEndpoints as s, TranslationFailureKind as st, TranslationEntityHint as t, Doc as tt, TRANSLATION_ACTIVITY_PANEL as u, invalidateTranslationSettings as v, RecordedFailure as w, siteFromInstructions as x, readTranslationSettings as y, ECONOMY_TRANSLATE_MODEL as z };
|
|
500
|
-
//# sourceMappingURL=capability-
|
|
500
|
+
//# sourceMappingURL=capability-NlorUIta.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"capability-
|
|
1
|
+
{"version":3,"file":"capability-NlorUIta.d.mts","names":[],"sources":["../src/translate/errors.ts","../src/translate/types.ts","../src/translate/anthropic.ts","../src/translate/key.ts","../src/translate/usage.ts","../src/translate/settings.ts","../src/translate/settings-endpoints.ts","../src/translate/capability.ts"],"mappings":";;;;;;AAWA;;;;;AAWA;;;KAXY,sBAAA;;iBAWI,sBAAA,CAAuB,KAAA,YAAiB,sBAAA;;;;KCrB5C,GAAA,GAAM,MAAA;;KAGN,oBAAA;;;;;ADkBZ;;;;;;;;ACrBA;UAkBiB,sBAAA;EACf,MAAA;EACA,IAAA,EAAM,oBAAA;AAAA;AAjBR;AAAA,cAqBa,yBAAA;;;;AANb;;UAaiB,aAAA;EAXW;EAa1B,IAAA;EAbA;EAeA,KAAA;EAf0B;EAiB1B,KAAA;EAbW;EAeX,YAAA;;;;AARF;;EAcE,SAAA,GAAY,MAAA;AAAA;;UAIG,gBAAA;EACf,IAAA;EACA,EAAA;EANA;EAQA,OAAA;EARkB;EAUlB,IAAA,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Options, check?: BlockLibraryCheck): Promise<true | string>;
|
|
212
212
|
//#endregion
|
|
213
213
|
export { PACKAGE_BLOCK_SLUGS as A, BlockLibraryDoc as C, BlockLibraryKind as D, BlockLibraryHolder as E, BlockLibraryRow as O, BlockLibraryCategoryId as S, BlockLibraryEntry as T, SectionControls as _, sectionControlsFromLibrary as a, BLOCK_LIBRARY_CATEGORIES as b, BlockLibraryReader as c, DEFAULT_SECTION_CONTROLS as d, HERO_SECTION_CONTROLS as f, SectionControlKey as g, SECTION_CONTROL_LABELS as h, defaultBlockLibraryValue as i, PackageBlockSlug as j, BlockLibraryUsage as k, blockLibraryEntriesFromConfig as l, SECTION_CONTROL_KEYS as m, BlockLibraryOptions as n, stampBlockLibrary as o, NO_SECTION_CONTROLS as p, blockLibraryCatalogue as r, validateBlockLibrary as s, BlockLibraryCheck as t, getSectionControls as u, defaultSectionControls as v, BlockLibraryDraftHolder as w, BLOCK_LIBRARY_SLUG as x, sectionControlsOf as y };
|
|
214
|
-
//# sourceMappingURL=catalogue-
|
|
214
|
+
//# sourceMappingURL=catalogue-CJ0RlTg4.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"catalogue-
|
|
1
|
+
{"version":3,"file":"catalogue-CJ0RlTg4.d.mts","names":[],"sources":["../src/block-library/types.ts","../src/block-library/controls.ts","../src/block-library/published.ts","../src/block-library/catalogue.ts"],"mappings":";;;cAEa,kBAAA;AAAA,cAEA,wBAAA;EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAaD,sBAAA,WAAiC,wBAAA;AAAA,KAEjC,gBAAA;;;;;cAMC,mBAAA;AAAA,KAuBD,gBAAA,WAA2B,mBAAA;AAAA,UAEtB,iBAAA;EACf,IAAA;EACA,KAAA;EACA,QAAA;EAPQ;EASR,IAAA,GAAO,gBAAA;EACP,YAAA;EACA,MAAA;EATU;;;;;AAEZ;EAcE,eAAA,GAAkB,OAAA,CAAQ,eAAA;;;;;;;;EAQ1B,SA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EGoDX,OAAA,YAAmB,kBAAA;;EAEnB,MAAA,YAAkB,kBAAA;EAClB,KAAA;AAAA;;;;;;;;;;iBAcc,qBAAA,CAAsB,MAAA,YAAiB,iBAAA,KAA2B,iBAAA;AAAA,iBASlE,wBAAA,CAAyB,OAAA,EAAS,mBAAA,GAAsB,eAAA;;;;;;;;iBAuBxD,iBAAA,CAAkB,KAAA,WAAgB,OAAA,EAAS,mBAAA,GAAsB,eAAA;;AHxFjF;;;;;AAEA;;;;;iBG+HgB,0BAAA,CACd,GAAA,EAAK,eAAA,qBACL,MAAA,YAAiB,iBAAA,KAChB,MAAA,SAAe,eAAA;;;;;AHrGlB;;iBGqIsB,oBAAA,CACpB,KAAA,WACA,OAAA,EAAS,mBAAA,EACT,KAAA,GAAO,iBAAA,GACN,OAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"facet-field-
|
|
1
|
+
{"version":3,"file":"facet-field-Cd6lffed.d.mts","names":[],"sources":["../src/taxonomy/facet-field.ts"],"mappings":";;;;;AAOA;;;UAAiB,UAAA;EAEf;EAAA,IAAA;EAIA;EAFA,KAAA;EAEU;EAAV,UAAA;AAAA;;;;;;;;;iBAWc,UAAA,CAAW,KAAA,EAAO,UAAA,GAAa,iBAAA"}
|
package/dist/index.d.mts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { A as PACKAGE_BLOCK_SLUGS, C as BlockLibraryDoc, D as BlockLibraryKind, E as BlockLibraryHolder, O as BlockLibraryRow, S as BlockLibraryCategoryId, T as BlockLibraryEntry, _ as SectionControls, a as sectionControlsFromLibrary, b as BLOCK_LIBRARY_CATEGORIES, c as BlockLibraryReader, d as DEFAULT_SECTION_CONTROLS, f as HERO_SECTION_CONTROLS, g as SectionControlKey, h as SECTION_CONTROL_LABELS, i as defaultBlockLibraryValue, k as BlockLibraryUsage, 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, u as getSectionControls, v as defaultSectionControls, w as BlockLibraryDraftHolder, x as BLOCK_LIBRARY_SLUG, y as sectionControlsOf } from "./catalogue-
|
|
2
|
-
import { a as SeoImageSize, i as SeoImageDoc, n as titleTemplate, o as SeoImageValue, r as MediaId, s as SeoMeta, t as documentTitle } from "./title-
|
|
3
|
-
import { C as rewriteColorUsages, S as findColorUsages, _ as ThemeIdentityFallback, a as THEME_APPEARANCE_SLUG, b as ColorUsagesList, c as THEME_SLUG, d as ThemeDoc, g as ResolvedThemeIdentity, h as ThemeUploadDoc, i as SystemColorKey, l as THEME_TYPOGRAPHY_SLUG, m as ThemeLibraryColorDoc, n as EditableTheme, o as THEME_COLORS_SLUG, r as SYSTEM_COLOR_KEYS, s as THEME_IDENTITY_SLUG, t as CreateThemeOptions, u as ThemeColorDoc, v as resolveThemeIdentity, x as ColorUsagesOption, y as ColorUsage } from "./types-
|
|
4
|
-
import { _ as deleteLibraryColor, a as PageEditorSystemKey, c as pageEditorTokens, d as LookFieldOptions, f as colorTokenField, g as rewriteColorTokens, h as findColorTokens, i as PAGE_EDITOR_SYSTEM_KEYS, l as themeLibraryFromDoc, m as ColorTokenHit, n as ColorSwatch, o as pageEditorLooks, p as lookField, r as LookOption, s as pageEditorSwatches, t as THEME_PREVIEW_BREAKPOINTS, u as LookFieldMode, v as rewriteColorToken, y as themeColorKeys } from "./preview-
|
|
5
|
-
import { n as facetField, t as FacetEntry } from "./facet-field-
|
|
6
|
-
import { a as translation, d as TRANSLATION_GRANT, f as TRANSLATION_KEY_PANEL, h as TRANSLATION_STATUS_BAR, n as TranslationOptions, p as TRANSLATION_SETTINGS_SLUG, u as TRANSLATION_ACTIVITY_PANEL } from "./capability-
|
|
7
|
-
import { C as NAVIGATION_FOOTER_SLUG, D as NavigationFooter, E as NavigationDoc, O as NavigationHeader, S as NAVIGATION_FOOTER_DB_NAME, T as NavigationBar, _ as validateExternalHref, a as FOOTER_MAX_LINK_COLUMNS, b as NAVIGATION_DB_NAME, c as FooterColumnWidth, d as normalizeFooterDesktop, f as validateFooterColumns, g as isValidExternalHref, h as headerCtaEnabled, i as FOOTER_MAX_COLUMNS, l as FooterSocial, m as EXTERNAL_HREF_MESSAGE, n as FOOTER_COLUMNS_FIELD, o as FOOTER_SOCIALS, p as validateFooterSocialUrl, r as FOOTER_COLUMN_WIDTHS, s as FOOTER_TWELFTHS, t as getNavigation, u as footerDesktopTracks, v as validateHeaderCta, w as NAVIGATION_SLUG, x as NAVIGATION_FEATURE, y as CreateNavigationOptions } from "./published-
|
|
1
|
+
import { A as PACKAGE_BLOCK_SLUGS, C as BlockLibraryDoc, D as BlockLibraryKind, E as BlockLibraryHolder, O as BlockLibraryRow, S as BlockLibraryCategoryId, T as BlockLibraryEntry, _ as SectionControls, a as sectionControlsFromLibrary, b as BLOCK_LIBRARY_CATEGORIES, c as BlockLibraryReader, d as DEFAULT_SECTION_CONTROLS, f as HERO_SECTION_CONTROLS, g as SectionControlKey, h as SECTION_CONTROL_LABELS, i as defaultBlockLibraryValue, k as BlockLibraryUsage, 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, u as getSectionControls, v as defaultSectionControls, w as BlockLibraryDraftHolder, x as BLOCK_LIBRARY_SLUG, y as sectionControlsOf } from "./catalogue-CJ0RlTg4.mjs";
|
|
2
|
+
import { a as SeoImageSize, i as SeoImageDoc, n as titleTemplate, o as SeoImageValue, r as MediaId, s as SeoMeta, t as documentTitle } from "./title-BVV3o329.mjs";
|
|
3
|
+
import { C as rewriteColorUsages, S as findColorUsages, _ as ThemeIdentityFallback, a as THEME_APPEARANCE_SLUG, b as ColorUsagesList, c as THEME_SLUG, d as ThemeDoc, g as ResolvedThemeIdentity, h as ThemeUploadDoc, i as SystemColorKey, l as THEME_TYPOGRAPHY_SLUG, m as ThemeLibraryColorDoc, n as EditableTheme, o as THEME_COLORS_SLUG, r as SYSTEM_COLOR_KEYS, s as THEME_IDENTITY_SLUG, t as CreateThemeOptions, u as ThemeColorDoc, v as resolveThemeIdentity, x as ColorUsagesOption, y as ColorUsage } from "./types-B1MmE-L3.mjs";
|
|
4
|
+
import { _ as deleteLibraryColor, a as PageEditorSystemKey, c as pageEditorTokens, d as LookFieldOptions, f as colorTokenField, g as rewriteColorTokens, h as findColorTokens, i as PAGE_EDITOR_SYSTEM_KEYS, l as themeLibraryFromDoc, m as ColorTokenHit, n as ColorSwatch, o as pageEditorLooks, p as lookField, r as LookOption, s as pageEditorSwatches, t as THEME_PREVIEW_BREAKPOINTS, u as LookFieldMode, v as rewriteColorToken, y as themeColorKeys } from "./preview-B69Dhi8T.mjs";
|
|
5
|
+
import { n as facetField, t as FacetEntry } from "./facet-field-Cd6lffed.mjs";
|
|
6
|
+
import { a as translation, d as TRANSLATION_GRANT, f as TRANSLATION_KEY_PANEL, h as TRANSLATION_STATUS_BAR, n as TranslationOptions, p as TRANSLATION_SETTINGS_SLUG, u as TRANSLATION_ACTIVITY_PANEL } from "./capability-NlorUIta.mjs";
|
|
7
|
+
import { C as NAVIGATION_FOOTER_SLUG, D as NavigationFooter, E as NavigationDoc, O as NavigationHeader, S as NAVIGATION_FOOTER_DB_NAME, T as NavigationBar, _ as validateExternalHref, a as FOOTER_MAX_LINK_COLUMNS, b as NAVIGATION_DB_NAME, c as FooterColumnWidth, d as normalizeFooterDesktop, f as validateFooterColumns, g as isValidExternalHref, h as headerCtaEnabled, i as FOOTER_MAX_COLUMNS, l as FooterSocial, m as EXTERNAL_HREF_MESSAGE, n as FOOTER_COLUMNS_FIELD, o as FOOTER_SOCIALS, p as validateFooterSocialUrl, r as FOOTER_COLUMN_WIDTHS, s as FOOTER_TWELFTHS, t as getNavigation, u as footerDesktopTracks, v as validateHeaderCta, w as NAVIGATION_SLUG, x as NAVIGATION_FEATURE, y as CreateNavigationOptions } from "./published-BhYTEAK_.mjs";
|
|
8
8
|
import { ThemeConfig } from "@bison-lab/tokens";
|
|
9
9
|
import * as payload$1 from "payload";
|
|
10
10
|
import { Access, Block, CheckboxField, CollectionAfterChangeHook, CollectionBeforeChangeHook, CollectionBeforeValidateHook, CollectionConfig, CollectionSlug, Config, Endpoint, Field, GlobalConfig, ImageSize, Payload, PayloadRequest, Plugin, UploadCollectionSlug } from "payload";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"locale-tnKLkutC.d.mts","names":[],"sources":["../src/locale.ts"],"mappings":";;AAQA;;;;;;;UAAiB,UAAA;EACf,MAAA;EACA,cAAA;AAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"messages-
|
|
1
|
+
{"version":3,"file":"messages-XFoL9RtF.mjs","names":[],"sources":["../src/translate/messages.ts"],"sourcesContent":["import { translateStrings } from \"./strings\";\nimport type { TranslateSite, Translator } from \"./types\";\n\n/** A next-intl message file: nested objects and arrays with string leaves. */\nexport type MessagesJson = string | number | boolean | null | MessagesJson[] | { [key: string]: MessagesJson };\n\nconst BATCH_SIZE = 40;\n\n/** Every string leaf as [path, value]; array indexes are path segments. */\nfunction stringLeaves(\n node: MessagesJson,\n path: string[] = [],\n out: Array<[string[], string]> = [],\n): Array<[string[], string]> {\n if (typeof node === \"string\") out.push([path, node]);\n else if (Array.isArray(node)) node.forEach((item, index) => stringLeaves(item, [...path, String(index)], out));\n else if (node && typeof node === \"object\") {\n for (const [key, value] of Object.entries(node)) stringLeaves(value, [...path, key], out);\n }\n return out;\n}\n\nfunction getAtPath(root: MessagesJson, path: string[]): MessagesJson | undefined {\n let current: MessagesJson | undefined = root;\n for (const segment of path) {\n if (current == null || typeof current !== \"object\") return undefined;\n current = Array.isArray(current) ? current[Number(segment)] : current[segment];\n }\n return current;\n}\n\nfunction setAtPath(root: { [key: string]: MessagesJson }, path: string[], value: string): void {\n let current: { [key: string]: MessagesJson } | MessagesJson[] = root;\n for (let i = 0; i < path.length - 1; i++) {\n const segment = path[i]!;\n const wantArray = /^\\d+$/.test(path[i + 1]!);\n const container = current as Record<string, MessagesJson>;\n let child = container[segment];\n // Create the container when missing, and REPAIR it when the existing\n // target node has the opposite shape from the source (the source changed\n // an object into a list) so string keys never land in an array or the\n // reverse.\n if (child == null || typeof child !== \"object\" || Array.isArray(child) !== wantArray) {\n child = wantArray ? [] : {};\n container[segment] = child;\n }\n current = child as { [key: string]: MessagesJson } | MessagesJson[];\n }\n (current as Record<string, MessagesJson>)[path[path.length - 1]!] = value;\n}\n\n/**\n * The `{name}` arguments of a message, sorted. Plural and select messages are\n * skipped (their branch bodies are braced text the model rightly translates),\n * so this only checks plain interpolations.\n */\nfunction placeholderNames(message: string): string | null {\n if (/,\\s*(plural|select|selectordinal)\\s*,/.test(message)) return null;\n const names = [...message.matchAll(/\\{\\s*([A-Za-z_][\\w]*)\\s*\\}/g)].map((match) => match[1]!);\n return names.sort().join(\",\");\n}\n\n/** A translation that dropped or renamed a `{placeholder}` would break at render; keep the source instead. */\nexport function keepsPlaceholders(source: string, translated: string): boolean {\n const before = placeholderNames(source);\n return before === null || before === placeholderNames(translated);\n}\n\nexport interface FillMessagesResult {\n /** The target file to write. */\n messages: MessagesJson;\n /** Keys translated. */\n translated: number;\n /**\n * Keys whose batch failed, or whose translation lost a `{placeholder}`.\n * They hold the source text, so the file stays\n * complete (a hole renders as MISSING_MESSAGE); a plain re-run will not\n * retry them, `--force` (or a hand edit) will.\n */\n fellBack: number;\n}\n\n/**\n * Fills a target next-intl message file from the source file. The source is\n * the truth; only keys that are missing or empty in the target are\n * translated, so reviewed copy is never overwritten, unless `force`\n * re-translates every key. Batches of 40, so one failure costs at most 40\n * keys. `{placeholders}` survive because the translator's prompt keeps them.\n */\nexport async function fillMessages(options: {\n source: MessagesJson;\n target?: MessagesJson;\n translator: Translator;\n from: string;\n to: string;\n force?: boolean;\n context?: string;\n site?: TranslateSite;\n onProgress?: (done: number, total: number) => void;\n}): Promise<FillMessagesResult> {\n const base =\n !options.force && options.target && typeof options.target === \"object\" && !Array.isArray(options.target)\n ? (structuredClone(options.target) as { [key: string]: MessagesJson })\n : {};\n const missing = stringLeaves(options.source).filter(([path]) => {\n const existing = getAtPath(base, path);\n return typeof existing !== \"string\" || existing.trim() === \"\";\n });\n\n let translated = 0;\n let fellBack = 0;\n for (let i = 0; i < missing.length; i += BATCH_SIZE) {\n const batch = missing.slice(i, i + BATCH_SIZE);\n const sources = batch.map(([, value]) => value);\n const result = await translateStrings(sources, {\n translator: options.translator,\n from: options.from,\n to: options.to,\n context: options.context ?? \"Website UI strings\",\n ...(options.site ? { site: options.site } : {}),\n });\n batch.forEach(([path, source], index) => {\n const value = result?.[index];\n if (value !== undefined && keepsPlaceholders(source, value)) {\n translated += 1;\n setAtPath(base, path, value);\n } else {\n fellBack += 1;\n setAtPath(base, path, source);\n }\n });\n options.onProgress?.(Math.min(i + BATCH_SIZE, missing.length), missing.length);\n }\n return { messages: base, translated, fellBack };\n}\n"],"mappings":";;AAMA,MAAM,aAAa;;AAGnB,SAAS,aACP,MACA,OAAiB,EAAE,EACnB,MAAiC,EAAE,EACR;AAC3B,KAAI,OAAO,SAAS,SAAU,KAAI,KAAK,CAAC,MAAM,KAAK,CAAC;UAC3C,MAAM,QAAQ,KAAK,CAAE,MAAK,SAAS,MAAM,UAAU,aAAa,MAAM,CAAC,GAAG,MAAM,OAAO,MAAM,CAAC,EAAE,IAAI,CAAC;UACrG,QAAQ,OAAO,SAAS,SAC/B,MAAK,MAAM,CAAC,KAAK,UAAU,OAAO,QAAQ,KAAK,CAAE,cAAa,OAAO,CAAC,GAAG,MAAM,IAAI,EAAE,IAAI;AAE3F,QAAO;;AAGT,SAAS,UAAU,MAAoB,MAA0C;CAC/E,IAAI,UAAoC;AACxC,MAAK,MAAM,WAAW,MAAM;AAC1B,MAAI,WAAW,QAAQ,OAAO,YAAY,SAAU,QAAO,KAAA;AAC3D,YAAU,MAAM,QAAQ,QAAQ,GA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MAAM,QAAQ,QAAQ,MAAM,GAAG,IAAI,WAAW;EAE9C,MAAM,SAAS,MAAM,iBADL,MAAM,KAAK,GAAG,WAAW,MAAM,EACA;GAC7C,YAAY,QAAQ;GACpB,MAAM,QAAQ;GACd,IAAI,QAAQ;GACZ,SAAS,QAAQ,WAAW;GAC5B,GAAI,QAAQ,OAAO,EAAE,MAAM,QAAQ,MAAM,GAAG,EAAE;GAC/C,CAAC;AACF,QAAM,SAAS,CAAC,MAAM,SAAS,UAAU;GACvC,MAAM,QAAQ,SAAS;AACvB,OAAI,UAAU,KAAA,KAAa,kBAAkB,QAAQ,MAAM,EAAE;AAC3D,kBAAc;AACd,cAAU,MAAM,MAAM,MAAM;UACvB;AACL,gBAAY;AACZ,cAAU,MAAM,MAAM,OAAO;;IAE/B;AACF,UAAQ,aAAa,KAAK,IAAI,IAAI,YAAY,QAAQ,OAAO,EAAE,QAAQ,OAAO;;AAEhF,QAAO;EAAE,UAAU;EAAM;EAAY;EAAU"}
|
package/dist/metadata.d.mts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { a as SeoImageSize, i as SeoImageDoc, n as titleTemplate, o as SeoImageValue, r as MediaId, s as SeoMeta, t as documentTitle } from "./title-
|
|
1
|
+
import { a as SeoImageSize, i as SeoImageDoc, n as titleTemplate, o as SeoImageValue, r as MediaId, s as SeoMeta, t as documentTitle } from "./title-BVV3o329.mjs";
|
|
2
|
+
import { t as LocaleAlternatesOptions } from "./alternates-DlRTsaVe.mjs";
|
|
2
3
|
|
|
3
4
|
//#region src/seo/metadata.d.ts
|
|
4
5
|
/** A page as the reader needs it; a site's generated `Page` is assignable. */
|
|
@@ -10,10 +11,10 @@ interface SeoPage {
|
|
|
10
11
|
/** Read only to fill `{id}` in `ogImageRoute`. */
|
|
11
12
|
id?: string | number | null;
|
|
12
13
|
}
|
|
13
|
-
interface
|
|
14
|
+
interface PageMetadataBaseOptions {
|
|
14
15
|
/** The suffix a page without a written meta title gets. */
|
|
15
16
|
siteName: string;
|
|
16
|
-
/** This page's absolute URL at the site's own origin. */
|
|
17
|
+
/** This page's absolute URL at the site's own origin, in the locale it was read in. */
|
|
17
18
|
canonical: string;
|
|
18
19
|
/** Turns a media file path into an absolute URL; crawlers take no other kind. */
|
|
19
20
|
absoluteUrl: (path: string) => string;
|
|
@@ -27,6 +28,12 @@ interface PageMetadataOptions {
|
|
|
27
28
|
*/
|
|
28
29
|
ogImageRoute?: string;
|
|
29
30
|
}
|
|
31
|
+
/**
|
|
32
|
+
* `pageMetadata`'s options. A multi-locale site adds `locales` and
|
|
33
|
+
* `pathFor` (#281) and gets `alternates.languages`; without them the output
|
|
34
|
+
* is unchanged.
|
|
35
|
+
*/
|
|
36
|
+
type PageMetadataOptions<P extends SeoPage = SeoPage> = PageMetadataBaseOptions & LocaleAlternatesOptions<P>;
|
|
30
37
|
interface PageMetadataImage {
|
|
31
38
|
url: string;
|
|
32
39
|
width?: number;
|
|
@@ -46,8 +53,10 @@ interface PageMetadata {
|
|
|
46
53
|
absolute: string;
|
|
47
54
|
};
|
|
48
55
|
description?: string;
|
|
56
|
+
/** `languages` (one URL per locale plus `x-default`) only when `locales` was passed. */
|
|
49
57
|
alternates: {
|
|
50
58
|
canonical: string;
|
|
59
|
+
languages?: Record<string, string>;
|
|
51
60
|
};
|
|
52
61
|
openGraph: {
|
|
53
62
|
title: string;
|
|
@@ -73,10 +82,15 @@ interface PageMetadata {
|
|
|
73
82
|
* whose SEO tab has no share image gets the generated card instead. Fields the editor left empty
|
|
74
83
|
* are left out, so the layout's defaults (a site-wide description, a default
|
|
75
84
|
* share image) carry through Next's merge. The canonical is always this
|
|
76
|
-
* site's origin; a page that must
|
|
85
|
+
* site's origin; a page that must canonicalize elsewhere is a redirect, not
|
|
77
86
|
* a field.
|
|
87
|
+
*
|
|
88
|
+
* With `locales` and `pathFor`, `alternates.languages` lists the page's URL
|
|
89
|
+
* in every locale plus `x-default`. The title and description are whatever
|
|
90
|
+
* `page.meta` holds, so read the page in the request's locale (`localeArgs`)
|
|
91
|
+
* and they come from that locale's localized SEO tab.
|
|
78
92
|
*/
|
|
79
|
-
declare function pageMetadata(page:
|
|
93
|
+
declare function pageMetadata<P extends SeoPage>(page: P, options: PageMetadataOptions<P>): PageMetadata;
|
|
80
94
|
//#endregion
|
|
81
|
-
export { type MediaId, type PageMetadata, type PageMetadataImage, type PageMetadataOptions, type SeoImageDoc, type SeoImageSize, type SeoImageValue, type SeoMeta, type SeoPage, documentTitle, pageMetadata, titleTemplate };
|
|
95
|
+
export { type LocaleAlternatesOptions, type MediaId, type PageMetadata, type PageMetadataBaseOptions, type PageMetadataImage, type PageMetadataOptions, type SeoImageDoc, type SeoImageSize, type SeoImageValue, type SeoMeta, type SeoPage, documentTitle, pageMetadata, titleTemplate };
|
|
82
96
|
//# sourceMappingURL=metadata.d.mts.map
|
package/dist/metadata.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"metadata.d.mts","names":[],"sources":["../src/seo/metadata.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"metadata.d.mts","names":[],"sources":["../src/seo/metadata.ts"],"mappings":";;;;;UAMiB,OAAA;EACf,KAAA;EACA,IAAA,GAAO,OAAA;;EAEP,IAAA;EAHA;EAKA,EAAA;AAAA;AAAA,UAGe,uBAAA;EAHf;EAKA,QAAA;EALE;EAOF,SAAA;EAJsC;EAMtC,WAAA,GAAc,IAAA;EANwB;EAQtC,SAAA;EAJA;;;;;;EAWA,YAAA;AAAA;;;;;;KAQU,mBAAA,WAA8B,OAAA,GAAU,OAAA,IAAW,uBAAA,GAC7D,uBAAA,CAAwB,CAAA;AAAA,UAET,iBAAA;EACf,GAAA;EACA,KAAA;EACA,MAAA;EACA,GAAA;AAAA;;;;;;AAJF;;;UAeiB,YAAA;EACf,KAAA;IAAkB,QAAA;EAAA;EAClB,WAAA;EAbG;EAeH,UAAA;IAAc,SAAA;IAAmB,SAAA,GAAY,MAAA;EAAA;EAC7C,SAAA;IACE,KAAA;IACA,WAAA;IACA,GAAA;IACA,MAAA,GAAS,iBAAA;EAAA;EAEX,OAAA;IACE,IAAA;IACA,KAAA;IACA,WAAA;IACA,MAAA,GAAS,iBAAA;EAAA;EAEX,MAAA;IAAW,KAAA;IAAc,MAAA;EAAA;AAAA;;;;;;;;;;;;;AA6D3B;;;iBAAgB,YAAA,WAAuB,OAAA,CAAA,CACrC,IAAA,EAAM,CAAA,EACN,OAAA,EAAS,mBAAA,CAAoB,CAAA,IAC5B,YAAA"}
|
package/dist/metadata.mjs
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { n as titleTemplate, t as documentTitle } from "./title-DJ7C48gq.mjs";
|
|
2
2
|
import { t as SHARE_IMAGE_SIZE } from "./share-image-C8ZtIcU8.mjs";
|
|
3
|
+
import { t as languageAlternates } from "./alternates-DxBTUXHh.mjs";
|
|
3
4
|
//#region src/seo/metadata.ts
|
|
4
5
|
/**
|
|
5
6
|
* The share image as a crawler wants it, or `undefined` when the page has
|
|
@@ -50,8 +51,13 @@ function generatedImage(page, options, alt) {
|
|
|
50
51
|
* whose SEO tab has no share image gets the generated card instead. Fields the editor left empty
|
|
51
52
|
* are left out, so the layout's defaults (a site-wide description, a default
|
|
52
53
|
* share image) carry through Next's merge. The canonical is always this
|
|
53
|
-
* site's origin; a page that must
|
|
54
|
+
* site's origin; a page that must canonicalize elsewhere is a redirect, not
|
|
54
55
|
* a field.
|
|
56
|
+
*
|
|
57
|
+
* With `locales` and `pathFor`, `alternates.languages` lists the page's URL
|
|
58
|
+
* in every locale plus `x-default`. The title and description are whatever
|
|
59
|
+
* `page.meta` holds, so read the page in the request's locale (`localeArgs`)
|
|
60
|
+
* and they come from that locale's localized SEO tab.
|
|
55
61
|
*/
|
|
56
62
|
function pageMetadata(page, options) {
|
|
57
63
|
const meta = page.meta ?? {};
|
|
@@ -59,10 +65,14 @@ function pageMetadata(page, options) {
|
|
|
59
65
|
const description = meta.description ? { description: meta.description } : {};
|
|
60
66
|
const image = shareImage(meta.image, options) ?? generatedImage(page, options, page.title);
|
|
61
67
|
const images = image ? { images: [image] } : {};
|
|
68
|
+
const languages = languageAlternates(page, options, options.absoluteUrl);
|
|
62
69
|
return {
|
|
63
70
|
title: meta.title ? { absolute: meta.title } : page.title,
|
|
64
71
|
...description,
|
|
65
|
-
alternates: {
|
|
72
|
+
alternates: {
|
|
73
|
+
canonical: options.canonical,
|
|
74
|
+
...languages ? { languages } : {}
|
|
75
|
+
},
|
|
66
76
|
openGraph: {
|
|
67
77
|
title,
|
|
68
78
|
...description,
|
package/dist/metadata.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"metadata.mjs","names":[],"sources":["../src/seo/metadata.ts"],"sourcesContent":["import { SHARE_IMAGE_SIZE } from \"./share-image\";\nimport { documentTitle } from \"./title\";\nimport type { SeoImageValue, SeoMeta } from \"./types\";\n\n/** A page as the reader needs it; a site's generated `Page` is assignable. */\nexport interface SeoPage {\n title: string;\n meta?: SeoMeta | null;\n /** Read only to fill `{slug}` in `ogImageRoute`. */\n slug?: string | null;\n /** Read only to fill `{id}` in `ogImageRoute`. */\n id?: string | number | null;\n}\n\nexport interface
|
|
1
|
+
{"version":3,"file":"metadata.mjs","names":[],"sources":["../src/seo/metadata.ts"],"sourcesContent":["import { languageAlternates, type LocaleAlternatesOptions } from \"./alternates\";\nimport { SHARE_IMAGE_SIZE } from \"./share-image\";\nimport { documentTitle } from \"./title\";\nimport type { SeoImageValue, SeoMeta } from \"./types\";\n\n/** A page as the reader needs it; a site's generated `Page` is assignable. */\nexport interface SeoPage {\n title: string;\n meta?: SeoMeta | null;\n /** Read only to fill `{slug}` in `ogImageRoute`. */\n slug?: string | null;\n /** Read only to fill `{id}` in `ogImageRoute`. */\n id?: string | number | null;\n}\n\nexport interface PageMetadataBaseOptions {\n /** The suffix a page without a written meta title gets. */\n siteName: string;\n /** This page's absolute URL at the site's own origin, in the locale it was read in. */\n canonical: string;\n /** Turns a media file path into an absolute URL; crawlers take no other kind. */\n absoluteUrl: (path: string) => string;\n /** The rendition to read off the meta image. Default `SHARE_IMAGE_SIZE.name`. */\n shareSize?: string;\n /**\n * Where the site mounts `ogImageHandler` from `@bison-lab/payload-core/og`,\n * as a path pattern with `{slug}` or `{id}`: `\"/og/{slug}\"`. A page with\n * no share image points `og:image` at it (BIS-183); an uploaded share\n * image always wins. Omit it and a page without one has no image, as before.\n */\n ogImageRoute?: string;\n}\n\n/**\n * `pageMetadata`'s options. A multi-locale site adds `locales` and\n * `pathFor` (#281) and gets `alternates.languages`; without them the output\n * is unchanged.\n */\nexport type PageMetadataOptions<P extends SeoPage = SeoPage> = PageMetadataBaseOptions &\n LocaleAlternatesOptions<P>;\n\nexport interface PageMetadataImage {\n url: string;\n width?: number;\n height?: number;\n alt?: string;\n}\n\n/**\n * The shape `pageMetadata` returns, assignable to Next's `Metadata` without\n * this package depending on `next`. A written meta title is `absolute` so\n * the layout's title template does not append the site name a second time;\n * an unwritten one is the bare page title, which the template completes.\n * Optional keys are absent rather than `undefined`: Next's merge lets an\n * `undefined` key override the layout's value instead of inheriting it.\n */\nexport interface PageMetadata {\n title: string | { absolute: string };\n description?: string;\n /** `languages` (one URL per locale plus `x-default`) only when `locales` was passed. */\n alternates: { canonical: string; languages?: Record<string, string> };\n openGraph: {\n title: string;\n description?: string;\n url: string;\n images?: PageMetadataImage[];\n };\n twitter: {\n card: \"summary_large_image\";\n title: string;\n description?: string;\n images?: PageMetadataImage[];\n };\n robots?: { index: false; follow: false };\n}\n\n/**\n * The share image as a crawler wants it, or `undefined` when the page has\n * none or the relation came back unpopulated (`depth: 0` upstream). The\n * named rendition is preferred; a file uploaded before that size existed, or\n * too small to cut, has only its original, which is used as is.\n */\nfunction shareImage(\n image: SeoImageValue,\n { absoluteUrl, shareSize = SHARE_IMAGE_SIZE.name }: PageMetadataBaseOptions,\n): PageMetadataImage | undefined {\n if (!image || typeof image !== \"object\") return undefined;\n const rendition = image.sizes?.[shareSize];\n const file = rendition?.url ? rendition : image;\n if (!file.url) return undefined;\n return {\n url: absoluteUrl(file.url),\n ...(file.width ? { width: file.width } : {}),\n ...(file.height ? { height: file.height } : {}),\n ...(image.alt ? { alt: image.alt } : {}),\n };\n}\n\n/**\n * The generated card for a page, from `ogImageRoute`, or `undefined` when\n * the pattern names a value the page does not carry.\n */\nfunction generatedImage(page: SeoPage, options: PageMetadataBaseOptions, alt: string): PageMetadataImage | undefined {\n const route = options.ogImageRoute;\n if (!route) return undefined;\n let missing = false;\n const path = route.replace(/\\{(slug|id)\\}/g, (_, key: \"slug\" | \"id\") => {\n const value = page[key];\n if (value === undefined || value === null || value === \"\") {\n missing = true;\n return \"\";\n }\n // A nested slug keeps its slashes: each segment is encoded on its own.\n return String(value).split(\"/\").map(encodeURIComponent).join(\"/\");\n });\n if (missing) return undefined;\n return { url: options.absoluteUrl(path), width: SHARE_IMAGE_SIZE.width, height: SHARE_IMAGE_SIZE.height, alt };\n}\n\n/**\n * Next metadata for a page with the SEO tab: `<title>`, description,\n * canonical, Open Graph and Twitter with the share image, and\n * `noindex, nofollow` when the page is hidden. With `ogImageRoute`, a page\n * whose SEO tab has no share image gets the generated card instead. Fields the editor left empty\n * are left out, so the layout's defaults (a site-wide description, a default\n * share image) carry through Next's merge. The canonical is always this\n * site's origin; a page that must canonicalize elsewhere is a redirect, not\n * a field.\n *\n * With `locales` and `pathFor`, `alternates.languages` lists the page's URL\n * in every locale plus `x-default`. The title and description are whatever\n * `page.meta` holds, so read the page in the request's locale (`localeArgs`)\n * and they come from that locale's localized SEO tab.\n */\nexport function pageMetadata<P extends SeoPage>(\n page: P,\n options: PageMetadataOptions<P>,\n): PageMetadata {\n const meta = page.meta ?? {};\n const title = meta.title || documentTitle(options.siteName, page.title);\n const description = meta.description ? { description: meta.description } : {};\n const image = shareImage(meta.image, options) ?? generatedImage(page, options, page.title);\n const images = image ? { images: [image] } : {};\n const languages = languageAlternates(page, options, options.absoluteUrl);\n\n return {\n title: meta.title ? { absolute: meta.title } : page.title,\n ...description,\n alternates: { canonical: options.canonical, ...(languages ? { languages } : {}) },\n openGraph: { title, ...description, url: options.canonical, ...images },\n twitter: { card: \"summary_large_image\", title, ...description, ...images },\n // Both off: a page hidden from search should not lend its links weight either.\n ...(meta.noIndex ? { robots: { index: false, follow: false } } : {}),\n };\n}\n"],"mappings":";;;;;;;;;;AAkFA,SAAS,WACP,OACA,EAAE,aAAa,YAAY,iBAAiB,QACb;AAC/B,KAAI,CAAC,SAAS,OAAO,UAAU,SAAU,QAAO,KAAA;CAChD,MAAM,YAAY,MAAM,QAAQ;CAChC,MAAM,OAAO,WAAW,MAAM,YAAY;AAC1C,KAAI,CAAC,KAAK,IAAK,QAAO,KAAA;AACtB,QAAO;EACL,KAAK,YAAY,KAAK,IAAI;EAC1B,GAAI,KAAK,QAAQ,EAAE,OAAO,KAAK,OAAO,GAAG,EAAE;EAC3C,GAAI,KAAK,SAAS,EAAE,QAAQ,KAAK,QAAQ,GAAG,EAAE;EAC9C,GAAI,MAAM,MAAM,EAAE,KAAK,MAAM,KAAK,GAAG,EAAE;EACxC;;;;;;AAOH,SAAS,eAAe,MAAe,SAAkC,KAA4C;CACnH,MAAM,QAAQ,QAAQ;AACtB,KAAI,CAAC,MAAO,QAAO,KAAA;CACnB,IAAI,UAAU;CACd,MAAM,OAAO,MAAM,QAAQ,mBAAmB,GAAG,QAAuB;EACtE,MAAM,QAAQ,KAAK;AACnB,MAAI,UAAU,KAAA,KAAa,UAAU,QAAQ,UAAU,IAAI;AACzD,aAAU;AACV,UAAO;;AAGT,SAAO,OAAO,MAAM,CAAC,MAAM,IAAI,CAAC,IAAI,mBAAmB,CAAC,KAAK,IAAI;GACjE;AACF,KAAI,QAAS,QAAO,KAAA;AACpB,QAAO;EAAE,KAAK,QAAQ,YAAY,KAAK;EAAE,OAAO,iBAAiB;EAAO,QAAQ,iBAAiB;EAAQ;EAAK;;;;;;;;;;;;;;;;;AAkBhH,SAAgB,aACd,MACA,SACc;CACd,MAAM,OAAO,KAAK,QAAQ,EAAE;CAC5B,MAAM,QAAQ,KAAK,SAAS,cAAc,QAAQ,UAAU,KAAK,MAAM;CACvE,MAAM,cAAc,KAAK,cAAc,EAAE,aAAa,KAAK,aAAa,GAAG,EAAE;CAC7E,MAAM,QAAQ,WAAW,KAAK,OAAO,QAAQ,IAAI,eAAe,MAAM,SAAS,KAAK,MAAM;CAC1F,MAAM,SAAS,QAAQ,EAAE,QAAQ,CAAC,MAAM,EAAE,GAAG,EAAE;CAC/C,MAAM,YAAY,mBAAmB,MAAM,SAAS,QAAQ,YAAY;AAExE,QAAO;EACL,OAAO,KAAK,QAAQ,EAAE,UAAU,KAAK,OAAO,GAAG,KAAK;EACpD,GAAG;EACH,YAAY;GAAE,WAAW,QAAQ;GAAW,GAAI,YAAY,EAAE,WAAW,GAAG,EAAE;GAAG;EACjF,WAAW;GAAE;GAAO,GAAG;GAAa,KAAK,QAAQ;GAAW,GAAG;GAAQ;EACvE,SAAS;GAAE,MAAM;GAAuB;GAAO,GAAG;GAAa,GAAG;GAAQ;EAE1E,GAAI,KAAK,UAAU,EAAE,QAAQ;GAAE,OAAO;GAAO,QAAQ;GAAO,EAAE,GAAG,EAAE;EACpE"}
|
package/dist/navigation.d.mts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { t as LocaleRead } from "./locale-
|
|
2
|
-
import { C as NAVIGATION_FOOTER_SLUG, D as NavigationFooter, E as NavigationDoc, O as NavigationHeader, S as NAVIGATION_FOOTER_DB_NAME, T as NavigationBar, _ as validateExternalHref, a as FOOTER_MAX_LINK_COLUMNS, b as NAVIGATION_DB_NAME, c as FooterColumnWidth, d as normalizeFooterDesktop, g as isValidExternalHref, i as FOOTER_MAX_COLUMNS, l as FooterSocial, m as EXTERNAL_HREF_MESSAGE, o as FOOTER_SOCIALS, p as validateFooterSocialUrl, r as FOOTER_COLUMN_WIDTHS, s as FOOTER_TWELFTHS, t as getNavigation, u as footerDesktopTracks, v as validateHeaderCta, w as NAVIGATION_SLUG } from "./published-
|
|
1
|
+
import { t as LocaleRead } from "./locale-tnKLkutC.mjs";
|
|
2
|
+
import { C as NAVIGATION_FOOTER_SLUG, D as NavigationFooter, E as NavigationDoc, O as NavigationHeader, S as NAVIGATION_FOOTER_DB_NAME, T as NavigationBar, _ as validateExternalHref, a as FOOTER_MAX_LINK_COLUMNS, b as NAVIGATION_DB_NAME, c as FooterColumnWidth, d as normalizeFooterDesktop, g as isValidExternalHref, i as FOOTER_MAX_COLUMNS, l as FooterSocial, m as EXTERNAL_HREF_MESSAGE, o as FOOTER_SOCIALS, p as validateFooterSocialUrl, r as FOOTER_COLUMN_WIDTHS, s as FOOTER_TWELFTHS, t as getNavigation, u as footerDesktopTracks, v as validateHeaderCta, w as NAVIGATION_SLUG } from "./published-BhYTEAK_.mjs";
|
|
3
3
|
export { EXTERNAL_HREF_MESSAGE, FOOTER_COLUMN_WIDTHS, FOOTER_MAX_COLUMNS, FOOTER_MAX_LINK_COLUMNS, FOOTER_SOCIALS, FOOTER_TWELFTHS, type FooterColumnWidth, type FooterSocial, type LocaleRead, NAVIGATION_DB_NAME, NAVIGATION_FOOTER_DB_NAME, NAVIGATION_FOOTER_SLUG, NAVIGATION_SLUG, type NavigationBar, type NavigationDoc, type NavigationFooter, type NavigationHeader, footerDesktopTracks, getNavigation, isValidExternalHref, normalizeFooterDesktop, validateExternalHref, validateFooterSocialUrl, validateHeaderCta };
|
package/dist/og.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { _ as ThemeIdentityFallback } from "./types-
|
|
2
|
-
import { t as ThemePayload } from "./published-
|
|
1
|
+
import { _ as ThemeIdentityFallback } from "./types-B1MmE-L3.mjs";
|
|
2
|
+
import { t as ThemePayload } from "./published-2I-k6zEo.mjs";
|
|
3
3
|
import { FontId } from "@bison-lab/fonts";
|
|
4
4
|
import { ThemeConfig } from "@bison-lab/tokens";
|
|
5
5
|
import { Payload } from "payload";
|
package/dist/og.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { t as SHARE_IMAGE_SIZE } from "./share-image-C8ZtIcU8.mjs";
|
|
2
2
|
import "./identity-CN6EOeDM.mjs";
|
|
3
|
-
import { n as getPublishedTheme, t as getPublishedIdentity } from "./published-
|
|
3
|
+
import { n as getPublishedTheme, t as getPublishedIdentity } from "./published-B80KqlcU.mjs";
|
|
4
4
|
import { isFontId } from "@bison-lab/fonts";
|
|
5
5
|
import { auditTheme, brandColorsFromConfig, deriveDarkPalette, deriveLightPalette } from "@bison-lab/tokens";
|
|
6
6
|
import * as fontsServer from "@bison-lab/fonts/server";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { d as ThemeDoc, m as ThemeLibraryColorDoc } from "./types-
|
|
1
|
+
import { d as ThemeDoc, m as ThemeLibraryColorDoc } from "./types-B1MmE-L3.mjs";
|
|
2
2
|
import { ShadeStep } from "@bison-lab/tokens";
|
|
3
3
|
import { StaticLabel, TextField, TextFieldSingleValidation } from "payload";
|
|
4
4
|
|
|
@@ -110,4 +110,4 @@ declare const THEME_PREVIEW_BREAKPOINTS: readonly [{
|
|
|
110
110
|
}];
|
|
111
111
|
//#endregion
|
|
112
112
|
export { deleteLibraryColor as _, PageEditorSystemKey as a, pageEditorTokens as c, LookFieldOptions as d, colorTokenField as f, rewriteColorTokens as g, findColorTokens as h, PAGE_EDITOR_SYSTEM_KEYS as i, themeLibraryFromDoc as l, ColorTokenHit as m, ColorSwatch as n, pageEditorLooks as o, lookField as p, LookOption as r, pageEditorSwatches as s, THEME_PREVIEW_BREAKPOINTS as t, LookFieldMode as u, rewriteColorToken as v, themeColorKeys as y };
|
|
113
|
-
//# sourceMappingURL=preview-
|
|
113
|
+
//# sourceMappingURL=preview-B69Dhi8T.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"preview-
|
|
1
|
+
{"version":3,"file":"preview-B69Dhi8T.d.mts","names":[],"sources":["../src/theme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,sBAA8B,WAAA;;;;;;;cCvGzD,yBAAA;EAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { _ as ThemeIdentityFallback, d as ThemeDoc, g as ResolvedThemeIdentity } from "./types-
|
|
2
|
-
import { t as LocaleRead } from "./locale-
|
|
1
|
+
import { _ as ThemeIdentityFallback, d as ThemeDoc, g as ResolvedThemeIdentity } from "./types-B1MmE-L3.mjs";
|
|
2
|
+
import { t as LocaleRead } from "./locale-tnKLkutC.mjs";
|
|
3
3
|
import { ThemeConfig } from "@bison-lab/tokens";
|
|
4
4
|
|
|
5
5
|
//#region src/theme/published.d.ts
|
|
@@ -27,4 +27,4 @@ declare function getPublishedTheme(payload: ThemePayload, seed: ThemeConfig): Pr
|
|
|
27
27
|
declare function getPublishedIdentity(payload: ThemePayload, fallback?: ThemeIdentityFallback, read?: LocaleRead): Promise<ResolvedThemeIdentity>;
|
|
28
28
|
//#endregion
|
|
29
29
|
export { getPublishedIdentity as n, getPublishedTheme as r, ThemePayload as t };
|
|
30
|
-
//# sourceMappingURL=published-
|
|
30
|
+
//# sourceMappingURL=published-2I-k6zEo.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"published-
|
|
1
|
+
{"version":3,"file":"published-2I-k6zEo.d.mts","names":[],"sources":["../src/theme/published.ts"],"mappings":";;;;;UAQiB,YAAA;EAIf,UAAA,GAAa,IAAA;IACX,IAAA;IACA,KAAA;IACA,KAAA;IACA,cAAA;EAAA,MACI,OAAA,CAAQ,QAAA;AAAA;;;;;;iBAQM,iBAAA,CAAkB,OAAA,EAAS,YAAA,EAAc,IAAA,EAAM,WAAA,GAAc,OAAA,CAAQ,WAAA;;AAA3F;;;;;;iBAiBsB,oBAAA,CACpB,OAAA,EAAS,YAAA,EACT,QAAA,GAAW,qBAAA,EACX,IAAA,GAAM,UAAA,GACL,OAAA,CAAQ,qBAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"published-
|
|
1
|
+
{"version":3,"file":"published-B80KqlcU.mjs","names":[],"sources":["../src/theme/published.ts"],"sourcesContent":["import type { ThemeConfig } from \"@bison-lab/tokens\";\n\nimport { localeArgs, type LocaleRead } from \"../locale\";\nimport { resolveThemeIdentity, type ResolvedThemeIdentity, type ThemeIdentityFallback } from \"./identity\";\nimport { themeConfigFromDoc } from \"./map\";\nimport { THEME_SLUG } from \"./types\";\nimport type { ThemeDoc } from \"./types\";\n\nexport interface ThemePayload {\n // No `locale` here: a site's generated types narrow it to its own\n // locales, and a wider `string` would refuse the site's `payload`. The\n // readers spread it in, which TypeScript does not check as excess.\n findGlobal: (args: {\n slug: string;\n draft?: boolean;\n depth?: number;\n overrideAccess?: boolean;\n }) => Promise<ThemeDoc | null | undefined>;\n}\n\n/**\n * The Theme row, or `seed` when the Global is empty. Theme has no draft\n * mode: `draft: false` is the live document. Access is overridden so a\n * logged-out request still gets the colours.\n */\nexport async function getPublishedTheme(payload: ThemePayload, seed: ThemeConfig): Promise<ThemeConfig> {\n const doc = await payload.findGlobal({\n slug: THEME_SLUG,\n draft: false,\n depth: 0,\n overrideAccess: true,\n });\n return themeConfigFromDoc(doc ?? {}, seed);\n}\n\n/**\n * Uploaded logo, favicon, and mobile-menu mark, or the fallback the site\n * passed into `createTheme`. Depth 1 so the upload url is populated.\n * Takes the request's `locale` like every other reader. Theme and its\n * brand assets hold no localized field today (a logo's alt is the brand\n * name), so it only matters once one does.\n */\nexport async function getPublishedIdentity(\n payload: ThemePayload,\n fallback?: ThemeIdentityFallback,\n read: LocaleRead = {},\n): Promise<ResolvedThemeIdentity> {\n const doc = await payload.findGlobal({\n slug: THEME_SLUG,\n draft: false,\n depth: 1,\n overrideAccess: true,\n ...localeArgs(read),\n });\n return resolveThemeIdentity(doc ?? {}, fallback);\n}\n"],"mappings":";;;;;;;;AAyBA,eAAsB,kBAAkB,SAAuB,MAAyC;AAOtG,QAAO,mBANK,MAAM,QAAQ,WAAW;EACnC,MAAA;EACA,OAAO;EACP,OAAO;EACP,gBAAgB;EACjB,CAAC,IAC+B,EAAE,EAAE,KAAK;;;;;;;;;AAU5C,eAAsB,qBACpB,SACA,UACA,OAAmB,EAAE,EACW;AAQhC,QAAO,qBAPK,MAAM,QAAQ,WAAW;EACnC,MAAA;EACA,OAAO;EACP,OAAO;EACP,gBAAgB;EAChB,GAAG,WAAW,KAAK;EACpB,CAAC,IACiC,EAAE,EAAE,SAAS"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as LocaleRead } from "./locale-
|
|
1
|
+
import { t as LocaleRead } from "./locale-tnKLkutC.mjs";
|
|
2
2
|
import { ArrayFieldValidation, Block, Field, GlobalConfig } from "payload";
|
|
3
3
|
|
|
4
4
|
//#region src/navigation/types.d.ts
|
|
@@ -137,4 +137,4 @@ declare function getNavigation({
|
|
|
137
137
|
}: GetNavigationArgs): Promise<NavigationDoc>;
|
|
138
138
|
//#endregion
|
|
139
139
|
export { NAVIGATION_FOOTER_SLUG as C, NavigationFooter as D, NavigationDoc as E, NavigationHeader as O, NAVIGATION_FOOTER_DB_NAME as S, NavigationBar as T, validateExternalHref as _, FOOTER_MAX_LINK_COLUMNS as a, NAVIGATION_DB_NAME as b, FooterColumnWidth as c, normalizeFooterDesktop as d, validateFooterColumns as f, isValidExternalHref as g, headerCtaEnabled as h, FOOTER_MAX_COLUMNS as i, FooterSocial as l, EXTERNAL_HREF_MESSAGE as m, FOOTER_COLUMNS_FIELD as n, FOOTER_SOCIALS as o, validateFooterSocialUrl as p, FOOTER_COLUMN_WIDTHS as r, FOOTER_TWELFTHS as s, getNavigation as t, footerDesktopTracks as u, validateHeaderCta as v, NAVIGATION_SLUG as w, NAVIGATION_FEATURE as x, CreateNavigationOptions as y };
|
|
140
|
-
//# sourceMappingURL=published-
|
|
140
|
+
//# sourceMappingURL=published-BhYTEAK_.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"published-
|
|
1
|
+
{"version":3,"file":"published-BhYTEAK_.d.mts","names":[],"sources":["../src/navigation/types.ts","../src/navigation/link.ts","../src/navigation/footer.ts","../src/navigation/published.ts"],"mappings":";;;;cAaa,eAAA;AAAA,cACA,kBAAA;AAAA,cACA,sBAAA;AAAA,cACA,yBAAA;AAAA,cAEA,kBAAA;AAAA,UAEI,uBAAA;;;;AAJjB;EASE,MAAA,EAAQ,KAAA;;;;AAPV;EAYE,OAAA,GAAU,WAAA,CAAY,WAAA,CAAY,YAAA;EAClC,WAAA,GAAc,WAAA,CAAY,WAAA,CAAY,YAAA;EAbT;;AAE/B;;EAgBE,aAAA;EAXQ;EAaR,eAAA;EARsB;EAUtB,mBAAA;AAAA;AAAA,UAGe,gBAAA;EACf,KAAA;EACA,GAAA;AAAA;AAAA,UAGe,aAAA;EACf,YAAA;EACA,QAAA;EACA,eAAA;AAAA;AAAA,UAGe,gBAAA;EACf,OAAA;EACA,KAAA;AAAA;AAAA,UAGe,aAAA;EACf,MAAA,EAAQ,gBAAA;EACR,MAAA,EAAQ,gBAAA;EACR,GAAA,EAAK,aAAA;AAAA;AAAA,UAGU,iBAAA,SAA0B,UAAA;EACzC,OAAA;IACE,UAAA,GAAa,IAAA;MACX,IAAA;MACA,KAAA;MACA,cAAA;MACA,KAAA;IAAA,MACI,OAAA;EAAA;EAER,KAAA;AAAA;;;KChEG,QAAA;AAAA,cAaQ,qBAAA;;ADVb;;;;iBCoBgB,mBAAA,CAAoB,KAAA;AAAA,iBAgBpB,oBAAA,CAAqB,KAAA,WAAgB,QAAA;AAAA,UA4HpC,cAAA;EACf,OAAA;EACA,IAAA,GAAO,QAAA;EACP,IAAA;EACA,IAAA;EACA,KAAA;AAAA;;iBAIc,gBAAA,CAAiB,GAAA,EAAK,cAAA;ADtKtC;;;;AAAA,iBCiLgB,iBAAA,CAAkB,KAAA;;;;;;ADpLlC;cELa,oBAAA;AAAA,KACD,iBAAA,WAA4B,oBAAA;;cAG3B,kBAAA;AFEb;AAAA,cEAa,uBAAA;AAAA,cAEA,cAAA;AAAA,KACD,YAAA,WAAuB,cAAA;;cAWtB,eAAA,EAAiB,MAAA,CAAO,iBAAA;AAAA,cASxB,oBAAA;;iBA+BG,sBAAA,CAAuB,KAAA,WAAgB,iBAAA;;AFpDvD;;;;iBE6DgB,mBAAA,CACd,KAAA,EAAO,iBAAA,qBACP,OAAA,EAAS,KAAA,CAAM,iBAAA;EAEf,YAAA;EACA,aAAA;EACA,aAAA;AAAA;;AF/DF;;;;;cEwFa,qBAAA,EAAuB,oBAAA;AAAA,iBA6CpB,uBAAA,CAAwB,KAAA;;;;;;AF5IxC;;;;;iBG4BsB,aAAA,CAAA;EACpB,OAAA;EACA,KAAA;EAAA,GACG;AAAA,GACF,iBAAA,GAAoB,OAAA,CAAQ,aAAA"}
|
package/dist/seo.d.mts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { t as LocaleAlternatesOptions } from "./alternates-DlRTsaVe.mjs";
|
|
1
2
|
import { Payload } from "payload";
|
|
2
3
|
import { ReactElement } from "react";
|
|
3
4
|
|
|
@@ -24,10 +25,12 @@ interface SitemapEntry {
|
|
|
24
25
|
lastModified?: string | Date;
|
|
25
26
|
changeFrequency?: "always" | "hourly" | "daily" | "weekly" | "monthly" | "yearly" | "never";
|
|
26
27
|
priority?: number;
|
|
28
|
+
/** The entry's URL in each locale plus `x-default`, when `pageSitemap` was given `locales`. */
|
|
29
|
+
alternates?: {
|
|
30
|
+
languages?: Record<string, string>;
|
|
31
|
+
};
|
|
27
32
|
}
|
|
28
|
-
interface
|
|
29
|
-
/** Public path of a page: the site's own route helper, home included. */
|
|
30
|
-
path: (page: P) => string;
|
|
33
|
+
interface PageSitemapBaseOptions<P extends SitemapPage> {
|
|
31
34
|
/** Turns a path into an absolute URL at the site's origin. */
|
|
32
35
|
absoluteUrl: (path: string) => string;
|
|
33
36
|
/** Per-page `changeFrequency` / `priority`; the URL and last edit are set here. */
|
|
@@ -40,18 +43,30 @@ interface PageSitemapOptions<P extends SitemapPage> {
|
|
|
40
43
|
*/
|
|
41
44
|
routes?: readonly SitemapEntry[];
|
|
42
45
|
}
|
|
46
|
+
/**
|
|
47
|
+
* `pageSitemap`'s options: `path` for a single-locale site, or `locales` and
|
|
48
|
+
* `pathFor` for a multi-locale one (#281), which lists each page once per
|
|
49
|
+
* locale with every locale's URL as its alternates.
|
|
50
|
+
*/
|
|
51
|
+
type PageSitemapOptions<P extends SitemapPage> = PageSitemapBaseOptions<P> & ({
|
|
52
|
+
/** Public path of a page: the site's own route helper, home included. */path: (page: P) => string;
|
|
53
|
+
locales?: undefined;
|
|
54
|
+
pathFor?: undefined;
|
|
55
|
+
defaultLocale?: undefined;
|
|
56
|
+
} | ({
|
|
57
|
+
path?: undefined;
|
|
58
|
+
} & Exclude<LocaleAlternatesOptions<P>, {
|
|
59
|
+
locales?: undefined;
|
|
60
|
+
}>));
|
|
43
61
|
/**
|
|
44
62
|
* `/sitemap.xml` from the published pages: every page with an address,
|
|
45
63
|
* skipping those the SEO tab hides from search (`meta.noIndex`), then the
|
|
46
64
|
* site's code-owned routes, one entry per URL. Pass the result straight back
|
|
47
|
-
* from `app/sitemap.ts`.
|
|
65
|
+
* from `app/sitemap.ts`. With `locales`, each page is listed at its URL in
|
|
66
|
+
* every locale, in order, and each of those entries carries
|
|
67
|
+
* `alternates.languages`; a hidden page is hidden in every locale.
|
|
48
68
|
*/
|
|
49
|
-
declare function pageSitemap<P extends SitemapPage>(pages: readonly P[],
|
|
50
|
-
path,
|
|
51
|
-
absoluteUrl,
|
|
52
|
-
entry,
|
|
53
|
-
routes
|
|
54
|
-
}: PageSitemapOptions<P>): SitemapEntry[];
|
|
69
|
+
declare function pageSitemap<P extends SitemapPage>(pages: readonly P[], options: PageSitemapOptions<P>): SitemapEntry[];
|
|
55
70
|
/** The one Local API call the reader makes, for a caller without a `Payload`. */
|
|
56
71
|
interface SitemapPagesReader {
|
|
57
72
|
find: (args: {
|
|
@@ -212,5 +227,5 @@ declare function JsonLd<T extends JsonLdInput>({
|
|
|
212
227
|
nonce
|
|
213
228
|
}: JsonLdProps<T>): ReactElement | null;
|
|
214
229
|
//#endregion
|
|
215
|
-
export { type BreadcrumbItem, type BreadcrumbListJsonLd, type GetSitemapPagesArgs, JsonLd, type JsonLdGraph, type JsonLdInput, type JsonLdNode, type JsonLdProps, type MaybeJsonLd, type OrganizationInput, type OrganizationJsonLd, type PageSitemapOptions, type SitemapEntry, type SitemapPage, type SitemapPagesReader, type WebsiteInput, type WebsiteJsonLd, breadcrumbListJsonLd, getSitemapPages, jsonLdGraph, jsonLdHtml, organizationJsonLd, pageSitemap, websiteJsonLd };
|
|
230
|
+
export { type BreadcrumbItem, type BreadcrumbListJsonLd, type GetSitemapPagesArgs, JsonLd, type JsonLdGraph, type JsonLdInput, type JsonLdNode, type JsonLdProps, type LocaleAlternatesOptions, type MaybeJsonLd, type OrganizationInput, type OrganizationJsonLd, type PageSitemapBaseOptions, type PageSitemapOptions, type SitemapEntry, type SitemapPage, type SitemapPagesReader, type WebsiteInput, type WebsiteJsonLd, breadcrumbListJsonLd, getSitemapPages, jsonLdGraph, jsonLdHtml, organizationJsonLd, pageSitemap, websiteJsonLd };
|
|
216
231
|
//# sourceMappingURL=seo.d.mts.map
|
package/dist/seo.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"seo.d.mts","names":[],"sources":["../src/seo/sitemap.ts","../src/seo/json-ld.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"seo.d.mts","names":[],"sources":["../src/seo/sitemap.ts","../src/seo/json-ld.ts"],"mappings":";;;;;;;;AAUA;;UAAiB,WAAA;EACf,IAAA;EACA,OAAA;EACA,SAAA;EACA,IAAA;IAAS,OAAA;EAAA;AAAA;;AAOX;;;UAAiB,YAAA;EACf,GAAA;EACA,YAAA,YAAwB,IAAA;EACxB,eAAA;EACA,QAAA;EAAA;EAEA,UAAA;IAAe,SAAA,GAAY,MAAA;EAAA;AAAA;AAAA,UAGZ,sBAAA,WAAi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B,WAAA,CAAY,CAAA;EDrD9C;ECuDZ,KAAA;AAAA;;;;ADnDF;iBC0DgB,MAAA,WAAiB,WAAA,CAAA,CAAA;EAAe,IAAA;EAAM;AAAA,GAAS,WAAA,CAAY,CAAA,IAAK,YAAA"}
|
package/dist/seo.mjs
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { l as isRootPageKey } from "./root-page-key-kx3C1eyp.mjs";
|
|
2
|
+
import { t as languageAlternates } from "./alternates-DxBTUXHh.mjs";
|
|
2
3
|
import { createElement } from "react";
|
|
3
4
|
//#region src/seo/sitemap.ts
|
|
4
5
|
/** A page with no address yet has nothing to list. Home is keyed, not slugged. */
|
|
@@ -9,24 +10,32 @@ function hasAddress(page) {
|
|
|
9
10
|
* `/sitemap.xml` from the published pages: every page with an address,
|
|
10
11
|
* skipping those the SEO tab hides from search (`meta.noIndex`), then the
|
|
11
12
|
* site's code-owned routes, one entry per URL. Pass the result straight back
|
|
12
|
-
* from `app/sitemap.ts`.
|
|
13
|
+
* from `app/sitemap.ts`. With `locales`, each page is listed at its URL in
|
|
14
|
+
* every locale, in order, and each of those entries carries
|
|
15
|
+
* `alternates.languages`; a hidden page is hidden in every locale.
|
|
13
16
|
*/
|
|
14
|
-
function pageSitemap(pages,
|
|
17
|
+
function pageSitemap(pages, options) {
|
|
18
|
+
const { absoluteUrl, entry, routes = [] } = options;
|
|
19
|
+
const urlsOf = (page) => options.locales ? options.locales.map((locale) => absoluteUrl(options.pathFor(page, locale))) : [absoluteUrl(options.path(page))];
|
|
15
20
|
const byUrl = /* @__PURE__ */ new Map();
|
|
16
21
|
const hidden = /* @__PURE__ */ new Set();
|
|
17
22
|
for (const page of pages) {
|
|
18
23
|
if (!hasAddress(page)) continue;
|
|
19
|
-
const
|
|
24
|
+
const urls = urlsOf(page);
|
|
20
25
|
if (page.meta?.noIndex) {
|
|
21
|
-
hidden.add(url);
|
|
26
|
+
for (const url of urls) hidden.add(url);
|
|
22
27
|
continue;
|
|
23
28
|
}
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
url
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
29
|
+
const languages = languageAlternates(page, options, absoluteUrl);
|
|
30
|
+
for (const url of urls) {
|
|
31
|
+
if (byUrl.has(url)) continue;
|
|
32
|
+
byUrl.set(url, {
|
|
33
|
+
url,
|
|
34
|
+
...page.updatedAt ? { lastModified: page.updatedAt } : {},
|
|
35
|
+
...entry?.(page),
|
|
36
|
+
...languages ? { alternates: { languages } } : {}
|
|
37
|
+
});
|
|
38
|
+
}
|
|
30
39
|
}
|
|
31
40
|
const seenRoutes = /* @__PURE__ */ new Set();
|
|
32
41
|
for (const route of routes) {
|
package/dist/seo.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"seo.mjs","names":[],"sources":["../src/seo/sitemap.ts","../src/seo/json-ld.ts"],"sourcesContent":["import type { Payload } from \"payload\";\n\nimport { isRootPageKey } from \"../collections/root-page-key\";\n\n/**\n * A page as the sitemap needs it; a site's generated `Page` is assignable.\n * Every field is optional and nullable, as `getSitemapPages` selects only\n * these.\n */\nexport interface SitemapPage {\n slug?: string | null;\n pageKey?: string | null;\n updatedAt?: string | null;\n meta?: { noIndex?: boolean | null } | null;\n}\n\n/**\n * One `<url>` of `/sitemap.xml`. Structurally assignable to an item of Next's\n * `MetadataRoute.Sitemap`, without this package depending on `next`.\n */\nexport interface SitemapEntry {\n url: string;\n lastModified?: string | Date;\n changeFrequency?: \"always\" | \"hourly\" | \"daily\" | \"weekly\" | \"monthly\" | \"yearly\" | \"never\";\n priority?: number;\n}\n\nexport interface PageSitemapOptions<P extends SitemapPage> {\n /** Public path of a page: the site's own route helper, home included. */\n path: (page: P) => string;\n /** Turns a path into an absolute URL at the site's origin. */\n absoluteUrl: (path: string) => string;\n /** Per-page `changeFrequency` / `priority`; the URL and last edit are set here. */\n entry?: (page: P) => Omit<SitemapEntry, \"url\" | \"lastModified\">;\n /**\n * The routes the site still serves from code, as absolute-URL entries.\n * They follow the pages. A route at a URL a page already lists is merged\n * into that page's entry (the page's fields win); a route at the URL of a\n * page hidden from search is dropped, because that page is what serves it.\n */\n routes?: readonly SitemapEntry[];\n}\n\n/** A page with no address yet has nothing to list. Home is keyed, not slugged. */\nfunction hasAddress(page: SitemapPage): boolean {\n return isRootPageKey(page.pageKey) || Boolean(page.slug);\n}\n\n/**\n * `/sitemap.xml` from the published pages: every page with an address,\n * skipping those the SEO tab hides from search (`meta.noIndex`), then the\n * site's code-owned routes, one entry per URL. Pass the result straight back\n * from `app/sitemap.ts`.\n */\nexport function pageSitemap<P extends SitemapPage>(\n pages: readonly P[],\n { path, absoluteUrl, entry, routes = [] }: PageSitemapOptions<P>,\n): SitemapEntry[] {\n const byUrl = new Map<string, SitemapEntry>();\n const hidden = new Set<string>();\n\n for (const page of pages) {\n if (!hasAddress(page)) continue;\n const url = absoluteUrl(path(page));\n if (page.meta?.noIndex) {\n hidden.add(url);\n continue;\n }\n if (byUrl.has(url)) continue;\n byUrl.set(url, {\n url,\n ...(page.updatedAt ? { lastModified: page.updatedAt } : {}),\n ...entry?.(page),\n });\n }\n\n const seenRoutes = new Set<string>();\n for (const route of routes) {\n // The first route at a URL wins over a later duplicate.\n if (hidden.has(route.url) || seenRoutes.has(route.url)) continue;\n seenRoutes.add(route.url);\n const page = byUrl.get(route.url);\n byUrl.set(route.url, page ? { ...route, ...page } : route);\n }\n\n return [...byUrl.values()];\n}\n\n/** The one Local API call the reader makes, for a caller without a `Payload`. */\nexport interface SitemapPagesReader {\n find: (args: {\n collection: string;\n where: Record<string, unknown>;\n draft: boolean;\n depth: number;\n pagination: boolean;\n select: Record<string, unknown>;\n }) => Promise<{ docs: unknown[] }>;\n}\n\nexport interface GetSitemapPagesArgs {\n /** The site's `Payload` (generated slugs and all), or anything with that `find`. */\n payload: SitemapPagesReader | Payload;\n /** The pages collection's slug. Default `pages` (`createPages`). */\n collection?: string;\n}\n\n/**\n * Every published page, with only the fields `pageSitemap` reads. A draft\n * never reaches the sitemap: the query filters on `_status` and reads the\n * published version. `updatedAt` is the document's, so an autosaved draft\n * over a live page can move a page's `lastModified` before it is republished.\n */\nexport async function getSitemapPages({\n payload,\n collection = \"pages\",\n}: GetSitemapPagesArgs): Promise<SitemapPage[]> {\n const { docs } = await (payload as SitemapPagesReader).find({\n collection,\n where: { _status: { equals: \"published\" } },\n draft: false,\n depth: 0,\n pagination: false,\n select: { slug: true, pageKey: true, updatedAt: true, meta: { noIndex: true } },\n });\n return docs as SitemapPage[];\n}\n","import { createElement, type ReactElement } from \"react\";\n\nconst SCHEMA_ORG = \"https://schema.org\";\n\n/** One schema.org node: a `@type` and whatever properties that type takes. */\nexport interface JsonLdNode {\n \"@context\"?: typeof SCHEMA_ORG;\n \"@type\": string;\n \"@id\"?: string;\n [property: string]: unknown;\n}\n\n/**\n * What `JsonLd` and `jsonLdGraph` accept: anything with a `@type`. No index\n * signature, so an interface (payload-blocks' `FaqPageJsonLd`, a site's own\n * `Product`) is accepted as well as a literal; the functions are generic so\n * a literal's extra properties are not refused either.\n */\nexport interface JsonLdInput {\n \"@type\": string | readonly string[];\n}\n\n/** A node, or nothing (a builder with nothing to say returns `null`). */\nexport type MaybeJsonLd<T extends JsonLdInput = JsonLdInput> = T | null | undefined;\n\n/** Optional text: empty and null both mean \"leave the property off\". */\ntype Text = string | null | undefined;\n\nfunction present<K extends string>(key: K, value: Text): Partial<Record<K, string>> {\n return value ? ({ [key]: value } as Record<K, string>) : {};\n}\n\nexport interface OrganizationInput {\n name: string;\n /** The site's home URL. */\n url: string;\n /**\n * A more specific schema.org type (`MedicalOrganization`, `LocalBusiness`).\n * Default `Organization`. Claims beyond the type are the site's to add.\n */\n type?: string;\n /** A stable `@id` (`https://acme.test/#organization`) other nodes can point at. */\n id?: Text;\n /** Absolute URL of the logo. */\n logo?: Text;\n description?: Text;\n telephone?: Text;\n email?: Text;\n /** Absolute URLs of the organization's profiles. Empty entries are dropped. */\n sameAs?: readonly Text[];\n}\n\nexport interface OrganizationJsonLd extends JsonLdNode {\n \"@context\": typeof SCHEMA_ORG;\n name: string;\n url: string;\n logo?: string;\n description?: string;\n telephone?: string;\n email?: string;\n sameAs?: string[];\n}\n\n/** The site's publisher: one Organization node, empty fields left off. */\nexport function organizationJsonLd(input: OrganizationInput): OrganizationJsonLd {\n const sameAs = (input.sameAs ?? []).filter((url): url is string => Boolean(url));\n return {\n \"@context\": SCHEMA_ORG,\n \"@type\": input.type ?? \"Organization\",\n ...present(\"@id\", input.id),\n name: input.name,\n url: input.url,\n ...present(\"logo\", input.logo),\n ...present(\"description\", input.description),\n ...present(\"telephone\", input.telephone),\n ...present(\"email\", input.email),\n ...(sameAs.length > 0 ? { sameAs } : {}),\n };\n}\n\nexport interface WebsiteInput {\n name: string;\n /** The site's home URL. */\n url: string;\n id?: Text;\n description?: Text;\n /** BCP 47 language tag, `en-US`. */\n inLanguage?: Text;\n /** The publishing Organization's `@id`. */\n publisher?: Text;\n}\n\nexport interface WebsiteJsonLd extends JsonLdNode {\n \"@context\": typeof SCHEMA_ORG;\n \"@type\": \"WebSite\";\n name: string;\n url: string;\n description?: string;\n inLanguage?: string;\n publisher?: { \"@id\": string };\n}\n\n/** The site itself, pointing at its publisher by `@id`. */\nexport function websiteJsonLd(input: WebsiteInput): WebsiteJsonLd {\n return {\n \"@context\": SCHEMA_ORG,\n \"@type\": \"WebSite\",\n ...present(\"@id\", input.id),\n name: input.name,\n url: input.url,\n ...present(\"description\", input.description),\n ...present(\"inLanguage\", input.inLanguage),\n ...(input.publisher ? { publisher: { \"@id\": input.publisher } } : {}),\n };\n}\n\nexport interface BreadcrumbItem {\n name: string;\n /** Absolute URL. Leave it off the current page, the trail's last item. */\n url?: Text;\n}\n\nexport interface BreadcrumbListJsonLd extends JsonLdNode {\n \"@context\": typeof SCHEMA_ORG;\n \"@type\": \"BreadcrumbList\";\n itemListElement: Array<{ \"@type\": \"ListItem\"; position: number; name: string; item?: string }>;\n}\n\n/**\n * A page's trail, home first, numbered from 1. `null` for an empty trail, so\n * a page with none renders no script.\n */\nexport function breadcrumbListJsonLd(items: readonly BreadcrumbItem[]): BreadcrumbListJsonLd | null {\n if (items.length === 0) return null;\n return {\n \"@context\": SCHEMA_ORG,\n \"@type\": \"BreadcrumbList\",\n itemListElement: items.map((crumb, index) => ({\n \"@type\": \"ListItem\" as const,\n position: index + 1,\n name: crumb.name,\n ...present(\"item\", crumb.url),\n })),\n };\n}\n\nexport interface JsonLdGraph {\n \"@context\": typeof SCHEMA_ORG;\n \"@graph\": JsonLdInput[];\n}\n\n/**\n * Several nodes under one `@context`, the absent ones dropped. `null` when\n * none is left.\n */\nexport function jsonLdGraph<T extends readonly MaybeJsonLd[]>(...nodes: T): JsonLdGraph | null {\n const graph = nodes.flatMap((node) => {\n if (!node) return [];\n const { \"@context\": _context, ...rest } = node as JsonLdInput & { \"@context\"?: unknown };\n return [rest as JsonLdInput];\n });\n return graph.length > 0 ? { \"@context\": SCHEMA_ORG, \"@graph\": graph } : null;\n}\n\n/**\n * JSON for an inline `<script>`, with `<` escaped so a value holding\n * `</script>` cannot close the tag. The escape is still valid JSON.\n */\nexport function jsonLdHtml(data: unknown): string {\n return JSON.stringify(data).replace(/</g, \"\\\\u003c\");\n}\n\nexport interface JsonLdProps<T extends JsonLdInput = JsonLdInput> {\n /**\n * A node (any builder here, payload-blocks' `faqPageJsonLd`, or a site's\n * own), a graph, or a list of nodes rendered as one `@graph`. Nothing to\n * say (`null`, or a list of nulls) renders nothing.\n */\n data: MaybeJsonLd<T> | JsonLdGraph | readonly MaybeJsonLd<T>[];\n /** CSP nonce for the `<script>` tag. */\n nonce?: string;\n}\n\n/**\n * One `<script type=\"application/ld+json\">`. A Server Component: no client\n * boundary, no `\"use client\"`, so a page route renders it as it is.\n */\nexport function JsonLd<T extends JsonLdInput>({ data, nonce }: JsonLdProps<T>): ReactElement | null {\n const value = Array.isArray(data) ? jsonLdGraph(...(data as readonly MaybeJsonLd[])) : data;\n if (!value) return null;\n return createElement(\"script\", {\n type: \"application/ld+json\",\n nonce,\n dangerouslySetInnerHTML: { __html: jsonLdHtml(value) },\n });\n}\n"],"mappings":";;;;AA4CA,SAAS,WAAW,MAA4B;AAC9C,QAAO,cAAc,KAAK,QAAQ,IAAI,QAAQ,KAAK,KAAK;;;;;;;;AAS1D,SAAgB,YACd,OACA,EAAE,MAAM,aAAa,OAAO,SAAS,EAAE,IACvB;CAChB,MAAM,wBAAQ,IAAI,KAA2B;CAC7C,MAAM,yBAAS,IAAI,KAAa;AAEhC,MAAK,MAAM,QAAQ,OAAO;AACxB,MAAI,CAAC,WAAW,KAAK,CAAE;EACvB,MAAM,MAAM,YAAY,KAAK,KAAK,CAAC;AACnC,MAAI,KAAK,MAAM,SAAS;AACtB,UAAO,IAAI,IAAI;AACf;;AAEF,MAAI,MAAM,IAAI,IAAI,CAAE;AACpB,QAAM,IAAI,KAAK;GACb;GACA,GAAI,KAAK,YAAY,EAAE,cAAc,KAAK,WAAW,GAAG,EAAE;GAC1D,GAAG,QAAQ,KAAK;GACjB,CAAC;;CAGJ,MAAM,6BAAa,IAAI,KAAa;AACpC,MAAK,MAAM,SAAS,QAAQ;AAE1B,MAAI,OAAO,IAAI,MAAM,IAAI,IAAI,WAAW,IAAI,MAAM,IAAI,CAAE;AACxD,aAAW,IAAI,MAAM,IAAI;EACzB,MAAM,OAAO,MAAM,IAAI,MAAM,IAAI;AACjC,QAAM,IAAI,MAAM,KAAK,OAAO;GAAE,GAAG;GAAO,GAAG;GAAM,GAAG,MAAM;;AAG5D,QAAO,CAAC,GAAG,MAAM,QAAQ,CAAC;;;;;;;;AA4B5B,eAAsB,gBAAgB,EACpC,SACA,aAAa,WACiC;CAC9C,MAAM,EAAE,SAAS,MAAO,QAA+B,KAAK;EAC1D;EACA,OAAO,EAAE,SAAS,EAAE,QAAQ,aAAa,EAAE;EAC3C,OAAO;EACP,OAAO;EACP,YAAY;EACZ,QAAQ;GAAE,MAAM;GAAM,SAAS;GAAM,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AAM,SAAS,SAAS;AACpC,MAAI,CAAC,KAAM,QAAO,EAAE;EACpB,MAAM,EAAE,YAAY,UAAU,GAAG,SAAS;AAC1C,SAAO,CAAC,KAAoB;GAC5B;AACF,QAAO,MAAM,SAAS,IAAI;EAAE,YAAY;EAAY,UAAU;EAAO,GAAG;;;;;;AAO1E,SAAgB,WAAW,MAAuB;AAChD,QAAO,KAAK,UAAU,KAAK,CAAC,QAAQ,MAAM,UAAU;;;;;;AAkBtD,SAAgB,OAA8B,EAAE,MAAM,SAA8C;CAClG,MAAM,QAAQ,MAAM,QAAQ,KAAK,GAAG,YAAY,GAAI,KAAgC,GAAG;AACvF,KAAI,CAAC,MAAO,QAAO;AACnB,QAAO,cAAc,UAAU;EAC7B,MAAM;EACN;EACA,yBAAyB,EAAE,QAAQ,WAAW,MAAM,EAAE;EACvD,CAAC"}
|
|
1
|
+
{"version":3,"file":"seo.mjs","names":[],"sources":["../src/seo/sitemap.ts","../src/seo/json-ld.ts"],"sourcesContent":["import type { Payload } from \"payload\";\n\nimport { isRootPageKey } from \"../collections/root-page-key\";\nimport { languageAlternates, type LocaleAlternatesOptions } from \"./alternates\";\n\n/**\n * A page as the sitemap needs it; a site's generated `Page` is assignable.\n * Every field is optional and nullable, as `getSitemapPages` selects only\n * these.\n */\nexport interface SitemapPage {\n slug?: string | null;\n pageKey?: string | null;\n updatedAt?: string | null;\n meta?: { noIndex?: boolean | null } | null;\n}\n\n/**\n * One `<url>` of `/sitemap.xml`. Structurally assignable to an item of Next's\n * `MetadataRoute.Sitemap`, without this package depending on `next`.\n */\nexport interface SitemapEntry {\n url: string;\n lastModified?: string | Date;\n changeFrequency?: \"always\" | \"hourly\" | \"daily\" | \"weekly\" | \"monthly\" | \"yearly\" | \"never\";\n priority?: number;\n /** The entry's URL in each locale plus `x-default`, when `pageSitemap` was given `locales`. */\n alternates?: { languages?: Record<string, string> };\n}\n\nexport interface PageSitemapBaseOptions<P extends SitemapPage> {\n /** Turns a path into an absolute URL at the site's origin. */\n absoluteUrl: (path: string) => string;\n /** Per-page `changeFrequency` / `priority`; the URL and last edit are set here. */\n entry?: (page: P) => Omit<SitemapEntry, \"url\" | \"lastModified\">;\n /**\n * The routes the site still serves from code, as absolute-URL entries.\n * They follow the pages. A route at a URL a page already lists is merged\n * into that page's entry (the page's fields win); a route at the URL of a\n * page hidden from search is dropped, because that page is what serves it.\n */\n routes?: readonly SitemapEntry[];\n}\n\n/**\n * `pageSitemap`'s options: `path` for a single-locale site, or `locales` and\n * `pathFor` for a multi-locale one (#281), which lists each page once per\n * locale with every locale's URL as its alternates.\n */\nexport type PageSitemapOptions<P extends SitemapPage> = PageSitemapBaseOptions<P> &\n (\n | {\n /** Public path of a page: the site's own route helper, home included. */\n path: (page: P) => string;\n locales?: undefined;\n pathFor?: undefined;\n defaultLocale?: undefined;\n }\n | ({ path?: undefined } & Exclude<LocaleAlternatesOptions<P>, { locales?: undefined }>)\n );\n\n/** A page with no address yet has nothing to list. Home is keyed, not slugged. */\nfunction hasAddress(page: SitemapPage): boolean {\n return isRootPageKey(page.pageKey) || Boolean(page.slug);\n}\n\n/**\n * `/sitemap.xml` from the published pages: every page with an address,\n * skipping those the SEO tab hides from search (`meta.noIndex`), then the\n * site's code-owned routes, one entry per URL. Pass the result straight back\n * from `app/sitemap.ts`. With `locales`, each page is listed at its URL in\n * every locale, in order, and each of those entries carries\n * `alternates.languages`; a hidden page is hidden in every locale.\n */\nexport function pageSitemap<P extends SitemapPage>(\n pages: readonly P[],\n options: PageSitemapOptions<P>,\n): SitemapEntry[] {\n const { absoluteUrl, entry, routes = [] } = options;\n const urlsOf = (page: P): string[] =>\n options.locales\n ? options.locales.map((locale) => absoluteUrl(options.pathFor(page, locale)))\n : [absoluteUrl(options.path(page))];\n const byUrl = new Map<string, SitemapEntry>();\n const hidden = new Set<string>();\n\n for (const page of pages) {\n if (!hasAddress(page)) continue;\n const urls = urlsOf(page);\n if (page.meta?.noIndex) {\n for (const url of urls) hidden.add(url);\n continue;\n }\n const languages = languageAlternates(page, options, absoluteUrl);\n for (const url of urls) {\n if (byUrl.has(url)) continue;\n byUrl.set(url, {\n url,\n ...(page.updatedAt ? { lastModified: page.updatedAt } : {}),\n ...entry?.(page),\n ...(languages ? { alternates: { languages } } : {}),\n });\n }\n }\n\n const seenRoutes = new Set<string>();\n for (const route of routes) {\n // The first route at a URL wins over a later duplicate.\n if (hidden.has(route.url) || seenRoutes.has(route.url)) continue;\n seenRoutes.add(route.url);\n const page = byUrl.get(route.url);\n byUrl.set(route.url, page ? { ...route, ...page } : route);\n }\n\n return [...byUrl.values()];\n}\n\n/** The one Local API call the reader makes, for a caller without a `Payload`. */\nexport interface SitemapPagesReader {\n find: (args: {\n collection: string;\n where: Record<string, unknown>;\n draft: boolean;\n depth: number;\n pagination: boolean;\n select: Record<string, unknown>;\n }) => Promise<{ docs: unknown[] }>;\n}\n\nexport interface GetSitemapPagesArgs {\n /** The site's `Payload` (generated slugs and all), or anything with that `find`. */\n payload: SitemapPagesReader | Payload;\n /** The pages collection's slug. Default `pages` (`createPages`). */\n collection?: string;\n}\n\n/**\n * Every published page, with only the fields `pageSitemap` reads. A draft\n * never reaches the sitemap: the query filters on `_status` and reads the\n * published version. `updatedAt` is the document's, so an autosaved draft\n * over a live page can move a page's `lastModified` before it is republished.\n */\nexport async function getSitemapPages({\n payload,\n collection = \"pages\",\n}: GetSitemapPagesArgs): Promise<SitemapPage[]> {\n const { docs } = await (payload as SitemapPagesReader).find({\n collection,\n where: { _status: { equals: \"published\" } },\n draft: false,\n depth: 0,\n pagination: false,\n select: { slug: true, pageKey: true, updatedAt: true, meta: { noIndex: true } },\n });\n return docs as SitemapPage[];\n}\n","import { createElement, type ReactElement } from \"react\";\n\nconst SCHEMA_ORG = \"https://schema.org\";\n\n/** One schema.org node: a `@type` and whatever properties that type takes. */\nexport interface JsonLdNode {\n \"@context\"?: typeof SCHEMA_ORG;\n \"@type\": string;\n \"@id\"?: string;\n [property: string]: unknown;\n}\n\n/**\n * What `JsonLd` and `jsonLdGraph` accept: anything with a `@type`. No index\n * signature, so an interface (payload-blocks' `FaqPageJsonLd`, a site's own\n * `Product`) is accepted as well as a literal; the functions are generic so\n * a literal's extra properties are not refused either.\n */\nexport interface JsonLdInput {\n \"@type\": string | readonly string[];\n}\n\n/** A node, or nothing (a builder with nothing to say returns `null`). */\nexport type MaybeJsonLd<T extends JsonLdInput = JsonLdInput> = T | null | undefined;\n\n/** Optional text: empty and null both mean \"leave the property off\". */\ntype Text = string | null | undefined;\n\nfunction present<K extends string>(key: K, value: Text): Partial<Record<K, string>> {\n return value ? ({ [key]: value } as Record<K, string>) : {};\n}\n\nexport interface OrganizationInput {\n name: string;\n /** The site's home URL. */\n url: string;\n /**\n * A more specific schema.org type (`MedicalOrganization`, `LocalBusiness`).\n * Default `Organization`. Claims beyond the type are the site's to add.\n */\n type?: string;\n /** A stable `@id` (`https://acme.test/#organization`) other nodes can point at. */\n id?: Text;\n /** Absolute URL of the logo. */\n logo?: Text;\n description?: Text;\n telephone?: Text;\n email?: Text;\n /** Absolute URLs of the organization's profiles. Empty entries are dropped. */\n sameAs?: readonly Text[];\n}\n\nexport interface OrganizationJsonLd extends JsonLdNode {\n \"@context\": typeof SCHEMA_ORG;\n name: string;\n url: string;\n logo?: string;\n description?: string;\n telephone?: string;\n email?: string;\n sameAs?: string[];\n}\n\n/** The site's publisher: one Organization node, empty fields left off. */\nexport function organizationJsonLd(input: OrganizationInput): OrganizationJsonLd {\n const sameAs = (input.sameAs ?? []).filter((url): url is string => Boolean(url));\n return {\n \"@context\": SCHEMA_ORG,\n \"@type\": input.type ?? \"Organization\",\n ...present(\"@id\", input.id),\n name: input.name,\n url: input.url,\n ...present(\"logo\", input.logo),\n ...present(\"description\", input.description),\n ...present(\"telephone\", input.telephone),\n ...present(\"email\", input.email),\n ...(sameAs.length > 0 ? { sameAs } : {}),\n };\n}\n\nexport interface WebsiteInput {\n name: string;\n /** The site's home URL. */\n url: string;\n id?: Text;\n description?: Text;\n /** BCP 47 language tag, `en-US`. */\n inLanguage?: Text;\n /** The publishing Organization's `@id`. */\n publisher?: Text;\n}\n\nexport interface WebsiteJsonLd extends JsonLdNode {\n \"@context\": typeof SCHEMA_ORG;\n \"@type\": \"WebSite\";\n name: string;\n url: string;\n description?: string;\n inLanguage?: string;\n publisher?: { \"@id\": string };\n}\n\n/** The site itself, pointing at its publisher by `@id`. */\nexport function websiteJsonLd(input: WebsiteInput): WebsiteJsonLd {\n return {\n \"@context\": SCHEMA_ORG,\n \"@type\": \"WebSite\",\n ...present(\"@id\", input.id),\n name: input.name,\n url: input.url,\n ...present(\"description\", input.description),\n ...present(\"inLanguage\", input.inLanguage),\n ...(input.publisher ? { publisher: { \"@id\": input.publisher } } : {}),\n };\n}\n\nexport interface BreadcrumbItem {\n name: string;\n /** Absolute URL. Leave it off the current page, the trail's last item. */\n url?: Text;\n}\n\nexport interface BreadcrumbListJsonLd extends JsonLdNode {\n \"@context\": typeof SCHEMA_ORG;\n \"@type\": \"BreadcrumbList\";\n itemListElement: Array<{ \"@type\": \"ListItem\"; position: number; name: string; item?: string }>;\n}\n\n/**\n * A page's trail, home first, numbered from 1. `null` for an empty trail, so\n * a page with none renders no script.\n */\nexport function breadcrumbListJsonLd(items: readonly BreadcrumbItem[]): BreadcrumbListJsonLd | null {\n if (items.length === 0) return null;\n return {\n \"@context\": SCHEMA_ORG,\n \"@type\": \"BreadcrumbList\",\n itemListElement: items.map((crumb, index) => ({\n \"@type\": \"ListItem\" as const,\n position: index + 1,\n name: crumb.name,\n ...present(\"item\", crumb.url),\n })),\n };\n}\n\nexport interface JsonLdGraph {\n \"@context\": typeof SCHEMA_ORG;\n \"@graph\": JsonLdInput[];\n}\n\n/**\n * Several nodes under one `@context`, the absent ones dropped. `null` when\n * none is left.\n */\nexport function jsonLdGraph<T extends readonly MaybeJsonLd[]>(...nodes: T): JsonLdGraph | null {\n const graph = nodes.flatMap((node) => {\n if (!node) return [];\n const { \"@context\": _context, ...rest } = node as JsonLdInput & { \"@context\"?: unknown };\n return [rest as JsonLdInput];\n });\n return graph.length > 0 ? { \"@context\": SCHEMA_ORG, \"@graph\": graph } : null;\n}\n\n/**\n * JSON for an inline `<script>`, with `<` escaped so a value holding\n * `</script>` cannot close the tag. The escape is still valid JSON.\n */\nexport function jsonLdHtml(data: unknown): string {\n return JSON.stringify(data).replace(/</g, \"\\\\u003c\");\n}\n\nexport interface JsonLdProps<T extends JsonLdInput = JsonLdInput> {\n /**\n * A node (any builder here, payload-blocks' `faqPageJsonLd`, or a site's\n * own), a graph, or a list of nodes rendered as one `@graph`. Nothing to\n * say (`null`, or a list of nulls) renders nothing.\n */\n data: MaybeJsonLd<T> | JsonLdGraph | readonly MaybeJsonLd<T>[];\n /** CSP nonce for the `<script>` tag. */\n nonce?: string;\n}\n\n/**\n * One `<script type=\"application/ld+json\">`. A Server Component: no client\n * boundary, no `\"use client\"`, so a page route renders it as it is.\n */\nexport function JsonLd<T extends JsonLdInput>({ data, nonce }: JsonLdProps<T>): ReactElement | null {\n const value = Array.isArray(data) ? jsonLdGraph(...(data as readonly MaybeJsonLd[])) : data;\n if (!value) return null;\n return createElement(\"script\", {\n type: \"application/ld+json\",\n nonce,\n dangerouslySetInnerHTML: { __html: jsonLdHtml(value) },\n });\n}\n"],"mappings":";;;;;AA8DA,SAAS,WAAW,MAA4B;AAC9C,QAAO,cAAc,KAAK,QAAQ,IAAI,QAAQ,KAAK,KAAK;;;;;;;;;;AAW1D,SAAgB,YACd,OACA,SACgB;CAChB,MAAM,EAAE,aAAa,OAAO,SAAS,EAAE,KAAK;CAC5C,MAAM,UAAU,SACd,QAAQ,UACJ,QAAQ,QAAQ,KAAK,WAAW,YAAY,QAAQ,QAAQ,MAAM,OAAO,CAAC,CAAC,GAC3E,CAAC,YAAY,QAAQ,KAAK,KAAK,CAAC,CAAC;CACvC,MAAM,wBAAQ,IAAI,KAA2B;CAC7C,MAAM,yBAAS,IAAI,KAAa;AAEhC,MAAK,MAAM,QAAQ,OAAO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WAAW,MAAuB;AAChD,QAAO,KAAK,UAAU,KAAK,CAAC,QAAQ,MAAM,UAAU;;;;;;AAkBtD,SAAgB,OAA8B,EAAE,MAAM,SAA8C;CAClG,MAAM,QAAQ,MAAM,QAAQ,KAAK,GAAG,YAAY,GAAI,KAAgC,GAAG;AACvF,KAAI,CAAC,MAAO,QAAO;AACnB,QAAO,cAAc,UAAU;EAC7B,MAAM;EACN;EACA,yBAAyB,EAAE,QAAQ,WAAW,MAAM,EAAE;EACvD,CAAC"}
|
package/dist/taxonomy.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as facetField, t as FacetEntry } from "./facet-field-
|
|
1
|
+
import { n as facetField, t as FacetEntry } from "./facet-field-Cd6lffed.mjs";
|
|
2
2
|
export { type FacetEntry, facetField };
|
package/dist/theme.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { _ as ThemeIdentityFallback, c as THEME_SLUG, d as ThemeDoc, f as ThemeHead, g as ResolvedThemeIdentity, h as ThemeUploadDoc, i as SystemColorKey, m as ThemeLibraryColorDoc, n as EditableTheme, p as ThemeHeadOptions, r as SYSTEM_COLOR_KEYS, t as CreateThemeOptions, u as ThemeColorDoc, v as resolveThemeIdentity } from "./types-
|
|
2
|
-
import { _ as deleteLibraryColor, a as PageEditorSystemKey, c as pageEditorTokens, f as colorTokenField, g as rewriteColorTokens, h as findColorTokens, i as PAGE_EDITOR_SYSTEM_KEYS, l as themeLibraryFromDoc, m as ColorTokenHit, n as ColorSwatch, o as pageEditorLooks, p as lookField, r as LookOption, s as pageEditorSwatches, t as THEME_PREVIEW_BREAKPOINTS, v as rewriteColorToken, y as themeColorKeys } from "./preview-
|
|
3
|
-
import { t as LocaleRead } from "./locale-
|
|
4
|
-
import { n as getPublishedIdentity, r as getPublishedTheme } from "./published-
|
|
1
|
+
import { _ as ThemeIdentityFallback, c as THEME_SLUG, d as ThemeDoc, f as ThemeHead, g as ResolvedThemeIdentity, h as ThemeUploadDoc, i as SystemColorKey, m as ThemeLibraryColorDoc, n as EditableTheme, p as ThemeHeadOptions, r as SYSTEM_COLOR_KEYS, t as CreateThemeOptions, u as ThemeColorDoc, v as resolveThemeIdentity } from "./types-B1MmE-L3.mjs";
|
|
2
|
+
import { _ as deleteLibraryColor, a as PageEditorSystemKey, c as pageEditorTokens, f as colorTokenField, g as rewriteColorTokens, h as findColorTokens, i as PAGE_EDITOR_SYSTEM_KEYS, l as themeLibraryFromDoc, m as ColorTokenHit, n as ColorSwatch, o as pageEditorLooks, p as lookField, r as LookOption, s as pageEditorSwatches, t as THEME_PREVIEW_BREAKPOINTS, v as rewriteColorToken, y as themeColorKeys } from "./preview-B69Dhi8T.mjs";
|
|
3
|
+
import { t as LocaleRead } from "./locale-tnKLkutC.mjs";
|
|
4
|
+
import { n as getPublishedIdentity, r as getPublishedTheme } from "./published-2I-k6zEo.mjs";
|
|
5
5
|
import { ShadeStep, ThemeConfig } from "@bison-lab/tokens";
|
|
6
6
|
|
|
7
7
|
//#region src/theme/map.d.ts
|
package/dist/theme.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { l as stateFromColorDoc, n as SYSTEM_COLOR_KEYS, o as THEME_SLUG, t as resolveThemeIdentity, u as themeConfigFromDoc } from "./identity-CN6EOeDM.mjs";
|
|
2
2
|
import { a as pageEditorLooks, c as themeLibraryFromDoc, d as deleteLibraryColor, f as rewriteColorToken, i as PAGE_EDITOR_SYSTEM_KEYS, l as findColorTokens, n as colorTokenField, o as pageEditorSwatches, p as themeColorKeys, r as lookField, s as pageEditorTokens, t as THEME_PREVIEW_BREAKPOINTS, u as rewriteColorTokens } from "./preview-Br1SQCKn.mjs";
|
|
3
|
-
import { n as getPublishedTheme, t as getPublishedIdentity } from "./published-
|
|
3
|
+
import { n as getPublishedTheme, t as getPublishedIdentity } from "./published-B80KqlcU.mjs";
|
|
4
4
|
import { fontFaceCss, fontPreloads } from "@bison-lab/fonts";
|
|
5
5
|
import { buildThemeCss, generateNamedScaleCSS, lookBindingCss, themeFontIds } from "@bison-lab/tokens";
|
|
6
6
|
//#region src/theme/look-css.ts
|
|
@@ -52,4 +52,4 @@ declare function documentTitle(siteName: string, pageTitle: string): string;
|
|
|
52
52
|
declare function titleTemplate(siteName: string): string;
|
|
53
53
|
//#endregion
|
|
54
54
|
export { SeoImageSize as a, SeoImageDoc as i, titleTemplate as n, SeoImageValue as o, MediaId as r, SeoMeta as s, documentTitle as t };
|
|
55
|
-
//# sourceMappingURL=title-
|
|
55
|
+
//# sourceMappingURL=title-BVV3o329.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"title-
|
|
1
|
+
{"version":3,"file":"title-BVV3o329.d.mts","names":[],"sources":["../src/seo/types.ts","../src/seo/title.ts"],"mappings":";;KACY,OAAA;;UAGK,YAAA;EACf,GAAA;EACA,KAAA;EACA,MAAA;AAAA;;;;;;;;AAWF;UAAiB,WAAA;EACf,GAAA;EACA,GAAA;EACA,KAAA;EACA,MAAA;EACA,KAAA;IAAA,CAAW,IAAA,WAAe,YAAA;EAAA;AAAA;;KAIhB,aAAA,GAAgB,OAAA,GAAU,WAAA;;AAAtC;;;UAMiB,OAAA;EACf,KAAA;EACA,WAAA;EACA,KAAA,GAAQ,aAAA;EACR,OAAA;AAAA;;;;AApCF;;;;;iBCKgB,aAAA,CAAc,QAAA,UAAkB,SAAA;;;;;iBAQhC,aAAA,CAAc,QAAA"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { o as anthropicTranslator } from "./strings-Fd7kUCT7.mjs";
|
|
3
|
-
import { t as fillMessages } from "./messages-
|
|
3
|
+
import { t as fillMessages } from "./messages-XFoL9RtF.mjs";
|
|
4
4
|
import { existsSync, readFileSync, writeFileSync } from "node:fs";
|
|
5
5
|
import { basename, resolve } from "node:path";
|
|
6
6
|
import { parseArgs } from "node:util";
|
package/dist/translate.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $ as BisonTranslationKind, A as usageThisMonth, B as KeyCheck, C as RATE_LIMIT_STREAK, D as monthKey, E as UsageMonth, F as resolveApiKey, G as containsWord, H as TRANSLATE_MODEL_PRICES, I as AnthropicMessagesClient, J as parseJsonArray, K as estimateCost, L as AnthropicTranslatorOptions, M as ResolvedKey, N as decryptApiKey, O as recordUsage, P as encryptApiKey, Q as BISON_TRANSLATION_CONTEXT, R as DEFAULT_TRANSLATE_MODEL, S as FAILURE_ADVICE, T as TRANSLATION_USAGE_SLUG, U as TranslatorCallEvent, V as ModelPrice, W as anthropicTranslator, X as verifyAnthropicKey, Y as translationSystemPrompt, Z as AutoTranslateOptions, _ as TranslationSettingsDoc, a as translation, at as TranslatedEntity, b as resolveModel, c as KeyStatus, ct as classifyAnthropicError, d as TRANSLATION_GRANT, et as BisonTranslationMarker, f as TRANSLATION_KEY_PANEL, g as TranslationModelChoice, h as TRANSLATION_STATUS_BAR, i as hasLocalizedFields, it as TranslateSite, j as KeySource, k as usageHistory, l as ResolvedTranslationSettings, m as TRANSLATION_STATE_SLUG, n as TranslationOptions, nt as TranslateLocaleResult, o as TranslationStatus, ot as Translator, p as TRANSLATION_SETTINGS_SLUG, q as modelPrice, r as applyTranslation, rt as TranslateRequest, s as translationSettingsEndpoints, st as TranslationFailureKind, t as TranslationEntityHint, tt as Doc, u as TRANSLATION_ACTIVITY_PANEL, v as invalidateTranslationSettings, w as RecordedFailure, x as siteFromInstructions, y as readTranslationSettings, z as ECONOMY_TRANSLATE_MODEL } from "./capability-
|
|
1
|
+
import { $ as BisonTranslationKind, A as usageThisMonth, B as KeyCheck, C as RATE_LIMIT_STREAK, D as monthKey, E as UsageMonth, F as resolveApiKey, G as containsWord, H as TRANSLATE_MODEL_PRICES, I as AnthropicMessagesClient, J as parseJsonArray, K as estimateCost, L as AnthropicTranslatorOptions, M as ResolvedKey, N as decryptApiKey, O as recordUsage, P as encryptApiKey, Q as BISON_TRANSLATION_CONTEXT, R as DEFAULT_TRANSLATE_MODEL, S as FAILURE_ADVICE, T as TRANSLATION_USAGE_SLUG, U as TranslatorCallEvent, V as ModelPrice, W as anthropicTranslator, X as verifyAnthropicKey, Y as translationSystemPrompt, Z as AutoTranslateOptions, _ as TranslationSettingsDoc, a as translation, at as TranslatedEntity, b as resolveModel, c as KeyStatus, ct as classifyAnthropicError, d as TRANSLATION_GRANT, et as BisonTranslationMarker, f as TRANSLATION_KEY_PANEL, g as TranslationModelChoice, h as TRANSLATION_STATUS_BAR, i as hasLocalizedFields, it as TranslateSite, j as KeySource, k as usageHistory, l as ResolvedTranslationSettings, m as TRANSLATION_STATE_SLUG, n as TranslationOptions, nt as TranslateLocaleResult, o as TranslationStatus, ot as Translator, p as TRANSLATION_SETTINGS_SLUG, q as modelPrice, r as applyTranslation, rt as TranslateRequest, s as translationSettingsEndpoints, st as TranslationFailureKind, t as TranslationEntityHint, tt as Doc, u as TRANSLATION_ACTIVITY_PANEL, v as invalidateTranslationSettings, w as RecordedFailure, x as siteFromInstructions, y as readTranslationSettings, z as ECONOMY_TRANSLATE_MODEL } from "./capability-NlorUIta.mjs";
|
|
2
2
|
import { Block, CollectionAfterChangeHook, CollectionConfig, Config, Endpoint, Field, GlobalConfig, Payload, PayloadRequest, Plugin, SanitizedConfig } from "payload";
|
|
3
3
|
|
|
4
4
|
//#region src/translate/plugin.d.ts
|
package/dist/translate.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { $ as LIBRARY_DEFAULT_LOCALE, A as TRANSLATE_NOW, B as TRANSLATION_STATUS_BAR, C as isAutosave, D as shouldSkipUndraftedTranslation, E as shouldSkipDraftedTranslation, F as TRANSLATION_ACTIVITY_PANEL, G as FAILURE_ADVICE, H as readTranslationSettings, I as TRANSLATION_GRANT, J as monthKey, K as RATE_LIMIT_STREAK, L as TRANSLATION_KEY_PANEL, M as BISON_TRANSLATION_CONTEXT, N as readTranslateState, O as TRANSACTION_TIMEOUT_MS, P as withTranslator, Q as ACTIVE_LOCALES_CACHE_MS, R as TRANSLATION_SETTINGS_SLUG, S as startJob, T as localizedCopyUnchanged, U as resolveModel, V as invalidateTranslationSettings, W as siteFromInstructions, X as usageHistory, Y as recordUsage, Z as usageThisMonth, _ as frozenWordForce, a as MESSAGES_CACHE_MS, at as invalidateActiveLocales, b as runJobSlice, c as importMessages, ct as encryptApiKey, d as unflattenMessages, dt as sameRow, et as LIBRARY_LOCALES, f as translationSettingsEndpoints, ft as translationJob, g as estimateJob, h as claimJob, i as INTERFACE_TEXT_SLUG, it as inactiveLocaleRedirect, j as translateDocument, k as runAfterCommit, l as interfaceTextGlobal, lt as resolveApiKey, m as TRANSLATION_JOBS_SLUG, n as hasLocalizedFields, nt as activeAlternates, o as flattenMessages, ot as withLibraryLocales, p as LEASE_MS, q as TRANSLATION_USAGE_SLUG, r as translation, rt as activeLocales, s as getMessages, st as decryptApiKey, t as applyTranslation, tt as LIBRARY_LOCALE_CODES, u as invalidateMessages, ut as collectLocalizedStrings, v as jobView, w as draftedTranslationDecision, x as startBackfill, y as resumeStaleJobs, z as TRANSLATION_STATE_SLUG } from "./capability-CAXtTcSU.mjs";
|
|
2
2
|
import { a as TRANSLATE_MODEL_PRICES, c as estimateCost, d as translationSystemPrompt, f as verifyAnthropicKey, i as ECONOMY_TRANSLATE_MODEL, l as modelPrice, n as translateStrings, o as anthropicTranslator, p as classifyAnthropicError, r as DEFAULT_TRANSLATE_MODEL, s as containsWord, t as isTranslatorConfigured, u as parseJsonArray } from "./strings-Fd7kUCT7.mjs";
|
|
3
|
-
import { t as fillMessages } from "./messages-
|
|
3
|
+
import { t as fillMessages } from "./messages-XFoL9RtF.mjs";
|
|
4
4
|
//#region src/translate/plugin.ts
|
|
5
5
|
function hints(list) {
|
|
6
6
|
return (list ?? []).map((entry) => typeof entry === "string" ? [entry, {}] : [entry.slug, entry.context ? { context: entry.context } : {}]);
|
|
@@ -258,4 +258,4 @@ declare const SYSTEM_COLOR_KEYS: readonly ["primary", "secondary", "accent", "hi
|
|
|
258
258
|
type SystemColorKey = (typeof SYSTEM_COLOR_KEYS)[number];
|
|
259
259
|
//#endregion
|
|
260
260
|
export { rewriteColorUsages as C, findColorUsages as S, ThemeIdentityFallback as _, THEME_APPEARANCE_SLUG as a, ColorUsagesList as b, THEME_SLUG as c, ThemeDoc as d, ThemeHead as f, ResolvedThemeIdentity as g, ThemeUploadDoc as h, SystemColorKey as i, THEME_TYPOGRAPHY_SLUG as l, ThemeLibraryColorDoc as m, EditableTheme as n, THEME_COLORS_SLUG as o, ThemeHeadOptions as p, SYSTEM_COLOR_KEYS as r, THEME_IDENTITY_SLUG as s, CreateThemeOptions as t, ThemeColorDoc as u, resolveThemeIdentity as v, ColorUsagesOption as x, ColorUsage as y };
|
|
261
|
-
//# sourceMappingURL=types-
|
|
261
|
+
//# sourceMappingURL=types-B1MmE-L3.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types-
|
|
1
|
+
{"version":3,"file":"types-B1MmE-L3.d.mts","names":[],"sources":["../src/theme/color-usages.ts","../src/theme/identity.ts","../src/theme/types.ts"],"mappings":";;;;;UAOiB,eAAA;EACf,WAAA;EACA,OAAA;AAAA;;;;AAQF;;KAAY,iBAAA,UAA2B,eAAA;AAAA,UAEtB,UAAA;EACf,UAAA;EACA,MAAA;EACA,EAAA;EACA,IAAA;EACA,KAAA;AAAA;AAAA,KAGG,UAAA;EAAe,IAAA,EAAM,MAAA;EAA2B,UAAA;EAAqB,IAAA;AAAA;AAAA,KAErE,OAAA;EAAY,IAAA;AAAA;AAAA,UAEA,iBAAA;EACf,IAAA,GAAO,IAAA;IACL,UAAA;IACA,KAAA;IACA,KAAA;IACA,KAAA;IACA,IAAA;IACA,cAAA;EAAA,MACI,OAAA,CAAQ,UAAA;EACd,UAAA,GAAa,IAAA;IACX,IAAA;IACA,KAAA;IACA,KAAA;IACA,cAAA;EAAA,MACI,OAAA,CAAQ,MAAA,oBAA0B,QAAA;E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,EAAO,WAAA,EAAa,GAAA,EAAK,QAAA,YAAoB,OAAA;EF9BlD;;;;;;;;EEuCR,WAAA,GAAc,iBAAA;AAAA;AAAA,UAGC,gBAAA;EACf,YAAA;EACA,SAAA;EACA,QAAA,GAAW,qBAAA;ED/II;;;;ECoJf,OAAA,GAAU,oBAAA;AAAA;AAAA,UAGK,SAAA;EACf,GAAA;EACA,QAAA;IAAY,IAAA;IAAc,IAAA;EAAA;EAC1B,QAAA,GAAW,qBAAA;AAAA;AAAA,cAGA,UAAA;AAAA,cACA,iBAAA;AAAA,cACA,qBAAA;AAAA,cACA,qBAAA;AAAA,cACA,mBAAA;AAAA,cAEA,iBAAA;AAAA,KASD,cAAA,WAAyB,iBAAA"}
|
|
@@ -300,4 +300,4 @@ async function captureWireframes(page, previews, { selector = WIREFRAME_ROOT } =
|
|
|
300
300
|
//#endregion
|
|
301
301
|
export { captureWireframes as a, wireframeSvg as c, WIREFRAME_WIDTH as i, WIREFRAME_ROOT as n, extractWireframe as o, WIREFRAME_VIEWPORT as r, svgDataUri as s, WIREFRAME_HEIGHT as t };
|
|
302
302
|
|
|
303
|
-
//# sourceMappingURL=wireframe-
|
|
303
|
+
//# sourceMappingURL=wireframe-Ba65SOj8.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wireframe-CXorKFU_.mjs","names":[],"sources":["../src/wireframe.ts"],"sourcesContent":["/**\n * @deprecated since 4.16: the Add Block drawer shows screenshots now\n * (`@bison-lab/payload-core/block-thumbnails`, `bison-block-thumbnails`).\n * Kept working for this release so a site that calls it does not break;\n * it goes in the next major.\n *\n * Black-and-white wireframes of Block library samples, for Payload's Add\n * Block drawer (`admin.images.thumbnail`). React-free and Payload-free: a\n * script drives a browser to each block's preview (`previewPath(slug)`),\n * `extractWireframe` reads where the headings, text, images, buttons and\n * surfaces sit, and `wireframeSvg` draws those boxes as greyscale shapes.\n * No copy and no brand color reach the picture, so it does not go stale\n * when Theme changes; rerun it when a block's layout does.\n */\n\n/** Payload's drawer card is 3:2; 480 × 320 is the size its docs suggest. */\nexport const WIREFRAME_WIDTH = 480;\nexport const WIREFRAME_HEIGHT = 320;\n\n/** Desktop width, so the picture is the layout most visitors see. */\nexport const WIREFRAME_VIEWPORT = { width: 1280, height: 900 } as const;\n\n/** The element the Block library preview wraps each sample in (`BlockLibraryIsland`). */\nexport const WIREFRAME_ROOT = \"[data-block-library-island]\";\n\n/** `light` draws light marks (they sit on a dark surface); `dark` draws dark ones (on paper). */\nexport type WireframeTone = \"light\" | \"dark\";\n\nexport type WireframeShape =\n /** A band or panel the block paints. `dark` is a dark fill; `light` a pale tint. */\n | { kind: \"surface\"; x: number; y: number; w: number; h: number; tone: WireframeTone }\n /** A bordered card with no fill of its own. */\n | { kind: \"frame\"; x: number; y: number; w: number; h: number; tone: WireframeTone }\n | { kind: \"image\"; x: number; y: number; w: number; h: number }\n | { kind: \"heading\" | \"text\" | \"icon\"; x: number; y: number; w: number; h: number; tone: WireframeTone }\n | { kind: \"button\"; x: number; y: number; w: number; h: number; filled: boolean; tone: WireframeTone }\n | { kind: \"field\"; x: number; y: number; w: number; h: number };\n\nexport type WireframeCapture = { width: number; height: number; shapes: WireframeShape[] };\n\n/**\n * Runs in the page (Playwright's `page.evaluate`), so it closes over\n * nothing: every helper is declared inside. Boxes are relative to the\n * element `selector` names (the preview's island), in CSS pixels.\n */\nexport function extractWireframe(selector: string): WireframeCapture {\n const root = document.querySelector(selector);\n // No sample on the page (a sign-in wall, a 404, a wrong selector): refuse,\n // rather than draw whatever page came back as the block's picture.\n if (!root) throw new Error(`no element matches ${selector}`);\n const origin = root.getBoundingClientRect();\n const shapes: WireframeShape[] = [];\n const taken = new Set<Element>();\n\n const parseColor = (value: string): [number, number, number, number] | null => {\n const match = value.match(/rgba?\\(([^)]+)\\)/);\n if (!match) return null;\n const parts = match[1]!.split(/[\\s,/]+/).filter(Boolean).map(Number);\n return [parts[0] ?? 0, parts[1] ?? 0, parts[2] ?? 0, parts[3] ?? 1];\n };\n const luminance = (rgb: [number, number, number, number]) => (0.2126 * rgb[0] + 0.7152 * rgb[1] + 0.0722 * rgb[2]) / 255;\n const style = (element: Element) => getComputedStyle(element);\n const shown = (element: Element) => {\n const css = style(element);\n return css.display !== \"none\" && css.visibility !== \"hidden\" && Number(css.opacity || \"1\") > 0.05;\n };\n const box = (element: Element) => {\n const rect = element.getBoundingClientRect();\n return {\n x: Math.round(rect.left - origin.left),\n y: Math.round(rect.top - origin.top),\n w: Math.round(rect.width),\n h: Math.round(rect.height),\n };\n };\n /** The fill an element paints, if any: a solid color, or a gradient's first stop. */\n const fillOf = (element: Element) => {\n const css = style(element);\n const solid = parseColor(css.backgroundColor);\n if (solid && solid[3] >= 0.5) return solid;\n if (css.backgroundImage.includes(\"gradient\")) return parseColor(css.backgroundImage);\n return null;\n };\n /** Light marks when the nearest painted ancestor is dark. */\n const toneUnder = (element: Element): WireframeTone => {\n for (let node: Element | null = element; node; node = node.parentElement) {\n const fill = fillOf(node);\n if (fill) return luminance(fill) < 0.45 ? \"light\" : \"dark\";\n if (node === root) break;\n }\n return \"dark\";\n };\n const insideTaken = (element: Element | null) => {\n for (let node = element; node && node !== root; node = node.parentElement) if (taken.has(node)) return true;\n return false;\n };\n\n const page = parseColor(style(document.body).backgroundColor);\n const pageLum = page && page[3] >= 0.5 ? luminance(page) : 1;\n\n const elements = root.querySelectorAll(\"*\");\n for (const element of Array.from(elements)) {\n if (insideTaken(element.parentElement) || !shown(element)) continue;\n const at = box(element);\n if (at.w < 2 || at.h < 2) continue;\n const tag = element.tagName.toLowerCase();\n const css = style(element);\n\n if (tag === \"img\" || tag === \"picture\" || tag === \"video\" || tag === \"canvas\" || tag === \"iframe\") {\n shapes.push({ kind: \"image\", ...at });\n taken.add(element);\n continue;\n }\n if (tag === \"svg\") {\n if (at.w >= 48 && at.h >= 48) shapes.push({ kind: \"image\", ...at });\n else {\n const color = parseColor(css.color);\n shapes.push({ kind: \"icon\", ...at, tone: color && luminance(color) > 0.5 ? \"light\" : \"dark\" });\n }\n taken.add(element);\n continue;\n }\n if (tag === \"input\" || tag === \"select\" || tag === \"textarea\") {\n if ((element as HTMLInputElement).type !== \"hidden\") shapes.push({ kind: \"field\", ...at });\n taken.add(element);\n continue;\n }\n\n const fill = fillOf(element);\n const border = parseFloat(css.borderTopWidth) >= 1 && css.borderTopStyle !== \"none\";\n const action = tag === \"a\" || tag === \"button\" || element.getAttribute(\"role\") === \"button\";\n if (action && (fill || border) && at.h >= 24 && at.h <= 80 && at.w <= 480) {\n shapes.push({ kind: \"button\", ...at, filled: Boolean(fill), tone: toneUnder(element.parentElement ?? element) });\n taken.add(element);\n continue;\n }\n if (/url\\(/.test(css.backgroundImage) && at.w >= 48 && at.h >= 48) {\n shapes.push({ kind: \"image\", ...at });\n continue;\n }\n if (fill && at.w >= 160 && at.h >= 80) {\n const lum = luminance(fill);\n if (lum < 0.45) shapes.push({ kind: \"surface\", ...at, tone: \"dark\" });\n else if (Math.abs(lum - pageLum) > 0.03) shapes.push({ kind: \"surface\", ...at, tone: \"light\" });\n continue;\n }\n if (!fill && border && at.w >= 120 && at.h >= 60) {\n shapes.push({ kind: \"frame\", ...at, tone: toneUnder(element) });\n }\n }\n\n // Text, one bar per rendered line, merged along the line.\n const walker = document.createTreeWalker(root, NodeFilter.SHOW_TEXT);\n const lines: WireframeShape[] = [];\n for (let node = walker.nextNode(); node; node = walker.nextNode()) {\n const parent = node.parentElement;\n if (!parent || !node.textContent?.trim() || insideTaken(parent) || !shown(parent)) continue;\n const css = style(parent);\n const size = parseFloat(css.fontSize) || 16;\n const heading = Boolean(parent.closest(\"h1,h2,h3,h4,h5,h6\")) || size >= 22;\n const color = parseColor(css.color);\n const tone: WireframeTone = color && luminance(color) > 0.5 ? \"light\" : \"dark\";\n const range = document.createRange();\n range.selectNodeContents(node);\n for (const rect of Array.from(range.getClientRects())) {\n if (rect.width < 2 || rect.height < 2) continue;\n const bar = Math.max(3, Math.round(size * (heading ? 0.62 : 0.5)));\n const y = Math.round(rect.top - origin.top + (rect.height - bar) / 2);\n const x = Math.round(rect.left - origin.left);\n const w = Math.round(rect.width);\n const kind = heading ? \"heading\" : \"text\";\n const previous = lines[lines.length - 1];\n if (\n previous &&\n previous.kind === kind &&\n \"tone\" in previous &&\n previous.tone === tone &&\n Math.abs(previous.y - y) <= 3 &&\n x - (previous.x + previous.w) <= 14\n ) {\n previous.w = Math.max(previous.x + previous.w, x + w) - previous.x;\n continue;\n }\n lines.push({ kind, x, y, w, h: bar, tone });\n }\n }\n\n return { width: Math.round(origin.width), height: Math.round(origin.height), shapes: [...shapes, ...lines] };\n}\n\nconst PAPER = \"#ffffff\";\nconst INK = \"#262626\";\nconst LIGHT_INK = \"#f5f5f5\";\nconst PALETTE = {\n frame: \"#d4d4d4\",\n imageFill: \"#e5e5e5\",\n imageLine: \"#a3a3a3\",\n tint: \"#f0f0f0\",\n textOnPaper: \"#a3a3a3\",\n textOnDark: \"#8a8a8a\",\n buttonOnPaper: \"#525252\",\n buttonOnDark: \"#d4d4d4\",\n} as const;\n\nconst DRAW_ORDER: Record<WireframeShape[\"kind\"], number> = {\n surface: 0,\n frame: 1,\n image: 2,\n field: 3,\n button: 4,\n icon: 5,\n heading: 6,\n text: 7,\n};\n\nconst n = (value: number) => String(Math.round(value * 10) / 10);\n\n/**\n * A capture as a 480 × 320 greyscale SVG. The block is scaled to the\n * width; a short block is centered, a tall one keeps its top and is clipped.\n * Surfaces first, text last, so marks sit on what they sit on in the page.\n */\nexport function wireframeSvg(capture: WireframeCapture): string {\n const scale = capture.width > 0 ? WIREFRAME_WIDTH / capture.width : 1;\n const drawn = capture.height * scale;\n const offset = drawn < WIREFRAME_HEIGHT ? (WIREFRAME_HEIGHT - drawn) / 2 : 0;\n const at = (shape: { x: number; y: number; w: number; h: number }) => ({\n x: n(shape.x * scale),\n y: n(shape.y * scale + offset),\n w: n(Math.max(shape.w * scale, 1)),\n h: n(Math.max(shape.h * scale, 1)),\n });\n const shapes = [...capture.shapes].sort((a, b) => DRAW_ORDER[a.kind] - DRAW_ORDER[b.kind]);\n\n const marks = shapes.map((shape) => {\n const { x, y, w, h } = at(shape);\n const r = (radius: number) => `rx='${n(radius)}'`;\n switch (shape.kind) {\n case \"surface\":\n return `<rect data-k='surface' x='${x}' y='${y}' width='${w}' height='${h}' fill='${shape.tone === \"dark\" ? INK : PALETTE.tint}'/>`;\n case \"frame\":\n return `<rect data-k='frame' x='${x}' y='${y}' width='${w}' height='${h}' ${r(4)} fill='none' stroke='${shape.tone === \"light\" ? PALETTE.textOnDark : PALETTE.frame}'/>`;\n case \"image\": {\n const x2 = n(Number(x) + Number(w));\n const y2 = n(Number(y) + Number(h));\n return (\n `<rect data-k='image' x='${x}' y='${y}' width='${w}' height='${h}' ${r(3)} fill='${PALETTE.imageFill}' stroke='${PALETTE.imageLine}'/>` +\n `<path data-k='image-x' d='M${x} ${y}L${x2} ${y2}M${x2} ${y}L${x} ${y2}' stroke='${PALETTE.imageLine}' stroke-width='0.75'/>`\n );\n }\n case \"field\":\n return `<rect data-k='field' x='${x}' y='${y}' width='${w}' height='${h}' ${r(3)} fill='${PAPER}' stroke='${PALETTE.imageLine}'/>`;\n case \"button\": {\n const color = shape.tone === \"light\" ? PALETTE.buttonOnDark : PALETTE.buttonOnPaper;\n const pill = r(Number(h) / 2);\n return shape.filled\n ? `<rect data-k='button' x='${x}' y='${y}' width='${w}' height='${h}' ${pill} fill='${color}'/>`\n : `<rect data-k='button' x='${x}' y='${y}' width='${w}' height='${h}' ${pill} fill='none' stroke='${color}' stroke-width='1.25'/>`;\n }\n case \"icon\":\n return `<circle data-k='icon' cx='${n(Number(x) + Number(w) / 2)}' cy='${n(Number(y) + Number(h) / 2)}' r='${n(Math.min(Number(w), Number(h)) / 2)}' fill='${shape.tone === \"light\" ? PALETTE.textOnDark : PALETTE.textOnPaper}'/>`;\n case \"heading\":\n return `<rect data-k='heading' x='${x}' y='${y}' width='${w}' height='${h}' ${r(Number(h) / 2)} fill='${shape.tone === \"light\" ? LIGHT_INK : INK}'/>`;\n case \"text\":\n return `<rect data-k='text' x='${x}' y='${y}' width='${w}' height='${h}' ${r(Number(h) / 2)} fill='${shape.tone === \"light\" ? PALETTE.textOnDark : PALETTE.textOnPaper}'/>`;\n }\n });\n\n return (\n `<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 ${WIREFRAME_WIDTH} ${WIREFRAME_HEIGHT}'>` +\n `<defs><clipPath id='c'><rect width='${WIREFRAME_WIDTH}' height='${WIREFRAME_HEIGHT}'/></clipPath></defs>` +\n `<rect width='${WIREFRAME_WIDTH}' height='${WIREFRAME_HEIGHT}' fill='${PAPER}'/>` +\n `<g clip-path='url(#c)'>` +\n marks.join(\"\") +\n `</g></svg>`\n );\n}\n\n/**\n * An SVG as a `data:` URI for `admin.images.thumbnail`. Only the characters\n * a URI cannot carry are escaped, so the string stays close to the SVG's\n * own size; the SVG must use single quotes.\n */\nexport function svgDataUri(svg: string): string {\n const body = svg\n .replace(/\"/g, \"'\")\n .replace(/\\s+/g, \" \")\n .replace(/[%#<>{}|\\\\^`\\r\\n]/g, (char) => `%${char.charCodeAt(0).toString(16).toUpperCase().padStart(2, \"0\")}`);\n return `data:image/svg+xml,${body}`;\n}\n\n/** The slice of Playwright's `Page` this needs; a site passes its own. */\nexport interface WireframePage {\n setViewportSize(size: { width: number; height: number }): Promise<void>;\n /** Playwright's `Response` (or `null`); a status of 400 or more refuses the capture. */\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}\n\n/**\n * Opens each preview at desktop width, waits for its fonts, and returns\n * one SVG per slug. The page must already be signed in when the preview\n * route needs it (the Block library's does). A preview that answers 400 or\n * more, or renders no element `selector` matches, throws: nothing is\n * written for a page that did not draw its sample.\n */\nexport async function captureWireframes(\n page: WireframePage,\n previews: readonly { slug: string; url: string }[],\n { selector = WIREFRAME_ROOT }: { selector?: string } = {},\n): Promise<Record<string, string>> {\n await page.setViewportSize({ ...WIREFRAME_VIEWPORT });\n const out: Record<string, string> = {};\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(() => document.fonts.ready.then(() => undefined), undefined);\n let capture: WireframeCapture;\n try {\n capture = await page.evaluate(extractWireframe, selector);\n } catch (error) {\n throw new Error(`${slug}: ${url} has no ${selector}; it did not render the sample`, { cause: error });\n }\n out[slug] = wireframeSvg(capture);\n }\n return out;\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAgBA,MAAa,kBAAkB;AAC/B,MAAa,mBAAmB;;AAGhC,MAAa,qBAAqB;CAAE,OAAO;CAAM,QAAQ;CAAK;;AAG9D,MAAa,iBAAiB;;;;;;AAsB9B,SAAgB,iBAAiB,UAAoC;CACnE,MAAM,OAAO,SAAS,cAAc,SAAS;AAG7C,KAAI,CAAC,KAAM,OAAM,IAAI,MAAM,sBAAsB,WAAW;CAC5D,MAAM,SAAS,KAAK,uBAAuB;CAC3C,MAAM,SAA2B,EAAE;CACnC,MAAM,wBAAQ,IAAI,KAAc;CAEhC,MAAM,cAAc,UAA2D;EAC7E,MAAM,QAAQ,MAAM,MAAM,mBAAmB;AAC7C,MAAI,CAAC,MAAO,QAAO;EACnB,MAAM,QAAQ,MAAM,GAAI,MAAM,UAAU,CAAC,OAAO,QAAQ,CAAC,IAAI,OAAO;AACpE,SAAO;GAAC,MAAM,MAAM;GAAG,MAAM,MAAM;GAAG,MAAM,MAAM;GAAG,MAAM,MAAM;GAAE;;CAErE,MAAM,aAAa,SAA2C,QAAS,IAAI,KAAK,QAAS,IAAI,KAAK,QAAS,IAAI,MAAM;CACrH,MAAM,SAAS,YAAqB,iBAAiB,QAAQ;CAC7D,MAAM,SAAS,YAAqB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,UACA,EAAE,WAAW,mBAA0C,EAAE,EACxB;AACjC,OAAM,KAAK,gBAAgB,EAAE,GAAG,oBAAoB,CAAC;CACrD,MAAM,MAA8B,EAAE;AACtC,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,SAAS,MAAM,MAAM,WAAW,KAAA,EAAU,EAAE,KAAA,EAAU;EAChF,IAAI;AACJ,MAAI;AACF,aAAU,MAAM,KAAK,SAAS,kBAAkB,SAAS;WAClD,OAAO;AACd,SAAM,IAAI,MAAM,GAAG,KAAK,IAAI,IAAI,UAAU,SAAS,iCAAiC,EAAE,OAAO,OAAO,CAAC;;AAEvG,MAAI,QAAQ,aAAa,QAAQ;;AAEnC,QAAO"}
|
|
1
|
+
{"version":3,"file":"wireframe-Ba65SOj8.mjs","names":[],"sources":["../src/wireframe.ts"],"sourcesContent":["/**\n * @deprecated since 4.16: the Add Block drawer shows screenshots now\n * (`@bison-lab/payload-core/block-thumbnails`, `bison-block-thumbnails`).\n * Kept working for this release so a site that calls it does not break;\n * it goes in the next major.\n *\n * Black-and-white wireframes of Block library samples, for Payload's Add\n * Block drawer (`admin.images.thumbnail`). React-free and Payload-free: a\n * script drives a browser to each block's preview (`previewPath(slug)`),\n * `extractWireframe` reads where the headings, text, images, buttons and\n * surfaces sit, and `wireframeSvg` draws those boxes as greyscale shapes.\n * No copy and no brand color reach the picture, so it does not go stale\n * when Theme changes; rerun it when a block's layout does.\n */\n\n/** Payload's drawer card is 3:2; 480 × 320 is the size its docs suggest. */\nexport const WIREFRAME_WIDTH = 480;\nexport const WIREFRAME_HEIGHT = 320;\n\n/** Desktop width, so the picture is the layout most visitors see. */\nexport const WIREFRAME_VIEWPORT = { width: 1280, height: 900 } as const;\n\n/** The element the Block library preview wraps each sample in (`BlockLibraryIsland`). */\nexport const WIREFRAME_ROOT = \"[data-block-library-island]\";\n\n/** `light` draws light marks (they sit on a dark surface); `dark` draws dark ones (on paper). */\nexport type WireframeTone = \"light\" | \"dark\";\n\nexport type WireframeShape =\n /** A band or panel the block paints. `dark` is a dark fill; `light` a pale tint. */\n | { kind: \"surface\"; x: number; y: number; w: number; h: number; tone: WireframeTone }\n /** A bordered card with no fill of its own. */\n | { kind: \"frame\"; x: number; y: number; w: number; h: number; tone: WireframeTone }\n | { kind: \"image\"; x: number; y: number; w: number; h: number }\n | { kind: \"heading\" | \"text\" | \"icon\"; x: number; y: number; w: number; h: number; tone: WireframeTone }\n | { kind: \"button\"; x: number; y: number; w: number; h: number; filled: boolean; tone: WireframeTone }\n | { kind: \"field\"; x: number; y: number; w: number; h: number };\n\nexport type WireframeCapture = { width: number; height: number; shapes: WireframeShape[] };\n\n/**\n * Runs in the page (Playwright's `page.evaluate`), so it closes over\n * nothing: every helper is declared inside. Boxes are relative to the\n * element `selector` names (the preview's island), in CSS pixels.\n */\nexport function extractWireframe(selector: string): WireframeCapture {\n const root = document.querySelector(selector);\n // No sample on the page (a sign-in wall, a 404, a wrong selector): refuse,\n // rather than draw whatever page came back as the block's picture.\n if (!root) throw new Error(`no element matches ${selector}`);\n const origin = root.getBoundingClientRect();\n const shapes: WireframeShape[] = [];\n const taken = new Set<Element>();\n\n const parseColor = (value: string): [number, number, number, number] | null => {\n const match = value.match(/rgba?\\(([^)]+)\\)/);\n if (!match) return null;\n const parts = match[1]!.split(/[\\s,/]+/).filter(Boolean).map(Number);\n return [parts[0] ?? 0, parts[1] ?? 0, parts[2] ?? 0, parts[3] ?? 1];\n };\n const luminance = (rgb: [number, number, number, number]) => (0.2126 * rgb[0] + 0.7152 * rgb[1] + 0.0722 * rgb[2]) / 255;\n const style = (element: Element) => getComputedStyle(element);\n const shown = (element: Element) => {\n const css = style(element);\n return css.display !== \"none\" && css.visibility !== \"hidden\" && Number(css.opacity || \"1\") > 0.05;\n };\n const box = (element: Element) => {\n const rect = element.getBoundingClientRect();\n return {\n x: Math.round(rect.left - origin.left),\n y: Math.round(rect.top - origin.top),\n w: Math.round(rect.width),\n h: Math.round(rect.height),\n };\n };\n /** The fill an element paints, if any: a solid color, or a gradient's first stop. */\n const fillOf = (element: Element) => {\n const css = style(element);\n const solid = parseColor(css.backgroundColor);\n if (solid && solid[3] >= 0.5) return solid;\n if (css.backgroundImage.includes(\"gradient\")) return parseColor(css.backgroundImage);\n return null;\n };\n /** Light marks when the nearest painted ancestor is dark. */\n const toneUnder = (element: Element): WireframeTone => {\n for (let node: Element | null = element; node; node = node.parentElement) {\n const fill = fillOf(node);\n if (fill) return luminance(fill) < 0.45 ? \"light\" : \"dark\";\n if (node === root) break;\n }\n return \"dark\";\n };\n const insideTaken = (element: Element | null) => {\n for (let node = element; node && node !== root; node = node.parentElement) if (taken.has(node)) return true;\n return false;\n };\n\n const page = parseColor(style(document.body).backgroundColor);\n const pageLum = page && page[3] >= 0.5 ? luminance(page) : 1;\n\n const elements = root.querySelectorAll(\"*\");\n for (const element of Array.from(elements)) {\n if (insideTaken(element.parentElement) || !shown(element)) continue;\n const at = box(element);\n if (at.w < 2 || at.h < 2) continue;\n const tag = element.tagName.toLowerCase();\n const css = style(element);\n\n if (tag === \"img\" || tag === \"picture\" || tag === \"video\" || tag === \"canvas\" || tag === \"iframe\") {\n shapes.push({ kind: \"image\", ...at });\n taken.add(element);\n continue;\n }\n if (tag === \"svg\") {\n if (at.w >= 48 && at.h >= 48) shapes.push({ kind: \"image\", ...at });\n else {\n const color = parseColor(css.color);\n shapes.push({ kind: \"icon\", ...at, tone: color && luminance(color) > 0.5 ? \"light\" : \"dark\" });\n }\n taken.add(element);\n continue;\n }\n if (tag === \"input\" || tag === \"select\" || tag === \"textarea\") {\n if ((element as HTMLInputElement).type !== \"hidden\") shapes.push({ kind: \"field\", ...at });\n taken.add(element);\n continue;\n }\n\n const fill = fillOf(element);\n const border = parseFloat(css.borderTopWidth) >= 1 && css.borderTopStyle !== \"none\";\n const action = tag === \"a\" || tag === \"button\" || element.getAttribute(\"role\") === \"button\";\n if (action && (fill || border) && at.h >= 24 && at.h <= 80 && at.w <= 480) {\n shapes.push({ kind: \"button\", ...at, filled: Boolean(fill), tone: toneUnder(element.parentElement ?? element) });\n taken.add(element);\n continue;\n }\n if (/url\\(/.test(css.backgroundImage) && at.w >= 48 && at.h >= 48) {\n shapes.push({ kind: \"image\", ...at });\n continue;\n }\n if (fill && at.w >= 160 && at.h >= 80) {\n const lum = luminance(fill);\n if (lum < 0.45) shapes.push({ kind: \"surface\", ...at, tone: \"dark\" });\n else if (Math.abs(lum - pageLum) > 0.03) shapes.push({ kind: \"surface\", ...at, tone: \"light\" });\n continue;\n }\n if (!fill && border && at.w >= 120 && at.h >= 60) {\n shapes.push({ kind: \"frame\", ...at, tone: toneUnder(element) });\n }\n }\n\n // Text, one bar per rendered line, merged along the line.\n const walker = document.createTreeWalker(root, NodeFilter.SHOW_TEXT);\n const lines: WireframeShape[] = [];\n for (let node = walker.nextNode(); node; node = walker.nextNode()) {\n const parent = node.parentElement;\n if (!parent || !node.textContent?.trim() || insideTaken(parent) || !shown(parent)) continue;\n const css = style(parent);\n const size = parseFloat(css.fontSize) || 16;\n const heading = Boolean(parent.closest(\"h1,h2,h3,h4,h5,h6\")) || size >= 22;\n const color = parseColor(css.color);\n const tone: WireframeTone = color && luminance(color) > 0.5 ? \"light\" : \"dark\";\n const range = document.createRange();\n range.selectNodeContents(node);\n for (const rect of Array.from(range.getClientRects())) {\n if (rect.width < 2 || rect.height < 2) continue;\n const bar = Math.max(3, Math.round(size * (heading ? 0.62 : 0.5)));\n const y = Math.round(rect.top - origin.top + (rect.height - bar) / 2);\n const x = Math.round(rect.left - origin.left);\n const w = Math.round(rect.width);\n const kind = heading ? \"heading\" : \"text\";\n const previous = lines[lines.length - 1];\n if (\n previous &&\n previous.kind === kind &&\n \"tone\" in previous &&\n previous.tone === tone &&\n Math.abs(previous.y - y) <= 3 &&\n x - (previous.x + previous.w) <= 14\n ) {\n previous.w = Math.max(previous.x + previous.w, x + w) - previous.x;\n continue;\n }\n lines.push({ kind, x, y, w, h: bar, tone });\n }\n }\n\n return { width: Math.round(origin.width), height: Math.round(origin.height), shapes: [...shapes, ...lines] };\n}\n\nconst PAPER = \"#ffffff\";\nconst INK = \"#262626\";\nconst LIGHT_INK = \"#f5f5f5\";\nconst PALETTE = {\n frame: \"#d4d4d4\",\n imageFill: \"#e5e5e5\",\n imageLine: \"#a3a3a3\",\n tint: \"#f0f0f0\",\n textOnPaper: \"#a3a3a3\",\n textOnDark: \"#8a8a8a\",\n buttonOnPaper: \"#525252\",\n buttonOnDark: \"#d4d4d4\",\n} as const;\n\nconst DRAW_ORDER: Record<WireframeShape[\"kind\"], number> = {\n surface: 0,\n frame: 1,\n image: 2,\n field: 3,\n button: 4,\n icon: 5,\n heading: 6,\n text: 7,\n};\n\nconst n = (value: number) => String(Math.round(value * 10) / 10);\n\n/**\n * A capture as a 480 × 320 greyscale SVG. The block is scaled to the\n * width; a short block is centered, a tall one keeps its top and is clipped.\n * Surfaces first, text last, so marks sit on what they sit on in the page.\n */\nexport function wireframeSvg(capture: WireframeCapture): string {\n const scale = capture.width > 0 ? WIREFRAME_WIDTH / capture.width : 1;\n const drawn = capture.height * scale;\n const offset = drawn < WIREFRAME_HEIGHT ? (WIREFRAME_HEIGHT - drawn) / 2 : 0;\n const at = (shape: { x: number; y: number; w: number; h: number }) => ({\n x: n(shape.x * scale),\n y: n(shape.y * scale + offset),\n w: n(Math.max(shape.w * scale, 1)),\n h: n(Math.max(shape.h * scale, 1)),\n });\n const shapes = [...capture.shapes].sort((a, b) => DRAW_ORDER[a.kind] - DRAW_ORDER[b.kind]);\n\n const marks = shapes.map((shape) => {\n const { x, y, w, h } = at(shape);\n const r = (radius: number) => `rx='${n(radius)}'`;\n switch (shape.kind) {\n case \"surface\":\n return `<rect data-k='surface' x='${x}' y='${y}' width='${w}' height='${h}' fill='${shape.tone === \"dark\" ? INK : PALETTE.tint}'/>`;\n case \"frame\":\n return `<rect data-k='frame' x='${x}' y='${y}' width='${w}' height='${h}' ${r(4)} fill='none' stroke='${shape.tone === \"light\" ? PALETTE.textOnDark : PALETTE.frame}'/>`;\n case \"image\": {\n const x2 = n(Number(x) + Number(w));\n const y2 = n(Number(y) + Number(h));\n return (\n `<rect data-k='image' x='${x}' y='${y}' width='${w}' height='${h}' ${r(3)} fill='${PALETTE.imageFill}' stroke='${PALETTE.imageLine}'/>` +\n `<path data-k='image-x' d='M${x} ${y}L${x2} ${y2}M${x2} ${y}L${x} ${y2}' stroke='${PALETTE.imageLine}' stroke-width='0.75'/>`\n );\n }\n case \"field\":\n return `<rect data-k='field' x='${x}' y='${y}' width='${w}' height='${h}' ${r(3)} fill='${PAPER}' stroke='${PALETTE.imageLine}'/>`;\n case \"button\": {\n const color = shape.tone === \"light\" ? PALETTE.buttonOnDark : PALETTE.buttonOnPaper;\n const pill = r(Number(h) / 2);\n return shape.filled\n ? `<rect data-k='button' x='${x}' y='${y}' width='${w}' height='${h}' ${pill} fill='${color}'/>`\n : `<rect data-k='button' x='${x}' y='${y}' width='${w}' height='${h}' ${pill} fill='none' stroke='${color}' stroke-width='1.25'/>`;\n }\n case \"icon\":\n return `<circle data-k='icon' cx='${n(Number(x) + Number(w) / 2)}' cy='${n(Number(y) + Number(h) / 2)}' r='${n(Math.min(Number(w), Number(h)) / 2)}' fill='${shape.tone === \"light\" ? PALETTE.textOnDark : PALETTE.textOnPaper}'/>`;\n case \"heading\":\n return `<rect data-k='heading' x='${x}' y='${y}' width='${w}' height='${h}' ${r(Number(h) / 2)} fill='${shape.tone === \"light\" ? LIGHT_INK : INK}'/>`;\n case \"text\":\n return `<rect data-k='text' x='${x}' y='${y}' width='${w}' height='${h}' ${r(Number(h) / 2)} fill='${shape.tone === \"light\" ? PALETTE.textOnDark : PALETTE.textOnPaper}'/>`;\n }\n });\n\n return (\n `<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 ${WIREFRAME_WIDTH} ${WIREFRAME_HEIGHT}'>` +\n `<defs><clipPath id='c'><rect width='${WIREFRAME_WIDTH}' height='${WIREFRAME_HEIGHT}'/></clipPath></defs>` +\n `<rect width='${WIREFRAME_WIDTH}' height='${WIREFRAME_HEIGHT}' fill='${PAPER}'/>` +\n `<g clip-path='url(#c)'>` +\n marks.join(\"\") +\n `</g></svg>`\n );\n}\n\n/**\n * An SVG as a `data:` URI for `admin.images.thumbnail`. Only the characters\n * a URI cannot carry are escaped, so the string stays close to the SVG's\n * own size; the SVG must use single quotes.\n */\nexport function svgDataUri(svg: string): string {\n const body = svg\n .replace(/\"/g, \"'\")\n .replace(/\\s+/g, \" \")\n .replace(/[%#<>{}|\\\\^`\\r\\n]/g, (char) => `%${char.charCodeAt(0).toString(16).toUpperCase().padStart(2, \"0\")}`);\n return `data:image/svg+xml,${body}`;\n}\n\n/** The slice of Playwright's `Page` this needs; a site passes its own. */\nexport interface WireframePage {\n setViewportSize(size: { width: number; height: number }): Promise<void>;\n /** Playwright's `Response` (or `null`); a status of 400 or more refuses the capture. */\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}\n\n/**\n * Opens each preview at desktop width, waits for its fonts, and returns\n * one SVG per slug. The page must already be signed in when the preview\n * route needs it (the Block library's does). A preview that answers 400 or\n * more, or renders no element `selector` matches, throws: nothing is\n * written for a page that did not draw its sample.\n */\nexport async function captureWireframes(\n page: WireframePage,\n previews: readonly { slug: string; url: string }[],\n { selector = WIREFRAME_ROOT }: { selector?: string } = {},\n): Promise<Record<string, string>> {\n await page.setViewportSize({ ...WIREFRAME_VIEWPORT });\n const out: Record<string, string> = {};\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(() => document.fonts.ready.then(() => undefined), undefined);\n let capture: WireframeCapture;\n try {\n capture = await page.evaluate(extractWireframe, selector);\n } catch (error) {\n throw new Error(`${slug}: ${url} has no ${selector}; it did not render the sample`, { cause: error });\n }\n out[slug] = wireframeSvg(capture);\n }\n return out;\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAgBA,MAAa,kBAAkB;AAC/B,MAAa,mBAAmB;;AAGhC,MAAa,qBAAqB;CAAE,OAAO;CAAM,QAAQ;CAAK;;AAG9D,MAAa,iBAAiB;;;;;;AAsB9B,SAAgB,iBAAiB,UAAoC;CACnE,MAAM,OAAO,SAAS,cAAc,SAAS;AAG7C,KAAI,CAAC,KAAM,OAAM,IAAI,MAAM,sBAAsB,WAAW;CAC5D,MAAM,SAAS,KAAK,uBAAuB;CAC3C,MAAM,SAA2B,EAAE;CACnC,MAAM,wBAAQ,IAAI,KAAc;CAEhC,MAAM,cAAc,UAA2D;EAC7E,MAAM,QAAQ,MAAM,MAAM,mBAAmB;AAC7C,MAAI,CAAC,MAAO,QAAO;EACnB,MAAM,QAAQ,MAAM,GAAI,MAAM,UAAU,CAAC,OAAO,QAAQ,CAAC,IAAI,OAAO;AACpE,SAAO;GAAC,MAAM,MAAM;GAAG,MAAM,MAAM;GAAG,MAAM,MAAM;GAAG,MAAM,MAAM;GAAE;;CAErE,MAAM,aAAa,SAA2C,QAAS,IAAI,KAAK,QAAS,IAAI,KAAK,QAAS,IAAI,MAAM;CACrH,MAAM,SAAS,YAAqB,iBAAiB,QAAQ;CAC7D,MAAM,SAAS,YAAqB;EAClC,MAAM,MAAM,MAAM,QAAQ;AAC1B,SAAO,IAAI,YAAY,UAAU,IAAI,eAAe,YAAY,OAAO,IAAI,WAAW,IAAI,GAAG;;CAE/F,MAAM,OAAO,Y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,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,SAAS,MAAM,MAAM,WAAW,KAAA,EAAU,EAAE,KAAA,EAAU;EAChF,IAAI;AACJ,MAAI;AACF,aAAU,MAAM,KAAK,SAAS,kBAAkB,SAAS;WAClD,OAAO;AACd,SAAM,IAAI,MAAM,GAAG,KAAK,IAAI,IAAI,UAAU,SAAS,iCAAiC,EAAE,OAAO,OAAO,CAAC;;AAEvG,MAAI,QAAQ,aAAa,QAAQ;;AAEnC,QAAO"}
|
package/dist/wireframe-cli.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { a as captureWireframes, s as svgDataUri } from "./wireframe-
|
|
2
|
+
import { a as captureWireframes, s as svgDataUri } from "./wireframe-Ba65SOj8.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";
|
package/dist/wireframe.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as captureWireframes, c as wireframeSvg, i as WIREFRAME_WIDTH, n as WIREFRAME_ROOT, o as extractWireframe, r as WIREFRAME_VIEWPORT, s as svgDataUri, t as WIREFRAME_HEIGHT } from "./wireframe-
|
|
1
|
+
import { a as captureWireframes, c as wireframeSvg, i as WIREFRAME_WIDTH, n as WIREFRAME_ROOT, o as extractWireframe, r as WIREFRAME_VIEWPORT, s as svgDataUri, t as WIREFRAME_HEIGHT } from "./wireframe-Ba65SOj8.mjs";
|
|
2
2
|
export { WIREFRAME_HEIGHT, WIREFRAME_ROOT, WIREFRAME_VIEWPORT, WIREFRAME_WIDTH, captureWireframes, extractWireframe, svgDataUri, wireframeSvg };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bison-lab/payload-core",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.6.0",
|
|
4
4
|
"description": "Site-agnostic Payload CMS configuration for Bison Lab sites: the SEO tab, the Theme global, the Roles Global, the brand-assets cupboard, and the metadata and theme readers for the pages they describe",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"bison-lab",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"locale-CTT3nn6T.d.mts","names":[],"sources":["../src/locale.ts"],"mappings":";;AAQA;;;;;;;UAAiB,UAAA;EACf,MAAA;EACA,cAAA;AAAA"}
|