@columnus/sdk 0.3.1 → 0.3.2

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.
@@ -2,7 +2,7 @@ import { useMarkdownInsertPickers } from './chunk-ZTWPGA37.js';
2
2
  import { readSessionCookie } from './chunk-QPQRNIKG.js';
3
3
  import { cmsBackdrop, cmsBox, cmsButton, ghostBtn, CMS_FIELD_EDITOR_Z_INDEX, buildStampAttrs, ACCENT_FG, ACCENT, primaryBtn, dangerBtn, IconTrash, cmsMuted, CMS_ROW_EDITOR_Z_INDEX, Icon, CMS_MARKDOWN_EDITOR_Z_INDEX } from './chunk-ICKWVUW7.js';
4
4
  import { createInertFieldsDataAdapter, inertRichtextHostAdapter, RichtextHostProvider, FieldsDataProvider, TooltipProvider, ImageCell, FieldInput, isPickerOverlayTarget, RowEditor, Dialog, DialogContent, preventDismissOnPickerOverlay, DialogHeader, DialogTitle, DialogDescription, DialogFooter, Button, Label, RichDocView, previewLabel, MarkdownFieldTrigger, validateFileForKind, CellRenderer } from './chunk-LTPU2AL3.js';
5
- import { fallbackPreviewLabel, filterSortDocuments, myDraft, toDocumentId, isValidAssetId, stripSystemFields, tableDisplayName, fieldDisplayName, editorAccessEnabled, richContentPlainText, newProvisionalRowId, findTableAccess, findProposalIdsOverlappingTarget, validatePatch, stringifyRichDoc, SHARE_LIST_LIMIT, collectRichDocAssetIds, formatNumericDate, looksLikeId, normalizeRichField, emptyToUndefined, isHttpUrl, focalObjectPosition, formatIdShort, refTarget, staleFieldNames, proposalDiffFieldNames, computeProposalRecordDiff, plainTextIfRichDoc } from './chunk-5IPH2A64.js';
5
+ import { fallbackPreviewLabel, filterSortDocuments, myDraft, toDocumentId, isValidAssetId, stripSystemFields, tableDisplayName, fieldDisplayName, editorAccessEnabled, richContentPlainText, newProvisionalRowId, findTableAccess, findProposalIdsOverlappingTarget, validatePatch, stringifyRichDoc, SHARE_LIST_LIMIT, collectRichDocAssetIds, formatNumericDate, looksLikeId, normalizeRichField, emptyToUndefined, isHttpUrl, focalObjectPosition, formatIdShort, plainTextIfRichDoc, refTarget, staleFieldNames, proposalDiffFieldNames, computeProposalRecordDiff } from './chunk-5IPH2A64.js';
6
6
  import { createContext, lazy, useMemo, useState, useRef, useCallback, useEffect, useContext, useId, useLayoutEffect, Suspense } from 'react';
7
7
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
8
8
  import { createPortal } from 'react-dom';
@@ -555,6 +555,11 @@ function draftTitle(proposal, mine) {
555
555
  if (!mine) return proposal.createdByName ?? "Another editor";
556
556
  return proposal.draftLabel ?? (proposal.draftKey ? "Builder session" : "Toolbar edits");
557
557
  }
558
+ var changeKey = (proposalId, target) => JSON.stringify([proposalId, target.table, target.rowId, target.field ?? null]);
559
+ function isOnPage(proposal, editorUserId, draftKey) {
560
+ const mine = editorUserId !== null && proposal.createdByUserId === editorUserId;
561
+ return !mine || proposal.draftKey === draftKey;
562
+ }
558
563
  var EMPTY_FIELD = { value: void 0, origin: null };
559
564
  function tableRowsFor(tables, table) {
560
565
  let rows = tables.get(table);
@@ -581,26 +586,26 @@ function rowFor(tables, table, rowId) {
581
586
  }
582
587
  return row;
583
588
  }
