@lionweb/class-core 0.6.13-beta.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/LICENSE +201 -0
- package/README.md +157 -0
- package/dist/base-types.d.ts +167 -0
- package/dist/base-types.d.ts.map +1 -0
- package/dist/base-types.js +147 -0
- package/dist/base-types.js.map +1 -0
- package/dist/convenience.d.ts +49 -0
- package/dist/convenience.d.ts.map +1 -0
- package/dist/convenience.js +75 -0
- package/dist/convenience.js.map +1 -0
- package/dist/deltas/appliers.d.ts +42 -0
- package/dist/deltas/appliers.d.ts.map +1 -0
- package/dist/deltas/appliers.js +274 -0
- package/dist/deltas/appliers.js.map +1 -0
- package/dist/deltas/base.d.ts +6 -0
- package/dist/deltas/base.d.ts.map +1 -0
- package/dist/deltas/base.js +18 -0
- package/dist/deltas/base.js.map +1 -0
- package/dist/deltas/handlers.d.ts +17 -0
- package/dist/deltas/handlers.d.ts.map +1 -0
- package/dist/deltas/handlers.js +43 -0
- package/dist/deltas/handlers.js.map +1 -0
- package/dist/deltas/index.d.ts +7 -0
- package/dist/deltas/index.d.ts.map +1 -0
- package/dist/deltas/index.js +23 -0
- package/dist/deltas/index.js.map +1 -0
- package/dist/deltas/inverters.d.ts +7 -0
- package/dist/deltas/inverters.d.ts.map +1 -0
- package/dist/deltas/inverters.js +82 -0
- package/dist/deltas/inverters.js.map +1 -0
- package/dist/deltas/serialization/base.d.ts +7 -0
- package/dist/deltas/serialization/base.d.ts.map +1 -0
- package/dist/deltas/serialization/base.js +18 -0
- package/dist/deltas/serialization/base.js.map +1 -0
- package/dist/deltas/serialization/deserializer.g.d.ts +5 -0
- package/dist/deltas/serialization/deserializer.g.d.ts.map +1 -0
- package/dist/deltas/serialization/deserializer.g.js +164 -0
- package/dist/deltas/serialization/deserializer.g.js.map +1 -0
- package/dist/deltas/serialization/index.d.ts +5 -0
- package/dist/deltas/serialization/index.d.ts.map +1 -0
- package/dist/deltas/serialization/index.js +21 -0
- package/dist/deltas/serialization/index.js.map +1 -0
- package/dist/deltas/serialization/serializer-helpers.d.ts +12 -0
- package/dist/deltas/serialization/serializer-helpers.d.ts.map +1 -0
- package/dist/deltas/serialization/serializer-helpers.js +28 -0
- package/dist/deltas/serialization/serializer-helpers.js.map +1 -0
- package/dist/deltas/serialization/serializer.g.d.ts +4 -0
- package/dist/deltas/serialization/serializer.g.d.ts.map +1 -0
- package/dist/deltas/serialization/serializer.g.js +208 -0
- package/dist/deltas/serialization/serializer.g.js.map +1 -0
- package/dist/deltas/serialization/types.g.d.ts +147 -0
- package/dist/deltas/serialization/types.g.d.ts.map +1 -0
- package/dist/deltas/serialization/types.g.js +18 -0
- package/dist/deltas/serialization/types.g.js.map +1 -0
- package/dist/deltas/types.g.d.ts +149 -0
- package/dist/deltas/types.g.d.ts.map +1 -0
- package/dist/deltas/types.g.js +180 -0
- package/dist/deltas/types.g.js.map +1 -0
- package/dist/deserializer.d.ts +27 -0
- package/dist/deserializer.d.ts.map +1 -0
- package/dist/deserializer.js +168 -0
- package/dist/deserializer.js.map +1 -0
- package/dist/duplicator.d.ts +19 -0
- package/dist/duplicator.d.ts.map +1 -0
- package/dist/duplicator.js +87 -0
- package/dist/duplicator.js.map +1 -0
- package/dist/id-mapping.d.ts +19 -0
- package/dist/id-mapping.d.ts.map +1 -0
- package/dist/id-mapping.js +44 -0
- package/dist/id-mapping.js.map +1 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +28 -0
- package/dist/index.js.map +1 -0
- package/dist/linking.d.ts +20 -0
- package/dist/linking.d.ts.map +1 -0
- package/dist/linking.js +18 -0
- package/dist/linking.js.map +1 -0
- package/dist/lionCore_builtins.g.d.ts +35 -0
- package/dist/lionCore_builtins.g.d.ts.map +1 -0
- package/dist/lionCore_builtins.g.js +96 -0
- package/dist/lionCore_builtins.g.js.map +1 -0
- package/dist/serializer.d.ts +17 -0
- package/dist/serializer.d.ts.map +1 -0
- package/dist/serializer.js +70 -0
- package/dist/serializer.js.map +1 -0
- package/dist/textualizer.d.ts +7 -0
- package/dist/textualizer.d.ts.map +1 -0
- package/dist/textualizer.js +82 -0
- package/dist/textualizer.js.map +1 -0
- package/dist/value-managers/annotations.d.ts +33 -0
- package/dist/value-managers/annotations.d.ts.map +1 -0
- package/dist/value-managers/annotations.js +192 -0
- package/dist/value-managers/annotations.js.map +1 -0
- package/dist/value-managers/base.d.ts +53 -0
- package/dist/value-managers/base.d.ts.map +1 -0
- package/dist/value-managers/base.js +102 -0
- package/dist/value-managers/base.js.map +1 -0
- package/dist/value-managers/containments.d.ts +58 -0
- package/dist/value-managers/containments.d.ts.map +1 -0
- package/dist/value-managers/containments.js +408 -0
- package/dist/value-managers/containments.js.map +1 -0
- package/dist/value-managers/index.d.ts +6 -0
- package/dist/value-managers/index.d.ts.map +1 -0
- package/dist/value-managers/index.js +22 -0
- package/dist/value-managers/index.js.map +1 -0
- package/dist/value-managers/properties.d.ts +24 -0
- package/dist/value-managers/properties.d.ts.map +1 -0
- package/dist/value-managers/properties.js +191 -0
- package/dist/value-managers/properties.js.map +1 -0
- package/dist/value-managers/references.d.ts +58 -0
- package/dist/value-managers/references.d.ts.map +1 -0
- package/dist/value-managers/references.js +346 -0
- package/dist/value-managers/references.js.map +1 -0
- package/package.json +35 -0
- package/src/base-types.ts +353 -0
- package/src/convenience.ts +101 -0
- package/src/deltas/appliers.ts +317 -0
- package/src/deltas/base.ts +23 -0
- package/src/deltas/handlers.ts +64 -0
- package/src/deltas/index.ts +23 -0
- package/src/deltas/inverters.ts +111 -0
- package/src/deltas/serialization/base.ts +26 -0
- package/src/deltas/serialization/deserializer.g.ts +193 -0
- package/src/deltas/serialization/index.ts +22 -0
- package/src/deltas/serialization/serializer-helpers.ts +36 -0
- package/src/deltas/serialization/serializer.g.ts +272 -0
- package/src/deltas/serialization/types.g.ts +209 -0
- package/src/deltas/types.g.ts +231 -0
- package/src/deserializer.ts +234 -0
- package/src/duplicator.ts +111 -0
- package/src/id-mapping.ts +58 -0
- package/src/index.ts +29 -0
- package/src/linking.ts +39 -0
- package/src/lionCore_builtins.g.ts +141 -0
- package/src/serializer.ts +86 -0
- package/src/textualizer.ts +104 -0
- package/src/value-managers/annotations.ts +139 -0
- package/src/value-managers/base.ts +123 -0
- package/src/value-managers/containments.ts +323 -0
- package/src/value-managers/index.ts +22 -0
- package/src/value-managers/properties.ts +127 -0
- package/src/value-managers/references.ts +268 -0
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
// Copyright 2025 TRUMPF Laser SE and other contributors
|
|
2
|
+
//
|
|
3
|
+
// Licensed under the Apache License, Version 2.0 (the "License")
|
|
4
|
+
// you may not use this file except in compliance with the License.
|
|
5
|
+
// You may obtain a copy of the License at
|
|
6
|
+
//
|
|
7
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
//
|
|
9
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
// See the License for the specific language governing permissions and
|
|
13
|
+
// limitations under the License.
|
|
14
|
+
//
|
|
15
|
+
// SPDX-FileCopyrightText: 2025 TRUMPF Laser SE and other contributors
|
|
16
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
17
|
+
import { allFeaturesOf, Containment, Property, Reference } from "@lionweb/core";
|
|
18
|
+
import { makeObservable } from "mobx";
|
|
19
|
+
import { AnnotationsValueManager, MultiContainmentValueManager, SingleContainmentValueManager } from "./index.js";
|
|
20
|
+
/**
|
|
21
|
+
* The base type for any node that's managed by a, potentially delta-emitting, API.
|
|
22
|
+
*
|
|
23
|
+
* It receives a {@link DeltaHandler} to pass {@link IDelta deltas} to
|
|
24
|
+
* that occur due to changes to values of its features,
|
|
25
|
+
* as well as moving among parents and deletion.
|
|
26
|
+
*
|
|
27
|
+
* It keeps explicit track of how it's contained by its parent (when it has one),
|
|
28
|
+
* to make moving children among parents easier.
|
|
29
|
+
*/
|
|
30
|
+
export class NodeBase {
|
|
31
|
+
get parent() {
|
|
32
|
+
return this._parentage?.[0];
|
|
33
|
+
}
|
|
34
|
+
get containment() {
|
|
35
|
+
return this._parentage?.[1];
|
|
36
|
+
}
|
|
37
|
+
/*
|
|
38
|
+
* Note: the tuple [_parent, _containingFeature] can only be set simultaneously, through the attachTo method.
|
|
39
|
+
*/
|
|
40
|
+
attachTo(parent, containingFeature) {
|
|
41
|
+
this._parentage = [parent, containingFeature];
|
|
42
|
+
}
|
|
43
|
+
detach() {
|
|
44
|
+
this._parentage = undefined;
|
|
45
|
+
}
|
|
46
|
+
constructor(classifier, id, handleDelta, parentage) {
|
|
47
|
+
this.classifier = classifier;
|
|
48
|
+
this.id = id;
|
|
49
|
+
this.handleDelta = handleDelta;
|
|
50
|
+
this.annotationsValueManager = new AnnotationsValueManager(this);
|
|
51
|
+
this.classifier = classifier;
|
|
52
|
+
this.id = id;
|
|
53
|
+
if (parentage) {
|
|
54
|
+
this.attachTo(parentage[0], parentage[1]);
|
|
55
|
+
}
|
|
56
|
+
makeObservable(this);
|
|
57
|
+
}
|
|
58
|
+
get locationMessage() {
|
|
59
|
+
return `instance of ${this.classifier.language.name}.${this.classifier.name} with id=${this.id}`;
|
|
60
|
+
}
|
|
61
|
+
getPropertyValueManager(property) {
|
|
62
|
+
throw new Error(`property (feature) "${property.name}" (with key=${property.key}) doesn't exist on ${this.locationMessage}`);
|
|
63
|
+
}
|
|
64
|
+
getContainmentValueManager(containment) {
|
|
65
|
+
throw new Error(`containment (feature) "${containment.name}" (with key=${containment.key}) doesn't exist on ${this.locationMessage}`);
|
|
66
|
+
}
|
|
67
|
+
getReferenceValueManager(reference) {
|
|
68
|
+
throw new Error(`reference (feature) "${reference.name}" (with key=${reference.key}) doesn't exist on ${this.locationMessage}`);
|
|
69
|
+
}
|
|
70
|
+
getFeatureValueManager(feature) {
|
|
71
|
+
if (feature instanceof Property) {
|
|
72
|
+
return this.getPropertyValueManager(feature);
|
|
73
|
+
}
|
|
74
|
+
if (feature instanceof Containment) {
|
|
75
|
+
return this.getContainmentValueManager(feature);
|
|
76
|
+
}
|
|
77
|
+
if (feature instanceof Reference) {
|
|
78
|
+
return this.getReferenceValueManager(feature);
|
|
79
|
+
}
|
|
80
|
+
throw new Error(`unhandled Feature sub type ${feature.constructor.name}`);
|
|
81
|
+
}
|
|
82
|
+
get setFeatures() {
|
|
83
|
+
return allFeaturesOf(this.classifier)
|
|
84
|
+
.filter((feature) => this.getFeatureValueManager(feature).isSet());
|
|
85
|
+
}
|
|
86
|
+
get children() {
|
|
87
|
+
return [
|
|
88
|
+
...(this.setFeatures
|
|
89
|
+
.filter((feature) => feature instanceof Containment)
|
|
90
|
+
.flatMap((feature) => {
|
|
91
|
+
const valueManager = this.getContainmentValueManager(feature);
|
|
92
|
+
if (valueManager instanceof SingleContainmentValueManager) {
|
|
93
|
+
return valueManager.isSet() ? [valueManager.getDirectly()] : [];
|
|
94
|
+
}
|
|
95
|
+
if (valueManager instanceof MultiContainmentValueManager) {
|
|
96
|
+
return valueManager.get();
|
|
97
|
+
}
|
|
98
|
+
throw new Error(`don't know how to obtain value of feature ${feature.name} of classifier ${this.classifier.name} in language ${this.classifier.language.name}`);
|
|
99
|
+
})),
|
|
100
|
+
...this.annotations
|
|
101
|
+
];
|
|
102
|
+
}
|
|
103
|
+
get annotations() {
|
|
104
|
+
return this.annotationsValueManager.get();
|
|
105
|
+
}
|
|
106
|
+
addAnnotation(annotation) {
|
|
107
|
+
this.annotationsValueManager.add(annotation);
|
|
108
|
+
}
|
|
109
|
+
insertAnnotationAtIndex(annotation, index) {
|
|
110
|
+
this.annotationsValueManager.insertAtIndex(annotation, index);
|
|
111
|
+
}
|
|
112
|
+
moveAnnotation(oldIndex, newIndex) {
|
|
113
|
+
this.annotationsValueManager.move(oldIndex, newIndex);
|
|
114
|
+
}
|
|
115
|
+
replaceAnnotationAtIndex(annotation, index) {
|
|
116
|
+
this.annotationsValueManager.replaceAtIndex(annotation, index);
|
|
117
|
+
}
|
|
118
|
+
removeAnnotation(annotation) {
|
|
119
|
+
this.annotationsValueManager.remove(annotation);
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Removes the given child node from its parent, and returns its containment index.
|
|
124
|
+
*/
|
|
125
|
+
export const removeFromParent = (parent, child) => {
|
|
126
|
+
if (parent === undefined) {
|
|
127
|
+
throw new Error(`can't remove an orphan from its parent`);
|
|
128
|
+
}
|
|
129
|
+
if (child.containment instanceof Containment) {
|
|
130
|
+
const valueManager = parent.getContainmentValueManager(child.containment);
|
|
131
|
+
if (valueManager instanceof SingleContainmentValueManager) {
|
|
132
|
+
valueManager.setDirectly(undefined);
|
|
133
|
+
return 0;
|
|
134
|
+
}
|
|
135
|
+
else if (valueManager instanceof MultiContainmentValueManager) {
|
|
136
|
+
return valueManager.removeDirectly(child);
|
|
137
|
+
}
|
|
138
|
+
else {
|
|
139
|
+
throw new Error(`don't know how to remove a child that's contained through a value manager of type ${valueManager.constructor.name}`);
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
if (child.containment === null) {
|
|
143
|
+
return parent.annotationsValueManager.removeDirectly(child);
|
|
144
|
+
}
|
|
145
|
+
throw new Error(`not going to remove a child from its parent without knowing how it's contained`);
|
|
146
|
+
};
|
|
147
|
+
//# sourceMappingURL=base-types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base-types.js","sourceRoot":"","sources":["../src/base-types.ts"],"names":[],"mappings":"AAAA,wDAAwD;AACxD,EAAE;AACF,iEAAiE;AACjE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,iDAAiD;AACjD,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AACjC,EAAE;AACF,sEAAsE;AACtE,sCAAsC;AAEtC,OAAO,EACH,aAAa,EAIb,WAAW,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C,UAAU,EAAE,KAAK,CAAC,CAAC;IACnE,CAAC;IAED,gBAAgB,CAAC,UAAqB;QAClC,IAAI,CAAC,uBAAuB,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;IACpD,CAAC;CAEJ;AAsBD;;GAEG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,MAA6B,EAAE,KAAgB,EAAU,EAAE;IACxF,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;QACvB,MAAM,IAAI,KAAK,CAAC,wCAAwC,CAAC,CAAC;IAC9D,CAAC;IACD,IAAI,KAAK,CAAC,WAAW,YAAY,WAAW,EAAE,CAAC;QAC3C,MAAM,YAAY,GAAG,MAAM,CAAC,0BAA0B,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;QAC1E,IAAI,YAAY,YAAY,6BAA6B,EAAE,CAAC;YACxD,YAAY,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC;YACpC,OAAO,CAAC,CAAC;QACb,CAAC;aAAM,IAAI,YAAY,YAAY,4BAA4B,EAAE,CAAC;YAC9D,OAAO,YAAY,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;QAC9C,CAAC;aAAM,CAAC;YACJ,MAAM,IAAI,KAAK,CAAC,qFAAqF,YAAY,CAAC,WAAW,CAAC,IAAI,EAAE,CAAC,CAAC;QAC1I,CAAC;IACL,CAAC;IACD,IAAI,KAAK,CAAC,WAAW,KAAK,IAAI,EAAE,CAAC;QAC7B,OAAO,MAAM,CAAC,uBAAuB,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;IAChE,CAAC;IACD,MAAM,IAAI,KAAK,CAAC,gFAAgF,CAAC,CAAC;AACtG,CAAC,CAAA"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { Id, ReferenceValue } from "@lionweb/core";
|
|
2
|
+
import { DeltaHandler, IdMapping, ILanguageBase, INodeBase } from "./index.js";
|
|
3
|
+
import { NodeDuplicator } from "./duplicator.js";
|
|
4
|
+
/**
|
|
5
|
+
* @return all descendant nodes from the given node, including that node itself.
|
|
6
|
+
*/
|
|
7
|
+
export declare const allNodesFrom: (rootNode: INodeBase) => INodeBase[];
|
|
8
|
+
/**
|
|
9
|
+
* Finds all references coming into the given target node or any of the given target nodes,
|
|
10
|
+
* within the search scope (given as _root_ nodes),
|
|
11
|
+
* returning these as {@link ReferenceValue reference values}.
|
|
12
|
+
* Note that any reference is found uniquely,
|
|
13
|
+
* i.e. the returned {@link ReferenceValue reference values} are pairwise distinct,
|
|
14
|
+
* even if the given target nodes or scope contain duplicate nodes.
|
|
15
|
+
*
|
|
16
|
+
* @param targetNodeOrNodes one or more target {@link Node nodes} for which the incoming references are searched
|
|
17
|
+
* @param rootNodesInScope the {@link Node _root_ nodes} of the model that's searched for references
|
|
18
|
+
*/
|
|
19
|
+
export declare const incomingReferences: (targetNodeOrNodes: INodeBase | INodeBase[], rootNodesInScope: INodeBase[]) => ReferenceValue<INodeBase>[];
|
|
20
|
+
/**
|
|
21
|
+
* @return a function that deep-clones the given nodes (of type {@link INodeBase}),
|
|
22
|
+
* *without* generating new IDs.
|
|
23
|
+
* @param languageBases the {@link ILanguageBase language bases} of the languages that the nodes might come from
|
|
24
|
+
* — these are necessary for their factories
|
|
25
|
+
* @param handleDelta an optional {@link DeltaHandler} that gets installed on the deep-cloned nodes
|
|
26
|
+
*/
|
|
27
|
+
export declare const deepClonerFor: (languageBases: ILanguageBase[], handleDelta?: DeltaHandler) => import("./duplicator.js").Duplicator;
|
|
28
|
+
/**
|
|
29
|
+
* Type definition for functions that compute a – not necessarily new – ID from a given original {@link INodeBase node}.
|
|
30
|
+
*/
|
|
31
|
+
export type NewIdFunction = (originalNode: INodeBase) => Id;
|
|
32
|
+
/**
|
|
33
|
+
* @return a {@link NodeDuplicator} function that does the “obvious” thing, given the parameters:
|
|
34
|
+
* @param languageBases an array of languages in the form of {@link ILanguageBase}s
|
|
35
|
+
* @param newIdFunc a function that computes a – not necessarily new – ID from a given original {@link INodeBase node}
|
|
36
|
+
* @param handleDelta an optional {@link DeltaHandler}
|
|
37
|
+
* @param idMapping an optional {@link IdMapping}
|
|
38
|
+
*/
|
|
39
|
+
export declare const defaultNodeDuplicatorFor: (languageBases: ILanguageBase[], newIdFunc: NewIdFunction, handleDelta?: DeltaHandler, idMapping?: IdMapping) => NodeDuplicator;
|
|
40
|
+
/**
|
|
41
|
+
* @return a function that deep-duplicates the given nodes (of type {@link INodeBase}),
|
|
42
|
+
* computing IDs using the `newIdFunc` function passed as the 2nd argument.
|
|
43
|
+
* @param languageBases the {@link ILanguageBase language bases} of the languages that the nodes might come from
|
|
44
|
+
* — these are necessary for their factories
|
|
45
|
+
* @param newIdFunc a function that computes a – not necessarily new – ID from a given original {@link INodeBase node}
|
|
46
|
+
* @param handleDelta an optional {@link DeltaHandler} that gets installed on the deep-cloned nodes
|
|
47
|
+
*/
|
|
48
|
+
export declare const deepDuplicatorFor: (languageBases: ILanguageBase[], newIdFunc: NewIdFunction, handleDelta?: DeltaHandler, idMapping?: IdMapping) => import("./duplicator.js").Duplicator;
|
|
49
|
+
//# sourceMappingURL=convenience.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"convenience.d.ts","sourceRoot":"","sources":["../src/convenience.ts"],"names":[],"mappings":"AAiBA,OAAO,EACH,EAAE,EAEF,cAAc,EACjB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAoB,YAAY,EAAE,SAAS,EAAE,aAAa,EAAE,SAAS,EAAC,MAAM,YAAY,CAAC;AAEhG,OAAO,EAAC,cAAc,EAAC,MAAM,iBAAiB,CAAC;AAG/C;;GAEG;AACH,eAAO,MAAM,YAAY,aAAc,SAAS,KAAG,SAAS,EAS3D,CAAA;AAGD;;;;;;;;;;GAUG;AACH,eAAO,MAAM,kBAAkB,sBAAuB,SAAS,GAAG,SAAS,EAAE,oBAAoB,SAAS,EAAE,KAAG,eAAe,SAAS,CAAC,EACrC,CAAC;AAGpG;;;;;;GAMG;AACH,eAAO,MAAM,aAAa,kBAAmB,aAAa,EAAE,gBAAgB,YAAY,yCACJ,CAAC;AAGrF;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG,CAAC,YAAY,EAAE,SAAS,KAAK,EAAE,CAAC;AAG5D;;;;;;GAMG;AACH,eAAO,MAAM,wBAAwB,kBAAmB,aAAa,EAAE,aAAa,aAAa,gBAAgB,YAAY,cAAc,SAAS,KAAG,cAMlJ,CAAC;AAGN;;;;;;;GAOG;AACH,eAAO,MAAM,iBAAiB,kBAAmB,aAAa,EAAE,aAAa,aAAa,gBAAgB,YAAY,cAAc,SAAS,yCAC5C,CAAC"}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
// Copyright 2025 TRUMPF Laser SE and other contributors
|
|
2
|
+
//
|
|
3
|
+
// Licensed under the Apache License, Version 2.0 (the "License")
|
|
4
|
+
// you may not use this file except in compliance with the License.
|
|
5
|
+
// You may obtain a copy of the License at
|
|
6
|
+
//
|
|
7
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
//
|
|
9
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
// See the License for the specific language governing permissions and
|
|
13
|
+
// limitations under the License.
|
|
14
|
+
//
|
|
15
|
+
// SPDX-FileCopyrightText: 2025 TRUMPF Laser SE and other contributors
|
|
16
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
17
|
+
import { incomingReferences as lwIncomingReferences } from "@lionweb/core";
|
|
18
|
+
import { deepDuplicateWith } from "./index.js";
|
|
19
|
+
import { nodeBaseReader } from "./serializer.js";
|
|
20
|
+
/**
|
|
21
|
+
* @return all descendant nodes from the given node, including that node itself.
|
|
22
|
+
*/
|
|
23
|
+
export const allNodesFrom = (rootNode) => {
|
|
24
|
+
const nodes = [rootNode];
|
|
25
|
+
const visit = (node) => {
|
|
26
|
+
const children = node.children;
|
|
27
|
+
nodes.push(...children);
|
|
28
|
+
children.forEach(visit);
|
|
29
|
+
};
|
|
30
|
+
visit(rootNode);
|
|
31
|
+
return nodes;
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* Finds all references coming into the given target node or any of the given target nodes,
|
|
35
|
+
* within the search scope (given as _root_ nodes),
|
|
36
|
+
* returning these as {@link ReferenceValue reference values}.
|
|
37
|
+
* Note that any reference is found uniquely,
|
|
38
|
+
* i.e. the returned {@link ReferenceValue reference values} are pairwise distinct,
|
|
39
|
+
* even if the given target nodes or scope contain duplicate nodes.
|
|
40
|
+
*
|
|
41
|
+
* @param targetNodeOrNodes one or more target {@link Node nodes} for which the incoming references are searched
|
|
42
|
+
* @param rootNodesInScope the {@link Node _root_ nodes} of the model that's searched for references
|
|
43
|
+
*/
|
|
44
|
+
export const incomingReferences = (targetNodeOrNodes, rootNodesInScope) => lwIncomingReferences(targetNodeOrNodes, rootNodesInScope.flatMap(allNodesFrom), nodeBaseReader);
|
|
45
|
+
/**
|
|
46
|
+
* @return a function that deep-clones the given nodes (of type {@link INodeBase}),
|
|
47
|
+
* *without* generating new IDs.
|
|
48
|
+
* @param languageBases the {@link ILanguageBase language bases} of the languages that the nodes might come from
|
|
49
|
+
* — these are necessary for their factories
|
|
50
|
+
* @param handleDelta an optional {@link DeltaHandler} that gets installed on the deep-cloned nodes
|
|
51
|
+
*/
|
|
52
|
+
export const deepClonerFor = (languageBases, handleDelta) => deepDuplicatorFor(languageBases, (originalNode) => originalNode.id, handleDelta);
|
|
53
|
+
/**
|
|
54
|
+
* @return a {@link NodeDuplicator} function that does the “obvious” thing, given the parameters:
|
|
55
|
+
* @param languageBases an array of languages in the form of {@link ILanguageBase}s
|
|
56
|
+
* @param newIdFunc a function that computes a – not necessarily new – ID from a given original {@link INodeBase node}
|
|
57
|
+
* @param handleDelta an optional {@link DeltaHandler}
|
|
58
|
+
* @param idMapping an optional {@link IdMapping}
|
|
59
|
+
*/
|
|
60
|
+
export const defaultNodeDuplicatorFor = (languageBases, newIdFunc, handleDelta, idMapping) => (originalNode) => {
|
|
61
|
+
const languageBase = languageBases.find((languageBase) => languageBase.language === originalNode.classifier.language);
|
|
62
|
+
const duplicatedNode = languageBase.factory(handleDelta)(originalNode.classifier, newIdFunc(originalNode));
|
|
63
|
+
idMapping?.updateWith(duplicatedNode);
|
|
64
|
+
return [duplicatedNode, originalNode.setFeatures];
|
|
65
|
+
};
|
|
66
|
+
/**
|
|
67
|
+
* @return a function that deep-duplicates the given nodes (of type {@link INodeBase}),
|
|
68
|
+
* computing IDs using the `newIdFunc` function passed as the 2nd argument.
|
|
69
|
+
* @param languageBases the {@link ILanguageBase language bases} of the languages that the nodes might come from
|
|
70
|
+
* — these are necessary for their factories
|
|
71
|
+
* @param newIdFunc a function that computes a – not necessarily new – ID from a given original {@link INodeBase node}
|
|
72
|
+
* @param handleDelta an optional {@link DeltaHandler} that gets installed on the deep-cloned nodes
|
|
73
|
+
*/
|
|
74
|
+
export const deepDuplicatorFor = (languageBases, newIdFunc, handleDelta, idMapping) => deepDuplicateWith(defaultNodeDuplicatorFor(languageBases, newIdFunc, handleDelta, idMapping));
|
|
75
|
+
//# sourceMappingURL=convenience.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"convenience.js","sourceRoot":"","sources":["../src/convenience.ts"],"names":[],"mappings":"AAAA,wDAAwD;AACxD,EAAE;AACF,iEAAiE;AACjE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,iDAAiD;AACjD,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AACjC,EAAE;AACF,sEAAsE;AACtE,sCAAsC;AAEtC,OAAO,EAEH,kBAAkB,IAAI,oBAAoB,EAE7C,MAAM,eAAe,CAAC;AACvB,OAAO,EAAC,iBAAiB,EAAoD,MAAM,YAAY,CAAC;AAChG,OAAO,EAAC,cAAc,E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AU,EAAE,SAAS,CAAC,YAAY,CAAC,CAAC,CAAC;IAC3G,SAAS,EAAE,UAAU,CAAC,cAAc,CAAC,CAAC;IACtC,OAAO,CAAC,cAAc,EAAE,YAAY,CAAC,WAAW,CAAC,CAAC;AACtD,CAAC,CAAC;AAGN;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,aAA8B,EAAE,SAAwB,EAAE,WAA0B,EAAE,SAAqB,EAAE,EAAE,CAC7I,iBAAiB,CAAC,wBAAwB,CAAC,aAAa,EAAE,SAAS,EAAE,WAAW,EAAE,SAAS,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { IdMapping } from "../id-mapping.js";
|
|
2
|
+
import { IDelta } from "./base.js";
|
|
3
|
+
/**
|
|
4
|
+
* Applies the given {@link Delta deltas} to the {@link INodeBase nodes} (object-)referenced in the deltas.
|
|
5
|
+
*/
|
|
6
|
+
export declare const applyDeltas: (deltas: IDelta[]) => void;
|
|
7
|
+
/**
|
|
8
|
+
* Applies the given {@link Delta delta} to the {@link INodeBase nodes} (object-)referenced in the delta.
|
|
9
|
+
*/
|
|
10
|
+
export declare const applyDelta: (delta: IDelta) => void;
|
|
11
|
+
/**
|
|
12
|
+
* Applies the given {@link Delta deltas} to {@link INodeBase nodes} given as the values of a {@link IdMapping ID mapping id → node}.
|
|
13
|
+
* Note that the deltas are *not* applied to the original nodes (object-)referenced by the deltas, but to the nodes present in the ID mapping.
|
|
14
|
+
* These can be distinct from the original nodes, e.g. after a roundtrip to an external model processor.
|
|
15
|
+
*
|
|
16
|
+
* @usage should look as follows.
|
|
17
|
+
*
|
|
18
|
+
* ```typescript
|
|
19
|
+
* const {roots, idMapping} = deserializeAsLDMModelWithMapping(serializationChunk, handleDelta);
|
|
20
|
+
* applyDeltasWithLookup(idMapping, deltas);
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
export declare const applyDeltasWithLookup: (idMapping: IdMapping, deltas: IDelta[]) => void;
|
|
24
|
+
/**
|
|
25
|
+
* Applies the given {@link Delta delta} to {@link nodes INodeBase} given as the values of a {@link IdMapping ID mapping id → node}.
|
|
26
|
+
* Note that the delta is *not* applied to the original nodes (object-)referenced by the deltas, but to the nodes present in the ID mapping.
|
|
27
|
+
* These can be distinct from the original nodes, e.g. after a roundtrip to an external model processor. *
|
|
28
|
+
* @usage should look as follows.
|
|
29
|
+
*
|
|
30
|
+
* ```typescript
|
|
31
|
+
* const {roots, idMapping} = deserializeAsLDMModelWithMapping(serializationChunk, handleDelta);
|
|
32
|
+
* applyDeltaWithLookup(idMapping, delta);
|
|
33
|
+
* ```
|
|
34
|
+
*/
|
|
35
|
+
export declare const applyDeltaWithLookup: (idMapping: IdMapping, delta: IDelta) => void;
|
|
36
|
+
/**
|
|
37
|
+
* Updates the given {@link IdMapping ID mapping} with the given {@link IDelta delta}.
|
|
38
|
+
* This is important if the delta adds a newly-created node to the model.
|
|
39
|
+
* (This function is here to avoid that {@link IdMapping} needs to know about {@link IDelta delta types}.)
|
|
40
|
+
*/
|
|
41
|
+
export declare const updateIdMappingWithDelta: (idMapping: IdMapping, delta: IDelta) => void;
|
|
42
|
+
//# sourceMappingURL=appliers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"appliers.d.ts","sourceRoot":"","sources":["../../src/deltas/appliers.ts"],"names":[],"mappings":"AA6CA,OAAO,EAAC,SAAS,EAAC,MAAM,kBAAkB,CAAC;AAE3C,OAAO,EAAC,MAAM,EAAC,MAAM,WAAW,CAAC;AA8MjC;;GAEG;AACH,eAAO,MAAM,WAAW,WAAY,MAAM,EAAE,KAAG,IAE9C,CAAC;AAGF;;GAEG;AACH,eAAO,MAAM,UAAU,UA9MX,MAAM,KAAG,IA8MmB,CAAA;AAGxC;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,qBAAqB,cAAe,SAAS,UAAU,MAAM,EAAE,KAAG,IAE9E,CAAC;AAGF;;;;;;;;;;GAUG;AACH,eAAO,MAAM,oBAAoB,cAAe,SAAS,SAAS,MAAM,KAAG,IACzC,CAAA;AAGlC;;;;GAIG;AACH,eAAO,MAAM,wBAAwB,cAAe,SAAS,SAAS,MAAM,SAW3E,CAAC"}
|
|
@@ -0,0 +1,274 @@
|
|
|
1
|
+
// Copyright 2025 TRUMPF Laser SE and other contributors
|
|
2
|
+
//
|
|
3
|
+
// Licensed under the Apache License, Version 2.0 (the "License")
|
|
4
|
+
// you may not use this file except in compliance with the License.
|
|
5
|
+
// You may obtain a copy of the License at
|
|
6
|
+
//
|
|
7
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
//
|
|
9
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
// See the License for the specific language governing permissions and
|
|
13
|
+
// limitations under the License.
|
|
14
|
+
//
|
|
15
|
+
// SPDX-FileCopyrightText: 2025 TRUMPF Laser SE and other contributors
|
|
16
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
17
|
+
import { AnnotationAddedDelta, AnnotationDeletedDelta, AnnotationMovedFromOtherParentDelta, AnnotationMovedInSameParentDelta, AnnotationReplacedDelta, ChildAddedDelta, ChildDeletedDelta, ChildMovedDelta, ChildMovedInSameContainmentDelta, ChildReplacedDelta, NoOpDelta, PropertyAddedDelta, PropertyChangedDelta, PropertyDeletedDelta, ReferenceAddedDelta, ReferenceDeletedDelta, ReferenceMovedDelta, ReferenceMovedInSameReferenceDelta, ReferenceReplacedDelta } from "./types.g.js";
|
|
18
|
+
import { unresolved } from "@lionweb/core";
|
|
19
|
+
/**
|
|
20
|
+
* @return a function that applies a given {@link Delta}, given an optional {@link IdMapping ID mapping}.
|
|
21
|
+
* If an {@link IdMapping} is provided, the {@link INodeBase nodes} relevant for the delta are looked up from that;
|
|
22
|
+
* otherwise, the delta is applied directly to (object-)referenced nodes.
|
|
23
|
+
*
|
|
24
|
+
* This is an internal function, solely meant to DRY the delta application with and without lookup in
|
|
25
|
+
*/
|
|
26
|
+
const deltaApplier = (idMapping) => (delta) => {
|
|
27
|
+
const lookupNodeFrom = (node) => {
|
|
28
|
+
if (idMapping === undefined) {
|
|
29
|
+
return node;
|
|
30
|
+
}
|
|
31
|
+
const lookup = idMapping.fromId(node.id);
|
|
32
|
+
if (lookup === undefined) {
|
|
33
|
+
throw new Error(`look up of node with id=${node.id} failed: node doesn't exist in ID mapping`);
|
|
34
|
+
}
|
|
35
|
+
if (node.classifier !== lookup.classifier) {
|
|
36
|
+
throw new Error(`look up of node with id=${node.id} failed: looked-up node has a different classifier than the original one`);
|
|
37
|
+
}
|
|
38
|
+
return lookup;
|
|
39
|
+
};
|
|
40
|
+
const lookupNodeRefFrom = (nodeRef) => {
|
|
41
|
+
if (idMapping === undefined) {
|
|
42
|
+
return nodeRef;
|
|
43
|
+
}
|
|
44
|
+
return nodeRef === unresolved
|
|
45
|
+
? unresolved
|
|
46
|
+
: lookupNodeFrom(nodeRef);
|
|
47
|
+
};
|
|
48
|
+
if (delta instanceof NoOpDelta) {
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
if (delta instanceof PropertyAddedDelta) {
|
|
52
|
+
lookupNodeFrom(delta.container).getPropertyValueManager(delta.property).setDirectly(delta.value);
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
if (delta instanceof PropertyChangedDelta) {
|
|
56
|
+
lookupNodeFrom(delta.container).getPropertyValueManager(delta.property).setDirectly(delta.newValue);
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
if (delta instanceof PropertyDeletedDelta) {
|
|
60
|
+
lookupNodeFrom(delta.container).getPropertyValueManager(delta.property).setDirectly(undefined);
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
if (delta instanceof ChildAddedDelta) {
|
|
64
|
+
const valueManager = lookupNodeFrom(delta.parent).getContainmentValueManager(delta.containment);
|
|
65
|
+
const newChild = lookupNodeFrom(delta.newChild);
|
|
66
|
+
if (delta.containment.multiple) {
|
|
67
|
+
valueManager.insertAtIndexDirectly(newChild, delta.index);
|
|
68
|
+
}
|
|
69
|
+
else {
|
|
70
|
+
valueManager.setDirectly(newChild);
|
|
71
|
+
}
|
|
72
|
+
newChild.attachTo(delta.parent, delta.containment);
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
if (delta instanceof ChildReplacedDelta) {
|
|
76
|
+
const valueManager = lookupNodeFrom(delta.parent).getContainmentValueManager(delta.containment);
|
|
77
|
+
const replacedChild = lookupNodeFrom(delta.replacedChild);
|
|
78
|
+
const newChild = lookupNodeFrom(delta.newChild);
|
|
79
|
+
if (delta.containment.multiple) {
|
|
80
|
+
const multiValueManager = valueManager;
|
|
81
|
+
multiValueManager.removeDirectly(replacedChild); // should be at index delta.index
|
|
82
|
+
multiValueManager.insertAtIndexDirectly(newChild, delta.index);
|
|
83
|
+
}
|
|
84
|
+
else {
|
|
85
|
+
valueManager.setDirectly(newChild);
|
|
86
|
+
}
|
|
87
|
+
replacedChild.detach();
|
|
88
|
+
newChild.attachTo(delta.parent, delta.containment);
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
if (delta instanceof ChildMovedDelta) {
|
|
92
|
+
const oldValueManager = delta.oldParent.getContainmentValueManager(delta.oldContainment);
|
|
93
|
+
const child = lookupNodeFrom(delta.child);
|
|
94
|
+
if (delta.oldContainment.multiple) {
|
|
95
|
+
oldValueManager.removeDirectly(child); // should be at index delta.oldIndex
|
|
96
|
+
}
|
|
97
|
+
else {
|
|
98
|
+
oldValueManager.setDirectly(undefined);
|
|
99
|
+
}
|
|
100
|
+
const newValueManager = delta.newParent.getContainmentValueManager(delta.newContainment);
|
|
101
|
+
if (delta.newContainment.multiple) {
|
|
102
|
+
newValueManager.insertAtIndexDirectly(child, delta.newIndex);
|
|
103
|
+
}
|
|
104
|
+
else {
|
|
105
|
+
newValueManager.setDirectly(child);
|
|
106
|
+
}
|
|
107
|
+
child.detach();
|
|
108
|
+
child.attachTo(delta.newParent, delta.newContainment);
|
|
109
|
+
return;
|
|
110
|
+
}
|
|
111
|
+
if (delta instanceof ChildMovedInSameContainmentDelta) {
|
|
112
|
+
const valueManager = lookupNodeFrom(delta.parent).getContainmentValueManager(delta.containment);
|
|
113
|
+
valueManager.moveDirectly(delta.oldIndex, delta.newIndex);
|
|
114
|
+
return;
|
|
115
|
+
}
|
|
116
|
+
if (delta instanceof ChildDeletedDelta) {
|
|
117
|
+
const valueManager = lookupNodeFrom(delta.parent).getContainmentValueManager(delta.containment);
|
|
118
|
+
if (delta.containment.multiple) {
|
|
119
|
+
const multiValueManager = valueManager;
|
|
120
|
+
multiValueManager.removeDirectly(lookupNodeFrom(delta.deletedChild));
|
|
121
|
+
}
|
|
122
|
+
else {
|
|
123
|
+
valueManager.setDirectly(undefined);
|
|
124
|
+
}
|
|
125
|
+
delta.deletedChild.detach();
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
if (delta instanceof ReferenceAddedDelta) {
|
|
129
|
+
const valueManager = lookupNodeFrom(delta.container).getReferenceValueManager(delta.reference);
|
|
130
|
+
const newTarget = lookupNodeRefFrom(delta.newTarget);
|
|
131
|
+
if (delta.reference.multiple) {
|
|
132
|
+
valueManager.insertAtIndexDirectly(newTarget, delta.index);
|
|
133
|
+
}
|
|
134
|
+
else {
|
|
135
|
+
valueManager.setDirectly(newTarget);
|
|
136
|
+
}
|
|
137
|
+
return;
|
|
138
|
+
}
|
|
139
|
+
if (delta instanceof ReferenceReplacedDelta) {
|
|
140
|
+
const valueManager = lookupNodeFrom(delta.container).getReferenceValueManager(delta.reference);
|
|
141
|
+
const replacedTarget = lookupNodeRefFrom(delta.replacedTarget);
|
|
142
|
+
const newTarget = lookupNodeRefFrom(delta.newTarget);
|
|
143
|
+
if (delta.reference.multiple) {
|
|
144
|
+
const multiValueManager = valueManager;
|
|
145
|
+
multiValueManager.removeDirectly(replacedTarget); // should be at index delta.index
|
|
146
|
+
multiValueManager.insertAtIndexDirectly(newTarget, delta.index);
|
|
147
|
+
}
|
|
148
|
+
else {
|
|
149
|
+
valueManager.setDirectly(newTarget);
|
|
150
|
+
}
|
|
151
|
+
return;
|
|
152
|
+
}
|
|
153
|
+
if (delta instanceof ReferenceMovedDelta) {
|
|
154
|
+
const oldValueManager = lookupNodeFrom(delta.oldContainer).getReferenceValueManager(delta.oldReference);
|
|
155
|
+
const target = lookupNodeRefFrom(delta.target);
|
|
156
|
+
if (delta.oldReference.multiple) {
|
|
157
|
+
oldValueManager.removeDirectly(target); // should be at index delta.oldIndex
|
|
158
|
+
}
|
|
159
|
+
else {
|
|
160
|
+
oldValueManager.setDirectly(undefined);
|
|
161
|
+
}
|
|
162
|
+
const newValueManager = lookupNodeFrom(delta.newContainer).getReferenceValueManager(delta.newReference);
|
|
163
|
+
if (delta.newReference.multiple) {
|
|
164
|
+
newValueManager.insertAtIndexDirectly(target, delta.newIndex);
|
|
165
|
+
}
|
|
166
|
+
else {
|
|
167
|
+
newValueManager.setDirectly(target);
|
|
168
|
+
}
|
|
169
|
+
return;
|
|
170
|
+
}
|
|
171
|
+
if (delta instanceof ReferenceMovedInSameReferenceDelta) {
|
|
172
|
+
const valueManager = lookupNodeFrom(delta.container).getReferenceValueManager(delta.reference);
|
|
173
|
+
valueManager.moveDirectly(delta.oldIndex, delta.newIndex);
|
|
174
|
+
return;
|
|
175
|
+
}
|
|
176
|
+
if (delta instanceof ReferenceDeletedDelta) {
|
|
177
|
+
const valueManager = lookupNodeFrom(delta.container).getReferenceValueManager(delta.reference);
|
|
178
|
+
const deletedTarget = lookupNodeRefFrom(delta.deletedTarget);
|
|
179
|
+
if (delta.reference.multiple) {
|
|
180
|
+
const multiValueManager = valueManager;
|
|
181
|
+
multiValueManager.removeDirectly(deletedTarget);
|
|
182
|
+
}
|
|
183
|
+
else {
|
|
184
|
+
valueManager.setDirectly(undefined);
|
|
185
|
+
}
|
|
186
|
+
return;
|
|
187
|
+
}
|
|
188
|
+
if (delta instanceof AnnotationAddedDelta) {
|
|
189
|
+
lookupNodeFrom(delta.parent).annotationsValueManager.insertAtIndexDirectly(delta.newAnnotation, delta.index);
|
|
190
|
+
delta.newAnnotation.attachTo(delta.parent, null);
|
|
191
|
+
return;
|
|
192
|
+
}
|
|
193
|
+
if (delta instanceof AnnotationDeletedDelta) {
|
|
194
|
+
lookupNodeFrom(delta.parent).annotationsValueManager.removeDirectly(delta.deletedAnnotation); // should be at index delta.index
|
|
195
|
+
delta.deletedAnnotation.detach();
|
|
196
|
+
return;
|
|
197
|
+
}
|
|
198
|
+
if (delta instanceof AnnotationReplacedDelta) {
|
|
199
|
+
const valueManager = lookupNodeFrom(delta.parent).annotationsValueManager;
|
|
200
|
+
valueManager.removeDirectly(delta.replacedAnnotation); // should be at index delta.index
|
|
201
|
+
delta.replacedAnnotation.detach();
|
|
202
|
+
valueManager.insertAtIndexDirectly(delta.newAnnotation, delta.index);
|
|
203
|
+
delta.newAnnotation.attachTo(delta.parent, null);
|
|
204
|
+
return;
|
|
205
|
+
}
|
|
206
|
+
if (delta instanceof AnnotationMovedFromOtherParentDelta) {
|
|
207
|
+
lookupNodeFrom(delta.oldParent).annotationsValueManager.removeDirectly(delta.movedAnnotation); // should be at index delta.index
|
|
208
|
+
delta.movedAnnotation.detach();
|
|
209
|
+
lookupNodeFrom(delta.newParent).annotationsValueManager.insertAtIndexDirectly(delta.movedAnnotation, delta.newIndex);
|
|
210
|
+
delta.movedAnnotation.attachTo(delta.newParent, null);
|
|
211
|
+
return;
|
|
212
|
+
}
|
|
213
|
+
if (delta instanceof AnnotationMovedInSameParentDelta) {
|
|
214
|
+
const valueManager = lookupNodeFrom(delta.parent).annotationsValueManager;
|
|
215
|
+
valueManager.moveDirectly(delta.oldIndex, delta.newIndex);
|
|
216
|
+
return;
|
|
217
|
+
}
|
|
218
|
+
throw new Error(`application of delta of class ${delta.constructor.name} not implemented`);
|
|
219
|
+
};
|
|
220
|
+
/**
|
|
221
|
+
* Applies the given {@link Delta deltas} to the {@link INodeBase nodes} (object-)referenced in the deltas.
|
|
222
|
+
*/
|
|
223
|
+
export const applyDeltas = (deltas) => {
|
|
224
|
+
deltas.forEach(applyDelta);
|
|
225
|
+
};
|
|
226
|
+
/**
|
|
227
|
+
* Applies the given {@link Delta delta} to the {@link INodeBase nodes} (object-)referenced in the delta.
|
|
228
|
+
*/
|
|
229
|
+
export const applyDelta = deltaApplier();
|
|
230
|
+
/**
|
|
231
|
+
* Applies the given {@link Delta deltas} to {@link INodeBase nodes} given as the values of a {@link IdMapping ID mapping id → node}.
|
|
232
|
+
* Note that the deltas are *not* applied to the original nodes (object-)referenced by the deltas, but to the nodes present in the ID mapping.
|
|
233
|
+
* These can be distinct from the original nodes, e.g. after a roundtrip to an external model processor.
|
|
234
|
+
*
|
|
235
|
+
* @usage should look as follows.
|
|
236
|
+
*
|
|
237
|
+
* ```typescript
|
|
238
|
+
* const {roots, idMapping} = deserializeAsLDMModelWithMapping(serializationChunk, handleDelta);
|
|
239
|
+
* applyDeltasWithLookup(idMapping, deltas);
|
|
240
|
+
* ```
|
|
241
|
+
*/
|
|
242
|
+
export const applyDeltasWithLookup = (idMapping, deltas) => {
|
|
243
|
+
deltas.forEach((delta) => applyDeltaWithLookup(idMapping, delta));
|
|
244
|
+
};
|
|
245
|
+
/**
|
|
246
|
+
* Applies the given {@link Delta delta} to {@link nodes INodeBase} given as the values of a {@link IdMapping ID mapping id → node}.
|
|
247
|
+
* Note that the delta is *not* applied to the original nodes (object-)referenced by the deltas, but to the nodes present in the ID mapping.
|
|
248
|
+
* These can be distinct from the original nodes, e.g. after a roundtrip to an external model processor. *
|
|
249
|
+
* @usage should look as follows.
|
|
250
|
+
*
|
|
251
|
+
* ```typescript
|
|
252
|
+
* const {roots, idMapping} = deserializeAsLDMModelWithMapping(serializationChunk, handleDelta);
|
|
253
|
+
* applyDeltaWithLookup(idMapping, delta);
|
|
254
|
+
* ```
|
|
255
|
+
*/
|
|
256
|
+
export const applyDeltaWithLookup = (idMapping, delta) => deltaApplier(idMapping)(delta);
|
|
257
|
+
/**
|
|
258
|
+
* Updates the given {@link IdMapping ID mapping} with the given {@link IDelta delta}.
|
|
259
|
+
* This is important if the delta adds a newly-created node to the model.
|
|
260
|
+
* (This function is here to avoid that {@link IdMapping} needs to know about {@link IDelta delta types}.)
|
|
261
|
+
*/
|
|
262
|
+
export const updateIdMappingWithDelta = (idMapping, delta) => {
|
|
263
|
+
if (delta instanceof ChildAddedDelta) {
|
|
264
|
+
idMapping.updateWith(delta.newChild);
|
|
265
|
+
}
|
|
266
|
+
if (delta instanceof ChildReplacedDelta) {
|
|
267
|
+
idMapping.updateWith(delta.newChild);
|
|
268
|
+
}
|
|
269
|
+
if (delta instanceof AnnotationAddedDelta) {
|
|
270
|
+
idMapping.updateWith(delta.newAnnotation);
|
|
271
|
+
}
|
|
272
|
+
// (nothing to be done: no need –yet?- to take deleted child nodes out of the ID mapping)
|
|
273
|
+
};
|
|
274
|
+
//# sourceMappingURL=appliers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"appliers.js","sourceRoot":"","sources":["../../src/deltas/appliers.ts"],"names":[],"mappings":"AAAA,wDAAwD;AACxD,EAAE;AACF,iEAAiE;AACjE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,iDAAiD;AACjD,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AACjC,EAAE;AACF,sEAAsE;AACtE,sCAAsC;AAEtC,OAAO,EACH,oBAAoB,EACpB,sBAAsB,EACtB,mCAAmC,EACnC,gCAAgC,EAChC,uBAAuB,EACvB,eAAe,EACf,iBAAiB,EACjB,eAAe,EACf,gCAAgC,EAChC,kBAAkB,EAClB,SAAS,EACT,kBAAkB,EAClB,oBAAoB,EACpB,oBAAoB,EACpB,mBAAmB,EACnB,qBAAq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