@jsenv/navi 0.29.93 → 0.29.95
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/jsenv_navi.js +61 -30
- package/dist/jsenv_navi.js.map +3 -3
- package/docs/AI_INSTRUCTIONS.md +3 -2
- package/docs/control_object.md +54 -12
- package/package.json +1 -1
package/dist/jsenv_navi.js
CHANGED
|
@@ -24679,7 +24679,7 @@ const useUIGroupStateController = (
|
|
|
24679
24679
|
|
|
24680
24680
|
// onChange and applyState live inside init so they close over the stable
|
|
24681
24681
|
// signals/pubsub without needing external refs.
|
|
24682
|
-
const onChange = (e, { notifyExternal }) => {
|
|
24682
|
+
const onChange = (e, { notifyExternal, actingChild }) => {
|
|
24683
24683
|
if (groupIsRenderingRef.current) {
|
|
24684
24684
|
// Held until the layout effect below, WITH what it asked for: a child
|
|
24685
24685
|
// whose bound signal was written from the outside changes during the
|
|
@@ -24692,6 +24692,7 @@ const useUIGroupStateController = (
|
|
|
24692
24692
|
e,
|
|
24693
24693
|
notifyExternal:
|
|
24694
24694
|
pendingChange?.notifyExternal === true ? true : notifyExternal,
|
|
24695
|
+
actingChild,
|
|
24695
24696
|
};
|
|
24696
24697
|
return;
|
|
24697
24698
|
}
|
|
@@ -24715,6 +24716,21 @@ const useUIGroupStateController = (
|
|
|
24715
24716
|
// Somebody answered: what the group is worth is what its children say
|
|
24716
24717
|
// between them, from here on.
|
|
24717
24718
|
controller.stateGivenFromAbove = false;
|
|
24719
|
+
if (resolvedDistributeChildStates) {
|
|
24720
|
+
// A group answering for all its children at once holds ONE answer
|
|
24721
|
+
// its children are views OF, rather than a value that IS what they
|
|
24722
|
+
// said: a list saying who plays and four seats saying who sits
|
|
24723
|
+
// where. One view speaking moves the answer, so the others have to
|
|
24724
|
+
// show it again — the same rule as a child arriving after the value
|
|
24725
|
+
// did, for a child that was there when the value moved without it.
|
|
24726
|
+
// The one that just acted is left alone: it is where the user put
|
|
24727
|
+
// it.
|
|
24728
|
+
controller.placeChildrenUIState(
|
|
24729
|
+
groupUIState,
|
|
24730
|
+
new CustomEvent("propagate_down_set_ui_state", { detail: {} }),
|
|
24731
|
+
{ except: actingChild },
|
|
24732
|
+
);
|
|
24733
|
+
}
|
|
24718
24734
|
applyState(groupUIState, e);
|
|
24719
24735
|
} else if (notifyExternal === "silent") {
|
|
24720
24736
|
controller.syncInternalState(groupUIState);
|
|
@@ -24745,6 +24761,30 @@ const useUIGroupStateController = (
|
|
|
24745
24761
|
}
|
|
24746
24762
|
};
|
|
24747
24763
|
|
|
24764
|
+
// What putting a value on a child comes down to, whichever way the group
|
|
24765
|
+
// worked out that value (one child at a time, or all of them at once).
|
|
24766
|
+
const placeOneChild = (childUIStateController, childNewState, e) => {
|
|
24767
|
+
if (
|
|
24768
|
+
childUIStateController.hasStateProp &&
|
|
24769
|
+
!childUIStateController.props.signal
|
|
24770
|
+
) {
|
|
24771
|
+
// A child bound to a signal is placed like any other: bound is not
|
|
24772
|
+
// frozen, and the placement writes the signal, so both ends keep
|
|
24773
|
+
// saying the same thing. Only a child controlled by a `value` /
|
|
24774
|
+
// `checked` prop cannot be moved — its owner decides. Worth saying
|
|
24775
|
+
// out loud only when the two disagree: a child already showing what
|
|
24776
|
+
// the group would put there has lost nothing, and both being fed from
|
|
24777
|
+
// the same value is a legitimate way to write a group.
|
|
24778
|
+
if (
|
|
24779
|
+
!compareTwoJsValues(childNewState, childUIStateController.uiState)
|
|
24780
|
+
) {
|
|
24781
|
+
warnChildAnswersForItself(s.controller);
|
|
24782
|
+
}
|
|
24783
|
+
return;
|
|
24784
|
+
}
|
|
24785
|
+
childUIStateController.setUIState(childNewState, e);
|
|
24786
|
+
};
|
|
24787
|
+
|
|
24748
24788
|
const applyState = (newUIState, e, { internalBehavior = false } = {}) => {
|
|
24749
24789
|
const { controller } = s;
|
|
24750
24790
|
const currentUIState = controller.uiState;
|
|
@@ -24790,12 +24830,9 @@ const useUIGroupStateController = (
|
|
|
24790
24830
|
ref,
|
|
24791
24831
|
getPropFromState: (uiState) => uiState,
|
|
24792
24832
|
distributeChildUIState: resolvedDistributeChildUIState,
|
|
24793
|
-
// Where the group puts a value on ONE child: the only place that knows
|
|
24794
|
-
// what each child gets, and the only one that sees a child it cannot
|
|
24795
|
-
// place — see warnChildAnswersForItself.
|
|
24796
24833
|
// One pass over every child, which is what a plural distribute needs:
|
|
24797
24834
|
// it is asked once, sees the whole group, and answers for all of them.
|
|
24798
|
-
placeChildrenUIState: (groupUIState, e) => {
|
|
24835
|
+
placeChildrenUIState: (groupUIState, e, { except } = {}) => {
|
|
24799
24836
|
if (!resolvedDistributeChildStates) {
|
|
24800
24837
|
for (const childUIStateController of childUIStateControllerArray) {
|
|
24801
24838
|
controller.placeChildUIState(
|
|
@@ -24817,24 +24854,25 @@ const useUIGroupStateController = (
|
|
|
24817
24854
|
return;
|
|
24818
24855
|
}
|
|
24819
24856
|
for (const childUIStateController of monitoredChildren) {
|
|
24857
|
+
if (childUIStateController === except) {
|
|
24858
|
+
continue;
|
|
24859
|
+
}
|
|
24820
24860
|
if (!stateByChild.has(childUIStateController)) {
|
|
24821
24861
|
// Not named by the answer: left where it is, the way
|
|
24822
24862
|
// CANNOT_DERIVE leaves a child a per-child distribute says
|
|
24823
24863
|
// nothing about.
|
|
24824
24864
|
continue;
|
|
24825
24865
|
}
|
|
24826
|
-
|
|
24827
|
-
childUIStateController
|
|
24828
|
-
!childUIStateController.props.signal
|
|
24829
|
-
) {
|
|
24830
|
-
continue;
|
|
24831
|
-
}
|
|
24832
|
-
childUIStateController.setUIState(
|
|
24866
|
+
placeOneChild(
|
|
24867
|
+
childUIStateController,
|
|
24833
24868
|
stateByChild.get(childUIStateController),
|
|
24834
24869
|
e,
|
|
24835
24870
|
);
|
|
24836
24871
|
}
|
|
24837
24872
|
},
|
|
24873
|
+
// Where the group puts a value on ONE child: the only place that knows
|
|
24874
|
+
// what each child gets, and the only one that sees a child it cannot
|
|
24875
|
+
// place — see warnChildAnswersForItself.
|
|
24838
24876
|
placeChildUIState: (childUIStateController, groupUIState, e) => {
|
|
24839
24877
|
if (!shouldPropagateStateToChild(childUIStateController)) {
|
|
24840
24878
|
return;
|
|
@@ -24846,23 +24884,7 @@ const useUIGroupStateController = (
|
|
|
24846
24884
|
if (childNewState === CANNOT_DERIVE) {
|
|
24847
24885
|
return;
|
|
24848
24886
|
}
|
|
24849
|
-
|
|
24850
|
-
childUIStateController.hasStateProp &&
|
|
24851
|
-
!childUIStateController.props.signal
|
|
24852
|
-
) {
|
|
24853
|
-
// A child bound to a signal is placed like any other: bound is not
|
|
24854
|
-
// frozen, and the placement writes the signal, so both ends keep
|
|
24855
|
-
// saying the same thing. Only a child controlled by a `value` /
|
|
24856
|
-
// `checked` prop cannot be moved — its owner decides. Worth saying
|
|
24857
|
-
// out loud only when the two disagree: a child already showing what
|
|
24858
|
-
// the group would put there has lost nothing, and both being fed
|
|
24859
|
-
// from the same value is a legitimate way to write a group.
|
|
24860
|
-
if (
|
|
24861
|
-
!compareTwoJsValues(childNewState, childUIStateController.uiState)
|
|
24862
|
-
) ;
|
|
24863
|
-
return;
|
|
24864
|
-
}
|
|
24865
|
-
childUIStateController.setUIState(childNewState, e);
|
|
24887
|
+
placeOneChild(childUIStateController, childNewState, e);
|
|
24866
24888
|
},
|
|
24867
24889
|
setUIState: (newUIState, e) => {
|
|
24868
24890
|
if (
|
|
@@ -25016,7 +25038,10 @@ const useUIGroupStateController = (
|
|
|
25016
25038
|
)}`,
|
|
25017
25039
|
);
|
|
25018
25040
|
if (stateChanged) {
|
|
25019
|
-
onChange(e, {
|
|
25041
|
+
onChange(e, {
|
|
25042
|
+
notifyExternal: silent ? "silent" : true,
|
|
25043
|
+
actingChild: childUIStateController,
|
|
25044
|
+
});
|
|
25020
25045
|
} else {
|
|
25021
25046
|
controller.onUIAction(e);
|
|
25022
25047
|
}
|
|
@@ -25229,6 +25254,7 @@ const useUIGroupStateController = (
|
|
|
25229
25254
|
chainEvent(batchedEvent, pendingChange.e);
|
|
25230
25255
|
scope._onChange(batchedEvent, {
|
|
25231
25256
|
notifyExternal: pendingChange.notifyExternal,
|
|
25257
|
+
actingChild: pendingChange.actingChild,
|
|
25232
25258
|
});
|
|
25233
25259
|
}
|
|
25234
25260
|
});
|
|
@@ -25573,6 +25599,11 @@ const dispatchSyntheticInput = (el, inputEvent, causeEvent) => {
|
|
|
25573
25599
|
chainEvent(inputEvent, causeEvent);
|
|
25574
25600
|
el.dispatchEvent(inputEvent);
|
|
25575
25601
|
};
|
|
25602
|
+
const warnChildAnswersForItself = (groupController, child) => {
|
|
25603
|
+
{
|
|
25604
|
+
return;
|
|
25605
|
+
}
|
|
25606
|
+
};
|
|
25576
25607
|
|
|
25577
25608
|
/**
|
|
25578
25609
|
* What a control is worth when it holds nothing — nothing, in the shape of the
|