@bison-lab/payload-core 3.34.0 → 3.39.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 CHANGED
@@ -137,7 +137,11 @@ Contrast is the automatic label on editable fills at 7:1; it
137
137
  is never enforced and lives in the Needs-attention modal, not on the page.
138
138
  `bison.config.json` is the seed a site starts from, not the source of truth.
139
139
  Pass `destructive` (or `seed.brandDestructive`); otherwise Theme uses the
140
- library’s `DESTRUCTIVE_SCALE_HEX` (`#ef4444`). Success falls back to `#22c55e`.
140
+ library’s `DESTRUCTIVE_SCALE_HEX` (`#FF7C6B`). Success falls back to `#83CEA2`.
141
+ Changing a brand hex or **This color is** leaves the chips as they were;
142
+ **Regenerate scale** rewrites the ramp with the hex pinned at that step.
143
+ Success and Destructive family banners use the same scale steps as the
144
+ visitor Alert.
141
145
 
142
146
  **1. Register the Global.** Access is required — Theme does not read the
143
147
  Roles or Features Global. Pass `canUseFeature("theme")` as `update`
package/dist/admin.d.mts CHANGED
@@ -14,7 +14,8 @@ declare const ColorField: TextFieldClientComponent;
14
14
  //#region src/admin/color-scale-field.d.ts
15
15
  /**
16
16
  * One system (or library row) color: hex, source step, include/exclude.
17
- * Writes the group's stored fields. A committed hex or step rebuilds the scale.
17
+ * Writes the group's stored fields. A committed hex or step marks the
18
+ * scale stale; Regenerate scale rewrites the ramp.
18
19
  */
19
20
  declare const ColorScaleField: GroupFieldClientComponent;
20
21
  //#endregion
@@ -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/role-name-field.tsx","../src/admin/roles-field.tsx","../src/admin/roles-grants-field.tsx","../src/admin/features-matrix-field.tsx","../src/admin/document-title-actions.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/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;;;;;;;cCsBZ,eAAA,EAAiB,yBAAA;;;;;;;;;cCOjB,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;;;KCrCpB,gBAAA;AAAA,iBAkCI,mBAAA,CAAoB,IAAA,EAAM,gBAAA;;;;;;;cClC7B,gBAAA,EAAkB,sBAAA;;;;;;;cCIlB,SAAA,EAAW,wBAAA;;;;;;;;cCqBX,gBAAA,EAAkB,yBAAA;;;;;;iBC1Bf,aAAA,CAAA,GAAa,kBAAA,CAAA,GAAA,CAAA,OAAA;;;;;;cCChB,aAAA,EAAe,wBAAA;;;;;;;;;cC2Bf,SAAA,EAAW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A,CAAc,KAAA,EAAO,mBAAA,GAAmB,kBAAA,CAAA,GAAA,CAAA,OAAA"}
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/role-name-field.tsx","../src/admin/roles-field.tsx","../src/admin/roles-grants-field.tsx","../src/admin/features-matrix-field.tsx","../src/admin/document-title-actions.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/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,CAA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;E8BvEC,IAAA;;EAEA,KAAA;E7BmBW;E6BjBX,MAAA;AAAA;AAAA,UAGe,eAAA;E7BiEhB;E6B/DC,IAAA;;EAEA,KAAA;E5BgBW;E4BdX,UAAA;;;;;EAKA,MAAA;;EAEA,IAAA,GAAO,cAAA;AAAA;;;iBCyKO,aAAA,CACd,KAAA,EAAO,mBAAA;EAAwB,UAAA,YAAsB,eAAA;AAAA,IAAmB,kBAAA,CAAA,GAAA,CAAA,OAAA;;;;;;;iBChM1D,gBAAA,CAAA;EAAmB;AAAA;EAAU,IAAA;AAAA;;;iBC2G7B,aAAA,CAAc,KAAA,EAAO,mBAAA,GAAmB,kBAAA,CAAA,GAAA,CAAA,OAAA"}
package/dist/admin.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import { a as colorDocFromState, i as SYSTEM_COLOR_KEYS, n as pageEditorLooks, r as pageEditorTokens, s as stateFromColorDoc } from "./looks-BbL309kO.mjs";
3
3
  import { ArrayField, Button, CheckboxInput, DefaultCell, FieldDescription, FieldError, FieldLabel, Link, Logout, NavGroup, NavToggler, SelectField, fieldBaseClass, useAuth, useBulkUpload, useConfig, useField, useForm, useFormFields, useListQuery, useModal, useNav, useRowLabel, useStepNav } from "@payloadcms/ui";
