@tidal-ts/terminal 0.28.0 → 0.29.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/dist/terminalMachine.js +33 -22
- package/package.json +3 -3
package/dist/terminalMachine.js
CHANGED
|
@@ -1943,35 +1943,46 @@ export function canonRows(rows) {
|
|
|
1943
1943
|
.map((k) => [k, c.outputStyles[k]])
|
|
1944
1944
|
: null,
|
|
1945
1945
|
c.fan ?? null,
|
|
1946
|
-
// How the metric reads under a comparison
|
|
1947
|
-
//
|
|
1948
|
-
//
|
|
1949
|
-
|
|
1950
|
-
//
|
|
1951
|
-
//
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
|
-
|
|
1955
|
-
|
|
1946
|
+
// How the metric reads under a comparison, appended only when any of
|
|
1947
|
+
// it is set, so a config without it hashes exactly as it did before
|
|
1948
|
+
// these fields existed and a saved preset still matches: one joined
|
|
1949
|
+
// line or two (`compareFn`), what it reads as its other side when
|
|
1950
|
+
// wired by hand (`compareWith`), the symbol it is locked to
|
|
1951
|
+
// (`compareOn`), and how its compared line draws (`compareStyle`).
|
|
1952
|
+
// Each takes its slot, an absent one a `null`, and the tail is cut
|
|
1953
|
+
// after the last one present.
|
|
1954
|
+
...trimNulls([
|
|
1955
|
+
c.compareFn || null,
|
|
1956
|
+
c.compareWith
|
|
1957
|
+
? [
|
|
1956
1958
|
columnOf.get(c.compareWith.id) ?? null,
|
|
1957
1959
|
c.compareWith.side,
|
|
1958
1960
|
...(c.compareWith.output ? [c.compareWith.output] : []),
|
|
1959
|
-
]
|
|
1960
|
-
|
|
1961
|
-
|
|
1962
|
-
|
|
1963
|
-
|
|
1964
|
-
...(c.compareOn
|
|
1965
|
-
? [
|
|
1966
|
-
...(c.compareFn || c.compareWith ? [] : [null]),
|
|
1967
|
-
...(c.compareWith ? [] : [null]),
|
|
1968
|
-
c.compareOn,
|
|
1969
|
-
]
|
|
1970
|
-
: []),
|
|
1961
|
+
]
|
|
1962
|
+
: null,
|
|
1963
|
+
c.compareOn || null,
|
|
1964
|
+
styleEntries(c.compareStyle),
|
|
1965
|
+
]),
|
|
1971
1966
|
]),
|
|
1972
1967
|
];
|
|
1973
1968
|
}));
|
|
1974
1969
|
}
|
|
1970
|
+
/** A style's set fields as key-sorted pairs, or `null` when none is set: a
|
|
1971
|
+
* field cleared to `undefined` hashes as absent, as it reads after a JSON
|
|
1972
|
+
* round-trip (PR #53 review). */
|
|
1973
|
+
const styleEntries = (st) => {
|
|
1974
|
+
const set = Object.entries(st ?? {})
|
|
1975
|
+
.filter(([, v]) => v !== undefined)
|
|
1976
|
+
.sort(([a], [b]) => (a < b ? -1 : a > b ? 1 : 0));
|
|
1977
|
+
return set.length > 0 ? set : null;
|
|
1978
|
+
};
|
|
1979
|
+
/** `xs` without its trailing `null`s. */
|
|
1980
|
+
const trimNulls = (xs) => {
|
|
1981
|
+
let n = xs.length;
|
|
1982
|
+
while (n > 0 && xs[n - 1] === null)
|
|
1983
|
+
n--;
|
|
1984
|
+
return xs.slice(0, n);
|
|
1985
|
+
};
|
|
1975
1986
|
/** The active slot: first saved preset whose rows deep-equal the live rows, else
|
|
1976
1987
|
* null (custom). The single derivation behind the filled circle + the seed. */
|
|
1977
1988
|
export function activeSlot(presets, rows) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tidal-ts/terminal",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.29.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "The terminal machine — an XState v5 statechart that owns a chart's configuration (rows, series, studies, pairs, axes, presets) and never its data.",
|
|
6
6
|
"license": "MIT",
|
|
@@ -36,8 +36,8 @@
|
|
|
36
36
|
"xstate": "^5.28.0"
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@tidal-ts/chart": "0.
|
|
40
|
-
"@tidal-ts/core": "0.
|
|
39
|
+
"@tidal-ts/chart": "0.29.0",
|
|
40
|
+
"@tidal-ts/core": "0.29.0"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
43
|
"@pond-ts/charts": "^0.78.0",
|