@player-ui/common-types-plugin 0.15.0-next.4 → 0.15.0-next.6
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.
|
@@ -4831,7 +4831,6 @@ var CommonTypesPlugin = function() {
|
|
|
4831
4831
|
this.ASTMap = /* @__PURE__ */ new Map();
|
|
4832
4832
|
this.logger = options.logger;
|
|
4833
4833
|
this.idCache = /* @__PURE__ */ new Set();
|
|
4834
|
-
this.AsyncIdMap = /* @__PURE__ */ new Map();
|
|
4835
4834
|
}
|
|
4836
4835
|
_create_class(Resolver, [
|
|
4837
4836
|
{
|
|
@@ -4842,27 +4841,44 @@ var CommonTypesPlugin = function() {
|
|
|
4842
4841
|
},
|
|
4843
4842
|
{
|
|
4844
4843
|
key: "update",
|
|
4845
|
-
value: function update(
|
|
4846
|
-
|
|
4847
|
-
this.hooks.beforeUpdate.call(changes);
|
|
4844
|
+
value: function update(dataChanges, nodeChanges) {
|
|
4845
|
+
this.hooks.beforeUpdate.call(dataChanges);
|
|
4848
4846
|
var resolveCache = /* @__PURE__ */ new Map();
|
|
4849
4847
|
this.idCache.clear();
|
|
4850
4848
|
var prevASTMap = new Map(this.ASTMap);
|
|
4851
4849
|
this.ASTMap.clear();
|
|
4852
|
-
var
|
|
4853
|
-
var
|
|
4854
|
-
|
|
4855
|
-
|
|
4856
|
-
|
|
4857
|
-
var
|
|
4858
|
-
|
|
4859
|
-
|
|
4850
|
+
var realNodeChanges = /* @__PURE__ */ new Set();
|
|
4851
|
+
var _nodeChanges_values;
|
|
4852
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
4853
|
+
try {
|
|
4854
|
+
for(var _iterator = ((_nodeChanges_values = nodeChanges === null || nodeChanges === void 0 ? void 0 : nodeChanges.values()) !== null && _nodeChanges_values !== void 0 ? _nodeChanges_values : [])[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
4855
|
+
var node = _step.value;
|
|
4856
|
+
var current = node;
|
|
4857
|
+
while(current){
|
|
4858
|
+
var _prevASTMap_get;
|
|
4859
|
+
var original = (_prevASTMap_get = prevASTMap.get(current)) !== null && _prevASTMap_get !== void 0 ? _prevASTMap_get : current;
|
|
4860
|
+
if (realNodeChanges.has(original)) {
|
|
4861
|
+
break;
|
|
4862
|
+
}
|
|
4863
|
+
realNodeChanges.add(original);
|
|
4864
|
+
current = current.parent;
|
|
4860
4865
|
}
|
|
4861
|
-
current = current.parent;
|
|
4862
4866
|
}
|
|
4863
|
-
})
|
|
4864
|
-
|
|
4865
|
-
|
|
4867
|
+
} catch (err) {
|
|
4868
|
+
_didIteratorError = true;
|
|
4869
|
+
_iteratorError = err;
|
|
4870
|
+
} finally{
|
|
4871
|
+
try {
|
|
4872
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
4873
|
+
_iterator.return();
|
|
4874
|
+
}
|
|
4875
|
+
} finally{
|
|
4876
|
+
if (_didIteratorError) {
|
|
4877
|
+
throw _iteratorError;
|
|
4878
|
+
}
|
|
4879
|
+
}
|
|
4880
|
+
}
|
|
4881
|
+
var updated = this.computeTree(this.root, void 0, dataChanges, resolveCache, toNodeResolveOptions(this.options), void 0, prevASTMap, realNodeChanges);
|
|
4866
4882
|
this.resolveCache = resolveCache;
|
|
4867
4883
|
this.hooks.afterUpdate.call(updated.value);
|
|
4868
4884
|
return updated.value;
|
|
@@ -4916,7 +4932,7 @@ var CommonTypesPlugin = function() {
|
|
|
4916
4932
|
},
|
|
4917
4933
|
{
|
|
4918
4934
|
key: "computeTree",
|
|
4919
|
-
value: function computeTree(node, rawParent, dataChanges, cacheUpdate, options, partiallyResolvedParent, prevASTMap,
|
|
4935
|
+
value: function computeTree(node, rawParent, dataChanges, cacheUpdate, options, partiallyResolvedParent, prevASTMap, nodeChanges) {
|
|
4920
4936
|
var _this = this;
|
|
4921
4937
|
var dependencyModel = new DependencyModel(options.data.model);
|
|
4922
4938
|
dependencyModel.trackSubset("core");
|
|
@@ -4934,8 +4950,9 @@ var CommonTypesPlugin = function() {
|
|
|
4934
4950
|
}), node);
|
|
4935
4951
|
var previousResult = this.getPreviousResult(node);
|
|
4936
4952
|
var previousDeps = previousResult === null || previousResult === void 0 ? void 0 : previousResult.dependencies;
|
|
4953
|
+
var isChanged = nodeChanges.has(node);
|
|
4937
4954
|
var dataChanged = caresAboutDataChanges(dataChanges, previousDeps);
|
|
4938
|
-
var shouldUseLastValue = this.hooks.skipResolve.call(!dataChanged, node, resolveOptions);
|
|
4955
|
+
var shouldUseLastValue = this.hooks.skipResolve.call(!dataChanged && !isChanged, node, resolveOptions);
|
|
4939
4956
|
if (previousResult && shouldUseLastValue) {
|
|
4940
4957
|
var update2 = _object_spread_props(_object_spread({}, previousResult), {
|
|
4941
4958
|
updated: false
|
|
@@ -4947,30 +4964,6 @@ var CommonTypesPlugin = function() {
|
|
|
4947
4964
|
updated: false
|
|
4948
4965
|
});
|
|
4949
4966
|
cacheUpdate.set(AST, resolvedUpdate);
|
|
4950
|
-
if (resolvedUpdate.node.type === "async") {
|
|
4951
|
-
nextAsyncIdMap.set(resolvedUpdate.node.id, resolvedUpdate.node);
|
|
4952
|
-
}
|
|
4953
|
-
var _resolvedUpdate_node_asyncNodesResolved;
|
|
4954
|
-
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
4955
|
-
try {
|
|
4956
|
-
for(var _iterator = ((_resolvedUpdate_node_asyncNodesResolved = resolvedUpdate.node.asyncNodesResolved) !== null && _resolvedUpdate_node_asyncNodesResolved !== void 0 ? _resolvedUpdate_node_asyncNodesResolved : [])[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
4957
|
-
var key = _step.value;
|
|
4958
|
-
nextAsyncIdMap.set(key, resolvedUpdate.node);
|
|
4959
|
-
}
|
|
4960
|
-
} catch (err) {
|
|
4961
|
-
_didIteratorError = true;
|
|
4962
|
-
_iteratorError = err;
|
|
4963
|
-
} finally{
|
|
4964
|
-
try {
|
|
4965
|
-
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
4966
|
-
_iterator.return();
|
|
4967
|
-
}
|
|
4968
|
-
} finally{
|
|
4969
|
-
if (_didIteratorError) {
|
|
4970
|
-
throw _iteratorError;
|
|
4971
|
-
}
|
|
4972
|
-
}
|
|
4973
|
-
}
|
|
4974
4967
|
var handleChildNode = function(childNode) {
|
|
4975
4968
|
var _prevASTMap_get;
|
|
4976
4969
|
var originalChildNode = (_prevASTMap_get = prevASTMap.get(childNode)) !== null && _prevASTMap_get !== void 0 ? _prevASTMap_get : childNode;
|
|
@@ -5001,30 +4994,6 @@ var CommonTypesPlugin = function() {
|
|
|
5001
4994
|
type: "empty"
|
|
5002
4995
|
};
|
|
5003
4996
|
resolvedAST.parent = partiallyResolvedParent;
|
|
5004
|
-
if (resolvedAST.type === "async") {
|
|
5005
|
-
nextAsyncIdMap.set(resolvedAST.id, resolvedAST);
|
|
5006
|
-
}
|
|
5007
|
-
var _resolvedAST_asyncNodesResolved;
|
|
5008
|
-
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
5009
|
-
try {
|
|
5010
|
-
for(var _iterator = ((_resolvedAST_asyncNodesResolved = resolvedAST.asyncNodesResolved) !== null && _resolvedAST_asyncNodesResolved !== void 0 ? _resolvedAST_asyncNodesResolved : [])[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
5011
|
-
var id = _step.value;
|
|
5012
|
-
nextAsyncIdMap.set(id, resolvedAST);
|
|
5013
|
-
}
|
|
5014
|
-
} catch (err) {
|
|
5015
|
-
_didIteratorError = true;
|
|
5016
|
-
_iteratorError = err;
|
|
5017
|
-
} finally{
|
|
5018
|
-
try {
|
|
5019
|
-
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
5020
|
-
_iterator.return();
|
|
5021
|
-
}
|
|
5022
|
-
} finally{
|
|
5023
|
-
if (_didIteratorError) {
|
|
5024
|
-
throw _iteratorError;
|
|
5025
|
-
}
|
|
5026
|
-
}
|
|
5027
|
-
}
|
|
5028
4997
|
resolveOptions.node = resolvedAST;
|
|
5029
4998
|
this.ASTMap.set(resolvedAST, node);
|
|
5030
4999
|
var resolved = this.hooks.resolve.call(void 0, resolvedAST, resolveOptions);
|
|
@@ -5037,7 +5006,7 @@ var CommonTypesPlugin = function() {
|
|
|
5037
5006
|
if ("children" in resolvedAST) {
|
|
5038
5007
|
var _resolvedAST_children;
|
|
5039
5008
|
var newChildren = (_resolvedAST_children = resolvedAST.children) === null || _resolvedAST_children === void 0 ? void 0 : _resolvedAST_children.map(function(child) {
|
|
5040
|
-
var computedChildTree = _this.computeTree(child.value, node, dataChanges, cacheUpdate, resolveOptions, resolvedAST, prevASTMap,
|
|
5009
|
+
var computedChildTree = _this.computeTree(child.value, node, dataChanges, cacheUpdate, resolveOptions, resolvedAST, prevASTMap, nodeChanges);
|
|
5041
5010
|
var childTreeDeps = computedChildTree.dependencies, childNode = computedChildTree.node, childUpdated = computedChildTree.updated, childValue = computedChildTree.value;
|
|
5042
5011
|
childTreeDeps.forEach(function(binding) {
|
|
5043
5012
|
return childDependencies.add(binding);
|
|
@@ -5060,7 +5029,7 @@ var CommonTypesPlugin = function() {
|
|
|
5060
5029
|
var childValue = [];
|
|
5061
5030
|
var rawParentToPassIn = node;
|
|
5062
5031
|
resolvedAST.values = resolvedAST.values.map(function(mValue) {
|
|
5063
|
-
var mTree = _this.computeTree(mValue, rawParentToPassIn, dataChanges, cacheUpdate, resolveOptions, resolvedAST, prevASTMap,
|
|
5032
|
+
var mTree = _this.computeTree(mValue, rawParentToPassIn, dataChanges, cacheUpdate, resolveOptions, resolvedAST, prevASTMap, nodeChanges);
|
|
5064
5033
|
if (mTree.value !== void 0 && mTree.value !== null) {
|
|
5065
5034
|
mTree.dependencies.forEach(function(bindingDep) {
|
|
5066
5035
|
return childDependencies.add(bindingDep);
|
|
@@ -5164,19 +5133,17 @@ var CommonTypesPlugin = function() {
|
|
|
5164
5133
|
}
|
|
5165
5134
|
_create_class(ViewInstance, [
|
|
5166
5135
|
{
|
|
5167
|
-
key: "updateAsync",
|
|
5136
|
+
/** @deprecated use ViewController.updateViewAST */ key: "updateAsync",
|
|
5168
5137
|
value: function updateAsync(asyncNode) {
|
|
5169
5138
|
var _this_resolver;
|
|
5170
|
-
var update = (_this_resolver = this.resolver) === null || _this_resolver === void 0 ? void 0 : _this_resolver.update(
|
|
5171
|
-
asyncNode
|
|
5172
|
-
]));
|
|
5139
|
+
var update = (_this_resolver = this.resolver) === null || _this_resolver === void 0 ? void 0 : _this_resolver.update();
|
|
5173
5140
|
this.lastUpdate = update;
|
|
5174
5141
|
this.hooks.onUpdate.call(update);
|
|
5175
5142
|
}
|
|
5176
5143
|
},
|
|
5177
5144
|
{
|
|
5178
5145
|
key: "update",
|
|
5179
|
-
value: function update(changes) {
|
|
5146
|
+
value: function update(changes, nodeChanges) {
|
|
5180
5147
|
var _this_resolver;
|
|
5181
5148
|
if (this.rootNode === void 0) {
|
|
5182
5149
|
this.validationProvider = new CrossfieldProvider(this.initialView, this.resolverOptions.parseBinding, this.resolverOptions.logger);
|
|
@@ -5194,7 +5161,7 @@ var CommonTypesPlugin = function() {
|
|
|
5194
5161
|
}));
|
|
5195
5162
|
this.hooks.resolver.call(this.resolver);
|
|
5196
5163
|
}
|
|
5197
|
-
var update = (_this_resolver = this.resolver) === null || _this_resolver === void 0 ? void 0 : _this_resolver.update(changes);
|
|
5164
|
+
var update = (_this_resolver = this.resolver) === null || _this_resolver === void 0 ? void 0 : _this_resolver.update(changes, nodeChanges);
|
|
5198
5165
|
if (this.lastUpdate === update) {
|
|
5199
5166
|
return this.lastUpdate;
|
|
5200
5167
|
}
|
|
@@ -6984,6 +6951,10 @@ var CommonTypesPlugin = function() {
|
|
|
6984
6951
|
]);
|
|
6985
6952
|
return ValidationController;
|
|
6986
6953
|
}();
|
|
6954
|
+
var mergeSets = function(setA, setB) {
|
|
6955
|
+
var _setA_values, _setB_values;
|
|
6956
|
+
return /* @__PURE__ */ new Set(_to_consumable_array((_setA_values = setA === null || setA === void 0 ? void 0 : setA.values()) !== null && _setA_values !== void 0 ? _setA_values : []).concat(_to_consumable_array((_setB_values = setB === null || setB === void 0 ? void 0 : setB.values()) !== null && _setB_values !== void 0 ? _setB_values : [])));
|
|
6957
|
+
};
|
|
6987
6958
|
var ViewController = /*#__PURE__*/ function() {
|
|
6988
6959
|
function ViewController(initialViews, options) {
|
|
6989
6960
|
var _this = this;
|
|
@@ -7013,7 +6984,7 @@ var CommonTypesPlugin = function() {
|
|
|
7013
6984
|
var silent = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false;
|
|
7014
6985
|
if (_this1.currentView) {
|
|
7015
6986
|
if (_this1.optimizeUpdates) {
|
|
7016
|
-
_this1.queueUpdate(updates, silent);
|
|
6987
|
+
_this1.queueUpdate(updates, void 0, silent);
|
|
7017
6988
|
} else {
|
|
7018
6989
|
_this1.currentView.update();
|
|
7019
6990
|
}
|
|
@@ -7043,25 +7014,26 @@ var CommonTypesPlugin = function() {
|
|
|
7043
7014
|
_create_class(ViewController, [
|
|
7044
7015
|
{
|
|
7045
7016
|
key: "queueUpdate",
|
|
7046
|
-
value: function queueUpdate(bindings) {
|
|
7017
|
+
value: function queueUpdate(bindings, nodes) {
|
|
7047
7018
|
var _this = this;
|
|
7048
|
-
var silent = arguments.length >
|
|
7049
|
-
|
|
7050
|
-
if ((_this_pendingUpdate = this.pendingUpdate) === null || _this_pendingUpdate === void 0 ? void 0 : _this_pendingUpdate.changedBindings) {
|
|
7051
|
-
this.pendingUpdate.changedBindings = /* @__PURE__ */ new Set(_to_consumable_array(this.pendingUpdate.changedBindings).concat(_to_consumable_array(bindings)));
|
|
7052
|
-
} else {
|
|
7019
|
+
var silent = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : false;
|
|
7020
|
+
if (!this.pendingUpdate) {
|
|
7053
7021
|
this.pendingUpdate = {
|
|
7054
|
-
changedBindings: bindings,
|
|
7055
7022
|
scheduled: false
|
|
7056
7023
|
};
|
|
7057
7024
|
}
|
|
7025
|
+
this.pendingUpdate = _object_spread_props(_object_spread({}, this.pendingUpdate), {
|
|
7026
|
+
changedBindings: mergeSets(this.pendingUpdate.changedBindings, bindings),
|
|
7027
|
+
changedNodes: mergeSets(this.pendingUpdate.changedNodes, nodes)
|
|
7028
|
+
});
|
|
7058
7029
|
if (!this.pendingUpdate.scheduled && !silent) {
|
|
7059
7030
|
this.pendingUpdate.scheduled = true;
|
|
7060
7031
|
(0, import_queue_microtask2.default)(function() {
|
|
7061
|
-
var
|
|
7062
|
-
var
|
|
7032
|
+
var _this_currentView;
|
|
7033
|
+
var _this_pendingUpdate;
|
|
7034
|
+
var _ref = (_this_pendingUpdate = _this.pendingUpdate) !== null && _this_pendingUpdate !== void 0 ? _this_pendingUpdate : {}, changedBindings = _ref.changedBindings, changedNodes = _ref.changedNodes;
|
|
7063
7035
|
_this.pendingUpdate = void 0;
|
|
7064
|
-
(_this_currentView = _this.currentView) === null || _this_currentView === void 0 ? void 0 : _this_currentView.update(
|
|
7036
|
+
(_this_currentView = _this.currentView) === null || _this_currentView === void 0 ? void 0 : _this_currentView.update(changedBindings, changedNodes);
|
|
7065
7037
|
});
|
|
7066
7038
|
}
|
|
7067
7039
|
}
|
|
@@ -7138,6 +7110,15 @@ var CommonTypesPlugin = function() {
|
|
|
7138
7110
|
new MultiNodePlugin()
|
|
7139
7111
|
];
|
|
7140
7112
|
}
|
|
7113
|
+
},
|
|
7114
|
+
{
|
|
7115
|
+
/** Marks all AST nodes in `nodes` as changed, triggering the view to update and re-resolve these nodes. View updates are triggered asynchronously and many calls to this in a short time will batch into a single update.
|
|
7116
|
+
*
|
|
7117
|
+
* NOTE: In most cases view updates are handled automatically by changes to data or any other built-in functionality that would require a view update. Only call this function if absolutely necessary.
|
|
7118
|
+
*/ key: "updateViewAST",
|
|
7119
|
+
value: function updateViewAST(nodes) {
|
|
7120
|
+
this.queueUpdate(void 0, nodes);
|
|
7121
|
+
}
|
|
7141
7122
|
}
|
|
7142
7123
|
]);
|
|
7143
7124
|
return ViewController;
|
|
@@ -7510,8 +7491,8 @@ var CommonTypesPlugin = function() {
|
|
|
7510
7491
|
ref: Symbol("not-started"),
|
|
7511
7492
|
status: "not-started"
|
|
7512
7493
|
};
|
|
7513
|
-
var PLAYER_VERSION = true ? "0.15.0-next.
|
|
7514
|
-
var COMMIT = true ? "
|
|
7494
|
+
var PLAYER_VERSION = true ? "0.15.0-next.6" : "unknown";
|
|
7495
|
+
var COMMIT = true ? "9b22cee7078ed75d77b3c31bc306c758ea07da8b" : "unknown";
|
|
7515
7496
|
var _Player = /*#__PURE__*/ function() {
|
|
7516
7497
|
function _Player2(config) {
|
|
7517
7498
|
var _this = this;
|