@parhelia/core 0.1.12719 → 0.1.12730
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/dist/editor/client/EditorShell.js +70 -35
- package/dist/editor/client/EditorShell.js.map +1 -1
- package/dist/editor/client/editContext.d.ts +2 -3
- package/dist/editor/client/editContext.js.map +1 -1
- package/dist/editor/client/operations.js +0 -24
- package/dist/editor/client/operations.js.map +1 -1
- package/dist/editor/menubar/toolbar-sections/ViewportControls.js +3 -2
- package/dist/editor/menubar/toolbar-sections/ViewportControls.js.map +1 -1
- package/dist/editor/page-viewer/PageViewer.js +3 -3
- package/dist/editor/page-viewer/PageViewer.js.map +1 -1
- package/dist/revision.d.ts +2 -2
- package/dist/revision.js +2 -2
- package/dist/types.d.ts +1 -1
- package/package.json +1 -1
|
@@ -61,6 +61,23 @@ import { FeatureGate, LicenseFeatures, LicenseProvider, LicenseOverlay, } from "
|
|
|
61
61
|
// nothing open" (param present with this value) so reload can honor the user's intent.
|
|
62
62
|
const SIDEBAR_NONE_SENTINEL = "none";
|
|
63
63
|
const sidebarUrlValue = (ids) => ids.length ? ids.join(",") : SIDEBAR_NONE_SENTINEL;
|
|
64
|
+
function reconcileSlotSettingsState(previous, slots, defaults) {
|
|
65
|
+
const next = {};
|
|
66
|
+
let changed = false;
|
|
67
|
+
for (const slot of slots) {
|
|
68
|
+
if (Object.prototype.hasOwnProperty.call(previous, slot.slotId)) {
|
|
69
|
+
next[slot.slotId] = previous[slot.slotId];
|
|
70
|
+
}
|
|
71
|
+
else {
|
|
72
|
+
next[slot.slotId] = { ...defaults };
|
|
73
|
+
changed = true;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
if (Object.keys(previous).length !== slots.length) {
|
|
77
|
+
changed = true;
|
|
78
|
+
}
|
|
79
|
+
return changed ? next : previous;
|
|
80
|
+
}
|
|
64
81
|
function AgentsSlotContextBridge({ slot }) {
|
|
65
82
|
const editContext = useEditContext();
|
|
66
83
|
const slotContext = useEditorSlotContext({
|
|
@@ -495,26 +512,7 @@ export function EditorShell({ configuration, className, item: loadItemDescriptor
|
|
|
495
512
|
const [focusFieldComponentId, setFocusFieldComponentId] = useState();
|
|
496
513
|
const [enableCompletions, setEnableCompletions] = useState(false);
|
|
497
514
|
const [showComponentNavigatorDefault, setShowComponentNavigatorDefault] = useState(userPreferences.showComponentNavigator ?? false);
|
|
498
|
-
const [
|
|
499
|
-
useEffect(() => {
|
|
500
|
-
setSlotComponentNavigatorVisibility((prev) => {
|
|
501
|
-
const next = {};
|
|
502
|
-
let changed = false;
|
|
503
|
-
for (const slot of editorSlots) {
|
|
504
|
-
if (Object.prototype.hasOwnProperty.call(prev, slot.slotId)) {
|
|
505
|
-
next[slot.slotId] = prev[slot.slotId];
|
|
506
|
-
}
|
|
507
|
-
else {
|
|
508
|
-
next[slot.slotId] = showComponentNavigatorDefault;
|
|
509
|
-
changed = true;
|
|
510
|
-
}
|
|
511
|
-
}
|
|
512
|
-
if (Object.keys(prev).length !== editorSlots.length) {
|
|
513
|
-
changed = true;
|
|
514
|
-
}
|
|
515
|
-
return changed ? next : prev;
|
|
516
|
-
});
|
|
517
|
-
}, [editorSlots, showComponentNavigatorDefault]);
|
|
515
|
+
const [slotSettingsById, setSlotSettingsById] = useState({});
|
|
518
516
|
const [showAgentsPanel, setShowAgentsPanel] = useState(() => {
|
|
519
517
|
const showAgentsParam = searchParams.get("showAgents");
|
|
520
518
|
if (showAgentsParam !== null) {
|
|
@@ -522,7 +520,13 @@ export function EditorShell({ configuration, className, item: loadItemDescriptor
|
|
|
522
520
|
}
|
|
523
521
|
return userPreferences.showAgentsPanel ?? false;
|
|
524
522
|
});
|
|
525
|
-
const [
|
|
523
|
+
const [editorFormHiddenDefault, setEditorFormHiddenDefault] = useState(userPreferences.editorFormHidden ?? false);
|
|
524
|
+
useEffect(() => {
|
|
525
|
+
setSlotSettingsById((prev) => reconcileSlotSettingsState(prev, editorSlots, {
|
|
526
|
+
showComponentNavigator: showComponentNavigatorDefault,
|
|
527
|
+
editorFormHidden: editorFormHiddenDefault,
|
|
528
|
+
}));
|
|
529
|
+
}, [editorSlots, showComponentNavigatorDefault, editorFormHiddenDefault]);
|
|
526
530
|
const [editorFormHintSeen, setEditorFormHintSeenState] = useState(userPreferences.editorFormHintSeen ?? false);
|
|
527
531
|
const [editorFormHintVisible, setEditorFormHintVisible] = useState(false);
|
|
528
532
|
const editorFormToggleButtonRef = useRef(null);
|
|
@@ -685,9 +689,15 @@ export function EditorShell({ configuration, className, item: loadItemDescriptor
|
|
|
685
689
|
const isComponentNavigatorOpenForSlot = useCallback((slotId) => {
|
|
686
690
|
if (!slotId)
|
|
687
691
|
return showComponentNavigatorDefault;
|
|
688
|
-
return (
|
|
689
|
-
|
|
692
|
+
return (slotSettingsById[slotId]?.showComponentNavigator ??
|
|
693
|
+
showComponentNavigatorDefault);
|
|
694
|
+
}, [slotSettingsById, showComponentNavigatorDefault]);
|
|
690
695
|
const showComponentNavigator = isComponentNavigatorOpenForSlot(activeSlotId);
|
|
696
|
+
const isEditorFormHiddenForSlot = useCallback((slotId) => {
|
|
697
|
+
if (!slotId)
|
|
698
|
+
return editorFormHiddenDefault;
|
|
699
|
+
return slotSettingsById[slotId]?.editorFormHidden ?? editorFormHiddenDefault;
|
|
700
|
+
}, [editorFormHiddenDefault, slotSettingsById]);
|
|
691
701
|
// Sync global compareMode from the active slot's compareMode for URL syncing
|
|
692
702
|
useEffect(() => {
|
|
693
703
|
if (activeSlotContext && activeSlotContext.compareMode !== compareMode) {
|
|
@@ -950,14 +960,20 @@ export function EditorShell({ configuration, className, item: loadItemDescriptor
|
|
|
950
960
|
const previousValue = isComponentNavigatorOpenForSlot(slotId);
|
|
951
961
|
const newValue = typeof value === "function" ? value(previousValue) : value;
|
|
952
962
|
if (slotId) {
|
|
953
|
-
|
|
954
|
-
const
|
|
955
|
-
|
|
963
|
+
setSlotSettingsById((prev) => {
|
|
964
|
+
const currentSettings = prev[slotId] ?? {
|
|
965
|
+
showComponentNavigator: showComponentNavigatorDefault,
|
|
966
|
+
editorFormHidden: editorFormHiddenDefault,
|
|
967
|
+
};
|
|
968
|
+
if (currentSettings.showComponentNavigator === newValue) {
|
|
956
969
|
return prev;
|
|
957
970
|
}
|
|
958
971
|
return {
|
|
959
972
|
...prev,
|
|
960
|
-
[slotId]:
|
|
973
|
+
[slotId]: {
|
|
974
|
+
...currentSettings,
|
|
975
|
+
showComponentNavigator: newValue,
|
|
976
|
+
},
|
|
961
977
|
};
|
|
962
978
|
});
|
|
963
979
|
}
|
|
@@ -970,6 +986,7 @@ export function EditorShell({ configuration, className, item: loadItemDescriptor
|
|
|
970
986
|
}, [
|
|
971
987
|
isComponentNavigatorOpenForSlot,
|
|
972
988
|
showComponentNavigatorDefault,
|
|
989
|
+
editorFormHiddenDefault,
|
|
973
990
|
setUserPreferences,
|
|
974
991
|
isMobile,
|
|
975
992
|
setShowAgentsPanel,
|
|
@@ -1030,10 +1047,27 @@ export function EditorShell({ configuration, className, item: loadItemDescriptor
|
|
|
1030
1047
|
setShowMinimap(newValue);
|
|
1031
1048
|
setUserPreferences({ showMinimap: newValue });
|
|
1032
1049
|
}, [showMinimap, setUserPreferences]);
|
|
1033
|
-
const
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1050
|
+
const setEditorFormHiddenForSlot = useCallback((slotId, value) => {
|
|
1051
|
+
if (!slotId) {
|
|
1052
|
+
setEditorFormHiddenDefault(value);
|
|
1053
|
+
return;
|
|
1054
|
+
}
|
|
1055
|
+
setSlotSettingsById((prev) => {
|
|
1056
|
+
const currentSettings = prev[slotId] ?? {
|
|
1057
|
+
showComponentNavigator: showComponentNavigatorDefault,
|
|
1058
|
+
editorFormHidden: editorFormHiddenDefault,
|
|
1059
|
+
};
|
|
1060
|
+
if (currentSettings.editorFormHidden === value)
|
|
1061
|
+
return prev;
|
|
1062
|
+
return {
|
|
1063
|
+
...prev,
|
|
1064
|
+
[slotId]: {
|
|
1065
|
+
...currentSettings,
|
|
1066
|
+
editorFormHidden: value,
|
|
1067
|
+
},
|
|
1068
|
+
};
|
|
1069
|
+
});
|
|
1070
|
+
}, [editorFormHiddenDefault, showComponentNavigatorDefault]);
|
|
1037
1071
|
const markEditorFormHintSeen = useCallback(() => {
|
|
1038
1072
|
setEditorFormHintSeenState(true);
|
|
1039
1073
|
setUserPreferences({ editorFormHintSeen: true });
|
|
@@ -4403,8 +4437,8 @@ export function EditorShell({ configuration, className, item: loadItemDescriptor
|
|
|
4403
4437
|
setComponentNavigatorOpenForSlot,
|
|
4404
4438
|
showAgentsPanel,
|
|
4405
4439
|
setShowAgentsPanel: handleSetShowAgentsPanel,
|
|
4406
|
-
|
|
4407
|
-
|
|
4440
|
+
isEditorFormHiddenForSlot,
|
|
4441
|
+
setEditorFormHiddenForSlot,
|
|
4408
4442
|
editorFormHintSeen,
|
|
4409
4443
|
markEditorFormHintSeen,
|
|
4410
4444
|
editorFormHintVisible,
|
|
@@ -4574,8 +4608,9 @@ export function EditorShell({ configuration, className, item: loadItemDescriptor
|
|
|
4574
4608
|
handleSetShowComponentNavigator,
|
|
4575
4609
|
showAgentsPanel,
|
|
4576
4610
|
handleSetShowAgentsPanel,
|
|
4577
|
-
|
|
4578
|
-
|
|
4611
|
+
activeSlotId,
|
|
4612
|
+
isEditorFormHiddenForSlot,
|
|
4613
|
+
setEditorFormHiddenForSlot,
|
|
4579
4614
|
editorFormHintSeen,
|
|
4580
4615
|
markEditorFormHintSeen,
|
|
4581
4616
|
editorFormHintVisible,
|