@ksp-gonogo/ui-kit 1.0.0-rc.21 → 1.0.0-rc.25
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/README.md +8 -2
- package/dist/{chunk-GGJES6XH.js → chunk-JNKL3HA3.js} +307 -263
- package/dist/chunk-JNKL3HA3.js.map +1 -0
- package/dist/{chunk-IZZF25H2.js → chunk-SPBHQUHI.js} +1 -1
- package/dist/chunk-SPBHQUHI.js.map +1 -0
- package/dist/gridUnits.d.ts +4 -4
- package/dist/gridUnits.js +1 -1
- package/dist/guards.d.ts +2 -1
- package/dist/guards.js.map +1 -1
- package/dist/index.d.ts +938 -328
- package/dist/index.js +1388 -798
- package/dist/index.js.map +1 -1
- package/dist/reads-index.json +1559 -0
- package/dist/testing.d.ts +2 -1
- package/dist/testing.js +2 -2
- package/dist/testing.js.map +1 -1
- package/dist/tokens.css +2 -0
- package/dist/{units-Cl-8ZdJc.d.ts → units-DZYIWBWP.d.ts} +32 -6
- package/package.json +5 -12
- package/dist/chunk-GGJES6XH.js.map +0 -1
- package/dist/chunk-IZZF25H2.js.map +0 -1
package/dist/tokens.css
CHANGED
|
@@ -792,6 +792,8 @@ textarea {
|
|
|
792
792
|
--inset-jog-wheel-label: 0 var(--space-2);
|
|
793
793
|
/* The room a Meter figure keeps for the held mark drawn outside it. */
|
|
794
794
|
--inset-meter-mark: var(--space-6);
|
|
795
|
+
/* The room an avatar keeps from the edge of the control it sits in, on each side. */
|
|
796
|
+
--inset-avatar: var(--space-4);
|
|
795
797
|
|
|
796
798
|
/* Fields. */
|
|
797
799
|
--inset-field: var(--space-6) var(--space-8);
|
|
@@ -7,23 +7,34 @@ import { DeclaredUnit, UnitDeclarations, UnitRung } from '@ksp-gonogo/sitrep-sdk
|
|
|
7
7
|
* Every type in this module reads `UnitDeclarations` and nothing else, which is
|
|
8
8
|
* what makes a unit an Uplink merges into it indistinguishable here from a
|
|
9
9
|
* first-party one.
|
|
10
|
+
*
|
|
11
|
+
* @category Unit
|
|
10
12
|
*/
|
|
11
13
|
type KindOfSymbol<Unit extends string> = Unit extends DeclaredUnit ? UnitDeclarations[Unit] extends {
|
|
12
14
|
kind: infer Kind;
|
|
13
15
|
} ? Kind : never : never;
|
|
14
|
-
/**
|
|
16
|
+
/**
|
|
17
|
+
* Every declared symbol that measures `Kind`.
|
|
18
|
+
*
|
|
19
|
+
* @category Unit
|
|
20
|
+
*/
|
|
15
21
|
type SymbolsOfKind<Kind> = {
|
|
16
22
|
[Unit in DeclaredUnit]: KindOfSymbol<Unit> extends Kind ? Unit : never;
|
|
17
23
|
}[DeclaredUnit];
|
|
18
|
-
/**
|
|
24
|
+
/**
|
|
25
|
+
* The ladder `Unit` is declared on, or `never` for a unit that climbs none.
|
|
26
|
+
*
|
|
27
|
+
* @category Unit
|
|
28
|
+
*/
|
|
19
29
|
type LadderOfSymbol<Unit extends string> = Unit extends DeclaredUnit ? UnitDeclarations[Unit] extends {
|
|
20
30
|
ladder: infer Ladder extends string;
|
|
21
31
|
} ? Ladder : never : never;
|
|
22
32
|
/**
|
|
23
33
|
* Every symbol of kind `Kind` that exists only as a conversion TARGET (`°C`),
|
|
24
|
-
* which the declarations do not name
|
|
25
|
-
* resolves. A pair whose source is itself undeclared is skipped, or `°C→K`
|
|
34
|
+
* which the declarations do not name but a conversion still reaches. A pair whose source is itself undeclared is skipped, or `°C→K`
|
|
26
35
|
* would make every kind accept `K`.
|
|
36
|
+
*
|
|
37
|
+
* @category Unit
|
|
27
38
|
*/
|
|
28
39
|
type ConversionTargetsOfKind<Kind> = {
|
|
29
40
|
[Conversion in keyof typeof CONVERSIONS]: Conversion extends `${infer Source}→${infer Target}` ? [KindOfSymbol<Source>] extends [never] ? never : [KindOfSymbol<Source>] extends [Kind] ? Target : never : never;
|
|
@@ -70,6 +81,10 @@ type PresentableAsKind<Kind> = SymbolsOfKind<Kind> | ConversionTargetsOfKind<Kin
|
|
|
70
81
|
* `m` and `km` are interchangeable and `m` and `m/s` are not, and it selects
|
|
71
82
|
* the ladder and the precision rule.
|
|
72
83
|
*
|
|
84
|
+
* A kind names a dimension, never a unit symbol: `length` is what `m` and `km`
|
|
85
|
+
* measure, `planeAngle` is what `°` measures and `universalTime` is what `ut`
|
|
86
|
+
* measures.
|
|
87
|
+
*
|
|
73
88
|
* @category Unit
|
|
74
89
|
*/
|
|
75
90
|
type KnownQuantityKind = "length" | "speed" | "acceleration" | "mass" | "force" | "pressure" | "temperature" | "time" | "universalTime" | "specificImpulse" | "irlTime" | "planeAngle" | "power" | "data" | "dataRate" | "doseRate" | "irradiance" | "level" | "density" | "massFlow" | "gravParameter" | "dimensionless" | "percent" | "scienceData" | "scienceRate" | "ratio" | "area" | "volume" | "angularSpeed" | "funds" | "science" | "reputation" | "fundsRate" | "reputationRate" | "count" | "id" | "resourceUnits" | "resourceFlow" | "text" | "flag" | "enum" | "n/a";
|
|
@@ -191,6 +206,11 @@ declare function writeQuantity(quantity: {
|
|
|
191
206
|
magnitude: number;
|
|
192
207
|
unit: string;
|
|
193
208
|
} | null | undefined, opts?: FormatQuantityOptions): string;
|
|
209
|
+
/**
|
|
210
|
+
* How a quantity is written: the unit to pin, the number of decimals, and the scale to draw it against.
|
|
211
|
+
*
|
|
212
|
+
* @category Unit
|
|
213
|
+
*/
|
|
194
214
|
interface FormatQuantityOptions {
|
|
195
215
|
/**
|
|
196
216
|
* Pin the unit rather than letting the ladder choose, for where convention
|
|
@@ -219,7 +239,13 @@ interface FormatQuantityOptions {
|
|
|
219
239
|
as?: string;
|
|
220
240
|
/** Override the kind's decimal places. */
|
|
221
241
|
decimals?: number;
|
|
222
|
-
/**
|
|
242
|
+
/**
|
|
243
|
+
* The unit the last render settled on, read from the formatted quantity's `rung`.
|
|
244
|
+
* Pass it back so a value hovering on a boundary between two units does not
|
|
245
|
+
* flicker between them. Nothing keeps it for you: {@link Unit} formats each
|
|
246
|
+
* render from its props alone, so a caller that wants the steadiness holds
|
|
247
|
+
* the last rung and passes it here.
|
|
248
|
+
*/
|
|
223
249
|
heldSymbol?: string;
|
|
224
250
|
}
|
|
225
251
|
/**
|
|
@@ -267,4 +293,4 @@ declare function quantityScale(reference: {
|
|
|
267
293
|
unit: string;
|
|
268
294
|
} | null | undefined, opts?: FormatQuantityOptions): QuantityScale;
|
|
269
295
|
|
|
270
|
-
export { type FormatQuantityOptions as F, type KindOfGroup as K, type LadderName as L, type PresentableAs as P, type QuantityKind as Q, type Rung as R, type UnitGroupKey as U, type FormatsFor as a, type FormatsForKind as b, type PresentableAsKind as c, type
|
|
296
|
+
export { type ConversionTargetsOfKind as C, type FormatQuantityOptions as F, type KindOfGroup as K, type LadderName as L, type PresentableAs as P, type QuantityKind as Q, type Rung as R, type SymbolsOfKind as S, type UnitGroupKey as U, type FormatsFor as a, type FormatsForKind as b, type PresentableAsKind as c, type KindOfSymbol as d, type KnownQuantityKind as e, type LadderOfSymbol as f, type QuantityScale as g, speakQuantity as h, quantityScale as q, setQuantityLocale as s, writeQuantity as w };
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@ksp-gonogo/ui-kit",
|
|
3
3
|
"description": "Export-safe design system for Gonogo mission-control widgets and third-party Uplinks",
|
|
4
4
|
"license": "MIT",
|
|
5
|
-
"version": "1.0.0-rc.
|
|
5
|
+
"version": "1.0.0-rc.25",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"repository": {
|
|
8
8
|
"type": "git",
|
|
@@ -33,14 +33,15 @@
|
|
|
33
33
|
"./guards": {
|
|
34
34
|
"types": "./dist/guards.d.ts",
|
|
35
35
|
"import": "./dist/guards.js"
|
|
36
|
-
}
|
|
36
|
+
},
|
|
37
|
+
"./reads-index.json": "./dist/reads-index.json"
|
|
37
38
|
},
|
|
38
39
|
"types": "./dist/index.d.ts",
|
|
39
40
|
"files": [
|
|
40
41
|
"dist"
|
|
41
42
|
],
|
|
42
43
|
"scripts": {
|
|
43
|
-
"build": "tsup && node scripts/extend-package-specifiers.mjs && cp node_modules/@ksp-gonogo/theme/dist/tokens.css dist/tokens.css",
|
|
44
|
+
"build": "tsup && node scripts/extend-package-specifiers.mjs && cp node_modules/@ksp-gonogo/theme/dist/tokens.css dist/tokens.css && node ../../scripts/build-reads-index.mjs @ksp-gonogo/ui-kit src/index.ts,src/guards.ts,src/gridUnits.ts",
|
|
44
45
|
"dev": "tsup --watch",
|
|
45
46
|
"lint": "tsc --noEmit",
|
|
46
47
|
"render:markers": "node scripts/render-markers.ts",
|
|
@@ -75,23 +76,15 @@
|
|
|
75
76
|
},
|
|
76
77
|
"peerDependencies": {
|
|
77
78
|
"@fontsource/jetbrains-mono": "^5.0.0",
|
|
78
|
-
"esbuild": "^0.25.0 || ^0.28.0",
|
|
79
79
|
"jest-axe": "^10.0.0",
|
|
80
|
-
"playwright": "^1.50.0",
|
|
81
80
|
"react": "^18.0.0",
|
|
82
81
|
"styled-components": "^6.0.0",
|
|
83
|
-
"@ksp-gonogo/sitrep-sdk": "1.0.0-rc.
|
|
82
|
+
"@ksp-gonogo/sitrep-sdk": "1.0.0-rc.25"
|
|
84
83
|
},
|
|
85
84
|
"peerDependenciesMeta": {
|
|
86
85
|
"jest-axe": {
|
|
87
86
|
"optional": true
|
|
88
87
|
},
|
|
89
|
-
"esbuild": {
|
|
90
|
-
"optional": true
|
|
91
|
-
},
|
|
92
|
-
"playwright": {
|
|
93
|
-
"optional": true
|
|
94
|
-
},
|
|
95
88
|
"@fontsource/jetbrains-mono": {
|
|
96
89
|
"optional": true
|
|
97
90
|
}
|