4
- import { GREY_SCALES, SHADE_STEPS, contrastForeground, contrastRatio, createColorScale, deriveDarkPalette, deriveLightPalette, hexToHSL, hslToString, includedShadeSteps, isThemeHex, presetHints, setColorScaleInclude } from "@bison-lab/tokens";
4
+ import { GREY_SCALES, SHADE_STEPS, contrastForeground, contrastRatio, createColorScale, deriveDarkPalette, deriveLightPalette, hexToHSL, hslToString, includedShadeSteps, isThemeHex, presetHints, regenerateColorScale, setColorScaleInclude, updateColorScale } from "@bison-lab/tokens";
5
5
  import { useCallback, useEffect, useId, useLayoutEffect, useMemo, useRef, useState } from "react";
6
6
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
7
7
  import { Badge, Button as Button$1, Checkbox, Chip, ConfirmDialog, DeleteGlyph, Dialog, EditGlyph, Field, Fold, Input, KitProvider, Label, MainHead, Page, Pagination, Popover, Select, SelectContent, SelectItem, SelectTrigger, SelectValue, Stack, Switch, Table, TableActions, TableCell, TableHead, TableRow, Thumbnail } from "@bison-lab/admin-ui";
@@ -321,6 +321,29 @@ function destructiveHueWarning(hex) {
321
321
  function hslCss(value) {
322
322
  return `hsl(${value})`;
323
323
  }
324
+ /**
325
+ * The scale steps the visitor Alert uses for Success and Destructive.
326
+ * Light: 50 wash, 300 border, 900 ink, 600 mark on 100. Dark: 900 at 60%,
327
+ * 700 border, 100 ink, 300 mark on 800.
328
+ */
329
+ function statusAlertPaint(scale, mode) {
330
+ if (mode === "dark") return {
331
+ fill: scale[900],
332
+ border: scale[700],
333
+ ink: scale[100],
334
+ mark: scale[300],
335
+ markWell: scale[800],
336
+ fillMix: .6
337
+ };
338
+ return {
339
+ fill: scale[50],
340
+ border: scale[300],
341
+ ink: scale[900],
342
+ mark: scale[600],
343
+ markWell: scale[100],
344
+ fillMix: 1
345
+ };
346
+ }
324
347
  /** Which appearances fail, in words. Empty when both pass. */
325
348
  function hardToReadModes(item) {
326
349
  const light = item.light.shortfall > 0;
@@ -519,12 +542,20 @@ const PREVIEW_VARS = [
519
542
  "--bl-preview-muted",
520
543
  "--bl-preview-input"
521
544
  ];
522
- /** Brand hexes do not affect grey-driven surfaces; derive still requires them. */
545
+ /** Grey surfaces ignore brand; primary and destructive still come from the form. */
523
546
  const PREVIEW_BRAND = {
524
547
  primary: "#111111",
525
548
  secondary: "#111111",
526
549
  success: "#111111"
527
550
  };
551
+ function brandForPreview(grey, brand) {
552
+ return {
553
+ ...PREVIEW_BRAND,
554
+ grey,
555
+ primary: brand?.primary && isThemeHex(brand.primary) ? brand.primary : PREVIEW_BRAND.primary,
556
+ destructive: brand?.destructive && isThemeHex(brand.destructive) ? brand.destructive : void 0
557
+ };
558
+ }
528
559
  function readDocumentTheme() {
529
560
  if (typeof document === "undefined") return "light";
530
561
  return document.documentElement.getAttribute("data-theme") === "dark" ? "dark" : "light";
@@ -555,14 +586,8 @@ function useThemePreviewMode() {
555
586
  }, []);
556
587
  return mode;
557
588
  }
558
- function previewVarsFor(grey, mode) {
559
- const palette = mode === "dark" ? deriveDarkPalette({
560
- ...PREVIEW_BRAND,
561
- grey
562
- }) : deriveLightPalette({
563
- ...PREVIEW_BRAND,
564
- grey
565
- });
589
+ function previewVarsFor(grey, mode, brand) {
590
+ const palette = mode === "dark" ? deriveDarkPalette(brandForPreview(grey, brand)) : deriveLightPalette(brandForPreview(grey, brand));
566
591
  return {
567
592
  "--bl-preview-bg": `hsl(${palette.background})`,
568
593
  "--bl-preview-card": `hsl(${palette.card})`,
@@ -570,11 +595,26 @@ function previewVarsFor(grey, mode) {
570
595
  "--bl-preview-text": `hsl(${palette.foreground})`,
571
596
  "--bl-preview-muted": `hsl(${palette["muted-foreground"]})`,
572
597
  "--bl-preview-input": `hsl(${palette.input})`,
598
+ "--primary": palette.primary,
599
+ "--primary-foreground": palette["primary-foreground"],
600
+ "--destructive": palette.destructive,
601
+ "--destructive-foreground": palette["destructive-foreground"],
602
+ "--bl-kit-accent": `hsl(${palette.primary})`,
573
603
  "--theme-elevation-0": `hsl(${palette.card})`,
574
604
  "--theme-elevation-150": `hsl(${palette.border})`,
575
605
  "--theme-elevation-800": `hsl(${palette.foreground})`
576
606
  };
577
607
  }
608
+ function usePreviewBrand() {
609
+ return useFormFields(([fields]) => {
610
+ const primary = fields["colors.brand.primary.hex"]?.value;
611
+ const destructive = fields["colors.brand.destructive.hex"]?.value;
612
+ return {
613
+ primary: typeof primary === "string" ? primary : void 0,
614
+ destructive: typeof destructive === "string" ? destructive : void 0
615
+ };
616
+ });
617
+ }
578
618
  function useGreyScale() {
579
619
  return useFormFields(([fields]) => {
580
620
  const value = fields["colors.greyScale"]?.value;
@@ -590,7 +630,7 @@ function usePreviewCanvas() {
590
630
  return {
591
631
  mode,
592
632
  className: "bl-preview-canvas",
593
- style: previewVarsFor(useGreyScale(), mode)
633
+ style: previewVarsFor(useGreyScale(), mode, usePreviewBrand())
594
634
  };
595
635
  }
596
636
  //#endregion
@@ -684,6 +724,17 @@ const STATUS_COPY = {
684
724
  drift: "This color may no longer read as a destructive or error state."
685
725
  }
686
726
  };
727
+ function familyBannerStyle(state, mode) {
728
+ const paint = statusAlertPaint(state.scale, mode);
729
+ const fill = paint.fillMix < 1 ? `color-mix(in srgb, ${hslCss(paint.fill)} ${Math.round(paint.fillMix * 100)}%, var(--bl-preview-card, transparent))` : hslCss(paint.fill);
730
+ return {
731
+ "--bl-family-fill": fill,
732
+ "--bl-family-border": hslCss(paint.border),
733
+ "--bl-family-ink": hslCss(paint.ink),
734
+ "--bl-family-mark": hslCss(paint.mark),
735
+ "--bl-family-mark-well": hslCss(paint.markWell)
736
+ };
737
+ }
687
738
  function IncludeMark({ on }) {
688
739
  return /* @__PURE__ */ jsx("span", {
689
740
  className: "bl-scale-card__status",
@@ -716,10 +767,10 @@ function ColorScaleCard({ id, name, hint, required, custom, state, onChange, onD
716
767
  const included = new Set(includedShadeSteps(state));
717
768
  const hueDrift = role === "success" ? Boolean(successHueWarning(state.hex)) : role === "destructive" ? Boolean(destructiveHueWarning(state.hex)) : false;
718
769
  function commitHex(hex) {
719
- onChange(createColorScale(hex, state.sourceStep, state.include));
770
+ onChange(updateColorScale(state, { hex }));
720
771
  }
721
772
  function commitStep(step) {
722
- onChange(createColorScale(state.hex, step, state.include));
773
+ onChange(updateColorScale(state, { sourceStep: step }));
723
774
  }
724
775
  function toggleStep(step) {
725
776
  if (step === state.sourceStep) {
@@ -737,6 +788,7 @@ function ColorScaleCard({ id, name, hint, required, custom, state, onChange, onD
737
788
  children: /* @__PURE__ */ jsxs("article", {
738
789
  className: `bl-scale-card ${canvas.className}`,
739
790
  "data-preview": canvas.mode,
791
+ "data-stale": state.stale ? "" : void 0,
740
792
  style: canvas.style,
741
793
  children: [
742
794
  /* @__PURE__ */ jsxs("header", {
@@ -771,38 +823,67 @@ function ColorScaleCard({ id, name, hint, required, custom, state, onChange, onD
771
823
  }),
772
824
  /* @__PURE__ */ jsxs("div", {
773
825
  className: "bl-scale-card__row",
774
- children: [/* @__PURE__ */ jsxs(Field, {
775
- as: "div",
776
- children: [/* @__PURE__ */ jsx(Label, { children: "Brand hex" }), /* @__PURE__ */ jsx(BrandHexField, {
777
- name,
778
- value: state.hex,
779
- onChange: commitHex,
780
- readOnly
781
- })]
782
- }), /* @__PURE__ */ jsxs(Field, {
783
- as: "div",
784
- children: [/* @__PURE__ */ jsx(Label, { children: "This color is" }), /* @__PURE__ */ jsxs(Select, {
785
- value: String(state.sourceStep),
786
- onValueChange: (value) => commitStep(Number(value)),
826
+ children: [
827
+ /* @__PURE__ */ jsxs(Field, {
828
+ as: "div",
829
+ children: [/* @__PURE__ */ jsx(Label, { children: "Brand hex" }), /* @__PURE__ */ jsx(BrandHexField, {
830
+ name,
831
+ value: state.hex,
832
+ onChange: commitHex,
833
+ readOnly
834
+ })]
835
+ }),
836
+ /* @__PURE__ */ jsxs(Field, {
837
+ as: "div",
838
+ children: [/* @__PURE__ */ jsx(Label, { children: "This color is" }), /* @__PURE__ */ jsxs(Select, {
839
+ value: String(state.sourceStep),
840
+ onValueChange: (value) => commitStep(Number(value)),
841
+ disabled: readOnly,
842
+ children: [/* @__PURE__ */ jsx(SelectTrigger, {
843
+ "aria-label": "This color is",
844
+ children: /* @__PURE__ */ jsx(SelectValue, {})
845
+ }), /* @__PURE__ */ jsx(SelectContent, { children: SHADE_STEPS.map((step) => /* @__PURE__ */ jsx(SelectItem, {
846
+ value: String(step),
847
+ children: step
848
+ }, step)) })]
849
+ })]
850
+ }),
851
+ /* @__PURE__ */ jsx(Button$1, {
852
+ type: "button",
853
+ variant: state.stale ? "primary" : "outline",
787
854
  disabled: readOnly,
788
- children: [/* @__PURE__ */ jsx(SelectTrigger, {
789
- "aria-label": "This color is",
790
- children: /* @__PURE__ */ jsx(SelectValue, {})
791
- }), /* @__PURE__ */ jsx(SelectContent, { children: SHADE_STEPS.map((step) => /* @__PURE__ */ jsx(SelectItem, {
792
- value: String(step),
793
- children: step
794
- }, step)) })]
795
- })]
796
- })]
855
+ onClick: () => onChange(regenerateColorScale(state)),
856
+ children: "Regenerate scale"
857
+ })
858
+ ]
797
859
  }),
860
+ state.stale ? /* @__PURE__ */ jsx("p", {
861
+ className: "bl-scale-card__stale",
862
+ children: "The chips still show the last generated scale. Regenerate after you set the hex and which step it is."
863
+ }) : null,
798
864
  role ? /* @__PURE__ */ jsxs("div", {
799
865
  className: "bl-scale-card__family",
800
866
  "data-role": role,
801
867
  "data-drift": hueDrift ? "" : void 0,
868
+ style: familyBannerStyle(state, canvas.mode),
802
869
  children: [/* @__PURE__ */ jsx("div", {
803
870
  className: "bl-scale-card__family-mark",
804
871
  "aria-hidden": "true",
805
- children: "!"
872
+ children: /* @__PURE__ */ jsxs("svg", {
873
+ viewBox: "0 0 16 16",
874
+ children: [/* @__PURE__ */ jsx("path", {
875
+ d: "M8 3.4v6.1",
876
+ fill: "none",
877
+ stroke: "currentColor",
878
+ strokeWidth: "2.2",
879
+ strokeLinecap: "round"
880
+ }), /* @__PURE__ */ jsx("circle", {
881
+ cx: "8",
882
+ cy: "12.2",
883
+ r: "1.2",
884
+ fill: "currentColor"
885
+ })]
886
+ })
806
887
  }), /* @__PURE__ */ jsxs("div", { children: [
807
888
  /* @__PURE__ */ jsx("div", {
808
889
  className: "bl-scale-card__family-title",
@@ -917,15 +998,15 @@ const COLOR_SCALE_CARD_CSS = `
917
998
  .bl-scale-card__title{margin:0;font-size:1rem}
918
999
  .bl-scale-card__hint{margin:.35rem 0 0;color:var(--bl-preview-muted,var(--theme-elevation-500,#64748b));font-size:12px}
919
1000
  .bl-scale-card__delete{border:0;background:none;color:#be123c;font:inherit;font-size:13px;font-weight:600;cursor:pointer}
920
- .bl-scale-card__row{display:grid;grid-template-columns:1fr 8rem;gap:.75rem;margin-top:1rem;align-items:start}
1001
+ .bl-scale-card__row{display:grid;grid-template-columns:max-content 8rem max-content;gap:.75rem;margin-top:1rem;align-items:end}
921
1002
  .bl-scale-card__row .bl-nav-kit__field{margin-bottom:0}
922
- .bl-scale-card__family{display:flex;gap:.75rem;align-items:flex-start;margin-top:1rem;padding:.75rem .85rem;border-radius:8px}
923
- .bl-scale-card__family[data-role=success]{border:1px solid #a7f3d0;background:#ecfdf5;color:#065f46}
924
- .bl-scale-card__family[data-role=destructive]{border:1px solid #fecdd3;background:#fff1f2;color:#9f1239}
1003
+ .bl-scale-card__row .bl-brand-hex .bl-nav-kit__input{width:8.5ch;min-width:8.5ch}
1004
+ .bl-scale-card__stale{margin:.55rem 0 0;font-size:12px;font-weight:600;color:#92400e}
1005
+ .bl-scale-card[data-stale] .bl-scale-card__chip{opacity:.55}
1006
+ .bl-scale-card__family{display:flex;gap:.75rem;align-items:flex-start;margin-top:1rem;padding:.75rem .85rem;border-radius:8px;border:1px solid var(--bl-family-border);background:var(--bl-family-fill);color:var(--bl-family-ink)}
925
1007
  .bl-scale-card__family[data-drift]{box-shadow:0 0 0 2px #fbbf24}
926
- .bl-scale-card__family-mark{flex:none;width:1.25rem;height:1.25rem;border-radius:999px;display:grid;place-items:center;font-size:11px;font-weight:700}
927
- .bl-scale-card__family[data-role=success] .bl-scale-card__family-mark{background:#d1fae5;color:#047857}
928
- .bl-scale-card__family[data-role=destructive] .bl-scale-card__family-mark{background:#ffe4e6;color:#be123c}
1008
+ .bl-scale-card__family-mark{flex:none;width:1.25rem;height:1.25rem;border-radius:999px;display:grid;place-items:center;background:var(--bl-family-mark-well);color:var(--bl-family-mark)}
1009
+ .bl-scale-card__family-mark svg{display:block;width:10px;height:10px}
929
1010
  .bl-scale-card__family-title{font-size:12px;font-weight:600}
930
1011
  .bl-scale-card__family p{margin:.25rem 0 0;font-size:11px;line-height:1.45;opacity:.85}
931
1012
  .bl-scale-card__family-drift{font-weight:600;opacity:1}
@@ -956,6 +1037,7 @@ const COLOR_SCALE_CARD_CSS = `
956
1037
  .bl-scale-card__panel-head button{border:0;background:none;font:inherit;font-size:1.25rem;line-height:1;color:#64748b;cursor:pointer}
957
1038
  .bl-scale-card__panel-done{margin-top:1rem;min-height:2.1rem;padding:.35rem .85rem;border:0;border-radius:8px;background:#0f172a;color:#fff;font:inherit;font-weight:600;cursor:pointer}
958
1039
  .bl-scale-card[data-preview=dark] .bl-scale-card__step[data-source] .bl-scale-card__chip{box-shadow:0 0 0 2px var(--bl-preview-text,#fafafa)}
1040
+ .bl-scale-card[data-preview=dark] .bl-scale-card__stale{color:#fde68a}
959
1041
  ` + READABILITY_LIST_CSS + THEME_COLORS_LAYOUT_CSS;
960
1042
  //#endregion
961
1043
  //#region src/admin/color-scale-field.tsx
@@ -976,7 +1058,8 @@ function includedStepsFromForm(path, value, getDataByPath) {
976
1058
  }
977
1059
  /**
978
1060
  * One system (or library row) color: hex, source step, include/exclude.
979
- * Writes the group's stored fields. A committed hex or step rebuilds the scale.
1061
+ * Writes the group's stored fields. A committed hex or step marks the
1062
+ * scale stale; Regenerate scale rewrites the ramp.
980
1063
  */
981
1064
  const ColorScaleField = ({ field, path, readOnly }) => {
982
1065
  const hex = useField({ path: `${path}.hex` });
@@ -2007,8 +2090,8 @@ const GREY_SCALE_FIELD_CSS = `
2007
2090
  .bl-grey__head h2{margin:0;font-size:1.1rem}
2008
2091
  .bl-grey__head p{margin:.35rem 0 0;max-width:40rem;font-size:13px;color:var(--bl-preview-muted,var(--theme-elevation-500,#64748b))}
2009
2092
  .bl-grey__choices{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:.6rem;padding:0 1.15rem 1.15rem;border:1px solid var(--bl-preview-border,var(--theme-elevation-150,#e2e8f0));border-top:0;border-radius:0 0 12px 12px;background:var(--bl-preview-card,var(--theme-elevation-0,#fff));color:var(--bl-preview-text,inherit)}
2010
- .bl-grey__choice{display:flex;flex-direction:column;gap:.45rem;padding:.75rem;border:1px solid var(--bl-preview-border,var(--theme-elevation-150,#e2e8f0));border-radius:12px;background:var(--bl-preview-bg,var(--theme-elevation-0,#fff));color:inherit;cursor:pointer}
2011
- .bl-grey__choice[data-selected]{box-shadow:inset 0 0 0 2px var(--bl-preview-text,#0f172a);border-color:var(--bl-preview-text,#0f172a)}
2093
+ .bl-grey__choice{display:flex;flex-direction:column;gap:.45rem;padding:.75rem;border:1px solid var(--bl-preview-border,var(--theme-elevation-150,#e2e8f0));border-radius:12px;background:transparent;color:inherit;cursor:pointer}
2094
+ .bl-grey__choice[data-selected]{border-width:2px;border-color:hsl(var(--primary))}
2012
2095
  .bl-grey__choice input{position:absolute;opacity:0;pointer-events:none}
2013
2096
  .bl-grey__ramp{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:3px}
2014
2097
  .bl-grey__ramp i{display:block;height:2rem;border-radius:6px}