@bison-lab/payload-core 4.39.0 → 5.0.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 +63 -33
- package/dist/admin.d.mts +19 -7
- package/dist/admin.d.mts.map +1 -1
- package/dist/admin.mjs +229 -16
- package/dist/admin.mjs.map +1 -1
- package/dist/block-library.d.mts +1 -1
- package/dist/block-library.mjs +1 -1
- package/dist/{block-thumbnails-DXOUzGjY.mjs → block-thumbnails-DC34uFtE.mjs} +1 -1
- package/dist/{block-thumbnails-DXOUzGjY.mjs.map → block-thumbnails-DC34uFtE.mjs.map} +1 -1
- package/dist/block-thumbnails-cli.mjs +1 -1
- package/dist/block-thumbnails.mjs +1 -1
- package/dist/capability-CqdYCzG1.d.mts +434 -0
- package/dist/capability-CqdYCzG1.d.mts.map +1 -0
- package/dist/capability-DHPE2kon.mjs +2685 -0
- package/dist/capability-DHPE2kon.mjs.map +1 -0
- package/dist/{catalogue-FxH10X3v.d.mts → catalogue-DWqHWVE5.d.mts} +1 -1
- package/dist/{catalogue-FxH10X3v.d.mts.map → catalogue-DWqHWVE5.d.mts.map} +1 -1
- package/dist/{facet-field-DjaZ0C7D.d.mts → facet-field-2K22iuWA.d.mts} +1 -1
- package/dist/{facet-field-DjaZ0C7D.d.mts.map → facet-field-2K22iuWA.d.mts.map} +1 -1
- package/dist/{facet-field-Uf8S4yL1.mjs → facet-field-DO3VT_Cz.mjs} +1 -1
- package/dist/{facet-field-Uf8S4yL1.mjs.map → facet-field-DO3VT_Cz.mjs.map} +1 -1
- package/dist/index.d.mts +13 -7
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +25 -667
- package/dist/index.mjs.map +1 -1
- package/dist/{locale-CFWfB4wP.mjs → locale-B6rUVwpg.mjs} +1 -1
- package/dist/locale-B6rUVwpg.mjs.map +1 -0
- package/dist/{locale-CWiIcGuU.d.mts → locale-CTT3nn6T.d.mts} +5 -4
- package/dist/locale-CTT3nn6T.d.mts.map +1 -0
- package/dist/messages-dZV_aAnR.mjs +93 -0
- package/dist/messages-dZV_aAnR.mjs.map +1 -0
- package/dist/metadata.d.mts +1 -1
- package/dist/navigation.d.mts +2 -2
- package/dist/navigation.mjs +1 -1
- package/dist/og.d.mts +2 -2
- package/dist/og.mjs +1 -1
- package/dist/{preview-CNBVfmM7.d.mts → preview-1vwxBgm5.d.mts} +2 -2
- package/dist/{preview-CNBVfmM7.d.mts.map → preview-1vwxBgm5.d.mts.map} +1 -1
- package/dist/{published-_1rrTj_B.d.mts → published-B3etM6X5.d.mts} +3 -3
- package/dist/{published-_1rrTj_B.d.mts.map → published-B3etM6X5.d.mts.map} +1 -1
- package/dist/{published-D3yVnbxs.mjs → published-BMt7Z5CF.mjs} +2 -2
- package/dist/{published-D3yVnbxs.mjs.map → published-BMt7Z5CF.mjs.map} +1 -1
- package/dist/{published-DefZv9na.mjs → published-CkqqY08H.mjs} +2 -2
- package/dist/{published-DefZv9na.mjs.map → published-CkqqY08H.mjs.map} +1 -1
- package/dist/{published-DXjnElZn.d.mts → published-QDNmDi02.d.mts} +2 -2
- package/dist/{published-DXjnElZn.d.mts.map → published-QDNmDi02.d.mts.map} +1 -1
- package/dist/{published-QyTcDznE.mjs → published-hqtvmVUD.mjs} +1 -1
- package/dist/{published-QyTcDznE.mjs.map → published-hqtvmVUD.mjs.map} +1 -1
- package/dist/{root-page-key-B86JwL8Z.mjs → root-page-key-kx3C1eyp.mjs} +1 -1
- package/dist/{root-page-key-B86JwL8Z.mjs.map → root-page-key-kx3C1eyp.mjs.map} +1 -1
- package/dist/seo.mjs +1 -1
- package/dist/{messages-Fl1spIwN.mjs → strings-Fd7kUCT7.mjs} +156 -118
- package/dist/strings-Fd7kUCT7.mjs.map +1 -0
- package/dist/taxonomy.d.mts +1 -1
- package/dist/taxonomy.mjs +1 -1
- package/dist/theme.d.mts +4 -4
- package/dist/theme.mjs +1 -1
- package/dist/{title-D_jixG36.d.mts → title-trhUexxM.d.mts} +1 -1
- package/dist/{title-D_jixG36.d.mts.map → title-trhUexxM.d.mts.map} +1 -1
- package/dist/translate-messages-cli.mjs +3 -2
- package/dist/translate-messages-cli.mjs.map +1 -1
- package/dist/translate.d.mts +300 -206
- package/dist/translate.d.mts.map +1 -1
- package/dist/translate.mjs +225 -1027
- package/dist/translate.mjs.map +1 -1
- package/dist/{types-Db6Iy3hJ.d.mts → types-DLBlHZUd.d.mts} +1 -1
- package/dist/{types-Db6Iy3hJ.d.mts.map → types-DLBlHZUd.d.mts.map} +1 -1
- package/dist/{wireframe-xcJNJzBf.mjs → wireframe-CXorKFU_.mjs} +1 -1
- package/dist/{wireframe-xcJNJzBf.mjs.map → wireframe-CXorKFU_.mjs.map} +1 -1
- package/dist/wireframe-cli.mjs +1 -1
- package/dist/wireframe.mjs +1 -1
- package/package.json +6 -8
- package/dist/locale-CFWfB4wP.mjs.map +0 -1
- package/dist/locale-CWiIcGuU.d.mts.map +0 -1
- package/dist/messages-Fl1spIwN.mjs.map +0 -1
package/README.md
CHANGED
|
@@ -33,8 +33,8 @@ lockstep.
|
|
|
33
33
|
| `@bison-lab/payload-core/taxonomy` | `facetField`, `FacetEntry` | Anywhere. What a block config imports to tag content from a taxonomy; no plugin, no React, so a browser bundle can take it (`@bison-lab/payload-blocks` main entry reaches the docs island and Storybook). |
|
|
34
34
|
| `@bison-lab/payload-core/block-thumbnails` | `captureThumbnails`, `thumbnailCss`, `NEUTRAL_THEME`, `thumbnailVersion`; the `bison-block-thumbnails` bin | Node, beside Playwright. What a site's thumbnail script imports; no Payload, no React. |
|
|
35
35
|
| `@bison-lab/payload-core/wireframe` | Deprecated: the 4.15 wireframe generator and the `bison-wireframes` bin | Node. Kept for one release so a site's script keeps working; use `./block-thumbnails`. Goes in the next major. |
|
|
36
|
-
| `@bison-lab/payload-core/translate` | `autoTranslate`, `anthropicTranslator`, `translateDocument`, `translateStrings`, the test seam (`readTranslateState`, `withTranslator`), the guard and walk helpers; the `bison-translate-messages` bin | Node. What `payload.config.ts` and a seed script import (#278); no React. `@anthropic-ai/sdk` is
|
|
37
|
-
| `@bison-lab/payload-core/admin` | Theme fields, the Roles and Features matrices, the Block library field, Admin nav, the Users Roles checklist, the FAQ Library list,
|
|
36
|
+
| `@bison-lab/payload-core/translate` | `applyTranslation` / `translation`, the deprecated `autoTranslate`, `anthropicTranslator`, `translateDocument`, `translateStrings`, the settings readers and key helpers, `BisonTranslationMarker`, the languages (`LIBRARY_LOCALES`, `activeLocales`, `inactiveLocaleRedirect`, `activeAlternates`), the `localizeExistingContent` migration and `isLocalizedPath`, the test seam (`readTranslateState`, `withTranslator`), the guard and walk helpers; the `bison-translate-messages` bin | Node. What `payload.config.ts` and a seed script import (#278); no React. `@anthropic-ai/sdk` is a required peer (every site has translation), imported on the first translation. |
|
|
37
|
+
| `@bison-lab/payload-core/admin` | Theme fields, the Roles and Features matrices, the Block library field, Admin nav, the Users Roles checklist, the FAQ Library list, "Translate now" (`TranslateNowMenuItem`) and the Translation key panel (`TranslationKeyPanel`) | Admin. Referenced by import-map string; `generate:importmap` writes it. |
|
|
38
38
|
| `@bison-lab/payload-core/react` | `BlockLibraryIsland`; `ThemePreview` (legacy; Theme has no preview pane) | Client. What a Block library preview route wraps its sample in. |
|
|
39
39
|
|
|
40
40
|
## What editors get
|
|
@@ -256,7 +256,9 @@ export async function up({ payload }) {
|
|
|
256
256
|
|
|
257
257
|
**3. Serve the catalogue.** A Next route around `serveFont` from
|
|
258
258
|
`@bison-lab/fonts/server`, listed in `serverExternalPackages`, at the path
|
|
259
|
-
you pass as `fontsBaseUrl` (default `/fonts`)
|
|
259
|
+
you pass as `fontsBaseUrl` (default `/fonts`), with the package's `files/`
|
|
260
|
+
folder in that route's `outputFileTracingIncludes` (see the fonts README;
|
|
261
|
+
without it a deploy answers 500 for every font).
|
|
260
262
|
|
|
261
263
|
**4. Render the published theme in the root layout.**
|
|
262
264
|
|
|
@@ -826,8 +828,9 @@ title and description (and the plugin's share image, its own setting), a
|
|
|
826
828
|
FAQ Library `question`, `answer` and `answerText`, a taxonomy term's
|
|
827
829
|
`name`, Header and Footer link labels, footer section headings and the
|
|
828
830
|
text below the logo, and a Media `alt`. Slugs, links, social URLs and
|
|
829
|
-
settings are shared.
|
|
830
|
-
|
|
831
|
+
settings are shared. Every site has `localization` (the library's
|
|
832
|
+
languages, #297), so these fields live in the `_locales` tables; a site
|
|
833
|
+
coming from one locale runs `localizeExistingContent` once.
|
|
831
834
|
`getNavigation` and `getPublishedIdentity` take the request's `locale` and
|
|
832
835
|
`fallbackLocale` (`LocaleRead`, exported from `./navigation` and
|
|
833
836
|
`./theme`). `src/__tests__/localized.test.ts` lists the localized paths.
|
|
@@ -841,37 +844,64 @@ See [Multiple locales](https://payload.bisonlab.ai/site/localization/).
|
|
|
841
844
|
|
|
842
845
|
## Auto-translation
|
|
843
846
|
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
`
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
847
|
+
Every site has Settings → Translation (#291): `adminNav()` calls
|
|
848
|
+
`applyTranslation(config)` (`translation()` is the same for a site without
|
|
849
|
+
it), which adds the `translation-settings` Global (versioned, behind the
|
|
850
|
+
`translation` grant that Developer and Admin always hold), the hidden
|
|
851
|
+
`translation-state` Global (the AES-256-GCM key under `PAYLOAD_SECRET`,
|
|
852
|
+
unreadable through the API and in no version row), the key endpoints
|
|
853
|
+
(`/api/translation/status`, `key`, `key/check`, `available`), and on every
|
|
854
|
+
collection and global with localized fields the save hook plus "Translate
|
|
855
|
+
now". It is idempotent: a second pass only hooks entities a later plugin
|
|
856
|
+
added. The Admin's switch governs everything; the stored key is used only
|
|
857
|
+
where `VERCEL_ENV=production` (elsewhere only `ANTHROPIC_API_KEY`), see
|
|
858
|
+
`resolveApiKey`. `autoTranslate({ enabled })` is deprecated: `false` returns
|
|
859
|
+
the config itself, `true` applies the same capability with its `site`,
|
|
860
|
+
`waitUntil`, hints and test `translator`.
|
|
861
|
+
|
|
862
|
+
The save hook (`hooks.ts`) skips `context.autoTranslate === false`, target
|
|
863
|
+
locale edits and autosave (`isAutosave`); with the switch on, Save draft
|
|
864
|
+
fills blanks into the draft, and a publish (or any save without drafts) also
|
|
865
|
+
re-translates strings changed since the last published version
|
|
866
|
+
(`draftedTranslationDecision`, never `previousDoc`, which is the autosave).
|
|
867
|
+
The per-string rule in `translationJob` keeps a hand-corrected target until
|
|
868
|
+
its source changes. `runAfterCommit` polls `req.transactionID` (Payload has
|
|
869
|
+
no post-commit hook), gives up after 30s and runs the work with no `req`; the
|
|
870
|
+
write is made as the saving user. Every translation write carries
|
|
871
|
+
`context.bisonTranslation = { locale, kind }` (`BisonTranslationMarker`) and
|
|
872
|
+
goes through a shallow copy of a passed `req`, because Payload's
|
|
873
|
+
`createLocalReq` merges `context` into the `req` it is given in place.
|
|
874
|
+
`custom: { translate: false }` on a field skips it; `custom.bisonTranslation.context`
|
|
875
|
+
on an entity is its prompt hint. `translateDocument` re-reads the latest
|
|
854
876
|
version right before each target write: Payload's update merges into the
|
|
855
|
-
latest version row
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
never by key name. The translator is injected; `anthropicTranslator` reads
|
|
865
|
-
no `process.env` and imports the SDK lazily. "Translate now" is an
|
|
866
|
-
`editMenuItems` entry plus `POST /api/<slug>/:id/translate`, registered for
|
|
867
|
-
the listed collections whether or not the translator has a key (the import
|
|
868
|
-
map must not depend on the environment); it gets `configured` and renders
|
|
869
|
-
nothing without a key, and the endpoint answers 503. Tests read or swap the
|
|
870
|
-
translator with `readTranslateState` / `withTranslator`, never the
|
|
871
|
-
`bisonAutoTranslate` key. `bison-translate-messages --language` names the
|
|
872
|
-
`--to` locale like `site.languages`. See
|
|
877
|
+
latest version row, draft included, so a live write over a newer autosave
|
|
878
|
+
would publish the draft; it writes into that draft instead and re-plans
|
|
879
|
+
from it (`writeLatest`, at most `REPLANS` extra calls). Instructions are the
|
|
880
|
+
screen's once saved, else the code `site`; frozen words reach the prompt
|
|
881
|
+
only when a string contains them whole-word, case-sensitively
|
|
882
|
+
(`containsWord`). The model is `quality` (Sonnet) or `economy` (Haiku);
|
|
883
|
+
`ANTHROPIC_TRANSLATE_MODEL` overrides it off production. Tests read or swap
|
|
884
|
+
the translator with `readTranslateState` / `withTranslator`; a test
|
|
885
|
+
translator still needs the switch on. See
|
|
873
886
|
[Auto-translation](https://payload.bisonlab.ai/site/auto-translate/).
|
|
874
887
|
|
|
888
|
+
### Languages (#297)
|
|
889
|
+
|
|
890
|
+
`LIBRARY_LOCALES` (English default, Spanish) is the list every site
|
|
891
|
+
carries: `applyTranslation` puts them into `localization` with
|
|
892
|
+
`withLibraryLocales`, keeping a site's own. The ticks on Settings →
|
|
893
|
+
Translation (`languages`, with a server-set `languagesChosen`; until it is
|
|
894
|
+
set the defaults apply, and a site's own declared target locales are the
|
|
895
|
+
defaults) decide which target languages are translated and live.
|
|
896
|
+
`activeLocales(payload)` caches the answer per process
|
|
897
|
+
(`ACTIVE_LOCALES_CACHE_MS`, cleared by a save in the same process) for
|
|
898
|
+
middleware; `inactiveLocaleRedirect` and `activeAlternates` are the 308 and
|
|
899
|
+
the switcher/hreflang filter; `GET /api/translation/locales` serves it to an
|
|
900
|
+
edge runtime. `localizeExistingContent` is the one-to-several locale data
|
|
901
|
+
migration: it runs the generated SQL with every `DROP COLUMN` / `DROP TYPE`
|
|
902
|
+
moved last and each moving column copied into `<table>_locales` first.
|
|
903
|
+
It also sets the default locale on the new `locale` column of `_rels` / `_texts` / `_numbers` rows whose `path` is a localized field (`isLocalizedPath` over the migration's `payload.config`), and stops when such rows exist without it. Postgres only. `pnpm --filter @bison-lab/payload-core test:postgres` runs it against a local Postgres with recorded `migrate:create` output (`src/__tests__/fixtures/localize/`); the normal suite skips it.
|
|
904
|
+
|
|
875
905
|
## No generated types
|
|
876
906
|
|
|
877
907
|
The package cannot import a site's `payload-types`, so the shapes it reads
|
package/dist/admin.d.mts
CHANGED
|
@@ -383,11 +383,12 @@ declare function MediaListView(props: ListViewClientProps): react_jsx_runtime0.J
|
|
|
383
383
|
//#endregion
|
|
384
384
|
//#region src/admin/translate-now.d.ts
|
|
385
385
|
/**
|
|
386
|
-
* "Translate now" in a document's menu (`
|
|
387
|
-
*
|
|
388
|
-
*
|
|
389
|
-
*
|
|
390
|
-
*
|
|
386
|
+
* "Translate now" in a document's menu (`TRANSLATE_NOW`). Re-translates
|
|
387
|
+
* this document with `overwrite`: into the locale being viewed when that is
|
|
388
|
+
* a target locale, else into every target locale. Always registered (so
|
|
389
|
+
* the import map does not depend on the key); it asks
|
|
390
|
+
* `GET /api/translation/available` and renders nothing while Settings →
|
|
391
|
+
* Translation is off or has no key here. `configured: false` hides it too.
|
|
391
392
|
*/
|
|
392
393
|
declare function TranslateNowMenuItem({
|
|
393
394
|
sourceLocale,
|
|
@@ -395,9 +396,20 @@ declare function TranslateNowMenuItem({
|
|
|
395
396
|
configured
|
|
396
397
|
}: {
|
|
397
398
|
sourceLocale?: string;
|
|
398
|
-
targetLocales?: string[]; /** False
|
|
399
|
+
targetLocales?: string[]; /** False hides the item whatever the server says. */
|
|
399
400
|
configured?: boolean;
|
|
400
401
|
}): react_jsx_runtime0.JSX.Element | null;
|
|
401
402
|
//#endregion
|
|
402
|
-
|
|
403
|
+
//#region src/admin/translation-key-panel.d.ts
|
|
404
|
+
/**
|
|
405
|
+
* The key panel at the top of Settings → Translation. The key is pasted
|
|
406
|
+
* here and sent straight to `POST /api/translation/key`, never into the
|
|
407
|
+
* document, so it is in no form state, version or response; only its last 4
|
|
408
|
+
* characters come back. Shows which key a translation would use here and
|
|
409
|
+
* why (production uses the stored key; elsewhere only the server's
|
|
410
|
+
* environment key).
|
|
411
|
+
*/
|
|
412
|
+
declare function TranslationKeyPanel(): react_jsx_runtime0.JSX.Element;
|
|
413
|
+
//#endregion
|
|
414
|
+
export { AdminNav, AdminNavEntityField, AdminNavItemRowLabel, AdminNavRowLabel, AppearanceField, BlockDrawerStyles, BlockLibraryField, ColorField, ColorScaleField, ContrastReport, DocumentCreateNew, DocumentTitleActions, FeaturesMatrixField, FontField, GreyScaleField, HiddenSaveButton, IdentityFallback, LibraryField, ListAlignStyles, LookField, MediaAltAutofill, MediaListView, PageSlugCell, PageTitleCell, PairingField, PublishChild, QuestionsList, RequiredPageCell, RequiredPageField, RichTextEditorFontStyles, RoleNameField, RoleSlugField, RolesCell, RolesField, RolesGrantsField, RolesMatrixField, RolesRowLabel, SectionHeading, SlugField, ThemeDocumentControls, ThemeSaveButton, TranslateNowMenuItem, TranslationKeyPanel, setThemePreviewMode };
|
|
403
415
|
//# sourceMappingURL=admin.d.mts.map
|
package/dist/admin.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"admin.d.mts","names":[],"sources":["../src/admin/color-field.tsx","../src/admin/color-scale-field.tsx","../src/admin/library-field.tsx","../src/admin/font-field.tsx","../src/admin/pairing-field.tsx","../src/admin/appearance-field.tsx","../src/admin/grey-scale-field.tsx","../src/admin/contrast-report.tsx","../src/admin/section-heading.tsx","../src/admin/publish-child.tsx","../src/admin/save-button.tsx","../src/admin/preview-mode.tsx","../src/admin/identity-fallback.tsx","../src/admin/look-field.tsx","../src/admin/roles-cell.tsx","../src/admin/roles-matrix-field.tsx","../src/admin/roles-row-label.tsx","../src/admin/role-slug-field.tsx","../src/admin/slug-field.tsx","../src/admin/page-title-cell.tsx","../src/admin/page-slug-cell.tsx","../src/admin/required-page-cell.tsx","../src/admin/role-name-field.tsx","../src/admin/roles-field.tsx","../src/admin/roles-grants-field.tsx","../src/admin/features-matrix-field.tsx","../src/admin/block-library-field.tsx","../src/admin/document-title-actions.tsx","../src/admin/list-align-styles.tsx","../src/admin/block-drawer-styles.tsx","../src/admin/rich-text-editor-font-styles.tsx","../src/admin/document-create-new.tsx","../src/admin-nav/types.ts","../src/admin/admin-nav.tsx","../src/admin/admin-nav-row-label.tsx","../src/admin/admin-nav-item-row-label.tsx","../src/admin/admin-nav-entity-field.tsx","../src/taxonomy/facet-field.ts","../src/questions/types.ts","../src/admin/questions-list.tsx","../src/admin/media-alt-autofill.tsx","../src/admin/media-list-view.tsx","../src/admin/translate-now.tsx"],"mappings":";;;;;;;;;;;cAWa,UAAA,EAAY,wBAAA;;;;;;;;cCuBZ,eAAA,EAAiB,yBAAA;;;;;;;;;cCMjB,YAAA,EAAc,yBAAA;;;;;;;;;cCtBd,SAAA,EAAW,0BAAA;;;;;;;cCNX,YAAA,EAAc,sBAAA;;;;;;;cCCd,eAAA,EAAiB,yBAAA;;;ALF9B;;;;AAAA,cM4Da,cAAA,EAAgB,0BAAA;;;;;;;cCnDhB,cAAA,EAAgB,sBAAA;;;;;;cCbhB,cAAA,EAAgB,sBAAA;;;cC0IhB,YAAA,EAAc,sBAAA;;;;;;;;iBCtIX,qBAAA,CAAA;;AVAhB;;;iBUQgB,eAAA,CAAA,GAAe,kBAAA,CAAA,GAAA,CAAA,OAAA;;iBA0Bf,gBAAA,CAAA,GAAgB,kBAAA,CAAA,GAAA,CAAA,OAAA;;;KCpCpB,gBAAA;AAAA,iBAgDI,mBAAA,CAAoB,IAAA,EAAM,gBAAA;;;;;;;cCjD7B,gBAAA,EAAkB,sBAAA;;;;;;;cCIlB,SAAA,EAAW,wBAAA;;;;;;;;;iBCOR,SAAA,CAAA;EAAY,QAAA;EAAU;AAAA,GAAS,yBAAA,GAAyB,kBAAA,CAAA,GAAA,CAAA,OAAA;;;;;;;;cCc3D,gBAAA,EAAkB,yBAAA;;;;;;iBC1Bf,aAAA,CAAA,GAAa,kBAAA,CAAA,GAAA,CAAA,OAAA;;;;;;cCChB,aAAA,EAAe,wBAAA;;;;;;;;;cC8Bf,SAAA,EAAW,wBAAA;;;;;;;iBC7BR,aAAA,CAAc,KAAA,EAAO,yBAAA,GAAyB,kBAAA,CAAA,GAAA,CAAA,OAAA;;;;iBCJ9C,YAAA,CAAA;EAAe,QAAA;EAAU;AAAA,GAAW,yBAAA,GAAyB,kBAAA,CAAA,GAAA,CAAA,OAAA;;;;cCEhE,iBAAA,EAAmB,wBAAA;AAAA,iBAEhB,gBAAA,CAAA;EAAmB;AAAA,GAAW,yBAAA,GAAyB,kBAAA,CAAA,GAAA,CAAA,OAAA;;;;;;;cCA1D,aAAA,EAAe,wBAAA;;;;;;;;cCqBf,UAAA,EAAY,0BAAA;;;;;;;;
|
|
1
|
+
{"version":3,"file":"admin.d.mts","names":[],"sources":["../src/admin/color-field.tsx","../src/admin/color-scale-field.tsx","../src/admin/library-field.tsx","../src/admin/font-field.tsx","../src/admin/pairing-field.tsx","../src/admin/appearance-field.tsx","../src/admin/grey-scale-field.tsx","../src/admin/contrast-report.tsx","../src/admin/section-heading.tsx","../src/admin/publish-child.tsx","../src/admin/save-button.tsx","../src/admin/preview-mode.tsx","../src/admin/identity-fallback.tsx","../src/admin/look-field.tsx","../src/admin/roles-cell.tsx","../src/admin/roles-matrix-field.tsx","../src/admin/roles-row-label.tsx","../src/admin/role-slug-field.tsx","../src/admin/slug-field.tsx","../src/admin/page-title-cell.tsx","../src/admin/page-slug-cell.tsx","../src/admin/required-page-cell.tsx","../src/admin/role-name-field.tsx","../src/admin/roles-field.tsx","../src/admin/roles-grants-field.tsx","../src/admin/features-matrix-field.tsx","../src/admin/block-library-field.tsx","../src/admin/document-title-actions.tsx","../src/admin/list-align-styles.tsx","../src/admin/block-drawer-styles.tsx","../src/admin/rich-text-editor-font-styles.tsx","../src/admin/document-create-new.tsx","../src/admin-nav/types.ts","../src/admin/admin-nav.tsx","../src/admin/admin-nav-row-label.tsx","../src/admin/admin-nav-item-row-label.tsx","../src/admin/admin-nav-entity-field.tsx","../src/taxonomy/facet-field.ts","../src/questions/types.ts","../src/admin/questions-list.tsx","../src/admin/media-alt-autofill.tsx","../src/admin/media-list-view.tsx","../src/admin/translate-now.tsx","../src/admin/translation-key-panel.tsx"],"mappings":"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"}
|
package/dist/admin.mjs
CHANGED
|
@@ -2721,6 +2721,14 @@ const LEGACY_THEME_FEATURE_SLUGS = [
|
|
|
2721
2721
|
"theme-identity",
|
|
2722
2722
|
"brand-assets"
|
|
2723
2723
|
];
|
|
2724
|
+
/**
|
|
2725
|
+
* The Roles grant that opens Settings → Translation. Not a Features row:
|
|
2726
|
+
* every site has the screen. Developer and Admin always hold it; any other
|
|
2727
|
+
* role holds it when ticked.
|
|
2728
|
+
*/
|
|
2729
|
+
const TRANSLATION_GRANT_SLUG = "translation";
|
|
2730
|
+
/** Roles that hold the translation grant whatever their ticks say. */
|
|
2731
|
+
const ALWAYS_TRANSLATION_ROLES = ["admin"];
|
|
2724
2732
|
const DEFAULT_ROLE_GRANTS = {
|
|
2725
2733
|
developer: [],
|
|
2726
2734
|
admin: [
|
|
@@ -2728,7 +2736,8 @@ const DEFAULT_ROLE_GRANTS = {
|
|
|
2728
2736
|
"publish",
|
|
2729
2737
|
"media",
|
|
2730
2738
|
"users",
|
|
2731
|
-
"roles"
|
|
2739
|
+
"roles",
|
|
2740
|
+
TRANSLATION_GRANT_SLUG
|
|
2732
2741
|
],
|
|
2733
2742
|
designer: [
|
|
2734
2743
|
"content",
|
|
@@ -2816,6 +2825,7 @@ function featureGroupLabel(group) {
|
|
|
2816
2825
|
}
|
|
2817
2826
|
function packageFeatureLabel(slug, extras = []) {
|
|
2818
2827
|
if (slug === "theme") return "Theme";
|
|
2828
|
+
if (slug === "translation") return "Translation settings";
|
|
2819
2829
|
const pack = PACKAGE_FEATURES.find((feature) => feature.slug === slug);
|
|
2820
2830
|
if (pack) return pack.label;
|
|
2821
2831
|
return extras.find((feature) => feature.slug === slug)?.label ?? slug;
|
|
@@ -3721,14 +3731,28 @@ function asGrants(value) {
|
|
|
3721
3731
|
return value.filter((entry) => typeof entry === "string");
|
|
3722
3732
|
}
|
|
3723
3733
|
const LEGACY_THEME_GRANTS = new Set(LEGACY_THEME_FEATURE_SLUGS);
|
|
3724
|
-
/**
|
|
3734
|
+
/**
|
|
3735
|
+
* Theme and Translation are ticks Features cannot hide. Legacy theme rows
|
|
3736
|
+
* are not ticks.
|
|
3737
|
+
*/
|
|
3725
3738
|
function withThemeGrant(rows) {
|
|
3726
|
-
|
|
3739
|
+
const theme = {
|
|
3727
3740
|
slug: "theme",
|
|
3728
3741
|
label: "Theme",
|
|
3729
3742
|
group: "theme",
|
|
3730
3743
|
released: true
|
|
3731
|
-
}
|
|
3744
|
+
};
|
|
3745
|
+
const translation = {
|
|
3746
|
+
slug: TRANSLATION_GRANT_SLUG,
|
|
3747
|
+
label: "Translation settings",
|
|
3748
|
+
group: "users",
|
|
3749
|
+
released: true
|
|
3750
|
+
};
|
|
3751
|
+
return [
|
|
3752
|
+
theme,
|
|
3753
|
+
...rows.filter((row) => row.slug !== "theme" && row.slug !== "translation" && !LEGACY_THEME_GRANTS.has(row.slug)),
|
|
3754
|
+
translation
|
|
3755
|
+
];
|
|
3732
3756
|
}
|
|
3733
3757
|
function rolePathFromGrants(path) {
|
|
3734
3758
|
return path.replace(/\.grants$/, ".role");
|
|
@@ -3760,12 +3784,16 @@ const RolesGrantsField = (props) => {
|
|
|
3760
3784
|
}, [api, serverURL]);
|
|
3761
3785
|
const grants = asGrants(value);
|
|
3762
3786
|
const shown = implicitAll ? catalogue : catalogue.filter((row) => row.released);
|
|
3787
|
+
const alwaysTranslation = typeof role === "string" && ALWAYS_TRANSLATION_ROLES.includes(role);
|
|
3788
|
+
function locked(slug) {
|
|
3789
|
+
return implicitAll || slug === "translation" && alwaysTranslation;
|
|
3790
|
+
}
|
|
3763
3791
|
function holds(slug) {
|
|
3764
3792
|
if (slug === "theme") return grants.some((entry) => entry === "theme" || LEGACY_THEME_GRANTS.has(entry));
|
|
3765
3793
|
return grants.includes(slug);
|
|
3766
3794
|
}
|
|
3767
3795
|
function toggle(slug, checked) {
|
|
3768
|
-
if (
|
|
3796
|
+
if (locked(slug)) return;
|
|
3769
3797
|
const next = new Set(grants);
|
|
3770
3798
|
if (slug === "theme") {
|
|
3771
3799
|
for (const legacy of LEGACY_THEME_GRANTS) next.delete(legacy);
|
|
@@ -3796,12 +3824,12 @@ const RolesGrantsField = (props) => {
|
|
|
3796
3824
|
className: "bl-role-grants__group-title",
|
|
3797
3825
|
children: featureGroupLabel(group)
|
|
3798
3826
|
}), members.map((row) => /* @__PURE__ */ jsxs("label", {
|
|
3799
|
-
className: ["bl-role-grants__row",
|
|
3827
|
+
className: ["bl-role-grants__row", locked(row.slug) && "is-implicit"].filter(Boolean).join(" "),
|
|
3800
3828
|
children: [/* @__PURE__ */ jsx("input", {
|
|
3801
3829
|
type: "checkbox",
|
|
3802
3830
|
"aria-label": `${row.label || row.slug}`,
|
|
3803
|
-
checked:
|
|
3804
|
-
disabled:
|
|
3831
|
+
checked: locked(row.slug) || holds(row.slug),
|
|
3832
|
+
disabled: locked(row.slug),
|
|
3805
3833
|
onChange: (event) => toggle(row.slug, event.target.checked)
|
|
3806
3834
|
}), /* @__PURE__ */ jsx("span", { children: row.label || row.slug })]
|
|
3807
3835
|
}, row.slug))]
|
|
@@ -7025,20 +7053,39 @@ function ChevronMark() {
|
|
|
7025
7053
|
//#endregion
|
|
7026
7054
|
//#region src/admin/translate-now.tsx
|
|
7027
7055
|
/**
|
|
7028
|
-
* "Translate now" in a document's menu (`
|
|
7029
|
-
*
|
|
7030
|
-
*
|
|
7031
|
-
*
|
|
7032
|
-
*
|
|
7056
|
+
* "Translate now" in a document's menu (`TRANSLATE_NOW`). Re-translates
|
|
7057
|
+
* this document with `overwrite`: into the locale being viewed when that is
|
|
7058
|
+
* a target locale, else into every target locale. Always registered (so
|
|
7059
|
+
* the import map does not depend on the key); it asks
|
|
7060
|
+
* `GET /api/translation/available` and renders nothing while Settings →
|
|
7061
|
+
* Translation is off or has no key here. `configured: false` hides it too.
|
|
7033
7062
|
*/
|
|
7034
7063
|
function TranslateNowMenuItem({ sourceLocale, targetLocales = [], configured = true }) {
|
|
7035
7064
|
const { id, collectionSlug } = useDocumentInfo();
|
|
7036
7065
|
const { config } = useConfig();
|
|
7037
7066
|
const locale = useLocale();
|
|
7038
7067
|
const [busy, setBusy] = useState(false);
|
|
7039
|
-
|
|
7068
|
+
const [available, setAvailable] = useState(false);
|
|
7069
|
+
const [languages, setLanguages] = useState(targetLocales);
|
|
7070
|
+
useEffect(() => {
|
|
7071
|
+
if (!configured) return;
|
|
7072
|
+
let cancelled = false;
|
|
7073
|
+
fetch(`${config.serverURL ?? ""}${config.routes.api}/translation/available`, { credentials: "include" }).then((response) => response.ok ? response.json() : { available: false }).then((body) => {
|
|
7074
|
+
if (cancelled) return;
|
|
7075
|
+
setAvailable(body.available === true);
|
|
7076
|
+
if (Array.isArray(body.languages)) setLanguages(body.languages.filter((code) => typeof code === "string"));
|
|
7077
|
+
}).catch(() => void 0);
|
|
7078
|
+
return () => {
|
|
7079
|
+
cancelled = true;
|
|
7080
|
+
};
|
|
7081
|
+
}, [
|
|
7082
|
+
configured,
|
|
7083
|
+
config.serverURL,
|
|
7084
|
+
config.routes.api
|
|
7085
|
+
]);
|
|
7086
|
+
if (!collectionSlug || !configured || !available) return null;
|
|
7040
7087
|
const viewing = locale && typeof locale === "object" ? locale.code : void 0;
|
|
7041
|
-
const into = viewing && viewing !== sourceLocale &&
|
|
7088
|
+
const into = viewing && viewing !== sourceLocale && languages.includes(viewing) ? viewing : void 0;
|
|
7042
7089
|
async function translate() {
|
|
7043
7090
|
if (!id || busy) return;
|
|
7044
7091
|
setBusy(true);
|
|
@@ -7064,6 +7111,172 @@ function TranslateNowMenuItem({ sourceLocale, targetLocales = [], configured = t
|
|
|
7064
7111
|
});
|
|
7065
7112
|
}
|
|
7066
7113
|
//#endregion
|
|
7067
|
-
|
|
7114
|
+
//#region src/admin/translation-key-panel.tsx
|
|
7115
|
+
const PANEL_CSS = `.bl-translation-key{padding:1rem 1.25rem;border:1px solid var(--theme-elevation-150,#e2e8f0);border-radius:8px;margin-block-end:1.5rem}.bl-translation-key__title{margin:0 0 .25rem;font-size:1rem;font-weight:600}.bl-translation-key__line{margin:0;font-size:14px;color:var(--theme-elevation-800,#1e293b)}.bl-translation-key__note{margin:0;font-size:13px;color:var(--theme-elevation-500,#64748b)}.bl-translation-key__warn{margin:0;font-size:14px;color:var(--theme-warning-650,#b45309)}.bl-translation-key__error{margin:0;font-size:14px;color:var(--theme-error-650,#b91c1c)}.bl-translation-key__row{display:flex;gap:.5rem;flex-wrap:wrap;align-items:flex-end}.bl-translation-key__row>:first-child{flex:1 1 18rem}`;
|
|
7116
|
+
const STATUS_WORDS = {
|
|
7117
|
+
valid: "checked and working",
|
|
7118
|
+
"out-of-credit": "its Anthropic account is out of credit",
|
|
7119
|
+
rejected: "Anthropic rejected it",
|
|
7120
|
+
unchecked: "not checked yet (Anthropic did not answer); checked on first use"
|
|
7121
|
+
};
|
|
7122
|
+
function when(value) {
|
|
7123
|
+
if (!value) return "";
|
|
7124
|
+
const date = new Date(value);
|
|
7125
|
+
return Number.isNaN(date.getTime()) ? value : date.toLocaleString();
|
|
7126
|
+
}
|
|
7127
|
+
/**
|
|
7128
|
+
* The key panel at the top of Settings → Translation. The key is pasted
|
|
7129
|
+
* here and sent straight to `POST /api/translation/key`, never into the
|
|
7130
|
+
* document, so it is in no form state, version or response; only its last 4
|
|
7131
|
+
* characters come back. Shows which key a translation would use here and
|
|
7132
|
+
* why (production uses the stored key; elsewhere only the server's
|
|
7133
|
+
* environment key).
|
|
7134
|
+
*/
|
|
7135
|
+
function TranslationKeyPanel() {
|
|
7136
|
+
const { config } = useConfig();
|
|
7137
|
+
const base = `${config.serverURL ?? ""}${config.routes.api}/translation`;
|
|
7138
|
+
const [status, setStatus] = useState(null);
|
|
7139
|
+
const [draft, setDraft] = useState("");
|
|
7140
|
+
const [busy, setBusy] = useState(false);
|
|
7141
|
+
const [message, setMessage] = useState(null);
|
|
7142
|
+
const load = useCallback(async () => {
|
|
7143
|
+
const response = await fetch(`${base}/status`, { credentials: "include" });
|
|
7144
|
+
if (response.ok) setStatus(await response.json());
|
|
7145
|
+
}, [base]);
|
|
7146
|
+
useEffect(() => {
|
|
7147
|
+
load().catch(() => void 0);
|
|
7148
|
+
}, [load]);
|
|
7149
|
+
async function send(path, method, body) {
|
|
7150
|
+
setBusy(true);
|
|
7151
|
+
setMessage(null);
|
|
7152
|
+
try {
|
|
7153
|
+
const response = await fetch(`${base}${path}`, {
|
|
7154
|
+
method,
|
|
7155
|
+
credentials: "include",
|
|
7156
|
+
...body ? {
|
|
7157
|
+
headers: { "Content-Type": "application/json" },
|
|
7158
|
+
body: JSON.stringify(body)
|
|
7159
|
+
} : {}
|
|
7160
|
+
});
|
|
7161
|
+
const result = await response.json().catch(() => ({}));
|
|
7162
|
+
if (result.status) setStatus(result.status);
|
|
7163
|
+
if (!response.ok) setMessage({
|
|
7164
|
+
tone: "error",
|
|
7165
|
+
text: result.error ?? "That did not work."
|
|
7166
|
+
});
|
|
7167
|
+
else if (result.message) setMessage({
|
|
7168
|
+
tone: result.check === "valid" ? "ok" : "warn",
|
|
7169
|
+
text: result.message
|
|
7170
|
+
});
|
|
7171
|
+
return response.ok;
|
|
7172
|
+
} finally {
|
|
7173
|
+
setBusy(false);
|
|
7174
|
+
}
|
|
7175
|
+
}
|
|
7176
|
+
async function save() {
|
|
7177
|
+
if (!draft.trim()) return;
|
|
7178
|
+
if (await send("/key", "POST", { key: draft.trim() })) setDraft("");
|
|
7179
|
+
}
|
|
7180
|
+
const stored = status?.stored;
|
|
7181
|
+
const inUse = status?.inUse;
|
|
7182
|
+
return /* @__PURE__ */ jsxs(KitProvider, { children: [/* @__PURE__ */ jsx("style", {
|
|
7183
|
+
href: "bl-translation-key",
|
|
7184
|
+
precedence: "default",
|
|
7185
|
+
children: PANEL_CSS
|
|
7186
|
+
}), /* @__PURE__ */ jsx("section", {
|
|
7187
|
+
className: "bl-translation-key",
|
|
7188
|
+
"aria-labelledby": "bl-translation-key-title",
|
|
7189
|
+
children: /* @__PURE__ */ jsxs(Stack, {
|
|
7190
|
+
size: "field",
|
|
7191
|
+
children: [
|
|
7192
|
+
/* @__PURE__ */ jsx("h3", {
|
|
7193
|
+
id: "bl-translation-key-title",
|
|
7194
|
+
className: "bl-translation-key__title",
|
|
7195
|
+
children: "Anthropic API key"
|
|
7196
|
+
}),
|
|
7197
|
+
stored ? /* @__PURE__ */ jsxs("p", {
|
|
7198
|
+
className: "bl-translation-key__line",
|
|
7199
|
+
children: [
|
|
7200
|
+
"Stored key ends …",
|
|
7201
|
+
stored.last4,
|
|
7202
|
+
stored.setBy ? `, set by ${stored.setBy}` : "",
|
|
7203
|
+
stored.setAt ? ` on ${when(stored.setAt)}` : "",
|
|
7204
|
+
stored.status ? ` — ${STATUS_WORDS[stored.status] ?? stored.status}.` : "."
|
|
7205
|
+
]
|
|
7206
|
+
}) : /* @__PURE__ */ jsx("p", {
|
|
7207
|
+
className: "bl-translation-key__line",
|
|
7208
|
+
children: "No key is stored."
|
|
7209
|
+
}),
|
|
7210
|
+
inUse?.source === "environment" ? /* @__PURE__ */ jsxs("p", {
|
|
7211
|
+
className: "bl-translation-key__note",
|
|
7212
|
+
children: [
|
|
7213
|
+
"Using a key from the server environment (…",
|
|
7214
|
+
inUse.last4,
|
|
7215
|
+
").",
|
|
7216
|
+
status?.production ? " Paste your own to take over." : ""
|
|
7217
|
+
]
|
|
7218
|
+
}) : null,
|
|
7219
|
+
!inUse ? /* @__PURE__ */ jsx("p", {
|
|
7220
|
+
className: "bl-translation-key__warn",
|
|
7221
|
+
children: "Translation has no key to use here, so nothing translates."
|
|
7222
|
+
}) : null,
|
|
7223
|
+
status?.note ? /* @__PURE__ */ jsx("p", {
|
|
7224
|
+
className: "bl-translation-key__note",
|
|
7225
|
+
children: status.note
|
|
7226
|
+
}) : null,
|
|
7227
|
+
/* @__PURE__ */ jsxs("div", {
|
|
7228
|
+
className: "bl-translation-key__row",
|
|
7229
|
+
children: [
|
|
7230
|
+
/* @__PURE__ */ jsxs(Field, { children: [/* @__PURE__ */ jsx(Label, { children: stored ? "Replace the key" : "Paste a key" }), /* @__PURE__ */ jsx(Input, {
|
|
7231
|
+
id: "bl-translation-key-input",
|
|
7232
|
+
type: "password",
|
|
7233
|
+
autoComplete: "off",
|
|
7234
|
+
spellCheck: false,
|
|
7235
|
+
value: draft,
|
|
7236
|
+
placeholder: "sk-ant-…",
|
|
7237
|
+
onChange: (event) => setDraft(event.target.value),
|
|
7238
|
+
onKeyDown: (event) => {
|
|
7239
|
+
if (event.key !== "Enter") return;
|
|
7240
|
+
event.preventDefault();
|
|
7241
|
+
event.stopPropagation();
|
|
7242
|
+
save();
|
|
7243
|
+
}
|
|
7244
|
+
})] }),
|
|
7245
|
+
/* @__PURE__ */ jsx(Button$1, {
|
|
7246
|
+
type: "button",
|
|
7247
|
+
disabled: busy || !draft.trim(),
|
|
7248
|
+
onClick: () => void save(),
|
|
7249
|
+
children: busy ? "Checking…" : "Save key"
|
|
7250
|
+
}),
|
|
7251
|
+
stored ? /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(Button$1, {
|
|
7252
|
+
type: "button",
|
|
7253
|
+
variant: "outline",
|
|
7254
|
+
disabled: busy,
|
|
7255
|
+
onClick: () => void send("/key/check", "POST"),
|
|
7256
|
+
children: "Check again"
|
|
7257
|
+
}), /* @__PURE__ */ jsx(Button$1, {
|
|
7258
|
+
type: "button",
|
|
7259
|
+
variant: "danger",
|
|
7260
|
+
disabled: busy,
|
|
7261
|
+
onClick: () => void send("/key", "DELETE"),
|
|
7262
|
+
children: "Remove key"
|
|
7263
|
+
})] }) : null
|
|
7264
|
+
]
|
|
7265
|
+
}),
|
|
7266
|
+
message ? /* @__PURE__ */ jsx("p", {
|
|
7267
|
+
role: "status",
|
|
7268
|
+
className: message.tone === "error" ? "bl-translation-key__error" : message.tone === "warn" ? "bl-translation-key__warn" : "bl-translation-key__line",
|
|
7269
|
+
children: message.text
|
|
7270
|
+
}) : null,
|
|
7271
|
+
/* @__PURE__ */ jsx("p", {
|
|
7272
|
+
className: "bl-translation-key__note",
|
|
7273
|
+
children: "The key is stored encrypted and never shown again; only its last 4 characters are. It is used only on the production site."
|
|
7274
|
+
})
|
|
7275
|
+
]
|
|
7276
|
+
})
|
|
7277
|
+
})] });
|
|
7278
|
+
}
|
|
7279
|
+
//#endregion
|
|
7280
|
+
export { AdminNav, AdminNavEntityField, AdminNavItemRowLabel, AdminNavRowLabel, AppearanceField, BlockDrawerStyles, BlockLibraryField, ColorField, ColorScaleField, ContrastReport, DocumentCreateNew, DocumentTitleActions, FeaturesMatrixField, FontField, GreyScaleField, HiddenSaveButton, IdentityFallback, LibraryField, ListAlignStyles, LookField, MediaAltAutofill, MediaListView, PageSlugCell, PageTitleCell, PairingField, PublishChild, QuestionsList, RequiredPageCell, RequiredPageField, RichTextEditorFontStyles, RoleNameField, RoleSlugField, RolesCell, RolesField, RolesGrantsField, RolesMatrixField, RolesRowLabel, SectionHeading, SlugField, ThemeDocumentControls, ThemeSaveButton, TranslateNowMenuItem, TranslationKeyPanel, setThemePreviewMode };
|
|
7068
7281
|
|
|
7069
7282
|
//# sourceMappingURL=admin.mjs.map
|