584
- function applyFields(row, patch, origin) {
589
+ function applyFields(row, patch, origin, skip) {
585
590
  for (const [field, value] of Object.entries(patch.fields)) {
586
- if (field === "_id") continue;
591
+ if (field === "_id" || skip?.has(field)) continue;
587
592
  row.value[field] = value;
588
593
  row.origins.set(field, origin);
589
594
  }
590
595
  for (const field of patch.clearFields ?? []) {
591
- if (field === "_id") continue;
596
+ if (field === "_id" || skip?.has(field)) continue;
592
597
  delete row.value[field];
593
598
  row.origins.set(field, origin);
594
599
  }
595
600
  }
596
- function applyPatch(row, patch, origin, placement) {
601
+ function applyPatch(row, patch, origin, placement, skip) {
597
602
  if (patch.op === "delete") {
598
603
  row.deletedBy = origin;
599
604
  return;
600
605
  }
601
606
  if (patch.op === "update" && !row.placement) {
602
607
  row.deletedBy = null;
603
- applyFields(row, patch, origin);
608
+ applyFields(row, patch, origin, skip);
604
609
  return;
605
610
  }
606
611
  if (patch.op === "insert" && !row.live) {
@@ -609,7 +614,7 @@ function applyPatch(row, patch, origin, placement) {
609
614
  row.placement = placement;
610
615
  }
611
616
  row.deletedBy = null;
612
- applyFields(row, patch, origin);
617
+ applyFields(row, patch, origin, skip);
613
618
  }
614
619
  function sortedProposalPatches(proposal) {
615
620
  return proposal.patches.map((patch, index) => ({ patch, index })).sort(
@@ -621,7 +626,8 @@ function createCmsProjection({
621
626
  draft,
622
627
  proposals,
623
628
  editorUserId,
624
- draftKey
629
+ draftKey,
630
+ hidden
625
631
  }) {
626
632
  const tables = /* @__PURE__ */ new Map();
627
633
  for (const [table, rows] of Object.entries(liveRows)) {
@@ -640,7 +646,8 @@ function createCmsProjection({
640
646
  }
641
647
  const isMine = (proposal) => editorUserId !== null && proposal.createdByUserId === editorUserId;
642
648
  const activeProposals = proposals.filter((proposal) => proposal.status === "active").sort((a, b) => a.createdAt - b.createdAt || a.id.localeCompare(b.id));
643
- activeProposals.filter((proposal) => !isMine(proposal) || proposal.draftKey === draftKey).forEach((proposal, rank) => {
649
+ let hidesChanges = false;
650
+ activeProposals.filter((proposal) => isOnPage(proposal, editorUserId, draftKey)).forEach((proposal, rank) => {
644
651
  const mine2 = isMine(proposal);
645
652
  const origin = {
646
653
  kind: "proposal",
@@ -650,7 +657,13 @@ function createCmsProjection({
650
657
  label: draftTitle(proposal, mine2)
651
658
  };
652
659
  for (const patch of sortedProposalPatches(proposal)) {
653
- applyPatch(rowFor(tables, patch.table, patch.rowId), patch, origin, [1, -rank]);
660
+ const isHidden = (field) => hidden?.has(changeKey(proposal.id, { table: patch.table, rowId: patch.rowId, field })) ?? false;
661
+ const fields = [...Object.keys(patch.fields), ...patch.clearFields ?? []];
662
+ const skip = new Set(patch.op === "update" ? fields.filter(isHidden) : []);
663
+ const whole = patch.op === "update" ? skip.size > 0 && skip.size === fields.length : isHidden();
664
+ hidesChanges ||= whole || skip.size > 0;
665
+ if (whole) continue;
666
+ applyPatch(rowFor(tables, patch.table, patch.rowId), patch, origin, [1, -rank], skip);
654
667
  }
655
668
  });
656
669
  const proposalDeletes = /* @__PURE__ */ new Map();
@@ -678,6 +691,7 @@ function createCmsProjection({
678
691
  );
679
692
  return {
680
693
  conflictsWithMine,
694
+ hidesChanges,
681
695
  field({ table, rowId, field }) {
682
696
  const row = tables.get(table)?.get(rowId);
683
697
  if (!row) return EMPTY_FIELD;
@@ -962,10 +976,12 @@ function buildCompoundCreateDraft(args) {
962
976
  }
963
977
  var SESSION_CHANGED = "The builder session changed since these changes were made: check the page, then try again";
964
978
  var WORK_ELSEWHERE = "This page holds unsaved work from another builder session: discard it first";
979
+ var CHANGES_HIDDEN = "The page hides some changes: show them all to edit";
965
980
  var stagedFor = (key) => (entry) => entry.madeUnder !== null && entry.madeUnder.key === key;
966
981
  var CmsContext = createContext(null);
967
982
  var OUTCOME_DISPLAY_MS = 5e3;
968
983
  var EMPTY_PROPOSALS = [];
984
+ var NO_HIDDEN = /* @__PURE__ */ new Set();
969
985
  var EMPTY_TABLE_ROWS = {};
970
986
  function CmsProvider(props) {
971
987
  const sessionKey = `${props.profileSlug}\0${props.editor?.user.id ?? "signed-out"}`;
@@ -991,6 +1007,7 @@ function CmsProviderSession({
991
1007
  richtextHostAdapter
992
1008
  }) {
993
1009
  const [editMode, setEditModeState] = useState(false);
1010
+ const [hidden, setHidden] = useState(NO_HIDDEN);
994
1011
  const [activeInPlaceKey, setActiveInPlaceKey] = useState(null);
995
1012
  const [pendingInPlaceKey, setPendingInPlaceKey] = useState(null);
996
1013
  const inPlaceHandlersRef = useRef(null);
@@ -1004,11 +1021,31 @@ function CmsProviderSession({
1004
1021
  const setEditMode = useCallback(
1005
1022
  (next) => {
1006
1023
  setEditModeState(next);
1007
- if (!next) clearInPlaceSession();
1024
+ if (next) setHidden(NO_HIDDEN);
1025
+ else clearInPlaceSession();
1026
+ },
1027
+ [clearInPlaceSession]
1028
+ );
1029
+ const setShowChanges = useCallback(
1030
+ (show) => {
1031
+ setHidden(show ? NO_HIDDEN : "all");
1032
+ if (!show) clearInPlaceSession();
1033
+ },
1034
+ [clearInPlaceSession]
1035
+ );
1036
+ const setChangeShown = useCallback(
1037
+ (key, shown) => {
1038
+ setHidden((prev) => {
1039
+ if (prev === "all") return prev;
1040
+ const next = new Set(prev);
1041
+ if (shown) next.delete(key);
1042
+ else next.add(key);
1043
+ return next;
1044
+ });
1045
+ if (!shown) clearInPlaceSession();
1008
1046
  },
1009
1047
  [clearInPlaceSession]
1010
1048
  );
1011
- const toggleEditMode = useCallback(() => setEditMode(!editMode), [editMode, setEditMode]);
1012
1049
  const registerInPlaceHandlers = useCallback((handlers) => {
1013
1050
  inPlaceHandlersRef.current = handlers;
1014
1051
  setInPlaceDirty(handlers?.isDirty() ?? false);
@@ -1062,7 +1099,11 @@ function CmsProviderSession({
1062
1099
  [createRecipesProp, manifest]
1063
1100
  );
1064
1101
  const { currentDraft, currentDraftRef, connectBuilder, lookupDraft, refreshBuilderSession } = useBuilderDraft();
1065
- const [changesOpen, setChangesOpen] = useState(false);
1102
+ const [changesOpen, setChangesOpenState] = useState(false);
1103
+ const setChangesOpen = useCallback((open) => {
1104
+ setChangesOpenState(open);
1105
+ if (!open) setHidden(NO_HIDDEN);
1106
+ }, []);
1066
1107
  const [highlight, setHighlight] = useState(null);
1067
1108
  const [draft, setDraft] = useState([]);
1068
1109
  const draftRef = useRef(draft);
@@ -1084,15 +1125,32 @@ function CmsProviderSession({
1084
1125
  (prev) => prev.some((entry) => entry.madeUnder === null) ? prev.map((entry) => ({ ...entry, madeUnder: entry.madeUnder ?? currentDraft })) : prev
1085
1126
  );
1086
1127
  }, [currentDraft]);
1087
- const refuseWorkElsewhere = useCallback(() => {
1128
+ const editorUserId = editor?.user.id ?? null;
1129
+ const projection = useMemo(
1130
+ () => createCmsProjection({
1131
+ liveRows: tableRows,
1132
+ draft: hidden === "all" ? [] : draft,
1133
+ proposals: hidden === "all" ? [] : proposals,
1134
+ editorUserId,
1135
+ // Before the builder first answers, none of my drafts.
1136
+ draftKey: currentDraft ? currentDraft.key : null,
1137
+ hidden: hidden === "all" ? void 0 : hidden
1138
+ }),
1139
+ [tableRows, draft, proposals, editorUserId, currentDraft, hidden]
1140
+ );
1141
+ const pageShows = hidden === "all" ? "none" : projection.hidesChanges ? "some" : "all";
1142
+ const editingAllowed = pageShows === "all";
1143
+ const editing = editMode && editingAllowed;
1144
+ const toggleEditMode = useCallback(() => setEditMode(!editing), [editing, setEditMode]);
1145
+ const refuseNewWork = useCallback(() => {
1088
1146
  const current = currentDraftRef.current;
1089
- if (current === null || localWorkFor(current)) return false;
1090
- setOutcomes([{ id: "_error", outcome: "rejected", message: WORK_ELSEWHERE }]);
1091
- return true;
1092
- }, [currentDraftRef, localWorkFor]);
1147
+ const message = !editingAllowed ? CHANGES_HIDDEN : current !== null && !localWorkFor(current) ? WORK_ELSEWHERE : null;
1148
+ if (message) setOutcomes([{ id: "_error", outcome: "rejected", message }]);
1149
+ return message !== null;
1150
+ }, [currentDraftRef, localWorkFor, editingAllowed]);
1093
1151
  const mutateDraft = useCallback(
1094
1152
  (next) => {
1095
- if (refuseWorkElsewhere()) return;
1153
+ if (refuseNewWork()) return;
1096
1154
  setDraft((prev) => {
1097
1155
  const value2 = next(prev);
1098
1156
  if (value2.length > 0 && prev.length === 0) {
@@ -1102,7 +1160,7 @@ function CmsProviderSession({
1102
1160
  return value2;
1103
1161
  });
1104
1162
  },
1105
- [currentDraftRef, refuseWorkElsewhere]
1163
+ [currentDraftRef, refuseNewWork]
1106
1164
  );
1107
1165
  const clearDraft = useCallback(() => {
1108
1166
  draftRef.current = [];
@@ -1137,18 +1195,6 @@ function CmsProviderSession({
1137
1195
  },
1138
1196
  []
1139
1197
  );
1140
- const editorUserId = editor?.user.id ?? null;
1141
- const projection = useMemo(
1142
- () => createCmsProjection({
1143
- liveRows: tableRows,
1144
- draft,
1145
- proposals,
1146
- editorUserId,
1147
- // Before the builder first answers, none of my drafts.
1148
- draftKey: currentDraft ? currentDraft.key : null
1149
- }),
1150
- [tableRows, draft, proposals, editorUserId, currentDraft]
1151
- );
1152
1198
  useEffect(() => {
1153
1199
  if (!proposalFeedError) return;
1154
1200
  setOutcomes([
@@ -1190,7 +1236,7 @@ function CmsProviderSession({
1190
1236
  );
1191
1237
  const registerPendingReplace = useCallback(
1192
1238
  (input2) => {
1193
- if (refuseWorkElsewhere()) return;
1239
+ if (refuseNewWork()) return;
1194
1240
  const kind = input2.kind ?? "file";
1195
1241
  setPendingReplaces((prev) => {
1196
1242
  const next = prev.filter((entry) => entry.assetId !== input2.assetId);
@@ -1199,7 +1245,7 @@ function CmsProviderSession({
1199
1245
  return next;
1200
1246
  });
1201
1247
  },
1202
- [currentDraftRef, refuseWorkElsewhere]
1248
+ [currentDraftRef, refuseNewWork]
1203
1249
  );
1204
1250
  const discardDraft = useCallback(() => {
1205
1251
  inPlaceHandlersRef.current?.discard();
@@ -1429,7 +1475,8 @@ function CmsProviderSession({
1429
1475
  const value = useMemo(
1430
1476
  () => ({
1431
1477
  editor,
1432
- editMode: editor !== null && editMode,
1478
+ editMode: editor !== null && editing,
1479
+ pageShows,
1433
1480
  setEditMode,
1434
1481
  toggleEditMode,
1435
1482
  readableTables,
@@ -1455,6 +1502,9 @@ function CmsProviderSession({
1455
1502
  resolve,
1456
1503
  changesOpen,
1457
1504
  setChangesOpen,
1505
+ setShowChanges,
1506
+ hiddenChanges: hidden === "all" ? NO_HIDDEN : hidden,
1507
+ setChangeShown,
1458
1508
  highlight,
1459
1509
  setHighlight,
1460
1510
  actionPhase,
@@ -1483,7 +1533,7 @@ function CmsProviderSession({
1483
1533
  }),
1484
1534
  [
1485
1535
  editor,
1486
- editMode,
1536
+ editing,
1487
1537
  toggleEditMode,
1488
1538
  readableTables,
1489
1539
  manifest,
@@ -1507,6 +1557,11 @@ function CmsProviderSession({
1507
1557
  discard,
1508
1558
  resolve,
1509
1559
  changesOpen,
1560
+ setChangesOpen,
1561
+ pageShows,
1562
+ setShowChanges,
1563
+ hidden,
1564
+ setChangeShown,
1510
1565
  highlight,
1511
1566
  actionPhase,
1512
1567
  proposalsLoadingProp,
@@ -2812,6 +2867,7 @@ function ResolveDialog({
2812
2867
  }
2813
2868
  ) });
2814
2869
  }
2870
+ var EDITING_FIRST = "Save or cancel the field you are editing first";
2815
2871
  var WARN = "color-mix(in oklab, darkorange 80%, CanvasText)";
2816
2872
  var panel = {
2817
2873
  ...cmsBox,
@@ -2833,6 +2889,17 @@ var card = {
2833
2889
  borderRadius: 8,
2834
2890
  padding: "10px 12px"
2835
2891
  };
2892
+ var pausedNotice = {
2893
+ position: "sticky",
2894
+ bottom: 0,
2895
+ marginTop: "auto",
2896
+ marginBottom: 0,
2897
+ padding: "8px 12px",
2898
+ borderRadius: 8,
2899
+ border: "1px solid color-mix(in oklab, darkorange 60%, transparent)",
2900
+ background: "color-mix(in oklab, darkorange 18%, Canvas)",
2901
+ fontWeight: 600
2902
+ };
2836
2903
  var smallBtn = { padding: "3px 8px", fontSize: 12 };
2837
2904
  var list = { listStyle: "none", margin: 0, padding: 0 };
2838
2905
  var item = {
@@ -2904,6 +2971,7 @@ function groupOf(manifest, drafts, me, currentDraft, proposal) {
2904
2971
  proposal,
2905
2972
  mine,
2906
2973
  current: mine && currentDraft !== null && proposal.draftKey === currentDraft.key,
2974
+ onPage: isOnPage(proposal, me ?? null, currentDraft ? currentDraft.key : null),
2907
2975
  title: draftTitle(proposal, mine),
2908
2976
  count: proposal.patches.reduce((sum, patch) => sum + patchChangeCount(patch), 0),
2909
2977
  changes: proposal.patches.flatMap((patch) => patchChanges(manifest, proposal, patch, drafts))
@@ -2952,12 +3020,60 @@ function ResolveGroup({ group, onClose }) {
2952
3020
  revision
2953
3021
  );
2954
3022
  }
3023
+ var CONTEXT = 40;
3024
+ var MAX_PART = 160;
3025
+ function crop(text, max, fromEnd = false) {
3026
+ if (text.length <= max) return text;
3027
+ if (fromEnd) {
3028
+ const tail = text.slice(-max);
3029
+ const at = tail.search(/\s/);
3030
+ return `\u2026${at < 0 ? tail : tail.slice(at + 1)}`;
3031
+ }
3032
+ const head = text.slice(0, max);
3033
+ const cut = head.search(/\s\S*$/);
3034
+ return `${cut > 0 ? head.slice(0, cut) : head}\u2026`;
3035
+ }
3036
+ function textChange(beforeText, afterText) {
3037
+ const shortest = Math.min(beforeText.length, afterText.length);
3038
+ let start = 0;
3039
+ while (start < shortest && beforeText[start] === afterText[start]) start++;
3040
+ let end = 0;
3041
+ while (end < shortest - start && beforeText[beforeText.length - 1 - end] === afterText[afterText.length - 1 - end]) {
3042
+ end++;
3043
+ }
3044
+ while (start > 0 && !/\s/.test(beforeText[start - 1])) start--;
3045
+ while (end > 0 && !/\s/.test(beforeText[beforeText.length - end])) end--;
3046
+ return {
3047
+ lead: crop(beforeText.slice(0, start), CONTEXT, true),
3048
+ removed: crop(beforeText.slice(start, beforeText.length - end), MAX_PART),
3049
+ added: crop(afterText.slice(start, afterText.length - end), MAX_PART),
3050
+ trail: crop(beforeText.slice(beforeText.length - end), CONTEXT)
3051
+ };
3052
+ }
3053
+ function TextChangeLine({ beforeText, afterText }) {
3054
+ const { lead, removed, added, trail } = textChange(beforeText, afterText);
3055
+ return /* @__PURE__ */ jsxs("span", { children: [
3056
+ /* @__PURE__ */ jsx("span", { style: { color: cmsMuted }, children: lead }),
3057
+ removed ? /* @__PURE__ */ jsx("del", { style: before, children: removed }) : null,
3058
+ removed && added ? " " : null,
3059
+ added ? /* @__PURE__ */ jsx("ins", { style: { ...after, textDecoration: "none" }, children: added }) : null,
3060
+ /* @__PURE__ */ jsx("span", { style: { color: cmsMuted }, children: trail })
3061
+ ] });
3062
+ }
2955
3063
  function ChangeLine({ change }) {
2956
3064
  if (change.kind === "insert") return /* @__PURE__ */ jsxs("span", { style: after, children: [
2957
3065
  "+ ",
2958
3066
  String(change.after)
2959
3067
  ] });
2960
3068
  if (change.kind === "delete") return /* @__PURE__ */ jsx("span", { style: before, children: "\u2212 delete row" });
3069
+ const beforeText = plainTextIfRichDoc(change.before);
3070
+ const afterText = plainTextIfRichDoc(change.after);
3071
+ if (typeof beforeText === "string" && typeof afterText === "string") {
3072
+ if (beforeText === afterText) return /* @__PURE__ */ jsx("span", { style: after, children: "Formatting changed" });
3073
+ if (Math.max(beforeText.length, afterText.length) > 80) {
3074
+ return /* @__PURE__ */ jsx(TextChangeLine, { beforeText, afterText });
3075
+ }
3076
+ }
2961
3077
  return /* @__PURE__ */ jsxs("span", { children: [
2962
3078
  change.before === void 0 ? null : /* @__PURE__ */ jsxs(Fragment, { children: [
2963
3079
  /* @__PURE__ */ jsx("span", { style: before, children: /* @__PURE__ */ jsx(Value, { value: change.before, type: change.type }) }),
@@ -2979,11 +3095,16 @@ function ChangesView({
2979
3095
  publishDraft,
2980
3096
  withdrawDraft,
2981
3097
  discard,
2982
- setHighlight
3098
+ setHighlight,
3099
+ pageShows,
3100
+ setShowChanges,
3101
+ hiddenChanges,
3102
+ setChangeShown,
3103
+ inPlaceDirty
2983
3104
  } = useCms();
2984
3105
  const [confirmWithdraw, setConfirmWithdraw] = useState(null);
2985
3106
  const [resolving, setResolving] = useState(null);
2986
- const [hidden, setHidden] = useState(null);
3107
+ const [offPageHint, setOffPageHint] = useState(null);
2987
3108
  const busy = actionPhase !== "idle";
2988
3109
  const me = editor?.user.id;
2989
3110
  const rank = (group) => group.current ? 0 : !group.mine ? 3 : group.proposal.draftKey === void 0 ? 2 : 1;
@@ -2992,11 +3113,11 @@ function ChangesView({
2992
3113
  );
2993
3114
  const resolvingGroup = groups.find((group) => group.proposal.id === resolving);
2994
3115
  const pointAt = (group, change, id) => {
2995
- if (group.mine && !group.current) setHidden(id);
3116
+ if (!group.onPage) setOffPageHint(id);
2996
3117
  else setHighlight({ table: change.table, rowId: change.rowId, field: change.field });
2997
3118
  };
2998
3119
  const leave = () => {
2999
- setHidden(null);
3120
+ setOffPageHint(null);
3000
3121
  setHighlight(null);
3001
3122
  };
3002
3123
  return /* @__PURE__ */ jsxs(
@@ -3007,6 +3128,28 @@ function ChangesView({
3007
3128
  children: [
3008
3129
  /* @__PURE__ */ jsxs("header", { style: { display: "flex", alignItems: "center", gap: 8 }, children: [
3009
3130
  /* @__PURE__ */ jsx("strong", { style: { fontSize: 15, flex: 1 }, children: "Changes" }),
3131
+ /* @__PURE__ */ jsxs(
3132
+ "label",
3133
+ {
3134
+ style: { display: "flex", alignItems: "center", gap: 4, color: cmsMuted },
3135
+ title: inPlaceDirty ? EDITING_FIRST : "Show the drafts on the page, or the live site",
3136
+ children: [
3137
+ /* @__PURE__ */ jsx(
3138
+ "input",
3139
+ {
3140
+ type: "checkbox",
3141
+ checked: pageShows === "all",
3142
+ ref: (input2) => {
3143
+ if (input2) input2.indeterminate = pageShows === "some";
3144
+ },
3145
+ disabled: inPlaceDirty,
3146
+ onChange: (event) => setShowChanges(event.target.checked)
3147
+ }
3148
+ ),
3149
+ "Show on page"
3150
+ ]
3151
+ }
3152
+ ),
3010
3153
  /* @__PURE__ */ jsx("button", { type: "button", style: ghostBtn, "aria-label": "Close changes", onClick: onClose, children: "\xD7" })
3011
3154
  ] }),
3012
3155
  proposals.length >= SHARE_LIST_LIMIT ? /* @__PURE__ */ jsxs("p", { role: "status", style: { margin: 0, color: WARN }, children: [
@@ -3074,7 +3217,7 @@ function ChangesView({
3074
3217
  }
3075
3218
  ) : null,
3076
3219
  /* @__PURE__ */ jsx("ul", { style: list, children: group.changes.map((change) => {
3077
- const id = `${proposal.id}\0${change.path}`;
3220
+ const id = changeKey(proposal.id, change);
3078
3221
  return /* @__PURE__ */ jsxs(
3079
3222
  "li",
3080
3223
  {
@@ -3083,6 +3226,18 @@ function ChangesView({
3083
3226
  onMouseEnter: () => pointAt(group, change, id),
3084
3227
  onMouseLeave: leave,
3085
3228
  children: [
3229
+ group.onPage ? /* @__PURE__ */ jsx(
3230
+ "input",
3231
+ {
3232
+ type: "checkbox",
3233
+ "aria-label": "Show on page",
3234
+ title: inPlaceDirty ? EDITING_FIRST : "Show this change on the page",
3235
+ style: { marginTop: 2 },
3236
+ checked: pageShows !== "none" && !hiddenChanges.has(id),
3237
+ disabled: pageShows === "none" || inPlaceDirty,
3238
+ onChange: (event) => setChangeShown(id, event.target.checked)
3239
+ }
3240
+ ) : null,
3086
3241
  /* @__PURE__ */ jsxs("div", { style: { flex: 1, minWidth: 0 }, children: [
3087
3242
  /* @__PURE__ */ jsxs("div", { style: { color: cmsMuted }, children: [
3088
3243
  change.path,
@@ -3090,7 +3245,7 @@ function ChangesView({
3090
3245
  change.shared ? /* @__PURE__ */ jsx(Marker, { title: "Another draft also changes this", children: "\u21C4" }) : null
3091
3246
  ] }),
3092
3247
  /* @__PURE__ */ jsx(ChangeLine, { change }),
3093
- hidden === id ? /* @__PURE__ */ jsx("div", { role: "status", style: { color: cmsMuted, fontSize: 12 }, children: "Not shown on the page: resume the session to see it" }) : null
3248
+ offPageHint === id ? /* @__PURE__ */ jsx("div", { role: "status", style: { color: cmsMuted, fontSize: 12 }, children: "Not shown on the page: resume the session to see it" }) : null
3094
3249
  ] }),
3095
3250
  group.mine ? /* @__PURE__ */ jsx(
3096
3251
  "button",
@@ -3115,6 +3270,7 @@ function ChangesView({
3115
3270
  }) })
3116
3271
  ] }, proposal.id);
3117
3272
  }),
3273
+ pageShows === "all" ? null : /* @__PURE__ */ jsx("p", { role: "status", style: pausedNotice, children: pageShows === "none" ? "The page shows the live site; editing is paused." : "Some changes are hidden on the page; editing is paused." }),
3118
3274
  resolvingGroup ? /* @__PURE__ */ jsx(ResolveGroup, { group: resolvingGroup, onClose: () => setResolving(null) }) : null
3119
3275
  ]
3120
3276
  }
@@ -4165,5 +4321,5 @@ function CmsRichDocView(props) {
4165
4321
  }
4166
4322
 
4167
4323
  export { CmsCompoundCreate, CmsCreateButton, CmsField, CmsFieldStamp, CmsFloatingToolbar, CmsLoginPage, CmsProvider, CmsRichDocView, CmsRow, DefaultRichtextHostProvider, DraftRowDialog, FieldEditorDialog, HTML_CACHE_BYPASS_HEADER, InsertRowDialog, applyDeleteToDraft, applyFieldToDraft, applyRowToDraft, buildInsertDraft, canProposeField, canProposeOp, cmsReadableTables, createDefaultCmsRichtextAdapters, createDefaultRichtextHostAdapter, createTableRowsRichtextHostAdapter, describeContentRefIntegrity, findContentRefField, inferNavigationTable, isCmsPath, mergeDraftIntoProposal, proposeEditableTable, readSession, resolveEditSurface, resolveStampDisplay, shouldBypassHtmlCache, slugifyDe, stampEditKey, uniqueSlug, useCms, useCmsOptional, useCmsProjectedField, useCmsProjectedString, useCmsProjectedTable, useCmsRelatedRow, useCmsRow, useCmsRowOptional, writeSession };
4168
- //# sourceMappingURL=chunk-UXUDOFKZ.js.map
4169
- //# sourceMappingURL=chunk-UXUDOFKZ.js.map
4324
+ //# sourceMappingURL=chunk-QN3K6RRP.js.map
4325
+ //# sourceMappingURL=chunk-QN3K6RRP.js.map