@bison-lab/payload-core 4.40.0 → 5.1.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 +47 -4
- package/dist/admin.d.mts +21 -1
- package/dist/admin.d.mts.map +1 -1
- package/dist/admin.mjs +270 -5
- package/dist/admin.mjs.map +1 -1
- package/dist/{capability-DdnN7AHB.mjs → capability-Cb62lWQo.mjs} +1392 -32
- package/dist/capability-Cb62lWQo.mjs.map +1 -0
- package/dist/{capability-BVDhJV8A.d.mts → capability-Dotbq58Q.d.mts} +85 -9
- package/dist/capability-Dotbq58Q.d.mts.map +1 -0
- package/dist/index.d.mts +3 -3
- package/dist/index.mjs +3 -3
- package/dist/locale-B6rUVwpg.mjs.map +1 -1
- package/dist/{locale-5z7KTvRJ.d.mts → locale-CTT3nn6T.d.mts} +5 -4
- package/dist/locale-CTT3nn6T.d.mts.map +1 -0
- package/dist/{messages-Bk1uYO3o.mjs → messages-dZV_aAnR.mjs} +2 -2
- package/dist/{messages-Bk1uYO3o.mjs.map → messages-dZV_aAnR.mjs.map} +1 -1
- package/dist/navigation.d.mts +2 -2
- package/dist/og.d.mts +1 -1
- package/dist/{published-CY5PIy5W.d.mts → published-B3etM6X5.d.mts} +2 -2
- package/dist/{published-CY5PIy5W.d.mts.map → published-B3etM6X5.d.mts.map} +1 -1
- package/dist/{published-BC8kg47c.d.mts → published-QDNmDi02.d.mts} +2 -2
- package/dist/{published-BC8kg47c.d.mts.map → published-QDNmDi02.d.mts.map} +1 -1
- package/dist/{strings-Bafwdg67.mjs → strings-Fd7kUCT7.mjs} +4 -4
- package/dist/strings-Fd7kUCT7.mjs.map +1 -0
- package/dist/theme.d.mts +2 -2
- package/dist/translate-messages-cli.mjs +3 -3
- package/dist/translate-messages-cli.mjs.map +1 -1
- package/dist/translate.d.mts +366 -6
- package/dist/translate.d.mts.map +1 -1
- package/dist/translate.mjs +238 -5
- package/dist/translate.mjs.map +1 -1
- package/package.json +8 -10
- package/dist/capability-BVDhJV8A.d.mts.map +0 -1
- package/dist/capability-DdnN7AHB.mjs.map +0 -1
- package/dist/locale-5z7KTvRJ.d.mts.map +0 -1
- package/dist/strings-Bafwdg67.mjs.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Block, Config, Endpoint, Field, GlobalConfig, Payload } from "payload";
|
|
1
|
+
import { Block, CollectionConfig, Config, Endpoint, Field, GlobalConfig, Payload } from "payload";
|
|
2
2
|
|
|
3
3
|
//#region src/translate/errors.d.ts
|
|
4
4
|
/**
|
|
@@ -212,9 +212,9 @@ declare function translationSystemPrompt(request: Pick<TranslateRequest, "from"
|
|
|
212
212
|
declare function parseJsonArray(text: string): string[] | null;
|
|
213
213
|
/**
|
|
214
214
|
* The provided `Translator`: one Anthropic Messages call per batch, the
|
|
215
|
-
* strings as a JSON array in and out. `@anthropic-ai/sdk` is
|
|
216
|
-
*
|
|
217
|
-
*
|
|
215
|
+
* strings as a JSON array in and out. `@anthropic-ai/sdk` is a peer,
|
|
216
|
+
* imported on the first call, so a site that never translates never loads
|
|
217
|
+
* it. Every failure (no key, the SDK missing, a network error, a
|
|
218
218
|
* refusal, a malformed or wrong-length reply) returns `null` and is logged
|
|
219
219
|
* by the caller; it never throws.
|
|
220
220
|
*/
|
|
@@ -263,6 +263,47 @@ declare function resolveApiKey(input: {
|
|
|
263
263
|
production?: boolean;
|
|
264
264
|
}): ResolvedKey;
|
|
265
265
|
//#endregion
|
|
266
|
+
//#region src/translate/usage.d.ts
|
|
267
|
+
/**
|
|
268
|
+
* What translation cost and why it last failed. Usage is one row per month
|
|
269
|
+
* in a hidden collection (kept, so previous months stay viewable); the
|
|
270
|
+
* failure lives on the unversioned `translation-state` Global and clears on
|
|
271
|
+
* the next success.
|
|
272
|
+
*/
|
|
273
|
+
declare const TRANSLATION_USAGE_SLUG = "translation-usage";
|
|
274
|
+
/** A failure an Admin can act on, shown in the admin-wide banner until the next success. */
|
|
275
|
+
type RecordedFailure = Exclude<TranslationFailureKind, "unreachable" | "other"> | "cap-reached";
|
|
276
|
+
/** How many 429s in a row make "rate limited" worth a banner. A single one is routine. */
|
|
277
|
+
declare const RATE_LIMIT_STREAK = 3;
|
|
278
|
+
interface UsageMonth {
|
|
279
|
+
/** Bumped on every write, for compare-and-set increments. */
|
|
280
|
+
rev?: number;
|
|
281
|
+
month: string;
|
|
282
|
+
strings: number;
|
|
283
|
+
inputTokens: number;
|
|
284
|
+
outputTokens: number;
|
|
285
|
+
/** Estimated USD. */
|
|
286
|
+
cost: number;
|
|
287
|
+
}
|
|
288
|
+
/** `2026-11`, in UTC. */
|
|
289
|
+
declare function monthKey(date?: Date): string;
|
|
290
|
+
type UsagePayload = Pick<Payload, "find" | "create" | "update" | "db">;
|
|
291
|
+
/** This month's usage, zeros when nothing ran. */
|
|
292
|
+
declare function usageThisMonth(payload: UsagePayload, now?: Date): Promise<UsageMonth>;
|
|
293
|
+
/** The last `months` months that have usage, newest first. */
|
|
294
|
+
declare function usageHistory(payload: Pick<Payload, "find">, months?: number): Promise<UsageMonth[]>;
|
|
295
|
+
/**
|
|
296
|
+
* Adds one successful call to its month. Calls finish concurrently (editor
|
|
297
|
+
* saves beside a running job), so the add is a compare-and-set on the
|
|
298
|
+
* row's `rev`: a write that lost the race reads again and retries, and no
|
|
299
|
+
* call's tokens or cost are lost to the cap.
|
|
300
|
+
*/
|
|
301
|
+
declare function recordUsage(payload: UsagePayload, event: Extract<TranslatorCallEvent, {
|
|
302
|
+
ok: true;
|
|
303
|
+
}>, now?: Date): Promise<void>;
|
|
304
|
+
/** What an Admin should do about each failure, in the banner's words. */
|
|
305
|
+
declare const FAILURE_ADVICE: Record<RecordedFailure, string>;
|
|
306
|
+
//#endregion
|
|
266
307
|
//#region src/translate/settings.d.ts
|
|
267
308
|
/** Settings → Translation: the switch, model, instructions and the key's public record. Versioned. */
|
|
268
309
|
declare const TRANSLATION_SETTINGS_SLUG = "translation-settings";
|
|
@@ -274,6 +315,10 @@ declare const TRANSLATION_SETTINGS_SLUG = "translation-settings";
|
|
|
274
315
|
declare const TRANSLATION_STATE_SLUG = "translation-state";
|
|
275
316
|
/** The Roles grant that opens Settings → Translation. Developer and Admin always hold it. */
|
|
276
317
|
declare const TRANSLATION_GRANT = "translation";
|
|
318
|
+
/** The admin-wide month-to-date line and failure banner, for `translation` holders only. */
|
|
319
|
+
declare const TRANSLATION_STATUS_BAR = "@bison-lab/payload-core/admin#TranslationStatusBar";
|
|
320
|
+
/** Usage, jobs and the bulk buttons on Settings → Translation. */
|
|
321
|
+
declare const TRANSLATION_ACTIVITY_PANEL = "@bison-lab/payload-core/admin#TranslationActivityPanel";
|
|
277
322
|
/** The admin component for the key panel on Settings → Translation. */
|
|
278
323
|
declare const TRANSLATION_KEY_PANEL = "@bison-lab/payload-core/admin#TranslationKeyPanel";
|
|
279
324
|
/** The model choice on the screen. */
|
|
@@ -283,6 +328,12 @@ type KeyStatus = "valid" | "out-of-credit" | "rejected" | "unchecked";
|
|
|
283
328
|
/** The saved Settings → Translation document, as this package reads it. Optional and nullable. */
|
|
284
329
|
interface TranslationSettingsDoc {
|
|
285
330
|
enabled?: boolean | null;
|
|
331
|
+
/** Ticked target languages. */
|
|
332
|
+
languages?: string[] | null;
|
|
333
|
+
/** USD per calendar month; blank is no cap. */
|
|
334
|
+
monthlyCap?: number | null;
|
|
335
|
+
/** Set by the server once someone has saved the ticks; until then the defaults apply. */
|
|
336
|
+
languagesChosen?: boolean | null;
|
|
286
337
|
model?: TranslationModelChoice | null;
|
|
287
338
|
keyLast4?: string | null;
|
|
288
339
|
keySetAt?: string | null;
|
|
@@ -307,6 +358,11 @@ interface TranslationStateDoc {
|
|
|
307
358
|
keyCipher?: string | null;
|
|
308
359
|
keyStatus?: KeyStatus | null;
|
|
309
360
|
keyCheckedAt?: string | null;
|
|
361
|
+
/** The last failure an Admin should act on; cleared by the next success. */
|
|
362
|
+
failure?: RecordedFailure | null;
|
|
363
|
+
failureAt?: string | null;
|
|
364
|
+
/** 429s in a row. */
|
|
365
|
+
rateLimitStreak?: number | null;
|
|
310
366
|
}
|
|
311
367
|
/** Settings → Translation, resolved for a translation run. */
|
|
312
368
|
interface ResolvedTranslationSettings {
|
|
@@ -316,6 +372,10 @@ interface ResolvedTranslationSettings {
|
|
|
316
372
|
site?: TranslateSite;
|
|
317
373
|
/** True once the document has been saved. */
|
|
318
374
|
saved: boolean;
|
|
375
|
+
/** The ticked target languages, the only ones translated into. */
|
|
376
|
+
languages: string[];
|
|
377
|
+
/** USD per calendar month, or `null` for no cap. */
|
|
378
|
+
monthlyCap: number | null;
|
|
319
379
|
doc: TranslationSettingsDoc;
|
|
320
380
|
state: TranslationStateDoc;
|
|
321
381
|
}
|
|
@@ -333,7 +393,9 @@ declare function resolveModel(choice: TranslationModelChoice | null | undefined,
|
|
|
333
393
|
declare function siteFromInstructions(instructions: TranslationSettingsDoc["instructions"]): TranslateSite | undefined;
|
|
334
394
|
/** Drops the cached read, so the next one sees a save at once. */
|
|
335
395
|
declare function invalidateTranslationSettings(payload: object): void;
|
|
336
|
-
type ReadPayload = Pick<Payload, "findGlobal"
|
|
396
|
+
type ReadPayload = Pick<Payload, "findGlobal"> & {
|
|
397
|
+
config?: Pick<Payload["config"], "localization" | "custom">;
|
|
398
|
+
};
|
|
337
399
|
/**
|
|
338
400
|
* Settings → Translation and its server state, read once per
|
|
339
401
|
* `SETTINGS_CACHE_MS` per process. A missing Global (a site that has not
|
|
@@ -360,6 +422,18 @@ interface TranslationStatus {
|
|
|
360
422
|
} | null;
|
|
361
423
|
/** Why the stored key is not in use, when it is not. */
|
|
362
424
|
note?: string;
|
|
425
|
+
/** This month's strings and estimated cost, and the months before it. */
|
|
426
|
+
usage: {
|
|
427
|
+
month: UsageMonth;
|
|
428
|
+
history: UsageMonth[];
|
|
429
|
+
cap: number | null;
|
|
430
|
+
};
|
|
431
|
+
/** The recorded failure and what to do about it, or `null`. */
|
|
432
|
+
failure: {
|
|
433
|
+
kind: string;
|
|
434
|
+
at: string | null;
|
|
435
|
+
advice: string;
|
|
436
|
+
} | null;
|
|
363
437
|
}
|
|
364
438
|
/** A test seam: replaces the Anthropic client the key check uses. */
|
|
365
439
|
interface TranslationEndpointOptions {
|
|
@@ -413,12 +487,14 @@ declare function hasLocalizedFields(fields: readonly Field[], blocks?: readonly
|
|
|
413
487
|
* and endpoints are added once, and each entity is hooked once, so a second
|
|
414
488
|
* pass only picks up entities a later plugin registered.
|
|
415
489
|
*
|
|
416
|
-
*
|
|
417
|
-
*
|
|
490
|
+
* It also puts every library language (`LIBRARY_LOCALES`) into the
|
|
491
|
+
* config's `localization`, adding it when the site has none, so every site
|
|
492
|
+
* carries every language in its schema. A target language is translated
|
|
493
|
+
* and served only once it is ticked on the screen (`activeLocales`).
|
|
418
494
|
*/
|
|
419
495
|
declare function applyTranslation(config: Config, options?: TranslationOptions): Config;
|
|
420
496
|
/** `applyTranslation` as a plugin, for a site that does not use `adminNav()`. */
|
|
421
497
|
declare function translation(options?: TranslationOptions): (config: Config) => Config;
|
|
422
498
|
//#endregion
|
|
423
|
-
export {
|
|
424
|
-
//# sourceMappingURL=capability-
|
|
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-Dotbq58Q.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"capability-Dotbq58Q.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,GAAO,aAAA;AAAA;;;;;;;;;;KAYG,UAAA,KAAe,OAAA,YAAmB,OAAA,EAAS,gBAAA,KAAqB,OAAA;EAC1E,UAAA;AAA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EACA,UAAA;ENTc;EMWd,MAAA;IAAU,KAAA;IAAe,KAAA;IAAuB,KAAA;IAAuB,MAAA,GAAS,SAAA;EAAA;;EAEhF,KAAA;IAAS,MAAA;IAAiC,KAAA;EAAA;ELlCpB;EKoCtB,IAAA;ELjC8B;EKmC9B,KAAA;IAAS,KAAA,EAAO,UAAA;IAAY,OAAA,EAAS,UAAA;IAAc,GAAA;EAAA;;EAEnD,OAAA;IAAW,IAAA;IAAc,EAAA;IAAmB,MAAA;EAAA;AAAA;ALhB9C;AAAA,UKoBiB,0BAAA;EACf,YAAA,GAAe,uBAAA;AAAA;;ALdjB;;;;;;;;;;iBK8FgB,4BAAA,CAA6B,OAAA,GAAS,0BAAA,GAAkC,QAAA;;;ANnHxF;;;;;AAAA,UOwBiB,qBAAA;EACf,OAAA,IAAW,GAAA,EAAK,GAAA;AAAA;;UAID,kBAAA;;EAEf,IAAA,GAAO,aAAA;;EAEP,SAAA,IAAa,OAAA,EAAS,OAAA;EN3CT;EM6Cb,UAAA,GAAa,UAAA;EN7CG;EM+ChB,KAAA,GAAQ,MAAA,SAAe,qBAAA;EN5Cb;EM8CV,SAAA,GAAY,0BAAA;AAAA;;iBAaE,kBAAA,CAAmB,MAAA,WAAiB,KAAA,IAAS,MAAA,YAAiB,KAAA;AN5C9E;;;;;;;;;AAMA;;;;;AAOA;;AAbA,iBM4HgB,gBAAA,CAAiB,MAAA,EAAQ,MAAA,EAAQ,OAAA,GAAS,kBAAA,GAA0B,MAAA;;iBAsGpE,WAAA,CAAY,OAAA,GAAS,kBAAA,IAC3B,MAAA,EAAQ,MAAA,KAAS,MAAA"}
|
package/dist/index.d.mts
CHANGED
|
@@ -3,8 +3,8 @@ import { a as SeoImageSize, i as SeoImageDoc, n as titleTemplate, o as SeoImageV
|
|
|
3
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-DLBlHZUd.mjs";
|
|
4
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-1vwxBgm5.mjs";
|
|
5
5
|
import { n as facetField, t as FacetEntry } from "./facet-field-2K22iuWA.mjs";
|
|
6
|
-
import { a as translation, d as
|
|
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-
|
|
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-Dotbq58Q.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-QDNmDi02.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";
|
|
@@ -1354,5 +1354,5 @@ declare function roleDescription(role: string, matrix?: readonly RoleRow[]): str
|
|
|
1354
1354
|
*/
|
|
1355
1355
|
declare function resetRolesMatrix(current: unknown): RoleRow[];
|
|
1356
1356
|
//#endregion
|
|
1357
|
-
export { ADMIN_NAV, ADMIN_NAV_ENTITY_FIELD, ADMIN_NAV_ITEM_ROW_LABEL, ADMIN_NAV_ROW_LABEL, ADMIN_NAV_SLUG, type AdminNavConfig, type AdminNavDoc, type AdminNavGroup, type AdminNavItem, type AdminNavVisibleEntities, BLOCK_DRAWER_CSS, BLOCK_DRAWER_STYLES, BLOCK_LIBRARY_CATEGORIES, BLOCK_LIBRARY_FIELD, BLOCK_LIBRARY_SLUG, BLOCK_THUMBNAIL_PATH, BRAND_ASSETS_MIME_TYPES, BRAND_ASSETS_SLUG, type BlockDrawerEntry, type BlockLibraryCategoryId, type BlockLibraryDoc, type BlockLibraryDraftHolder, type BlockLibraryEntry, type BlockLibraryHolder, type BlockLibraryKind, type BlockLibraryPayload, type BlockLibraryReader, type BlockLibraryRow, type BlockLibraryUsage, type BlockUsageOptions, CAPABILITIES, CAPABILITY_FEATURES, type Capability, type ColorSwatch, type ColorTokenHit, type ColorUsage, type ColorUsagesList, type ColorUsagesOption, type CreateBlockLibraryOptions, type CreateBrandAssetsOptions, type CreateFeaturesOptions, type CreateFormSubmissionsOptions, type CreateNavigationOptions, type CreateQuestionsOptions, type CreateRolesOptions, type CreateTaxonomyOptions, type CreateThemeOptions, DEFAULT_ROLE_GRANTS, DEFAULT_ROLE_MATRIX, DEFAULT_SECTION_CONTROLS, DESCRIPTION_LENGTH, DEVELOPER_DESCRIPTION, DOCUMENT_CREATE_NEW, DOCUMENT_TITLE_ACTIONS, DUPLICATE_ROLE_NAME_MESSAGE, DUPLICATE_ROLE_SLUG_MESSAGE, EXISTING_PARENT_MESSAGE, EXTERNAL_HREF_MESSAGE, type EditableTheme, FEATURES_MATRIX_FIELD, FEATURES_SLUG, FEATURE_GROUPS, FEATURE_GROUP_LABELS, FOOTER_COLUMNS_FIELD, FOOTER_COLUMN_WIDTHS, FOOTER_MAX_COLUMNS, FOOTER_MAX_LINK_COLUMNS, FOOTER_SOCIALS, FOOTER_TWELFTHS, FORM_SUBMISSIONS_SLUG, type FacetEntry, type FeatureExtra, type FeatureGroupId, type FeatureRow, type FeaturesDoc, type FooterColumnWidth, type FooterSocial, HERO_SECTION_CONTROLS, INVALID_ROLE_NAME_MESSAGE, LAST_ADMIN_DELETE_MESSAGE, LAST_ADMIN_DEMOTE_MESSAGE, LAST_USERS_TICK_MESSAGE, LAYOUT_DESCRIPTION, LAYOUT_REQUIRED_LABEL, LAYOUT_REQUIRED_MESSAGE, LIST_ALIGN, LOOK_FIELD, type ListAlign, type ListAlignColumn, type LookFieldMode, type LookFieldOptions, type LookOption, MEDIA_ALT_AUTOFILL, MEDIA_IN_USE_PATH, MEDIA_LIST, MISSING_PACKAGE_FEATURES_MESSAGE, MISSING_SEED_ROLES_MESSAGE, type MaybeUser, type MediaId, type MediaInUseOption, type MediaOptions, NAVIGATION_DB_NAME, NAVIGATION_FEATURE, NAVIGATION_FOOTER_DB_NAME, NAVIGATION_FOOTER_SLUG, NAVIGATION_SLUG, NEW_FOLDER_PARENT, NO_SECTION_CONTROLS, type NavigationBar, type NavigationDoc, type NavigationFooter, type NavigationHeader, type OrganizeByEntry, type OrganizeByLook, PACKAGE_BLOCK_SLUGS, PACKAGE_FEATURES, PACKAGE_FEATURE_SLUGS, PAGE_EDITOR_SYSTEM_KEYS, PAGE_SLUG_CELL, PAGE_TITLE_CELL, type PackageFeature, type PackageFeatureSlug, type PageEditorSystemKey, type PagesOptions, QUESTIONS_FEATURE, QUESTIONS_LIST, QUESTIONS_SLUG, REDIRECTS_SLUG, REQUIRED_PAGE_CELL, REQUIRED_PAGE_DELETE_MESSAGE, REQUIRED_PAGE_FIELD, REQUIRED_PAGE_UNPUBLISH_MESSAGE, RICH_TEXT_EDITOR_FONTS, RICH_TEXT_EDITOR_FONTS_CSS, ROLES, ROLES_CELL, ROLES_FIELD, ROLES_FIELD_DESCRIPTION, ROLES_GLOBAL_DESCRIPTION, ROLES_GRANTS_FIELD, ROLES_LOCKOUT_MESSAGE, ROLES_MATRIX_FIELD, ROLES_ROW_LABEL, ROLES_SLUG, ROLE_LABELS, ROLE_NAME_FIELD, ROLE_SLUG_FIELD, ROOT_PAGE_KEY, ROOT_PAGE_SLUG, type ResolveAdminNavArgs, type ResolvedThemeIdentity, type Role, type RoleExtra, type RoleRow, type RolesDoc, SECTION_CONTROL_KEYS, SECTION_CONTROL_LABELS, SHARE_IMAGE_SIZE, SLUG_FIELD, SLUG_UNLOCK_WARNING, SYSTEM_COLOR_KEYS, type SectionControlKey, type SectionControls, type SeoDoc, type SeoImageDoc, type SeoImageSize, type SeoImageValue, type SeoMeta, type SeoPluginOptions, type SlugFieldOptions, type SystemColorKey, THEME_APPEARANCE_FIELD, THEME_APPEARANCE_SLUG, THEME_COLORS_SLUG, THEME_COLOR_FIELD, THEME_COLOR_SCALE_FIELD, THEME_CONTRAST_REPORT, THEME_DOCUMENT_CONTROLS, THEME_FEATURE_SLUGS, THEME_FONT_FIELD, THEME_GREY_SCALE_FIELD, THEME_IDENTITY_FALLBACK, THEME_IDENTITY_SLUG, THEME_LIBRARY_FIELD, THEME_PAIRING_FIELD, THEME_PREVIEW_BREAKPOINTS, THEME_PUBLISH_FIELD, THEME_SAVE_BUTTON, THEME_SECTION_HEADING, THEME_SLUG, THEME_TYPOGRAPHY_SLUG, TRANSLATION_GRANT, TRANSLATION_KEY_PANEL, TRANSLATION_SETTINGS_SLUG, type ThemeChild, type ThemeColorDoc, type ThemeDoc, type ThemeIdentityFallback, type ThemeLibraryColorDoc, type ThemeUploadDoc, type TranslationOptions, type UsersOptions, adminNav, adminOnlyApiTab, allowedFeaturesForUser, altFromFilename, applyRoleSlugsFromNames, authenticatedOrPublished, blockDrawer, blockLibraryCatalogue, blockLibraryEntriesFromConfig, blockThumbnailEndpoint, blockUsage, canManageBrand, canManageContent, canPublish, canUseFeature, colorTokenField, composeSlug, createAdminNav, createBlockLibrary, createBrandAssets, createFeatures, createFormSubmissions, createMedia, createNavigation, createPages, createQuestions, createRedirects, createRoles, createTaxonomy, createTheme, createUsers, defaultBlockLibraryValue, defaultFeaturesFieldValue, defaultRolesFieldValue, defaultSectionControls, deleteLibraryColor, developerOnlyAccess, documentCreateNew, documentTitle, documentTitleActions, ensureRootPage, facetField, featureCatalogue, featureGroupLabel, fillBlankAltFromFilename, findColorTokens, findColorUsages, firstImageIn, footerDesktopTracks, getFeaturesMatrix, getNavigation, getRolesMatrix, getSectionControls, groupBlocksByCategory, hasCapability, hasFeature, hasGrant, hasRole, headerCtaEnabled, hideUnlessDeveloper, hideUnlessFeature, inferredFolders, isAdmin, isAdminOrSelf, isAuthenticated, isDeveloper, isDeveloperTab, isFeatureGroupId, isFeatureSlug, isLockedFeature, isPackageFeatureSlug, isPrivilegedRole, isRole, isRoleName, isRoleSlug, isRootPageKey, isValidExternalHref, lexicalPlainText, listAlign, listAlignColumns, listAlignCss, lockSlugOnPublish, lookField, noIndexField, normalizeFooterDesktop, normalizeSlug, normalizeStoredRoles, packageThumbnailURL, pageEditorLooks, pageEditorSwatches, pageEditorTokens, parentPrefix, parseFeaturesMatrix, parseRolesMatrix, persistThemeChild, pruneUserRoles, publishThemeChild, recordPublishedSlugRedirect, redirectPath, replaceClientOriginalWithResizedFile, requireLayoutOnPublish, resetRolesMatrix, resolveAdminNav, resolveThemeIdentity, rewriteColorToken, rewriteColorTokens, rewriteColorUsages, richTextEditorFonts, roleDescription, roleLabel, roleSelectOptions, sanitizeRoleNameInput, sanitizeSvg, sectionControlsFromLibrary, sectionControlsOf, seedFeatures, seedRoleRows, seedRoles, seedTheme, seoPlugin, slugDepth, slugField, slugLeaf, slugifyRoleName, stampBlockLibrary, stampFeatureCatalogue, storedRoles, stripDrafts, syncAnswerText, themeColorKeys, themeLibraryFromDoc, titleTemplate, translation, truncateAtWord, validateBlockLibrary, validateExternalHref, validateFeaturesMatrix, validateFooterColumns, validateFooterSocialUrl, validateHeaderCta, validateRolesMatrix, withThumbnail, writePublishedSlugRedirect };
|
|
1357
|
+
export { ADMIN_NAV, ADMIN_NAV_ENTITY_FIELD, ADMIN_NAV_ITEM_ROW_LABEL, ADMIN_NAV_ROW_LABEL, ADMIN_NAV_SLUG, type AdminNavConfig, type AdminNavDoc, type AdminNavGroup, type AdminNavItem, type AdminNavVisibleEntities, BLOCK_DRAWER_CSS, BLOCK_DRAWER_STYLES, BLOCK_LIBRARY_CATEGORIES, BLOCK_LIBRARY_FIELD, BLOCK_LIBRARY_SLUG, BLOCK_THUMBNAIL_PATH, BRAND_ASSETS_MIME_TYPES, BRAND_ASSETS_SLUG, type BlockDrawerEntry, type BlockLibraryCategoryId, type BlockLibraryDoc, type BlockLibraryDraftHolder, type BlockLibraryEntry, type BlockLibraryHolder, type BlockLibraryKind, type BlockLibraryPayload, type BlockLibraryReader, type BlockLibraryRow, type BlockLibraryUsage, type BlockUsageOptions, CAPABILITIES, CAPABILITY_FEATURES, type Capability, type ColorSwatch, type ColorTokenHit, type ColorUsage, type ColorUsagesList, type ColorUsagesOption, type CreateBlockLibraryOptions, type CreateBrandAssetsOptions, type CreateFeaturesOptions, type CreateFormSubmissionsOptions, type CreateNavigationOptions, type CreateQuestionsOptions, type CreateRolesOptions, type CreateTaxonomyOptions, type CreateThemeOptions, DEFAULT_ROLE_GRANTS, DEFAULT_ROLE_MATRIX, DEFAULT_SECTION_CONTROLS, DESCRIPTION_LENGTH, DEVELOPER_DESCRIPTION, DOCUMENT_CREATE_NEW, DOCUMENT_TITLE_ACTIONS, DUPLICATE_ROLE_NAME_MESSAGE, DUPLICATE_ROLE_SLUG_MESSAGE, EXISTING_PARENT_MESSAGE, EXTERNAL_HREF_MESSAGE, type EditableTheme, FEATURES_MATRIX_FIELD, FEATURES_SLUG, FEATURE_GROUPS, FEATURE_GROUP_LABELS, FOOTER_COLUMNS_FIELD, FOOTER_COLUMN_WIDTHS, FOOTER_MAX_COLUMNS, FOOTER_MAX_LINK_COLUMNS, FOOTER_SOCIALS, FOOTER_TWELFTHS, FORM_SUBMISSIONS_SLUG, type FacetEntry, type FeatureExtra, type FeatureGroupId, type FeatureRow, type FeaturesDoc, type FooterColumnWidth, type FooterSocial, HERO_SECTION_CONTROLS, INVALID_ROLE_NAME_MESSAGE, LAST_ADMIN_DELETE_MESSAGE, LAST_ADMIN_DEMOTE_MESSAGE, LAST_USERS_TICK_MESSAGE, LAYOUT_DESCRIPTION, LAYOUT_REQUIRED_LABEL, LAYOUT_REQUIRED_MESSAGE, LIST_ALIGN, LOOK_FIELD, type ListAlign, type ListAlignColumn, type LookFieldMode, type LookFieldOptions, type LookOption, MEDIA_ALT_AUTOFILL, MEDIA_IN_USE_PATH, MEDIA_LIST, MISSING_PACKAGE_FEATURES_MESSAGE, MISSING_SEED_ROLES_MESSAGE, type MaybeUser, type MediaId, type MediaInUseOption, type MediaOptions, NAVIGATION_DB_NAME, NAVIGATION_FEATURE, NAVIGATION_FOOTER_DB_NAME, NAVIGATION_FOOTER_SLUG, NAVIGATION_SLUG, NEW_FOLDER_PARENT, NO_SECTION_CONTROLS, type NavigationBar, type NavigationDoc, type NavigationFooter, type NavigationHeader, type OrganizeByEntry, type OrganizeByLook, PACKAGE_BLOCK_SLUGS, PACKAGE_FEATURES, PACKAGE_FEATURE_SLUGS, PAGE_EDITOR_SYSTEM_KEYS, PAGE_SLUG_CELL, PAGE_TITLE_CELL, type PackageFeature, type PackageFeatureSlug, type PageEditorSystemKey, type PagesOptions, QUESTIONS_FEATURE, QUESTIONS_LIST, QUESTIONS_SLUG, REDIRECTS_SLUG, REQUIRED_PAGE_CELL, REQUIRED_PAGE_DELETE_MESSAGE, REQUIRED_PAGE_FIELD, REQUIRED_PAGE_UNPUBLISH_MESSAGE, RICH_TEXT_EDITOR_FONTS, RICH_TEXT_EDITOR_FONTS_CSS, ROLES, ROLES_CELL, ROLES_FIELD, ROLES_FIELD_DESCRIPTION, ROLES_GLOBAL_DESCRIPTION, ROLES_GRANTS_FIELD, ROLES_LOCKOUT_MESSAGE, ROLES_MATRIX_FIELD, ROLES_ROW_LABEL, ROLES_SLUG, ROLE_LABELS, ROLE_NAME_FIELD, ROLE_SLUG_FIELD, ROOT_PAGE_KEY, ROOT_PAGE_SLUG, type ResolveAdminNavArgs, type ResolvedThemeIdentity, type Role, type RoleExtra, type RoleRow, type RolesDoc, SECTION_CONTROL_KEYS, SECTION_CONTROL_LABELS, SHARE_IMAGE_SIZE, SLUG_FIELD, SLUG_UNLOCK_WARNING, SYSTEM_COLOR_KEYS, type SectionControlKey, type SectionControls, type SeoDoc, type SeoImageDoc, type SeoImageSize, type SeoImageValue, type SeoMeta, type SeoPluginOptions, type SlugFieldOptions, type SystemColorKey, THEME_APPEARANCE_FIELD, THEME_APPEARANCE_SLUG, THEME_COLORS_SLUG, THEME_COLOR_FIELD, THEME_COLOR_SCALE_FIELD, THEME_CONTRAST_REPORT, THEME_DOCUMENT_CONTROLS, THEME_FEATURE_SLUGS, THEME_FONT_FIELD, THEME_GREY_SCALE_FIELD, THEME_IDENTITY_FALLBACK, THEME_IDENTITY_SLUG, THEME_LIBRARY_FIELD, THEME_PAIRING_FIELD, THEME_PREVIEW_BREAKPOINTS, THEME_PUBLISH_FIELD, THEME_SAVE_BUTTON, THEME_SECTION_HEADING, THEME_SLUG, THEME_TYPOGRAPHY_SLUG, TRANSLATION_ACTIVITY_PANEL, TRANSLATION_GRANT, TRANSLATION_KEY_PANEL, TRANSLATION_SETTINGS_SLUG, TRANSLATION_STATUS_BAR, type ThemeChild, type ThemeColorDoc, type ThemeDoc, type ThemeIdentityFallback, type ThemeLibraryColorDoc, type ThemeUploadDoc, type TranslationOptions, type UsersOptions, adminNav, adminOnlyApiTab, allowedFeaturesForUser, altFromFilename, applyRoleSlugsFromNames, authenticatedOrPublished, blockDrawer, blockLibraryCatalogue, blockLibraryEntriesFromConfig, blockThumbnailEndpoint, blockUsage, canManageBrand, canManageContent, canPublish, canUseFeature, colorTokenField, composeSlug, createAdminNav, createBlockLibrary, createBrandAssets, createFeatures, createFormSubmissions, createMedia, createNavigation, createPages, createQuestions, createRedirects, createRoles, createTaxonomy, createTheme, createUsers, defaultBlockLibraryValue, defaultFeaturesFieldValue, defaultRolesFieldValue, defaultSectionControls, deleteLibraryColor, developerOnlyAccess, documentCreateNew, documentTitle, documentTitleActions, ensureRootPage, facetField, featureCatalogue, featureGroupLabel, fillBlankAltFromFilename, findColorTokens, findColorUsages, firstImageIn, footerDesktopTracks, getFeaturesMatrix, getNavigation, getRolesMatrix, getSectionControls, groupBlocksByCategory, hasCapability, hasFeature, hasGrant, hasRole, headerCtaEnabled, hideUnlessDeveloper, hideUnlessFeature, inferredFolders, isAdmin, isAdminOrSelf, isAuthenticated, isDeveloper, isDeveloperTab, isFeatureGroupId, isFeatureSlug, isLockedFeature, isPackageFeatureSlug, isPrivilegedRole, isRole, isRoleName, isRoleSlug, isRootPageKey, isValidExternalHref, lexicalPlainText, listAlign, listAlignColumns, listAlignCss, lockSlugOnPublish, lookField, noIndexField, normalizeFooterDesktop, normalizeSlug, normalizeStoredRoles, packageThumbnailURL, pageEditorLooks, pageEditorSwatches, pageEditorTokens, parentPrefix, parseFeaturesMatrix, parseRolesMatrix, persistThemeChild, pruneUserRoles, publishThemeChild, recordPublishedSlugRedirect, redirectPath, replaceClientOriginalWithResizedFile, requireLayoutOnPublish, resetRolesMatrix, resolveAdminNav, resolveThemeIdentity, rewriteColorToken, rewriteColorTokens, rewriteColorUsages, richTextEditorFonts, roleDescription, roleLabel, roleSelectOptions, sanitizeRoleNameInput, sanitizeSvg, sectionControlsFromLibrary, sectionControlsOf, seedFeatures, seedRoleRows, seedRoles, seedTheme, seoPlugin, slugDepth, slugField, slugLeaf, slugifyRoleName, stampBlockLibrary, stampFeatureCatalogue, storedRoles, stripDrafts, syncAnswerText, themeColorKeys, themeLibraryFromDoc, titleTemplate, translation, truncateAtWord, validateBlockLibrary, validateExternalHref, validateFeaturesMatrix, validateFooterColumns, validateFooterSocialUrl, validateHeaderCta, validateRolesMatrix, withThumbnail, writePublishedSlugRedirect };
|
|
1358
1358
|
//# sourceMappingURL=index.d.mts.map
|
package/dist/index.mjs
CHANGED
|
@@ -2,12 +2,12 @@ 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
3
|
import { C as THEME_PAIRING_FIELD, D as headingSelectValue, E as THEME_SECTION_HEADING, S as THEME_LIBRARY_FIELD, T as THEME_SAVE_BUTTON, _ as THEME_CONTRAST_REPORT, a as THEME_IDENTITY_SLUG, b as THEME_GREY_SCALE_FIELD, c as docFromConfig, d as validateSourceIncluded, f as validateThemeHex, g as THEME_COLOR_SCALE_FIELD, h as THEME_COLOR_FIELD, i as THEME_COLORS_SLUG, m as THEME_APPEARANCE_FIELD, n as SYSTEM_COLOR_KEYS, o as THEME_SLUG, p as LOOK_FIELD, r as THEME_APPEARANCE_SLUG, s as THEME_TYPOGRAPHY_SLUG, t as resolveThemeIdentity, u as themeConfigFromDoc, v as THEME_DOCUMENT_CONTROLS, w as THEME_PUBLISH_FIELD, x as THEME_IDENTITY_FALLBACK, y as THEME_FONT_FIELD } from "./identity-CN6EOeDM.mjs";
|
|
4
4
|
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";
|
|
5
|
-
import { $ as
|
|
5
|
+
import { $t as validateFeaturesMatrix, A as TRANSLATION_SETTINGS_SLUG, At as DUPLICATE_ROLE_SLUG_MESSAGE, Bt as normalizeStoredRoles, Ct as isDeveloper, D as TRANSLATION_ACTIVITY_PANEL, Dt as DEFAULT_ROLE_MATRIX, Et as storedRoles, Ft as ROLES_GLOBAL_DESCRIPTION, Gt as seedRoleRows, Ht as resetRolesMatrix, It as ROLES_SLUG, Jt as defaultFeaturesFieldValue, Kt as validateRolesMatrix, Lt as applyRoleSlugsFromNames, M as TRANSLATION_STATUS_BAR, Mt as LAST_USERS_TICK_MESSAGE, Nt as MISSING_SEED_ROLES_MESSAGE, O as TRANSLATION_GRANT, Ot as DEVELOPER_DESCRIPTION, Pt as ROLES_FIELD_DESCRIPTION, Qt as stampFeatureCatalogue, Rt as defaultRolesFieldValue, St as isAuthenticated, Tt as isPrivilegedRole, Ut as roleDescription, Vt as parseRolesMatrix, Wt as roleSelectOptions, Xt as featureGroupLabel, Yt as featureCatalogue, Zt as parseFeaturesMatrix, _n as isFeatureGroupId, _t as hasGrant, an as THEME_FEATURE_SLUGS, at as allowedFeaturesForUser, bn as isPackageFeatureSlug, bt as isAdmin, cn as isRoleSlug, ct as hasFeature, dn as slugifyRoleName, dt as canManageBrand, en as CAPABILITIES, fn as FEATURES_SLUG, ft as canManageContent, gn as PACKAGE_FEATURE_SLUGS, gt as hasCapability, hn as PACKAGE_FEATURES, ht as getRolesMatrix, in as ROLE_LABELS, jt as INVALID_ROLE_NAME_MESSAGE, k as TRANSLATION_KEY_PANEL, kt as DUPLICATE_ROLE_NAME_MESSAGE, ln as roleLabel, lt as hideUnlessFeature, mn as FEATURE_GROUP_LABELS, mt as developerOnlyAccess, nn as DEFAULT_ROLE_GRANTS, on as isRole, ot as canUseFeature, pn as FEATURE_GROUPS, pt as canPublish, qt as MISSING_PACKAGE_FEATURES_MESSAGE, r as translation, rn as ROLES, sn as isRoleName, st as getFeaturesMatrix, t as applyTranslation, tn as CAPABILITY_FEATURES, un as sanitizeRoleNameInput, ut as authenticatedOrPublished, vn as isFeatureSlug, vt as hasRole, wt as isDeveloperTab, xt as isAdminOrSelf, yn as isLockedFeature, yt as hideUnlessDeveloper, zt as grantsFromStoredRole } from "./capability-Cb62lWQo.mjs";
|
|
6
6
|
import { _ as sectionControlsOf, a as sectionControlsFromLibrary, c as BLOCK_LIBRARY_CATEGORIES, d as DEFAULT_SECTION_CONTROLS, f as HERO_SECTION_CONTROLS, g as defaultSectionControls, h as SECTION_CONTROL_LABELS, i as defaultBlockLibraryValue, l as BLOCK_LIBRARY_SLUG, m as SECTION_CONTROL_KEYS, n as getSectionControls, o as stampBlockLibrary, p as NO_SECTION_CONTROLS, r as blockLibraryCatalogue, s as validateBlockLibrary, t as blockLibraryEntriesFromConfig, u as PACKAGE_BLOCK_SLUGS } from "./published-hqtvmVUD.mjs";
|
|
7
7
|
import { C as NAVIGATION_SLUG, S as NAVIGATION_FOOTER_SLUG, _ as validateExternalHref, a as FOOTER_MAX_LINK_COLUMNS, b as NAVIGATION_FEATURE, c as footerDesktopTracks, d as validateFooterColumns, f as validateFooterSocialUrl, g as linkField, h as isValidExternalHref, i as FOOTER_MAX_COLUMNS, l as footerFields, m as headerCtaEnabled, n as FOOTER_COLUMNS_FIELD, o as FOOTER_SOCIALS, p as EXTERNAL_HREF_MESSAGE, r as FOOTER_COLUMN_WIDTHS, s as FOOTER_TWELFTHS, t as getNavigation, u as normalizeFooterDesktop, v as validateHeaderCta, x as NAVIGATION_FOOTER_DB_NAME, y as NAVIGATION_DB_NAME } from "./published-BMt7Z5CF.mjs";
|
|
8
8
|
import { a as REQUIRED_PAGE_UNPUBLISH_MESSAGE, c as isRequiredPageKey, i as REQUIRED_PAGE_FIELD, l as isRootPageKey, n as REQUIRED_PAGE_CELL, o as ROOT_PAGE_KEY, r as REQUIRED_PAGE_DELETE_MESSAGE, s as ROOT_PAGE_SLUG, t as PAGE_SLUG_CELL, u as requiredPageKeys } from "./root-page-key-kx3C1eyp.mjs";
|
|
9
9
|
import { t as facetField } from "./facet-field-DO3VT_Cz.mjs";
|
|
10
|
-
import "./strings-
|
|
10
|
+
import "./strings-Fd7kUCT7.mjs";
|
|
11
11
|
import { l as thumbnailVersion } from "./block-thumbnails-DC34uFtE.mjs";
|
|
12
12
|
import { seoPlugin as seoPlugin$1 } from "@payloadcms/plugin-seo";
|
|
13
13
|
import { catalog } from "@bison-lab/fonts";
|
|
@@ -3868,6 +3868,6 @@ const richTextEditorFonts = definePlugin({
|
|
|
3868
3868
|
}
|
|
3869
3869
|
});
|
|
3870
3870
|
//#endregion
|
|
3871
|
-
export { ADMIN_NAV, ADMIN_NAV_ENTITY_FIELD, ADMIN_NAV_ITEM_ROW_LABEL, ADMIN_NAV_ROW_LABEL, ADMIN_NAV_SLUG, BLOCK_DRAWER_CSS, BLOCK_DRAWER_STYLES, BLOCK_LIBRARY_CATEGORIES, BLOCK_LIBRARY_FIELD, BLOCK_LIBRARY_SLUG, BLOCK_THUMBNAIL_PATH, BRAND_ASSETS_MIME_TYPES, BRAND_ASSETS_SLUG, CAPABILITIES, CAPABILITY_FEATURES, DEFAULT_ROLE_GRANTS, DEFAULT_ROLE_MATRIX, DEFAULT_SECTION_CONTROLS, DESCRIPTION_LENGTH, DEVELOPER_DESCRIPTION, DOCUMENT_CREATE_NEW, DOCUMENT_TITLE_ACTIONS, DUPLICATE_ROLE_NAME_MESSAGE, DUPLICATE_ROLE_SLUG_MESSAGE, EXISTING_PARENT_MESSAGE, EXTERNAL_HREF_MESSAGE, FEATURES_MATRIX_FIELD, FEATURES_SLUG, FEATURE_GROUPS, FEATURE_GROUP_LABELS, FOOTER_COLUMNS_FIELD, FOOTER_COLUMN_WIDTHS, FOOTER_MAX_COLUMNS, FOOTER_MAX_LINK_COLUMNS, FOOTER_SOCIALS, FOOTER_TWELFTHS, FORM_SUBMISSIONS_SLUG, HERO_SECTION_CONTROLS, INVALID_ROLE_NAME_MESSAGE, LAST_ADMIN_DELETE_MESSAGE, LAST_ADMIN_DEMOTE_MESSAGE, LAST_USERS_TICK_MESSAGE, LAYOUT_DESCRIPTION, LAYOUT_REQUIRED_LABEL, LAYOUT_REQUIRED_MESSAGE, LIST_ALIGN, LOOK_FIELD, MEDIA_ALT_AUTOFILL, MEDIA_IN_USE_PATH, MEDIA_LIST, MISSING_PACKAGE_FEATURES_MESSAGE, MISSING_SEED_ROLES_MESSAGE, NAVIGATION_DB_NAME, NAVIGATION_FEATURE, NAVIGATION_FOOTER_DB_NAME, NAVIGATION_FOOTER_SLUG, NAVIGATION_SLUG, NEW_FOLDER_PARENT, NO_SECTION_CONTROLS, PACKAGE_BLOCK_SLUGS, PACKAGE_FEATURES, PACKAGE_FEATURE_SLUGS, PAGE_EDITOR_SYSTEM_KEYS, PAGE_SLUG_CELL, PAGE_TITLE_CELL, QUESTIONS_FEATURE, QUESTIONS_LIST, QUESTIONS_SLUG, REDIRECTS_SLUG, REQUIRED_PAGE_CELL, REQUIRED_PAGE_DELETE_MESSAGE, REQUIRED_PAGE_FIELD, REQUIRED_PAGE_UNPUBLISH_MESSAGE, RICH_TEXT_EDITOR_FONTS, RICH_TEXT_EDITOR_FONTS_CSS, ROLES, ROLES_CELL, ROLES_FIELD, ROLES_FIELD_DESCRIPTION, ROLES_GLOBAL_DESCRIPTION, ROLES_GRANTS_FIELD, ROLES_LOCKOUT_MESSAGE, ROLES_MATRIX_FIELD, ROLES_ROW_LABEL, ROLES_SLUG, ROLE_LABELS, ROLE_NAME_FIELD, ROLE_SLUG_FIELD, ROOT_PAGE_KEY, ROOT_PAGE_SLUG, SECTION_CONTROL_KEYS, SECTION_CONTROL_LABELS, SHARE_IMAGE_SIZE, SLUG_FIELD, SLUG_UNLOCK_WARNING, SYSTEM_COLOR_KEYS, THEME_APPEARANCE_FIELD, THEME_APPEARANCE_SLUG, THEME_COLORS_SLUG, THEME_COLOR_FIELD, THEME_COLOR_SCALE_FIELD, THEME_CONTRAST_REPORT, THEME_DOCUMENT_CONTROLS, THEME_FEATURE_SLUGS, THEME_FONT_FIELD, THEME_GREY_SCALE_FIELD, THEME_IDENTITY_FALLBACK, THEME_IDENTITY_SLUG, THEME_LIBRARY_FIELD, THEME_PAIRING_FIELD, THEME_PREVIEW_BREAKPOINTS, THEME_PUBLISH_FIELD, THEME_SAVE_BUTTON, THEME_SECTION_HEADING, THEME_SLUG, THEME_TYPOGRAPHY_SLUG, TRANSLATION_GRANT, TRANSLATION_KEY_PANEL, TRANSLATION_SETTINGS_SLUG, adminNav, adminOnlyApiTab, allowedFeaturesForUser, altFromFilename, applyRoleSlugsFromNames, authenticatedOrPublished, blockDrawer, blockLibraryCatalogue, blockLibraryEntriesFromConfig, blockThumbnailEndpoint, blockUsage, canManageBrand, canManageContent, canPublish, canUseFeature, colorTokenField, composeSlug, createAdminNav, createBlockLibrary, createBrandAssets, createFeatures, createFormSubmissions, createMedia, createNavigation, createPages, createQuestions, createRedirects, createRoles, createTaxonomy, createTheme, createUsers, defaultBlockLibraryValue, defaultFeaturesFieldValue, defaultRolesFieldValue, defaultSectionControls, deleteLibraryColor, developerOnlyAccess, documentCreateNew, documentTitle, documentTitleActions, ensureRootPage, facetField, featureCatalogue, featureGroupLabel, fillBlankAltFromFilename, findColorTokens, findColorUsages, firstImageIn, footerDesktopTracks, getFeaturesMatrix, getNavigation, getRolesMatrix, getSectionControls, groupBlocksByCategory, hasCapability, hasFeature, hasGrant, hasRole, headerCtaEnabled, hideUnlessDeveloper, hideUnlessFeature, inferredFolders, isAdmin, isAdminOrSelf, isAuthenticated, isDeveloper, isDeveloperTab, isFeatureGroupId, isFeatureSlug, isLockedFeature, isPackageFeatureSlug, isPrivilegedRole, isRole, isRoleName, isRoleSlug, isRootPageKey, isValidExternalHref, lexicalPlainText, listAlign, listAlignColumns, listAlignCss, lockSlugOnPublish, lookField, noIndexField, normalizeFooterDesktop, normalizeSlug, normalizeStoredRoles, packageThumbnailURL, pageEditorLooks, pageEditorSwatches, pageEditorTokens, parentPrefix, parseFeaturesMatrix, parseRolesMatrix, persistThemeChild, pruneUserRoles, publishThemeChild, recordPublishedSlugRedirect, redirectPath, replaceClientOriginalWithResizedFile, requireLayoutOnPublish, resetRolesMatrix, resolveAdminNav, resolveThemeIdentity, rewriteColorToken, rewriteColorTokens, rewriteColorUsages, richTextEditorFonts, roleDescription, roleLabel, roleSelectOptions, sanitizeRoleNameInput, sanitizeSvg, sectionControlsFromLibrary, sectionControlsOf, seedFeatures, seedRoleRows, seedRoles, seedTheme, seoPlugin, slugDepth, slugField, slugLeaf, slugifyRoleName, stampBlockLibrary, stampFeatureCatalogue, storedRoles, stripDrafts, syncAnswerText, themeColorKeys, themeLibraryFromDoc, titleTemplate, translation, truncateAtWord, validateBlockLibrary, validateExternalHref, validateFeaturesMatrix, validateFooterColumns, validateFooterSocialUrl, validateHeaderCta, validateRolesMatrix, withThumbnail, writePublishedSlugRedirect };
|
|
3871
|
+
export { ADMIN_NAV, ADMIN_NAV_ENTITY_FIELD, ADMIN_NAV_ITEM_ROW_LABEL, ADMIN_NAV_ROW_LABEL, ADMIN_NAV_SLUG, BLOCK_DRAWER_CSS, BLOCK_DRAWER_STYLES, BLOCK_LIBRARY_CATEGORIES, BLOCK_LIBRARY_FIELD, BLOCK_LIBRARY_SLUG, BLOCK_THUMBNAIL_PATH, BRAND_ASSETS_MIME_TYPES, BRAND_ASSETS_SLUG, CAPABILITIES, CAPABILITY_FEATURES, DEFAULT_ROLE_GRANTS, DEFAULT_ROLE_MATRIX, DEFAULT_SECTION_CONTROLS, DESCRIPTION_LENGTH, DEVELOPER_DESCRIPTION, DOCUMENT_CREATE_NEW, DOCUMENT_TITLE_ACTIONS, DUPLICATE_ROLE_NAME_MESSAGE, DUPLICATE_ROLE_SLUG_MESSAGE, EXISTING_PARENT_MESSAGE, EXTERNAL_HREF_MESSAGE, FEATURES_MATRIX_FIELD, FEATURES_SLUG, FEATURE_GROUPS, FEATURE_GROUP_LABELS, FOOTER_COLUMNS_FIELD, FOOTER_COLUMN_WIDTHS, FOOTER_MAX_COLUMNS, FOOTER_MAX_LINK_COLUMNS, FOOTER_SOCIALS, FOOTER_TWELFTHS, FORM_SUBMISSIONS_SLUG, HERO_SECTION_CONTROLS, INVALID_ROLE_NAME_MESSAGE, LAST_ADMIN_DELETE_MESSAGE, LAST_ADMIN_DEMOTE_MESSAGE, LAST_USERS_TICK_MESSAGE, LAYOUT_DESCRIPTION, LAYOUT_REQUIRED_LABEL, LAYOUT_REQUIRED_MESSAGE, LIST_ALIGN, LOOK_FIELD, MEDIA_ALT_AUTOFILL, MEDIA_IN_USE_PATH, MEDIA_LIST, MISSING_PACKAGE_FEATURES_MESSAGE, MISSING_SEED_ROLES_MESSAGE, NAVIGATION_DB_NAME, NAVIGATION_FEATURE, NAVIGATION_FOOTER_DB_NAME, NAVIGATION_FOOTER_SLUG, NAVIGATION_SLUG, NEW_FOLDER_PARENT, NO_SECTION_CONTROLS, PACKAGE_BLOCK_SLUGS, PACKAGE_FEATURES, PACKAGE_FEATURE_SLUGS, PAGE_EDITOR_SYSTEM_KEYS, PAGE_SLUG_CELL, PAGE_TITLE_CELL, QUESTIONS_FEATURE, QUESTIONS_LIST, QUESTIONS_SLUG, REDIRECTS_SLUG, REQUIRED_PAGE_CELL, REQUIRED_PAGE_DELETE_MESSAGE, REQUIRED_PAGE_FIELD, REQUIRED_PAGE_UNPUBLISH_MESSAGE, RICH_TEXT_EDITOR_FONTS, RICH_TEXT_EDITOR_FONTS_CSS, ROLES, ROLES_CELL, ROLES_FIELD, ROLES_FIELD_DESCRIPTION, ROLES_GLOBAL_DESCRIPTION, ROLES_GRANTS_FIELD, ROLES_LOCKOUT_MESSAGE, ROLES_MATRIX_FIELD, ROLES_ROW_LABEL, ROLES_SLUG, ROLE_LABELS, ROLE_NAME_FIELD, ROLE_SLUG_FIELD, ROOT_PAGE_KEY, ROOT_PAGE_SLUG, SECTION_CONTROL_KEYS, SECTION_CONTROL_LABELS, SHARE_IMAGE_SIZE, SLUG_FIELD, SLUG_UNLOCK_WARNING, SYSTEM_COLOR_KEYS, THEME_APPEARANCE_FIELD, THEME_APPEARANCE_SLUG, THEME_COLORS_SLUG, THEME_COLOR_FIELD, THEME_COLOR_SCALE_FIELD, THEME_CONTRAST_REPORT, THEME_DOCUMENT_CONTROLS, THEME_FEATURE_SLUGS, THEME_FONT_FIELD, THEME_GREY_SCALE_FIELD, THEME_IDENTITY_FALLBACK, THEME_IDENTITY_SLUG, THEME_LIBRARY_FIELD, THEME_PAIRING_FIELD, THEME_PREVIEW_BREAKPOINTS, THEME_PUBLISH_FIELD, THEME_SAVE_BUTTON, THEME_SECTION_HEADING, THEME_SLUG, THEME_TYPOGRAPHY_SLUG, TRANSLATION_ACTIVITY_PANEL, TRANSLATION_GRANT, TRANSLATION_KEY_PANEL, TRANSLATION_SETTINGS_SLUG, TRANSLATION_STATUS_BAR, adminNav, adminOnlyApiTab, allowedFeaturesForUser, altFromFilename, applyRoleSlugsFromNames, authenticatedOrPublished, blockDrawer, blockLibraryCatalogue, blockLibraryEntriesFromConfig, blockThumbnailEndpoint, blockUsage, canManageBrand, canManageContent, canPublish, canUseFeature, colorTokenField, composeSlug, createAdminNav, createBlockLibrary, createBrandAssets, createFeatures, createFormSubmissions, createMedia, createNavigation, createPages, createQuestions, createRedirects, createRoles, createTaxonomy, createTheme, createUsers, defaultBlockLibraryValue, defaultFeaturesFieldValue, defaultRolesFieldValue, defaultSectionControls, deleteLibraryColor, developerOnlyAccess, documentCreateNew, documentTitle, documentTitleActions, ensureRootPage, facetField, featureCatalogue, featureGroupLabel, fillBlankAltFromFilename, findColorTokens, findColorUsages, firstImageIn, footerDesktopTracks, getFeaturesMatrix, getNavigation, getRolesMatrix, getSectionControls, groupBlocksByCategory, hasCapability, hasFeature, hasGrant, hasRole, headerCtaEnabled, hideUnlessDeveloper, hideUnlessFeature, inferredFolders, isAdmin, isAdminOrSelf, isAuthenticated, isDeveloper, isDeveloperTab, isFeatureGroupId, isFeatureSlug, isLockedFeature, isPackageFeatureSlug, isPrivilegedRole, isRole, isRoleName, isRoleSlug, isRootPageKey, isValidExternalHref, lexicalPlainText, listAlign, listAlignColumns, listAlignCss, lockSlugOnPublish, lookField, noIndexField, normalizeFooterDesktop, normalizeSlug, normalizeStoredRoles, packageThumbnailURL, pageEditorLooks, pageEditorSwatches, pageEditorTokens, parentPrefix, parseFeaturesMatrix, parseRolesMatrix, persistThemeChild, pruneUserRoles, publishThemeChild, recordPublishedSlugRedirect, redirectPath, replaceClientOriginalWithResizedFile, requireLayoutOnPublish, resetRolesMatrix, resolveAdminNav, resolveThemeIdentity, rewriteColorToken, rewriteColorTokens, rewriteColorUsages, richTextEditorFonts, roleDescription, roleLabel, roleSelectOptions, sanitizeRoleNameInput, sanitizeSvg, sectionControlsFromLibrary, sectionControlsOf, seedFeatures, seedRoleRows, seedRoles, seedTheme, seoPlugin, slugDepth, slugField, slugLeaf, slugifyRoleName, stampBlockLibrary, stampFeatureCatalogue, storedRoles, stripDrafts, syncAnswerText, themeColorKeys, themeLibraryFromDoc, titleTemplate, translation, truncateAtWord, validateBlockLibrary, validateExternalHref, validateFeaturesMatrix, validateFooterColumns, validateFooterSocialUrl, validateHeaderCta, validateRolesMatrix, withThumbnail, writePublishedSlugRedirect };
|
|
3872
3872
|
|
|
3873
3873
|
//# sourceMappingURL=index.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"locale-B6rUVwpg.mjs","names":[],"sources":["../src/locale.ts"],"sourcesContent":["/**\n * Which locale a read returns, as Payload's Local API takes it.
|
|
1
|
+
{"version":3,"file":"locale-B6rUVwpg.mjs","names":[],"sources":["../src/locale.ts"],"sourcesContent":["/**\n * Which locale a read returns, as Payload's Local API takes it. Pass the\n * request's locale (every site carries the library's languages), or a\n * Spanish page renders the default locale's copy; omitted reads the\n * default locale.\n * `fallbackLocale: false` returns empty where the locale has no value\n * instead of the default locale's.\n */\nexport interface LocaleRead {\n locale?: string;\n fallbackLocale?: string | false;\n}\n\n/** The `locale` / `fallbackLocale` arguments to spread into a read, only when set. */\nexport function localeArgs({ locale, fallbackLocale }: LocaleRead = {}): LocaleRead {\n return {\n ...(locale !== undefined ? { locale } : {}),\n ...(fallbackLocale !== undefined ? { fallbackLocale } : {}),\n };\n}\n"],"mappings":";;AAcA,SAAgB,WAAW,EAAE,QAAQ,mBAA+B,EAAE,EAAc;AAClF,QAAO;EACL,GAAI,WAAW,KAAA,IAAY,EAAE,QAAQ,GAAG,EAAE;EAC1C,GAAI,mBAAmB,KAAA,IAAY,EAAE,gBAAgB,GAAG,EAAE;EAC3D"}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
//#region src/locale.d.ts
|
|
2
2
|
/**
|
|
3
|
-
* Which locale a read returns, as Payload's Local API takes it.
|
|
4
|
-
*
|
|
5
|
-
*
|
|
3
|
+
* Which locale a read returns, as Payload's Local API takes it. Pass the
|
|
4
|
+
* request's locale (every site carries the library's languages), or a
|
|
5
|
+
* Spanish page renders the default locale's copy; omitted reads the
|
|
6
|
+
* default locale.
|
|
6
7
|
* `fallbackLocale: false` returns empty where the locale has no value
|
|
7
8
|
* instead of the default locale's.
|
|
8
9
|
*/
|
|
@@ -12,4 +13,4 @@ interface LocaleRead {
|
|
|
12
13
|
}
|
|
13
14
|
//#endregion
|
|
14
15
|
export { LocaleRead as t };
|
|
15
|
-
//# sourceMappingURL=locale-
|
|
16
|
+
//# sourceMappingURL=locale-CTT3nn6T.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"locale-CTT3nn6T.d.mts","names":[],"sources":["../src/locale.ts"],"mappings":";;AAQA;;;;;;;UAAiB,UAAA;EACf,MAAA;EACA,cAAA;AAAA"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as translateStrings } from "./strings-
|
|
1
|
+
import { n as translateStrings } from "./strings-Fd7kUCT7.mjs";
|
|
2
2
|
//#region src/translate/messages.ts
|
|
3
3
|
const BATCH_SIZE = 40;
|
|
4
4
|
/** Every string leaf as [path, value]; array indexes are path segments. */
|
|
@@ -90,4 +90,4 @@ async function fillMessages(options) {
|
|
|
90
90
|
//#endregion
|
|
91
91
|
export { fillMessages as t };
|
|
92
92
|
|
|
93
|
-
//# sourceMappingURL=messages-
|
|
93
|
+
//# sourceMappingURL=messages-dZV_aAnR.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"messages-
|
|
1
|
+
{"version":3,"file":"messages-dZV_aAnR.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,K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ION_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-CTT3nn6T.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-QDNmDi02.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
1
|
import { _ as ThemeIdentityFallback } from "./types-DLBlHZUd.mjs";
|
|
2
|
-
import { t as ThemePayload } from "./published-
|
|
2
|
+
import { t as ThemePayload } from "./published-B3etM6X5.mjs";
|
|
3
3
|
import { FontId } from "@bison-lab/fonts";
|
|
4
4
|
import { ThemeConfig } from "@bison-lab/tokens";
|
|
5
5
|
import { Payload } from "payload";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { _ as ThemeIdentityFallback, d as ThemeDoc, g as ResolvedThemeIdentity } from "./types-DLBlHZUd.mjs";
|
|
2
|
-
import { t as LocaleRead } from "./locale-
|
|
2
|
+
import { t as LocaleRead } from "./locale-CTT3nn6T.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-B3etM6X5.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"published-
|
|
1
|
+
{"version":3,"file":"published-B3etM6X5.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,4 +1,4 @@
|
|
|
1
|
-
import { t as LocaleRead } from "./locale-
|
|
1
|
+
import { t as LocaleRead } from "./locale-CTT3nn6T.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-QDNmDi02.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"published-
|
|
1
|
+
{"version":3,"file":"published-QDNmDi02.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,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,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"}
|
|
@@ -116,9 +116,9 @@ function parseJsonArray(text) {
|
|
|
116
116
|
}
|
|
117
117
|
/**
|
|
118
118
|
* The provided `Translator`: one Anthropic Messages call per batch, the
|
|
119
|
-
* strings as a JSON array in and out. `@anthropic-ai/sdk` is
|
|
120
|
-
*
|
|
121
|
-
*
|
|
119
|
+
* strings as a JSON array in and out. `@anthropic-ai/sdk` is a peer,
|
|
120
|
+
* imported on the first call, so a site that never translates never loads
|
|
121
|
+
* it. Every failure (no key, the SDK missing, a network error, a
|
|
122
122
|
* refusal, a malformed or wrong-length reply) returns `null` and is logged
|
|
123
123
|
* by the caller; it never throws.
|
|
124
124
|
*/
|
|
@@ -264,4 +264,4 @@ function isTranslatorConfigured(translator) {
|
|
|
264
264
|
//#endregion
|
|
265
265
|
export { TRANSLATE_MODEL_PRICES as a, estimateCost as c, translationSystemPrompt as d, verifyAnthropicKey as f, ECONOMY_TRANSLATE_MODEL as i, modelPrice as l, translateStrings as n, anthropicTranslator as o, classifyAnthropicError as p, DEFAULT_TRANSLATE_MODEL as r, containsWord as s, isTranslatorConfigured as t, parseJsonArray as u };
|
|
266
266
|
|
|
267
|
-
//# sourceMappingURL=strings-
|
|
267
|
+
//# sourceMappingURL=strings-Fd7kUCT7.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"strings-Fd7kUCT7.mjs","names":[],"sources":["../src/translate/errors.ts","../src/translate/anthropic.ts","../src/translate/strings.ts"],"sourcesContent":["/**\n * Why a translation call failed, in the terms an Admin can act on.\n *\n * - `out-of-credit`: the Anthropic account has no credit or a billing\n * problem (402 `billing_error`, or the older 400 \"credit balance is too\n * low\").\n * - `key-rejected`: the key is wrong, revoked or lacks permission (401, 403).\n * - `rate-limited`: 429, after the SDK's own retry.\n * - `unreachable`: no answer, a timeout, or a 5xx / 529 from Anthropic.\n * - `other`: anything else (a malformed reply, a refusal).\n */\nexport type TranslationFailureKind = \"out-of-credit\" | \"key-rejected\" | \"rate-limited\" | \"unreachable\" | \"other\";\n\nfunction errorType(error: { error?: unknown; type?: unknown }): string | undefined {\n if (typeof error.type === \"string\") return error.type;\n const body = error.error as { type?: unknown; error?: { type?: unknown } } | undefined;\n if (typeof body?.error?.type === \"string\") return body.error.type;\n if (typeof body?.type === \"string\") return body.type;\n return undefined;\n}\n\n/** Sorts an error thrown by the Anthropic SDK (or a network failure) into a `TranslationFailureKind`. */\nexport function classifyAnthropicError(error: unknown): TranslationFailureKind {\n if (!error || typeof error !== \"object\") return \"other\";\n const candidate = error as { status?: unknown; message?: unknown; error?: unknown; type?: unknown };\n const status = typeof candidate.status === \"number\" ? candidate.status : undefined;\n const type = errorType(candidate);\n const message = typeof candidate.message === \"string\" ? candidate.message : \"\";\n if (status === 402 || type === \"billing_error\") return \"out-of-credit\";\n if (status === 400 && /credit balance/i.test(message)) return \"out-of-credit\";\n if (status === 401 || status === 403 || type === \"authentication_error\" || type === \"permission_error\") {\n return \"key-rejected\";\n }\n if (status === 429 || type === \"rate_limit_error\") return \"rate-limited\";\n if (status === undefined || status >= 500) return \"unreachable\";\n return \"other\";\n}\n","import { classifyAnthropicError, type TranslationFailureKind } from \"./errors\";\nimport type { TranslateRequest, TranslateSite, Translator } from \"./types\";\n\n/**\n * The library's default model. Translating marketing copy does not need the\n * most capable model; a current Sonnet handles it well at a fraction of the\n * price. A site overrides it per environment (`ANTHROPIC_TRANSLATE_MODEL`).\n */\nexport const DEFAULT_TRANSLATE_MODEL = \"claude-sonnet-5-5\";\n\n/** \"Economy (Haiku)\" on Settings → Translation: a fraction of Sonnet's price for plainer copy. */\nexport const ECONOMY_TRANSLATE_MODEL = \"claude-haiku-5-5\";\n\n/** USD per million tokens, for the cost estimates on Settings → Translation. */\nexport interface ModelPrice {\n input: number;\n output: number;\n}\n\n/**\n * Anthropic's list prices for the two models the screen offers. A model\n * not listed (an `ANTHROPIC_TRANSLATE_MODEL` override) is estimated at\n * Sonnet's price, so an estimate errs high rather than reading as free.\n */\nexport const TRANSLATE_MODEL_PRICES: Record<string, ModelPrice> = {\n [DEFAULT_TRANSLATE_MODEL]: { input: 2, output: 10 },\n [ECONOMY_TRANSLATE_MODEL]: { input: 0.1, output: 0.5 },\n};\n\nexport function modelPrice(model: string): ModelPrice {\n return TRANSLATE_MODEL_PRICES[model] ?? TRANSLATE_MODEL_PRICES[DEFAULT_TRANSLATE_MODEL]!;\n}\n\n/** Estimated USD for one call's tokens on `model`. */\nexport function estimateCost(model: string, inputTokens: number, outputTokens: number): number {\n const price = modelPrice(model);\n return (inputTokens * price.input + outputTokens * price.output) / 1_000_000;\n}\n\n/** What one translator call did, for usage, cost and failure reporting. */\nexport type TranslatorCallEvent =\n | { ok: true; model: string; strings: number; inputTokens: number; outputTokens: number }\n | { ok: false; model: string; strings: number; failure: TranslationFailureKind; status?: number; message: string };\n\n/**\n * True when `text` contains `word` as a whole word, case-sensitively: \"ProtectIQ\"\n * is in \"Get ProtectIQ today\" but not in \"protectiq\" or \"ProtectIQs\". A\n * frozen word is only kept where it appears this way.\n */\nexport function containsWord(text: string, word: string): boolean {\n if (!word) return false;\n const escaped = word.replace(/[.*+?^${}()|[\\]\\\\]/g, \"\\\\$&\");\n return new RegExp(`(?<![\\\\p{L}\\\\p{N}_])${escaped}(?![\\\\p{L}\\\\p{N}_])`, \"u\").test(text);\n}\n\n/**\n * The SDK's defaults are a 10-minute timeout with retries. A translation\n * must stay bounded to seconds, not minutes: the manual endpoint awaits it\n * while an editor waits, and a deferred run must finish inside the host's\n * `waitUntil` window. One retry, 90s cap, then the target stays as it was.\n */\nconst TIMEOUT_MS = 90_000;\nconst MAX_RETRIES = 1;\n\n/** The slice of the Anthropic client this translator calls. */\nexport interface AnthropicMessagesClient {\n messages: {\n create(\n body: Record<string, unknown>,\n options?: { timeout?: number; maxRetries?: number },\n ): Promise<{\n content: Array<{ type: string; text?: string }>;\n usage?: { input_tokens?: number | null; output_tokens?: number | null } | null;\n }>;\n };\n}\n\nexport interface AnthropicTranslatorOptions {\n /**\n * The API key, usually `process.env.ANTHROPIC_API_KEY`. Without one the\n * translator reports `configured: false`: publishes still work, a\n * warning is logged, and \"Translate now\" is hidden.\n */\n apiKey?: string | null;\n /** The model id; omitted or blank uses `DEFAULT_TRANSLATE_MODEL`. */\n model?: string | null;\n /** The site facts the prompt carries. The plugin's own `site`, when given, wins. */\n site?: TranslateSite;\n /** A client to use instead of constructing one (tests, a proxied client). */\n client?: AnthropicMessagesClient;\n /**\n * Called once per API call with its token usage, or with why it failed.\n * Settings → Translation records usage and failures through it. A throw\n * here is ignored.\n */\n onCall?: (event: TranslatorCallEvent) => void | Promise<void>;\n}\n\nfunction languageName(code: string, site: TranslateSite | undefined): string {\n const named = site?.languages?.[code];\n if (named) return named;\n try {\n return new Intl.DisplayNames([\"en\"], { type: \"language\" }).of(code) ?? code;\n } catch {\n return code;\n }\n}\n\n/**\n * The system prompt: the library's generic rules plus the site's own facts.\n * Exported so a site can read exactly what the model is told.\n */\nexport function translationSystemPrompt(request: Pick<TranslateRequest, \"from\" | \"to\" | \"site\">): string {\n const { site } = request;\n const from = languageName(request.from, site);\n const to = languageName(request.to, site);\n const who = site?.name\n ? `You are a professional translator for ${site.name}${site.about ? `, ${site.about}` : \"\"}.`\n : \"You are a professional translator for a business website.\";\n const voice = site?.voice ? ` Keep the ${site.voice} brand voice.` : \" Keep the brand voice.\";\n const verbatim = [site?.name, ...(site?.keepVerbatim ?? [])].filter(\n (value, index, all): value is string => Boolean(value) && all.indexOf(value) === index,\n );\n const keep = verbatim.length\n ? `- Keep these EXACTLY as written, untranslated: ${verbatim.join(\n \", \",\n )}. Also keep URLs, email addresses and phone numbers as written.`\n : \"- Keep URLs, email addresses and phone numbers exactly as written.\";\n\n return `${who} Translate website and UI copy from ${from} into clear, natural ${to}.${voice}\n\nHard rules:\n- You receive a JSON array of strings. Return ONLY a JSON array of the translated strings, in the SAME ORDER and SAME LENGTH. No prose, no markdown, no code fences.\n${keep}\n- Preserve any ICU/message placeholders such as {year}, {count}, {name} verbatim, including the braces.\n- Preserve any HTML tags (e.g. <em>...</em>, <strong>...</strong>) and their positions; translate only the text between them.\n- For legal, regulatory or compliance copy, translate faithfully and literally. This output is a first-pass draft for a native speaker to review, not final compliance copy.\n- If a string is empty or is only a placeholder/URL/number, return it unchanged.`;\n}\n\n/** Tolerant JSON-array parse: strips accidental ``` fences and prose around the array, and checks the shape. */\nexport function parseJsonArray(text: string): string[] | null {\n let candidate = text.trim();\n const fenced = candidate.match(/```(?:json)?\\s*([\\s\\S]*?)```/);\n if (fenced?.[1] !== undefined) candidate = fenced[1].trim();\n // If the model wrapped the array in prose, take the outermost [ ... ].\n const start = candidate.indexOf(\"[\");\n const end = candidate.lastIndexOf(\"]\");\n if (start !== -1 && end > start) candidate = candidate.slice(start, end + 1);\n try {\n const value: unknown = JSON.parse(candidate);\n if (Array.isArray(value) && value.every((item) => typeof item === \"string\")) return value as string[];\n } catch {\n // fall through\n }\n return null;\n}\n\n/**\n * The provided `Translator`: one Anthropic Messages call per batch, the\n * strings as a JSON array in and out. `@anthropic-ai/sdk` is a peer,\n * imported on the first call, so a site that never translates never loads\n * it. Every failure (no key, the SDK missing, a network error, a\n * refusal, a malformed or wrong-length reply) returns `null` and is logged\n * by the caller; it never throws.\n */\nexport function anthropicTranslator(options: AnthropicTranslatorOptions): Translator {\n const apiKey = options.apiKey || undefined;\n const model = options.model?.trim() || DEFAULT_TRANSLATE_MODEL;\n let client: AnthropicMessagesClient | undefined = options.client;\n\n const getClient = async (): Promise<AnthropicMessagesClient | null> => {\n if (client) return client;\n if (!apiKey) return null;\n const sdk = (await import(\"@anthropic-ai/sdk\")) as unknown as {\n default: new (init: { apiKey: string }) => AnthropicMessagesClient;\n };\n client = new sdk.default({ apiKey });\n return client;\n };\n\n const report = async (event: TranslatorCallEvent): Promise<void> => {\n try {\n await options.onCall?.(event);\n } catch {\n // Reporting must never change the translation's outcome.\n }\n };\n\n const translate = async (strings: string[], request: TranslateRequest): Promise<string[] | null> => {\n if (strings.length === 0) return [];\n let anthropic: AnthropicMessagesClient | null;\n try {\n anthropic = await getClient();\n } catch {\n return null;\n }\n if (!anthropic) return null;\n try {\n const given = request.site ?? options.site;\n // Only the frozen words this batch actually contains (whole word,\n // case-sensitive), so \"protectiq\" in English is never told to stay\n // \"ProtectIQ\".\n const site = given?.keepVerbatim\n ? {\n ...given,\n keepVerbatim: given.keepVerbatim.filter((word) => strings.some((value) => containsWord(value, word))),\n }\n : given;\n const to = languageName(request.to, site);\n const content =\n (request.context ? `Context: ${request.context}\\n\\n` : \"\") +\n `Translate this JSON array of ${strings.length} strings to ${to}:\\n${JSON.stringify(strings)}`;\n const response = await anthropic.messages.create(\n {\n model,\n max_tokens: 16000,\n // A batch of copy is routine work; low effort keeps it fast and\n // inside the timeout without changing the result.\n output_config: { effort: \"low\" },\n system: translationSystemPrompt({ from: request.from, to: request.to, site }),\n messages: [{ role: \"user\", content }],\n },\n { timeout: TIMEOUT_MS, maxRetries: MAX_RETRIES },\n );\n const text = response.content\n .filter((block) => block.type === \"text\" && typeof block.text === \"string\")\n .map((block) => block.text)\n .join(\"\")\n .trim();\n const parsed = parseJsonArray(text);\n const usable = parsed && parsed.length === strings.length ? parsed : null;\n if (usable) {\n await report({\n ok: true,\n model,\n strings: strings.length,\n inputTokens: response.usage?.input_tokens ?? 0,\n outputTokens: response.usage?.output_tokens ?? 0,\n });\n } else {\n await report({ ok: false, model, strings: strings.length, failure: \"other\", message: \"The reply was not a usable JSON array.\" });\n }\n return usable;\n } catch (error) {\n const status = (error as { status?: unknown }).status;\n await report({\n ok: false,\n model,\n strings: strings.length,\n failure: classifyAnthropicError(error),\n ...(typeof status === \"number\" ? { status } : {}),\n message: error instanceof Error ? error.message : String(error),\n });\n return null;\n }\n };\n\n return Object.assign(translate, { configured: Boolean(apiKey || options.client) });\n}\n\n/** What a key check found. */\nexport type KeyCheck = \"valid\" | \"rejected\" | \"out-of-credit\" | \"unreachable\";\n\n/**\n * Checks a key with the smallest call that proves both the key and the\n * account's credit: one Haiku message with a few output tokens (a fraction\n * of a cent). A 401 is `rejected`; a billing error `out-of-credit`; no\n * answer, a 5xx or a rate limit `unreachable`, meaning \"check again on\n * first use\". Never throws.\n */\nexport async function verifyAnthropicKey(\n apiKey: string,\n options: { client?: AnthropicMessagesClient } = {},\n): Promise<KeyCheck> {\n try {\n let client = options.client;\n if (!client) {\n const sdk = (await import(\"@anthropic-ai/sdk\")) as unknown as {\n default: new (init: { apiKey: string }) => AnthropicMessagesClient;\n };\n client = new sdk.default({ apiKey });\n }\n await client.messages.create(\n {\n model: ECONOMY_TRANSLATE_MODEL,\n max_tokens: 16,\n output_config: { effort: \"low\" },\n messages: [{ role: \"user\", content: \"Reply with OK.\" }],\n },\n { timeout: 20_000, maxRetries: 0 },\n );\n return \"valid\";\n } catch (error) {\n const kind = classifyAnthropicError(error);\n if (kind === \"key-rejected\") return \"rejected\";\n if (kind === \"out-of-credit\") return \"out-of-credit\";\n return \"unreachable\";\n }\n}\n","import type { TranslateRequest, Translator } from \"./types\";\n\n/**\n * Translates `strings` with `translator` in one batch, preserving order.\n * Repeated strings are sent once. Returns `null` when the translator throws,\n * returns `null`, or returns anything but one string per string sent, so a\n * caller can leave the target as it was. Never throws.\n */\nexport async function translateStrings(\n strings: readonly string[],\n options: TranslateRequest & { translator: Translator },\n): Promise<string[] | null> {\n if (strings.length === 0) return [];\n const { translator, ...request } = options;\n const unique = [...new Set(strings)];\n let result: unknown;\n try {\n result = await translator(unique, request);\n } catch {\n return null;\n }\n if (!Array.isArray(result) || result.length !== unique.length) return null;\n if (!result.every((value) => typeof value === \"string\")) return null;\n const byString = new Map(unique.map((value, index) => [value, result[index] as string]));\n return strings.map((value) => byString.get(value) ?? value);\n}\n\n/** True unless the translator says it cannot run (an Anthropic translator with no API key). */\nexport function isTranslatorConfigured(translator: Translator | undefined): translator is Translator {\n return translator !== undefined && translator.configured !== false;\n}\n"],"mappings":";AAaA,SAAS,UAAU,OAAgE;AACjF,KAAI,OAAO,MAAM,SAAS,SAAU,QAAO,MAAM;CACjD,MAAM,OAAO,MAAM;AACnB,KAAI,OAAO,MAAM,OAAO,SAAS,SAAU,QAAO,KAAK,MAAM;AAC7D,KAAI,OAAO,MAAM,SAAS,SAAU,QAAO,KAAK;;;AAKlD,SAAgB,uBAAuB,OAAwC;AAC7E,KAAI,CAAC,SAAS,OAAO,UAAU,SAAU,QAAO;CAChD,MAAM,YAAY;CAClB,MAAM,SAAS,OAAO,UAAU,WAAW,WAAW,UAAU,SAAS,KAAA;CACzE,MAAM,OAAO,UAAU,UAAU;CACjC,MAAM,UAAU,OAAO,UAAU,YAAY,WAAW,UAAU,UAAU;AAC5E,KAAI,WAAW,OAAO,SAAS,gBAAiB,QAAO;AACvD,KAAI,WAAW,OAAO,kBAAkB,KAAK,QAAQ,CAAE,QAAO;AAC9D,KAAI,WAAW,OAAO,WAAW,OAAO,SAAS,0BAA0B,SAAS,mBAClF,QAAO;AAET,KAAI,WAAW,OAAO,SAAS,mBAAoB,QAAO;AAC1D,KAAI,WAAW,KAAA,KAAa,UAAU,IAAK,QAAO;AAClD,QAAO;;;;;;;;;AC3BT,MAAa,0BAA0B;;AAGvC,MAAa,0BAA0B;;;;;;AAavC,MAAa,yBAAqD;EAC/D,0BAA0B;EAAE,OAAO;EAAG,QAAQ;EAAI;EAClD,0BAA0B;EAAE,OAAO;EAAK,QAAQ;EAAK;CACvD;AAED,SAAgB,WAAW,OAA2B;AACpD,QAAO,uBA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IAAI,SAAS,QAAQ;AACrB,MAAI,CAAC,OAIH,UAAS,KAHI,OAAM,OAAO,uBAGT,QAAQ,EAAE,QAAQ,CAAC;AAEtC,QAAM,OAAO,SAAS,OACpB;GACE,OAAO;GACP,YAAY;GACZ,eAAe,EAAE,QAAQ,OAAO;GAChC,UAAU,CAAC;IAAE,MAAM;IAAQ,SAAS;IAAkB,CAAC;GACxD,EACD;GAAE,SAAS;GAAQ,YAAY;GAAG,CACnC;AACD,SAAO;UACA,OAAO;EACd,MAAM,OAAO,uBAAuB,MAAM;AAC1C,MAAI,SAAS,eAAgB,QAAO;AACpC,MAAI,SAAS,gBAAiB,QAAO;AACrC,SAAO;;;;;;;;;;;ACjSX,eAAsB,iBACpB,SACA,SAC0B;AAC1B,KAAI,QAAQ,WAAW,EAAG,QAAO,EAAE;CACnC,MAAM,EAAE,YAAY,GAAG,YAAY;CACnC,MAAM,SAAS,CAAC,GAAG,IAAI,IAAI,QAAQ,CAAC;CACpC,IAAI;AACJ,KAAI;AACF,WAAS,MAAM,WAAW,QAAQ,QAAQ;SACpC;AACN,SAAO;;AAET,KAAI,CAAC,MAAM,QAAQ,OAAO,IAAI,OAAO,WAAW,OAAO,OAAQ,QAAO;AACtE,KAAI,CAAC,OAAO,OAAO,UAAU,OAAO,UAAU,SAAS,CAAE,QAAO;CAChE,MAAM,WAAW,IAAI,IAAI,OAAO,KAAK,OAAO,UAAU,CAAC,OAAO,OAAO,OAAiB,CAAC,CAAC;AACxF,QAAO,QAAQ,KAAK,UAAU,SAAS,IAAI,MAAM,IAAI,MAAM;;;AAI7D,SAAgB,uBAAuB,YAA8D;AACnG,QAAO,eAAe,KAAA,KAAa,WAAW,eAAe"}
|
package/dist/theme.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
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-DLBlHZUd.mjs";
|
|
2
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-1vwxBgm5.mjs";
|
|
3
|
-
import { t as LocaleRead } from "./locale-
|
|
4
|
-
import { n as getPublishedIdentity, r as getPublishedTheme } from "./published-
|
|
3
|
+
import { t as LocaleRead } from "./locale-CTT3nn6T.mjs";
|
|
4
|
+
import { n as getPublishedIdentity, r as getPublishedTheme } from "./published-B3etM6X5.mjs";
|
|
5
5
|
import { ShadeStep, ThemeConfig } from "@bison-lab/tokens";
|
|
6
6
|
|
|
7
7
|
//#region src/theme/map.d.ts
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { o as anthropicTranslator } from "./strings-
|
|
3
|
-
import { t as fillMessages } from "./messages-
|
|
2
|
+
import { o as anthropicTranslator } from "./strings-Fd7kUCT7.mjs";
|
|
3
|
+
import { t as fillMessages } from "./messages-dZV_aAnR.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";
|
|
@@ -129,7 +129,7 @@ function loadEnvFiles(cwd) {
|
|
|
129
129
|
/**
|
|
130
130
|
* `bison-translate-messages`: fills a next-intl message file from the source
|
|
131
131
|
* locale's file with the Anthropic translator. Run it from the site, which
|
|
132
|
-
* installs `@anthropic-ai/sdk` (
|
|
132
|
+
* installs `@anthropic-ai/sdk` (a peer of this package).
|
|
133
133
|
*
|
|
134
134
|
* bison-translate-messages --source src/messages/en.json --out src/messages/es.json
|
|
135
135
|
* bison-translate-messages --source src/messages/en.json --out src/messages/es.json --force
|