@bison-lab/payload-core 4.12.2 → 4.12.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +10 -1
- package/dist/admin.d.mts +13 -1
- package/dist/admin.d.mts.map +1 -1
- package/dist/admin.mjs +97 -27
- package/dist/admin.mjs.map +1 -1
- package/dist/index.d.mts +18 -1
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +120 -33
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -276,6 +276,14 @@ seed slugs stay read-only.
|
|
|
276
276
|
back to that seed (plus extras). The package never writes `developer`
|
|
277
277
|
onto a user row.
|
|
278
278
|
|
|
279
|
+
Removing a row removes that slug from every user in the same save, so a
|
|
280
|
+
later row saved under the same slug cannot hand it back. A user whose
|
|
281
|
+
only role it was is left with none. A save that would leave no user
|
|
282
|
+
holding Developer or a role with the Users tick is refused
|
|
283
|
+
(`ROLES_LOCKOUT_MESSAGE`), whether by deleting the row or unticking
|
|
284
|
+
Users. `pruneUserRoles(req)` strips every slug not on the saved Global;
|
|
285
|
+
call it once from a migration to clean users saved before this rule.
|
|
286
|
+
|
|
279
287
|
```ts
|
|
280
288
|
createRoles({
|
|
281
289
|
extras: [{ role: "editor", label: "Editor", grants: ["content"] }],
|
|
@@ -395,7 +403,8 @@ Every page block carries the same four section settings (Background,
|
|
|
395
403
|
Spacing, Anchor, Hidden; `withSectionSettings` in payload-blocks). Which
|
|
396
404
|
of them a block *offers* is data, not code: four ticks under Enabled on
|
|
397
405
|
each card, stored on the row as `sectionControls`, so turning one control
|
|
398
|
-
off for one block is a Save, not a release. The words are the fold's
|
|
406
|
+
off for one block is a Save, not a release. The words are the fold's; a
|
|
407
|
+
legend above the cards says what each one does. A
|
|
399
408
|
tick off hides the control in the editor and the renderer ignores its
|
|
400
409
|
stored value (payload-blocks, BIS-138). The four columns on every page
|
|
401
410
|
block stay; no page schema moves when a tick changes.
|
package/dist/admin.d.mts
CHANGED
|
@@ -107,6 +107,18 @@ declare const IdentityFallback: UIFieldClientComponent;
|
|
|
107
107
|
*/
|
|
108
108
|
declare const LookField: TextFieldClientComponent;
|
|
109
109
|
//#endregion
|
|
110
|
+
//#region src/admin/roles-cell.d.ts
|
|
111
|
+
/**
|
|
112
|
+
* Users list Roles column. Labels come from the saved Roles Global, the
|
|
113
|
+
* same list the edit field offers, so a renamed role reads its new name
|
|
114
|
+
* and a slug whose row was deleted is not shown at all. Until that loads
|
|
115
|
+
* (or when this login cannot read Roles), the field's seed options stand in.
|
|
116
|
+
*/
|
|
117
|
+
declare function RolesCell({
|
|
118
|
+
cellData,
|
|
119
|
+
field
|
|
120
|
+
}: DefaultCellComponentProps): react_jsx_runtime0.JSX.Element;
|
|
121
|
+
//#endregion
|
|
110
122
|
//#region src/admin/roles-matrix-field.d.ts
|
|
111
123
|
/**
|
|
112
124
|
* Payload's array field: drag rank stays, add is for custom rows.
|
|
@@ -343,5 +355,5 @@ declare function MediaAltAutofill({
|
|
|
343
355
|
//#region src/admin/media-list-view.d.ts
|
|
344
356
|
declare function MediaListView(props: ListViewClientProps): react_jsx_runtime0.JSX.Element;
|
|
345
357
|
//#endregion
|
|
346
|
-
export { AdminNav, AdminNavEntityField, AdminNavItemRowLabel, AdminNavRowLabel, AppearanceField, BlockLibraryField, ColorField, ColorScaleField, ContrastReport, DocumentCreateNew, DocumentTitleActions, FeaturesMatrixField, FontField, GreyScaleField, HiddenSaveButton, IdentityFallback, LibraryField, ListAlignStyles, LookField, MediaAltAutofill, MediaListView, PageSlugCell, PageTitleCell, PairingField, PublishChild, QuestionsList, RequiredPageCell, RequiredPageField, RoleNameField, RoleSlugField, RolesField, RolesGrantsField, RolesMatrixField, RolesRowLabel, SectionHeading, SlugField, ThemeDocumentControls, ThemeSaveButton, setThemePreviewMode };
|
|
358
|
+
export { AdminNav, AdminNavEntityField, AdminNavItemRowLabel, AdminNavRowLabel, AppearanceField, BlockLibraryField, ColorField, ColorScaleField, ContrastReport, DocumentCreateNew, DocumentTitleActions, FeaturesMatrixField, FontField, GreyScaleField, HiddenSaveButton, IdentityFallback, LibraryField, ListAlignStyles, LookField, MediaAltAutofill, MediaListView, PageSlugCell, PageTitleCell, PairingField, PublishChild, QuestionsList, RequiredPageCell, RequiredPageField, RoleNameField, RoleSlugField, RolesCell, RolesField, RolesGrantsField, RolesMatrixField, RolesRowLabel, SectionHeading, SlugField, ThemeDocumentControls, ThemeSaveButton, setThemePreviewMode };
|
|
347
359
|
//# 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-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/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"],"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;;;;;;;;
|
|
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/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"],"mappings":"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"}
|
package/dist/admin.mjs
CHANGED
|
@@ -2951,6 +2951,69 @@ function resetRolesMatrix(current) {
|
|
|
2951
2951
|
return [...defaultRolesFieldValue(), ...extras];
|
|
2952
2952
|
}
|
|
2953
2953
|
//#endregion
|
|
2954
|
+
//#region src/admin/use-live-roles.ts
|
|
2955
|
+
const inFlight = /* @__PURE__ */ new Map();
|
|
2956
|
+
function fetchLiveRoles(url) {
|
|
2957
|
+
const pending = inFlight.get(url);
|
|
2958
|
+
if (pending) return pending;
|
|
2959
|
+
const request = fetch(url, { credentials: "include" }).then((response) => response.ok ? response.json() : null).then((doc) => {
|
|
2960
|
+
if (!doc) return null;
|
|
2961
|
+
const parsed = parseRolesMatrix(doc.roles);
|
|
2962
|
+
return parsed.ok ? roleSelectOptions(parsed.rows) : null;
|
|
2963
|
+
}).catch(() => null).finally(() => {
|
|
2964
|
+
setTimeout(() => inFlight.delete(url), 0);
|
|
2965
|
+
});
|
|
2966
|
+
inFlight.set(url, request);
|
|
2967
|
+
return request;
|
|
2968
|
+
}
|
|
2969
|
+
/**
|
|
2970
|
+
* The saved Roles Global as options, or `null` until it has loaded (or
|
|
2971
|
+
* when this login cannot read it).
|
|
2972
|
+
*/
|
|
2973
|
+
function useLiveRoles() {
|
|
2974
|
+
const { config } = useConfig();
|
|
2975
|
+
const [live, setLive] = useState(null);
|
|
2976
|
+
const api = config?.routes?.api;
|
|
2977
|
+
const serverURL = config?.serverURL ?? "";
|
|
2978
|
+
useEffect(() => {
|
|
2979
|
+
if (!api) return;
|
|
2980
|
+
let cancelled = false;
|
|
2981
|
+
fetchLiveRoles(`${serverURL}${api}/globals/${ROLES_SLUG}?depth=0`).then((options) => {
|
|
2982
|
+
if (!cancelled && options) setLive(options);
|
|
2983
|
+
});
|
|
2984
|
+
return () => {
|
|
2985
|
+
cancelled = true;
|
|
2986
|
+
};
|
|
2987
|
+
}, [api, serverURL]);
|
|
2988
|
+
return live;
|
|
2989
|
+
}
|
|
2990
|
+
//#endregion
|
|
2991
|
+
//#region src/admin/roles-cell.tsx
|
|
2992
|
+
function staticOptions(field) {
|
|
2993
|
+
return ("options" in field && Array.isArray(field.options) ? field.options : []).map((option) => typeof option === "string" ? {
|
|
2994
|
+
value: option,
|
|
2995
|
+
label: option
|
|
2996
|
+
} : {
|
|
2997
|
+
value: String(option.value),
|
|
2998
|
+
label: typeof option.label === "string" ? option.label : String(option.value)
|
|
2999
|
+
});
|
|
3000
|
+
}
|
|
3001
|
+
/**
|
|
3002
|
+
* Users list Roles column. Labels come from the saved Roles Global, the
|
|
3003
|
+
* same list the edit field offers, so a renamed role reads its new name
|
|
3004
|
+
* and a slug whose row was deleted is not shown at all. Until that loads
|
|
3005
|
+
* (or when this login cannot read Roles), the field's seed options stand in.
|
|
3006
|
+
*/
|
|
3007
|
+
function RolesCell({ cellData, field }) {
|
|
3008
|
+
const live = useLiveRoles();
|
|
3009
|
+
const roles = Array.isArray(cellData) ? cellData.filter((role) => typeof role === "string") : [];
|
|
3010
|
+
const options = live ?? staticOptions(field);
|
|
3011
|
+
return /* @__PURE__ */ jsx("span", { children: roles.flatMap((role) => {
|
|
3012
|
+
const option = options.find((entry) => entry.value === role);
|
|
3013
|
+
return option ? [option.label] : [];
|
|
3014
|
+
}).join(", ") });
|
|
3015
|
+
}
|
|
3016
|
+
//#endregion
|
|
2954
3017
|
//#region src/admin/roles-matrix-field.tsx
|
|
2955
3018
|
const HIDE_ROW_CHROME = `.bl-roles-matrix .array-actions__add,.bl-roles-matrix .array-actions__duplicate,.bl-roles-matrix .array-actions__copy{display:none}.bl-roles-matrix .array-field__add-row{display:none}.bl-roles-matrix--hide-developer .array-field__row:has([data-role-seed="developer"]),.bl-roles-matrix--hide-developer .collapsible:has([data-role-seed="developer"]){display:none}.bl-roles-matrix__toolbar{display:flex;justify-content:flex-end;gap:.5rem;margin-block-end:.75rem}.bl-roles-matrix__reset{min-height:2.25rem;padding:.35rem .9rem;border:1px solid var(--theme-elevation-150,#e2e8f0);border-radius:8px;background:transparent;color:inherit;font:inherit;cursor:pointer}body.bl-roles-matrix-seed-menu .array-actions__remove{display:none}`;
|
|
2956
3019
|
function seedRoleFromTrigger(trigger) {
|
|
@@ -3496,25 +3559,6 @@ function optionValue(option) {
|
|
|
3496
3559
|
function optionLabel(option) {
|
|
3497
3560
|
return typeof option === "string" ? option : String(option.label);
|
|
3498
3561
|
}
|
|
3499
|
-
function useOfferedRoles(fallback) {
|
|
3500
|
-
const { config } = useConfig();
|
|
3501
|
-
const [live, setLive] = useState(null);
|
|
3502
|
-
const api = config?.routes?.api;
|
|
3503
|
-
const serverURL = config?.serverURL ?? "";
|
|
3504
|
-
useEffect(() => {
|
|
3505
|
-
if (!api) return;
|
|
3506
|
-
let cancelled = false;
|
|
3507
|
-
fetch(`${serverURL}${api}/globals/${ROLES_SLUG}?depth=0`, { credentials: "include" }).then((response) => response.ok ? response.json() : null).then((doc) => {
|
|
3508
|
-
if (cancelled || !doc) return;
|
|
3509
|
-
const parsed = parseRolesMatrix(doc.roles);
|
|
3510
|
-
if (parsed.ok) setLive(roleSelectOptions(parsed.rows));
|
|
3511
|
-
}).catch(() => void 0);
|
|
3512
|
-
return () => {
|
|
3513
|
-
cancelled = true;
|
|
3514
|
-
};
|
|
3515
|
-
}, [api, serverURL]);
|
|
3516
|
-
return live ?? fallback;
|
|
3517
|
-
}
|
|
3518
3562
|
/**
|
|
3519
3563
|
* Users Roles checklist. Order and labels come from the field options (the
|
|
3520
3564
|
* Roles Global, or the seed plus extras). Copy is `roleDescription`.
|
|
@@ -3522,10 +3566,11 @@ function useOfferedRoles(fallback) {
|
|
|
3522
3566
|
*/
|
|
3523
3567
|
const RolesField = ({ field, path: pathFromProps, readOnly, validate }) => {
|
|
3524
3568
|
const { admin: { description } = {}, label, localized, options = [], required } = field;
|
|
3525
|
-
const
|
|
3569
|
+
const fallback = (options.length ? options : roleSelectOptions()).map((option) => ({
|
|
3526
3570
|
value: optionValue(option),
|
|
3527
3571
|
label: optionLabel(option)
|
|
3528
|
-
}))
|
|
3572
|
+
}));
|
|
3573
|
+
const offered = useLiveRoles() ?? fallback;
|
|
3529
3574
|
const { disabled, errorMessage, path, setValue, showError, value } = useField({
|
|
3530
3575
|
potentiallyStalePath: pathFromProps,
|
|
3531
3576
|
validate: useCallback((value, validationOptions) => {
|
|
@@ -3911,7 +3956,7 @@ const BLOCK_LIBRARY_CATEGORIES = [
|
|
|
3911
3956
|
];
|
|
3912
3957
|
//#endregion
|
|
3913
3958
|
//#region src/admin/block-library-field.tsx
|
|
3914
|
-
const LIST_CSS$1 = `.bl-block-library{display:grid;grid-template-columns:12rem 1fr;gap:1.5rem;align-items:start}.bl-block-library__rail{display:flex;flex-direction:column;gap:.25rem}.bl-block-library__rail button{text-align:left;background:transparent;border:0;padding:.4rem .6rem;border-radius:8px;cursor:pointer}.bl-block-library__rail button[aria-current=true]{background:var(--theme-elevation-100,#f1f5f9);font-weight:650}.bl-block-library__card{display:flex;flex-direction:column;gap:.5rem;margin-block-end:1.25rem}.bl-block-library__card header{display:flex;justify-content:space-between;align-items:center;gap:1rem}.bl-block-library__controls{display:flex;flex-wrap:wrap;gap:.25rem 1.25rem;margin:0;padding:0;border:0}.bl-block-library__controls legend{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0)}.bl-block-library__control{display:inline-flex;align-items:center;gap:.5rem;font-size:13px}.bl-block-library__control[data-locked]{color:var(--theme-elevation-400,#94a3b8)}.bl-block-library__refusal{margin:0;color:var(--theme-error-500,#b91c1c)}.bl-block-library__drafts{margin:.5rem 0 0;padding-inline-start:1.25rem}.bl-block-library iframe{width:100%;height:720px;border:1px solid var(--theme-elevation-150,#e2e8f0);border-radius:12px;background:var(--theme-elevation-0,#fff)}`;
|
|
3959
|
+
const LIST_CSS$1 = `.bl-block-library{display:grid;grid-template-columns:12rem 1fr;gap:1.5rem;align-items:start}.bl-block-library__rail{display:flex;flex-direction:column;gap:.25rem}.bl-block-library__rail button{text-align:left;background:transparent;border:0;padding:.4rem .6rem;border-radius:8px;cursor:pointer}.bl-block-library__rail button[aria-current=true]{background:var(--theme-elevation-100,#f1f5f9);font-weight:650}.bl-block-library__card{display:flex;flex-direction:column;gap:.5rem;margin-block-end:1.25rem}.bl-block-library__card header{display:flex;justify-content:space-between;align-items:center;gap:1rem}.bl-block-library__controls{display:flex;flex-wrap:wrap;gap:.25rem 1.25rem;margin:0;padding:0;border:0}.bl-block-library__controls legend{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0)}.bl-block-library__control{display:inline-flex;align-items:center;gap:.5rem;font-size:13px}.bl-block-library__control[data-locked]{color:var(--theme-elevation-400,#94a3b8)}.bl-block-library__legend{margin:0 0 1.5rem;padding:.75rem 1rem;border:1px solid var(--theme-elevation-150,#e2e8f0);border-radius:12px;font-size:13px;line-height:1.45}.bl-block-library__legend h2{margin:0 0 .25rem;font-size:13px;font-weight:650}.bl-block-library__legend p{margin:0 0 .5rem;color:var(--theme-elevation-600,#475569)}.bl-block-library__legend dl{display:grid;grid-template-columns:max-content 1fr;gap:.25rem 1rem;margin:0}.bl-block-library__legend dt{font-weight:600}.bl-block-library__legend dd{margin:0;color:var(--theme-elevation-600,#475569)}.bl-block-library__refusal{margin:0;color:var(--theme-error-500,#b91c1c)}.bl-block-library__drafts{margin:.5rem 0 0;padding-inline-start:1.25rem}.bl-block-library iframe{width:100%;height:720px;border:1px solid var(--theme-elevation-150,#e2e8f0);border-radius:12px;background:var(--theme-elevation-0,#fff)}@media (max-width:768px){.bl-block-library{grid-template-columns:minmax(0,1fr)}.bl-block-library__rail{flex-direction:row;overflow-x:auto;padding-block-end:.25rem}.bl-block-library__rail button{white-space:nowrap}.bl-block-library__legend dl{grid-template-columns:minmax(0,1fr);gap:0}.bl-block-library__legend dd{margin-block-end:.4rem}}`;
|
|
3915
3960
|
function holderLabel(holder) {
|
|
3916
3961
|
const title = holder.title?.trim() || "Untitled";
|
|
3917
3962
|
const slug = holder.slug?.trim();
|
|
@@ -3923,6 +3968,31 @@ function refusalOf(label, usage) {
|
|
|
3923
3968
|
function isUsage(value) {
|
|
3924
3969
|
return Boolean(value) && typeof value === "object" && Array.isArray(value.published) && Array.isArray(value.drafts);
|
|
3925
3970
|
}
|
|
3971
|
+
/** What each tick on a card does, in the order the cards draw them. */
|
|
3972
|
+
const SECTION_CONTROL_LEGEND = {
|
|
3973
|
+
background: "The surface the section sits on.",
|
|
3974
|
+
spacing: "The air above and below the section. Not the site-wide spacing in Theme → Appearance.",
|
|
3975
|
+
anchor: "An in-page link target, like #stories.",
|
|
3976
|
+
hidden: "Keeps the section in the editor and off the page. A hero cannot offer it: a page needs its hero."
|
|
3977
|
+
};
|
|
3978
|
+
/** One key for the whole screen, above the cards, so the ticks need no help text of their own. */
|
|
3979
|
+
function SectionControlLegend() {
|
|
3980
|
+
return /* @__PURE__ */ jsxs("section", {
|
|
3981
|
+
className: "bl-block-library__legend",
|
|
3982
|
+
"aria-labelledby": "bl-block-library-legend",
|
|
3983
|
+
children: [
|
|
3984
|
+
/* @__PURE__ */ jsx("h2", {
|
|
3985
|
+
id: "bl-block-library-legend",
|
|
3986
|
+
children: "What the checkboxes do"
|
|
3987
|
+
}),
|
|
3988
|
+
/* @__PURE__ */ jsx("p", { children: "Each card's checkboxes choose which Block Settings editors get on that block. Unticked, the control leaves the editor and the page ignores whatever was saved in it." }),
|
|
3989
|
+
/* @__PURE__ */ jsx("dl", { children: SECTION_CONTROL_KEYS.map((key) => /* @__PURE__ */ jsxs("div", {
|
|
3990
|
+
style: { display: "contents" },
|
|
3991
|
+
children: [/* @__PURE__ */ jsx("dt", { children: SECTION_CONTROL_LABELS[key] }), /* @__PURE__ */ jsx("dd", { children: SECTION_CONTROL_LEGEND[key] })]
|
|
3992
|
+
}, key)) })
|
|
3993
|
+
]
|
|
3994
|
+
});
|
|
3995
|
+
}
|
|
3926
3996
|
/**
|
|
3927
3997
|
* The four ticks under Enabled: which section settings the block offers.
|
|
3928
3998
|
* Not drawn on a navbar. Hidden is locked off on a hero (a page cannot
|
|
@@ -4185,7 +4255,7 @@ const BlockLibraryField = (props) => {
|
|
|
4185
4255
|
const [category, setCategory] = useState("hero");
|
|
4186
4256
|
const navbarCount = rows.filter((row) => row.kind === "navbar").length;
|
|
4187
4257
|
const visible = rows.filter((row) => row.category === category);
|
|
4188
|
-
return /* @__PURE__ */ jsx(KitProvider, { children: /* @__PURE__ */
|
|
4258
|
+
return /* @__PURE__ */ jsx(KitProvider, { children: /* @__PURE__ */ jsxs("div", {
|
|
4189
4259
|
className: "bl-block-library",
|
|
4190
4260
|
children: [
|
|
4191
4261
|
/* @__PURE__ */ jsx("style", {
|
|
@@ -4204,15 +4274,15 @@ const BlockLibraryField = (props) => {
|
|
|
4204
4274
|
children: entry.label
|
|
4205
4275
|
}, entry.id))
|
|
4206
4276
|
}),
|
|
4207
|
-
/* @__PURE__ */
|
|
4277
|
+
/* @__PURE__ */ jsxs("div", { children: [visible.some((row) => row.kind !== "navbar") ? /* @__PURE__ */ jsx(SectionControlLegend, {}) : null, visible.map((row) => /* @__PURE__ */ jsx(LibraryCard, {
|
|
4208
4278
|
row,
|
|
4209
4279
|
write: loaded.some((entry) => entry.slug === row.slug) ? writeRow(row.slug) : null,
|
|
4210
4280
|
src: previews[row.slug] ?? "",
|
|
4211
4281
|
toggle: row.kind !== "navbar" || navbarCount > 1,
|
|
4212
4282
|
usageURL
|
|
4213
|
-
}, row.slug)) })
|
|
4283
|
+
}, row.slug))] })
|
|
4214
4284
|
]
|
|
4215
|
-
}) })
|
|
4285
|
+
}) });
|
|
4216
4286
|
};
|
|
4217
4287
|
//#endregion
|
|
4218
4288
|
//#region src/admin/theme-kit-accent.tsx
|
|
@@ -6645,6 +6715,6 @@ function ChevronMark() {
|
|
|
6645
6715
|
});
|
|
6646
6716
|
}
|
|
6647
6717
|
//#endregion
|
|
6648
|
-
export { AdminNav, AdminNavEntityField, AdminNavItemRowLabel, AdminNavRowLabel, AppearanceField, BlockLibraryField, ColorField, ColorScaleField, ContrastReport, DocumentCreateNew, DocumentTitleActions, FeaturesMatrixField, FontField, GreyScaleField, HiddenSaveButton, IdentityFallback, LibraryField, ListAlignStyles, LookField, MediaAltAutofill, MediaListView, PageSlugCell, PageTitleCell, PairingField, PublishChild, QuestionsList, RequiredPageCell, RequiredPageField, RoleNameField, RoleSlugField, RolesField, RolesGrantsField, RolesMatrixField, RolesRowLabel, SectionHeading, SlugField, ThemeDocumentControls, ThemeSaveButton, setThemePreviewMode };
|
|
6718
|
+
export { AdminNav, AdminNavEntityField, AdminNavItemRowLabel, AdminNavRowLabel, AppearanceField, BlockLibraryField, ColorField, ColorScaleField, ContrastReport, DocumentCreateNew, DocumentTitleActions, FeaturesMatrixField, FontField, GreyScaleField, HiddenSaveButton, IdentityFallback, LibraryField, ListAlignStyles, LookField, MediaAltAutofill, MediaListView, PageSlugCell, PageTitleCell, PairingField, PublishChild, QuestionsList, RequiredPageCell, RequiredPageField, RoleNameField, RoleSlugField, RolesCell, RolesField, RolesGrantsField, RolesMatrixField, RolesRowLabel, SectionHeading, SlugField, ThemeDocumentControls, ThemeSaveButton, setThemePreviewMode };
|
|
6649
6719
|
|
|
6650
6720
|
//# sourceMappingURL=admin.mjs.map
|