@bison-lab/payload-core 5.9.3 → 5.12.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 +43 -0
- package/dist/admin.d.mts +9 -3
- package/dist/admin.d.mts.map +1 -1
- package/dist/admin.mjs +115 -11
- package/dist/admin.mjs.map +1 -1
- package/dist/{capability-B3Mk0KRh.mjs → capability-Kd5LgQpm.mjs} +80 -9
- package/dist/capability-Kd5LgQpm.mjs.map +1 -0
- package/dist/index.d.mts +63 -5
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +116 -79
- package/dist/index.mjs.map +1 -1
- package/dist/translate.mjs +1 -1
- package/package.json +4 -4
- package/dist/capability-B3Mk0KRh.mjs.map +0 -1
package/README.md
CHANGED
|
@@ -402,6 +402,49 @@ document. Nav hiding follows `user.allowedFeatures` on the JWT
|
|
|
402
402
|
(computed at user read from the live Features and Roles Globals) so
|
|
403
403
|
Payload's `admin.hidden({ user })` matches the API.
|
|
404
404
|
|
|
405
|
+
### Release-only rows
|
|
406
|
+
|
|
407
|
+
A **release-only row** is a site extra passed with `releaseOnly: true`: a
|
|
408
|
+
launch switch, not a permission. It stays on Settings → Features as a
|
|
409
|
+
release switch, with the copy `RELEASE_ONLY_NOTE` ("Releasing turns this
|
|
410
|
+
on for everyone."), but it is never a tick on Settings → Roles, for any
|
|
411
|
+
role, Developer included, released or not. A Roles save drops any grant
|
|
412
|
+
on its slug and keeps every other grant. Released, `hasFeature` /
|
|
413
|
+
`canUseFeature` on it is true for every login; off, only for a Developer.
|
|
414
|
+
It does not count toward its group slug (`pages`).
|
|
415
|
+
|
|
416
|
+
```ts
|
|
417
|
+
createFeatures({
|
|
418
|
+
extras: [
|
|
419
|
+
{ slug: "doctors", label: "Doctors", group: "pages" },
|
|
420
|
+
{ slug: "find-a-doctor", label: "Find a Doctor", group: "pages", releaseOnly: true },
|
|
421
|
+
],
|
|
422
|
+
});
|
|
423
|
+
```
|
|
424
|
+
|
|
425
|
+
The mark lives in the code catalogue, never in a column, so adding one
|
|
426
|
+
needs no migration and leaves generated types alone. `createFeatures`
|
|
427
|
+
stamps `releaseOnly: true` onto that row when the Global is read (an
|
|
428
|
+
`afterRead` hook, added only when a site passes a release-only extra) and
|
|
429
|
+
lists the slugs in the Global's `custom` for the Roles save
|
|
430
|
+
(`releaseOnlySlugsFromConfig`). A site that passes none gets the same
|
|
431
|
+
config, rows and access results as before. A site's own Features matrix
|
|
432
|
+
field reads `row.releaseOnly` from the fetched Global and shows
|
|
433
|
+
`RELEASE_ONLY_NOTE` (also exported from `./admin`).
|
|
434
|
+
|
|
435
|
+
Whether a row is released, for every visitor rather than one login, is
|
|
436
|
+
`readFeatureReleased(payload, slug, req?)`: it reads the saved Global with
|
|
437
|
+
override access, matches the slug exactly, and answers `false` for a
|
|
438
|
+
missing row, an empty or unreadable Global, or a read that throws (no
|
|
439
|
+
table yet). `featureReleased(rows, slug)` is the same answer from rows
|
|
440
|
+
already in hand.
|
|
441
|
+
|
|
442
|
+
```ts
|
|
443
|
+
import { readFeatureReleased } from "@bison-lab/payload-core";
|
|
444
|
+
|
|
445
|
+
const launched = await readFeatureReleased(payload, "find-a-doctor");
|
|
446
|
+
```
|
|
447
|
+
|
|
405
448
|
## Block library
|
|
406
449
|
|
|
407
450
|
Settings → Block library is one card per installed option. Editors browse
|
package/dist/admin.d.mts
CHANGED
|
@@ -191,14 +191,16 @@ declare const RolesField: SelectFieldClientComponent;
|
|
|
191
191
|
/**
|
|
192
192
|
* Released catalogue rows as ticks, plus the Theme grant. Unreleased
|
|
193
193
|
* features do not appear. Theme always does — Features cannot hide it.
|
|
194
|
-
* On Developer every row is shown granted and locked.
|
|
194
|
+
* On Developer every row is shown granted and locked. A release-only
|
|
195
|
+
* row never appears, released or not, on any role.
|
|
195
196
|
*/
|
|
196
197
|
declare const RolesGrantsField: JSONFieldClientComponent;
|
|
197
198
|
//#endregion
|
|
198
199
|
//#region src/admin/features-matrix-field.d.ts
|
|
199
200
|
/**
|
|
200
201
|
* One release switch per catalogue row, grouped. Off hides the tick on
|
|
201
|
-
* Roles; Developer still has the feature.
|
|
202
|
+
* Roles; Developer still has the feature. A release-only row says that
|
|
203
|
+
* releasing it turns it on for everyone.
|
|
202
204
|
*
|
|
203
205
|
* Writes both the array value and each row's `released` checkbox path.
|
|
204
206
|
* Payload still registers those child fields; toggling only the parent
|
|
@@ -206,6 +208,10 @@ declare const RolesGrantsField: JSONFieldClientComponent;
|
|
|
206
208
|
*/
|
|
207
209
|
declare const FeaturesMatrixField: ArrayFieldClientComponent;
|
|
208
210
|
//#endregion
|
|
211
|
+
//#region src/features/types.d.ts
|
|
212
|
+
/** Settings → Features copy beside a release-only row's switch. */
|
|
213
|
+
declare const RELEASE_ONLY_NOTE = "Releasing turns this on for everyone.";
|
|
214
|
+
//#endregion
|
|
209
215
|
//#region src/admin/block-library-field.d.ts
|
|
210
216
|
/**
|
|
211
217
|
* Category rail and a gallery of live islands. Each island is the sample
|
|
@@ -452,5 +458,5 @@ declare function TranslationActivityPanel(): react_jsx_runtime0.JSX.Element;
|
|
|
452
458
|
*/
|
|
453
459
|
declare function TranslationStatusBar(): react_jsx_runtime0.JSX.Element | null;
|
|
454
460
|
//#endregion
|
|
455
|
-
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, RefusedSubmitGuard, RefusedSubmitProvider, RequiredPageCell, RequiredPageField, RichTextEditorFontStyles, RoleNameField, RoleSlugField, RolesCell, RolesField, RolesGrantsField, RolesMatrixField, RolesRowLabel, SectionHeading, SlugField, ThemeDocumentControls, ThemeSaveButton, TranslateNowMenuItem, TranslationActivityPanel, TranslationKeyPanel, TranslationStatusBar, setThemePreviewMode };
|
|
461
|
+
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, RELEASE_ONLY_NOTE, RefusedSubmitGuard, RefusedSubmitProvider, RequiredPageCell, RequiredPageField, RichTextEditorFontStyles, RoleNameField, RoleSlugField, RolesCell, RolesField, RolesGrantsField, RolesMatrixField, RolesRowLabel, SectionHeading, SlugField, ThemeDocumentControls, ThemeSaveButton, TranslateNowMenuItem, TranslationActivityPanel, TranslationKeyPanel, TranslationStatusBar, setThemePreviewMode };
|
|
456
462
|
//# 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/refused-submit.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","../src/admin/translation-activity-panel.tsx","../src/admin/translation-status-bar.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;;;;;;;;;AlB3BxB;iBmBCgB,aAAA,CAAc,KAAA,EAAO,yBAAA,GAAyB,kBAAA,CAAA,GAAA,CAAA,OAAA;;;;iBCP9C,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/features/types.ts","../src/admin/block-library-field.tsx","../src/admin/document-title-actions.tsx","../src/admin/refused-submit.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","../src/admin/translation-activity-panel.tsx","../src/admin/translation-status-bar.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;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wBAAA,CAAA,GAAwB,kBAAA,CAAA,GAAA,CAAA,OAAA;;;;;;A9C/BxC;;;;;iB+CuBgB,oBAAA,CAAA,GAAoB,kBAAA,CAAA,GAAA,CAAA,OAAA"}
|
package/dist/admin.mjs
CHANGED
|
@@ -2683,6 +2683,8 @@ const PACKAGE_FEATURES = [
|
|
|
2683
2683
|
defaultReleased: true
|
|
2684
2684
|
}
|
|
2685
2685
|
];
|
|
2686
|
+
/** Settings → Features copy beside a release-only row's switch. */
|
|
2687
|
+
const RELEASE_ONLY_NOTE = "Releasing turns this on for everyone.";
|
|
2686
2688
|
function isFeatureGroupId(value) {
|
|
2687
2689
|
return typeof value === "string" && FEATURE_GROUPS.includes(value);
|
|
2688
2690
|
}
|
|
@@ -2771,12 +2773,17 @@ function defaultGrantsForRole(role, extraGrants) {
|
|
|
2771
2773
|
//#endregion
|
|
2772
2774
|
//#region src/features/matrix.ts
|
|
2773
2775
|
const MISSING_PACKAGE_FEATURES_MESSAGE = "Features must include Content, Publish, Media, Users, and Roles.";
|
|
2776
|
+
/** `{ releaseOnly: true }` for a release-only row, nothing otherwise, so other rows keep their shape. */
|
|
2777
|
+
function releaseOnlyMark(releaseOnly) {
|
|
2778
|
+
return releaseOnly === true ? { releaseOnly: true } : {};
|
|
2779
|
+
}
|
|
2774
2780
|
function featureCatalogue(extras = []) {
|
|
2775
2781
|
return [...PACKAGE_FEATURES.map((feature) => ({ ...feature })), ...extras.map((extra) => ({
|
|
2776
2782
|
slug: extra.slug,
|
|
2777
2783
|
label: extra.label,
|
|
2778
2784
|
group: extra.group ?? "users",
|
|
2779
|
-
defaultReleased: extra.defaultReleased ?? false
|
|
2785
|
+
defaultReleased: extra.defaultReleased ?? false,
|
|
2786
|
+
...releaseOnlyMark(extra.releaseOnly)
|
|
2780
2787
|
}))];
|
|
2781
2788
|
}
|
|
2782
2789
|
function defaultFeaturesFieldValue(extras = []) {
|
|
@@ -2785,7 +2792,8 @@ function defaultFeaturesFieldValue(extras = []) {
|
|
|
2785
2792
|
slug: feature.slug,
|
|
2786
2793
|
label: feature.label,
|
|
2787
2794
|
group: feature.group,
|
|
2788
|
-
released: feature.defaultReleased
|
|
2795
|
+
released: feature.defaultReleased,
|
|
2796
|
+
...releaseOnlyMark(feature.releaseOnly)
|
|
2789
2797
|
}));
|
|
2790
2798
|
}
|
|
2791
2799
|
function parseFeaturesMatrix(value) {
|
|
@@ -2808,7 +2816,8 @@ function parseFeaturesMatrix(value) {
|
|
|
2808
2816
|
slug,
|
|
2809
2817
|
label,
|
|
2810
2818
|
group,
|
|
2811
|
-
released: Boolean("released" in item && item.released)
|
|
2819
|
+
released: Boolean("released" in item && item.released),
|
|
2820
|
+
...releaseOnlyMark("releaseOnly" in item && item.releaseOnly === true)
|
|
2812
2821
|
});
|
|
2813
2822
|
}
|
|
2814
2823
|
if (PACKAGE_FEATURES.some((feature) => !seen.has(feature.slug))) return {
|
|
@@ -3777,7 +3786,8 @@ function rolePathFromGrants(path) {
|
|
|
3777
3786
|
/**
|
|
3778
3787
|
* Released catalogue rows as ticks, plus the Theme grant. Unreleased
|
|
3779
3788
|
* features do not appear. Theme always does — Features cannot hide it.
|
|
3780
|
-
* On Developer every row is shown granted and locked.
|
|
3789
|
+
* On Developer every row is shown granted and locked. A release-only
|
|
3790
|
+
* row never appears, released or not, on any role.
|
|
3781
3791
|
*/
|
|
3782
3792
|
const RolesGrantsField = (props) => {
|
|
3783
3793
|
const { setValue, value } = useField({ path: props.path });
|
|
@@ -3800,7 +3810,8 @@ const RolesGrantsField = (props) => {
|
|
|
3800
3810
|
};
|
|
3801
3811
|
}, [api, serverURL]);
|
|
3802
3812
|
const grants = asGrants(value);
|
|
3803
|
-
const
|
|
3813
|
+
const ticks = catalogue.filter((row) => !row.releaseOnly);
|
|
3814
|
+
const shown = implicitAll ? ticks : ticks.filter((row) => row.released);
|
|
3804
3815
|
const alwaysTranslation = typeof role === "string" && ALWAYS_TRANSLATION_ROLES.includes(role);
|
|
3805
3816
|
function locked(slug) {
|
|
3806
3817
|
return implicitAll || slug === "translation" && alwaysTranslation;
|
|
@@ -3857,17 +3868,26 @@ const RolesGrantsField = (props) => {
|
|
|
3857
3868
|
};
|
|
3858
3869
|
//#endregion
|
|
3859
3870
|
//#region src/admin/features-matrix-field.tsx
|
|
3860
|
-
const LIST_CSS$2 = `.bl-features{margin-block:.35rem 0;font-size:16px}.bl-features__group{margin-block:1rem 0}.bl-features__group-title{font-size:14px;letter-spacing:.02em;color:var(--theme-elevation-400,#94a3b8);font-weight:650;margin-block-end:.35rem}.bl-features__row{display:flex;align-items:center;justify-content:space-between;gap:1rem;padding:.55rem 0;border-bottom:1px solid var(--theme-elevation-150,#e2e8f0)}.bl-features__row:last-child{border-bottom:0}.bl-features input{inline-size:1.15rem;block-size:1.15rem}`;
|
|
3871
|
+
const LIST_CSS$2 = `.bl-features{margin-block:.35rem 0;font-size:16px}.bl-features__group{margin-block:1rem 0}.bl-features__group-title{font-size:14px;letter-spacing:.02em;color:var(--theme-elevation-400,#94a3b8);font-weight:650;margin-block-end:.35rem}.bl-features__row{display:flex;align-items:center;justify-content:space-between;gap:1rem;padding:.55rem 0;border-bottom:1px solid var(--theme-elevation-150,#e2e8f0)}.bl-features__row:last-child{border-bottom:0}.bl-features input{inline-size:1.15rem;block-size:1.15rem}.bl-features__name{display:flex;flex-direction:column;gap:.15rem}.bl-features__note{font-size:13px;color:var(--theme-elevation-500,#64748b)}`;
|
|
3861
3872
|
function asRows$1(value) {
|
|
3862
3873
|
return Array.isArray(value) ? value : [];
|
|
3863
3874
|
}
|
|
3864
3875
|
function FeatureReleaseRow({ path, index, row, rows, setRows }) {
|
|
3865
3876
|
const { setValue: setReleased } = useField({ path: `${path}.${index}.released` });
|
|
3877
|
+
const noteId = row.releaseOnly ? `bl-features-note-${row.slug}` : void 0;
|
|
3866
3878
|
return /* @__PURE__ */ jsxs("div", {
|
|
3867
3879
|
className: "bl-features__row",
|
|
3868
|
-
children: [/* @__PURE__ */
|
|
3880
|
+
children: [/* @__PURE__ */ jsxs("span", {
|
|
3881
|
+
className: "bl-features__name",
|
|
3882
|
+
children: [/* @__PURE__ */ jsx("span", { children: row.label || row.slug }), noteId ? /* @__PURE__ */ jsx("span", {
|
|
3883
|
+
id: noteId,
|
|
3884
|
+
className: "bl-features__note",
|
|
3885
|
+
children: RELEASE_ONLY_NOTE
|
|
3886
|
+
}) : null]
|
|
3887
|
+
}), /* @__PURE__ */ jsx("input", {
|
|
3869
3888
|
type: "checkbox",
|
|
3870
3889
|
"aria-label": `Release ${row.label || row.slug}`,
|
|
3890
|
+
"aria-describedby": noteId,
|
|
3871
3891
|
checked: Boolean(row.released),
|
|
3872
3892
|
onChange: (event) => {
|
|
3873
3893
|
const released = event.target.checked;
|
|
@@ -3882,7 +3902,8 @@ function FeatureReleaseRow({ path, index, row, rows, setRows }) {
|
|
|
3882
3902
|
}
|
|
3883
3903
|
/**
|
|
3884
3904
|
* One release switch per catalogue row, grouped. Off hides the tick on
|
|
3885
|
-
* Roles; Developer still has the feature.
|
|
3905
|
+
* Roles; Developer still has the feature. A release-only row says that
|
|
3906
|
+
* releasing it turns it on for everyone.
|
|
3886
3907
|
*
|
|
3887
3908
|
* Writes both the array value and each row's `released` checkbox path.
|
|
3888
3909
|
* Payload still registers those child fields; toggling only the parent
|
|
@@ -4816,6 +4837,15 @@ function ThemeKitAccent({ children }) {
|
|
|
4816
4837
|
* collection / global share one lift. A MutationObserver re-applies
|
|
4817
4838
|
* after Payload redraws the controls.
|
|
4818
4839
|
*
|
|
4840
|
+
* The lifted nodes still belong to Payload's React tree, which keeps
|
|
4841
|
+
* updating them in place. React also expects them under the parent it
|
|
4842
|
+
* rendered them into: inserting a sibling before one, or removing one,
|
|
4843
|
+
* would throw `NotFoundError` and unmount the controls, leaving a frozen
|
|
4844
|
+
* copy on the title row (#354). So each lift leaves a comment where the
|
|
4845
|
+
* node was and guards that one parent (see `guardParent`), never
|
|
4846
|
+
* `Node.prototype`. A comment does not stop `.doc-controls__meta:empty`
|
|
4847
|
+
* matching, so the empty band still collapses.
|
|
4848
|
+
*
|
|
4819
4849
|
* It also carries `RefusedSubmitProvider`, so a refused publish keeps its
|
|
4820
4850
|
* field errors and stays publishable (#357).
|
|
4821
4851
|
*/
|
|
@@ -4835,6 +4865,77 @@ const TITLE_ACTIONS_CSS = `
|
|
|
4835
4865
|
const TITLE_ROW_CLASS = "bl-doc-title-row";
|
|
4836
4866
|
const STATUS = ".doc-controls__status";
|
|
4837
4867
|
const ACTIONS = ".doc-controls__controls-wrapper";
|
|
4868
|
+
/** The comment a lift leaves at a lifted node's place in React's parent. */
|
|
4869
|
+
const placeholders = /* @__PURE__ */ new WeakMap();
|
|
4870
|
+
const guardedParents = /* @__PURE__ */ new WeakSet();
|
|
4871
|
+
/** The placeholder of `node` when it was lifted out of `parent`. */
|
|
4872
|
+
function placeholderIn(parent, node) {
|
|
4873
|
+
const mark = node ? placeholders.get(node) : void 0;
|
|
4874
|
+
return mark && mark.parentNode === parent && node?.parentNode !== parent ? mark : null;
|
|
4875
|
+
}
|
|
4876
|
+
/**
|
|
4877
|
+
* Teaches one parent the lift moved a node out of to answer React as if
|
|
4878
|
+
* the node were still there: an insert before it lands at its
|
|
4879
|
+
* placeholder, moving it moves the placeholder (the node stays on the
|
|
4880
|
+
* title row), and removing it removes both, wherever the node now sits.
|
|
4881
|
+
* Every other call goes through untouched. `moveBefore` is not guarded:
|
|
4882
|
+
* react-dom 19.2 never calls it.
|
|
4883
|
+
*/
|
|
4884
|
+
function guardParent(parent) {
|
|
4885
|
+
if (guardedParents.has(parent)) return;
|
|
4886
|
+
guardedParents.add(parent);
|
|
4887
|
+
const insertBefore = parent.insertBefore;
|
|
4888
|
+
const appendChild = parent.appendChild;
|
|
4889
|
+
const removeChild = parent.removeChild;
|
|
4890
|
+
parent.insertBefore = function(node, child) {
|
|
4891
|
+
const ref = placeholderIn(parent, child) ?? child;
|
|
4892
|
+
const mark = placeholderIn(parent, node);
|
|
4893
|
+
if (mark) {
|
|
4894
|
+
if (mark !== ref) insertBefore.call(parent, mark, ref);
|
|
4895
|
+
return node;
|
|
4896
|
+
}
|
|
4897
|
+
return insertBefore.call(parent, node, ref);
|
|
4898
|
+
};
|
|
4899
|
+
parent.appendChild = function(node) {
|
|
4900
|
+
const mark = placeholderIn(parent, node);
|
|
4901
|
+
if (mark) {
|
|
4902
|
+
appendChild.call(parent, mark);
|
|
4903
|
+
return node;
|
|
4904
|
+
}
|
|
4905
|
+
return appendChild.call(parent, node);
|
|
4906
|
+
};
|
|
4907
|
+
parent.removeChild = function(child) {
|
|
4908
|
+
const mark = placeholderIn(parent, child);
|
|
4909
|
+
if (mark) {
|
|
4910
|
+
removeChild.call(parent, mark);
|
|
4911
|
+
placeholders.delete(child);
|
|
4912
|
+
child.parentNode?.removeChild(child);
|
|
4913
|
+
return child;
|
|
4914
|
+
}
|
|
4915
|
+
return removeChild.call(parent, child);
|
|
4916
|
+
};
|
|
4917
|
+
}
|
|
4918
|
+
/** Moves `node` into `group`, leaving a guarded placeholder where it was. */
|
|
4919
|
+
function lift(group, node, before) {
|
|
4920
|
+
const parent = node.parentNode;
|
|
4921
|
+
if (parent) {
|
|
4922
|
+
guardParent(parent);
|
|
4923
|
+
placeholders.get(node)?.remove();
|
|
4924
|
+
const mark = node.ownerDocument.createComment(TITLE_ROW_CLASS);
|
|
4925
|
+
parent.insertBefore(mark, node);
|
|
4926
|
+
placeholders.set(node, mark);
|
|
4927
|
+
}
|
|
4928
|
+
group.insertBefore(node, before);
|
|
4929
|
+
}
|
|
4930
|
+
/**
|
|
4931
|
+
* A lifted node whose placeholder left the group's tree belongs to a
|
|
4932
|
+
* controls band React unmounted: React removed the band, not the node,
|
|
4933
|
+
* so the copy on the title row is frozen.
|
|
4934
|
+
*/
|
|
4935
|
+
function isOrphaned(group, node) {
|
|
4936
|
+
const mark = placeholders.get(node);
|
|
4937
|
+
return !!mark && mark.getRootNode() !== group.getRootNode();
|
|
4938
|
+
}
|
|
4838
4939
|
/**
|
|
4839
4940
|
* Moves a node Payload just rendered into the group. A lifted node of
|
|
4840
4941
|
* the same kind is dropped first: when Payload remounts its controls
|
|
@@ -4844,7 +4945,7 @@ const ACTIONS = ".doc-controls__controls-wrapper";
|
|
|
4844
4945
|
function place(group, node, selector, before) {
|
|
4845
4946
|
if (!node) return;
|
|
4846
4947
|
for (const stale of Array.from(group.querySelectorAll(`:scope > ${selector}`))) stale.remove();
|
|
4847
|
-
group
|
|
4948
|
+
lift(group, node, before);
|
|
4848
4949
|
}
|
|
4849
4950
|
/**
|
|
4850
4951
|
* The element that bounds one document view. Payload's `Drawer` renders
|
|
@@ -4875,10 +4976,13 @@ function ownControl(root, view, selector) {
|
|
|
4875
4976
|
function liftTitleActions(root = document) {
|
|
4876
4977
|
for (const header of Array.from(root.querySelectorAll(".doc-header__header"))) {
|
|
4877
4978
|
const view = viewOf(header);
|
|
4979
|
+
let group = header.querySelector(`:scope > .${TITLE_ROW_CLASS}`);
|
|
4980
|
+
if (group) {
|
|
4981
|
+
for (const lifted of Array.from(group.children)) if (isOrphaned(group, lifted)) lifted.remove();
|
|
4982
|
+
}
|
|
4878
4983
|
const status = ownControl(root, view, STATUS);
|
|
4879
4984
|
const actions = ownControl(root, view, ACTIONS);
|
|
4880
4985
|
if (!status && !actions) continue;
|
|
4881
|
-
let group = header.querySelector(`:scope > .${TITLE_ROW_CLASS}`);
|
|
4882
4986
|
if (!group) {
|
|
4883
4987
|
group = header.ownerDocument.createElement("div");
|
|
4884
4988
|
group.className = TITLE_ROW_CLASS;
|
|
@@ -7763,6 +7867,6 @@ function TranslationActivityPanel() {
|
|
|
7763
7867
|
] });
|
|
7764
7868
|
}
|
|
7765
7869
|
//#endregion
|
|
7766
|
-
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, RefusedSubmitGuard, RefusedSubmitProvider, RequiredPageCell, RequiredPageField, RichTextEditorFontStyles, RoleNameField, RoleSlugField, RolesCell, RolesField, RolesGrantsField, RolesMatrixField, RolesRowLabel, SectionHeading, SlugField, ThemeDocumentControls, ThemeSaveButton, TranslateNowMenuItem, TranslationActivityPanel, TranslationKeyPanel, TranslationStatusBar, setThemePreviewMode };
|
|
7870
|
+
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, RELEASE_ONLY_NOTE, RefusedSubmitGuard, RefusedSubmitProvider, RequiredPageCell, RequiredPageField, RichTextEditorFontStyles, RoleNameField, RoleSlugField, RolesCell, RolesField, RolesGrantsField, RolesMatrixField, RolesRowLabel, SectionHeading, SlugField, ThemeDocumentControls, ThemeSaveButton, TranslateNowMenuItem, TranslationActivityPanel, TranslationKeyPanel, TranslationStatusBar, setThemePreviewMode };
|
|
7767
7871
|
|
|
7768
7872
|
//# sourceMappingURL=admin.mjs.map
|