@nakafa/aksara-contracts 8.17.0 → 8.17.1
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.
|
@@ -30,8 +30,9 @@ export declare function spaceFormulaFields(object: SpaceMathObject): readonly Fo
|
|
|
30
30
|
/** Reports one formula that reads a name it may not, at its root path. */
|
|
31
31
|
export declare function strayIssues(field: FormulaField, declared: readonly string[], root: readonly (string | number)[]): Schema.FilterIssue[];
|
|
32
32
|
/**
|
|
33
|
-
* Reports every formula that reads a name its object does not offer,
|
|
34
|
-
* slider whose name repeats an earlier one
|
|
33
|
+
* Reports every formula that reads a name its object does not offer, every
|
|
34
|
+
* slider whose name repeats an earlier one, and every slider that drives no
|
|
35
|
+
* object in the visual scene.
|
|
35
36
|
*/
|
|
36
37
|
export declare function formulaScopeIssues<Object>(objects: readonly Object[], fields: (object: Object) => readonly FormulaField[], parameters: readonly FormulaParameter[]): readonly Schema.FilterIssue[];
|
|
37
38
|
/** Each slider's starting value by its name, the scope a scene first draws with. */
|
|
@@ -104,8 +104,9 @@ export function strayIssues(field, declared, root) {
|
|
|
104
104
|
];
|
|
105
105
|
}
|
|
106
106
|
/**
|
|
107
|
-
* Reports every formula that reads a name its object does not offer,
|
|
108
|
-
* slider whose name repeats an earlier one
|
|
107
|
+
* Reports every formula that reads a name its object does not offer, every
|
|
108
|
+
* slider whose name repeats an earlier one, and every slider that drives no
|
|
109
|
+
* object in the visual scene.
|
|
109
110
|
*/
|
|
110
111
|
export function formulaScopeIssues(objects, fields, parameters) {
|
|
111
112
|
const names = Arr.map(parameters, ({ name }) => name);
|
|
@@ -118,8 +119,18 @@ export function formulaScopeIssues(objects, fields, parameters) {
|
|
|
118
119
|
},
|
|
119
120
|
]
|
|
120
121
|
: []);
|
|
122
|
+
const usedInObjects = Arr.reduce(Arr.flatMap(objects, fields), HashSet.empty(), (acc, field) => HashSet.union(acc, namesOf(field)));
|
|
123
|
+
const unused = Arr.flatMap(parameters, ({ name }, index) => Arr.contains(Arr.take(names, index), name) ||
|
|
124
|
+
HashSet.has(usedInObjects, name)
|
|
125
|
+
? []
|
|
126
|
+
: [
|
|
127
|
+
{
|
|
128
|
+
issue: `Expected slider "${name}" to drive at least one object in the visual scene.`,
|
|
129
|
+
path: ["parameters", index, "name"],
|
|
130
|
+
},
|
|
131
|
+
]);
|
|
121
132
|
const unknown = Arr.flatMap(objects, (object, index) => Arr.flatMap(fields(object), (field) => strayIssues(field, declared, ["objects", index])));
|
|
122
|
-
return [...repeated, ...unknown];
|
|
133
|
+
return [...repeated, ...unused, ...unknown];
|
|
123
134
|
}
|
|
124
135
|
/** Each slider's starting value by its name, the scope a scene first draws with. */
|
|
125
136
|
export function parameterScope(parameters) {
|
package/package.json
CHANGED