@ksp-gonogo/ui-kit 1.0.0-rc.21 → 1.0.0-rc.27

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/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
- /** Every declared symbol that measures `Kind`. */
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
- /** The ladder `Unit` is declared on, or `never` for a unit that climbs none. */
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
- * Every symbol of kind `Kind` that exists only as a conversion TARGET (`°C`),
24
- * which the declarations do not name and {@link kindOfConversion} still
25
- * resolves. A pair whose source is itself undeclared is skipped, or `°C→K`
33
+ * Every symbol of kind `Kind` that exists only as a conversion target (`°C`),
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;
@@ -42,14 +53,14 @@ type ConversionTargetsOfKind<Kind> = {
42
53
  */
43
54
  type FormatsFor<Unit extends string> = string extends Unit ? string : FormatsForKind<KindOfSymbol<Unit>>;
44
55
  /**
45
- * {@link FormatsFor}, asked of the KIND rather than of one of its units, for a
56
+ * {@link FormatsFor}, asked of the kind rather than of one of its units, for a
46
57
  * pin addressed to a whole group that has no single unit to check against.
47
58
  *
48
59
  * @category Unit
49
60
  */
50
61
  type FormatsForKind<Kind> = SymbolsOfKind<Kind>;
51
62
  /**
52
- * Every unit a value in `Unit` may be SHOWN as, which is every unit of its kind
63
+ * Every unit a value in `Unit` may be shown as, which is every unit of its kind
53
64
  * plus the presentation-only ones the conversion table reaches.
54
65
  *
55
66
  * Wider than {@link FormatsFor} by exactly the symbols that are not on the
@@ -60,7 +71,7 @@ type FormatsForKind<Kind> = SymbolsOfKind<Kind>;
60
71
  */
61
72
  type PresentableAs<Unit extends string> = string extends Unit ? string : PresentableAsKind<KindOfSymbol<Unit>>;
62
73
  /**
63
- * {@link PresentableAs}, asked of the KIND. See {@link FormatsForKind}.
74
+ * {@link PresentableAs}, asked of the kind. See {@link FormatsForKind}.
64
75
  *
65
76
  * @category Unit
66
77
  */
@@ -70,11 +81,15 @@ 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";
76
91
  /**
77
- * A quantity kind, OPEN to kinds this package has never heard of.
92
+ * A quantity kind, open to kinds this package has never heard of.
78
93
  *
79
94
  * The `string & {}` member lets a third-party Uplink introduce its own dimension
80
95
  * while the known kinds still autocomplete.
@@ -101,7 +116,7 @@ type LadderName = {
101
116
  [Unit in DeclaredUnit]: LadderOfSymbol<Unit>;
102
117
  }[DeclaredUnit];
103
118
  /**
104
- * What a pin may be addressed to: one GROUP, named the way the group is formed.
119
+ * What a pin may be addressed to: one group, named the way the group is formed.
105
120
  *
106
121
  * A unit on a ladder is named by the ladder, because every unit of it settles
107
122
  * together and `m`, `km` and `Mm` are one thing to pin. Everything else is named
@@ -161,13 +176,13 @@ declare const CONVERSIONS: {
161
176
  };
162
177
  };
163
178
  /**
164
- * A quantity as a screen reader should hear it: the value followed by the
165
- * unit's WORD rather than its symbol.
166
- *
167
- * For the places that cannot take a node (`aria-label`, `title`, an SVG
168
- * `aria-valuetext`), so an accessible name reads "250.0 kilometres" rather
169
- * than "kay em". If the result is going to be rendered, use {@link Unit} or
170
- * {@link writeQuantity}. Falls back to the symbol for a unit with no word.
179
+ * A quantity as text for a screen reader: the value followed by the unit's
180
+ * word, so an accessible name reads "250.0 kilometres" where the symbol would
181
+ * be spoken as "kay em". Useful in the places that cannot take a node
182
+ * (`aria-label`, `title`, an SVG `aria-valuetext`). Used by {@link Dial} and
183
+ * {@link Meter} for their accessible values. To render a quantity, use
184
+ * {@link Unit} or {@link writeQuantity}. Falls back to the symbol for a unit
185
+ * with no word.
171
186
  *
172
187
  * @category Unit
173
188
  */
@@ -176,7 +191,7 @@ declare function speakQuantity(quantity: {
176
191
  unit: string;
177
192
  } | null | undefined, opts?: FormatQuantityOptions): string;
178
193
  /**
179
- * A quantity as it is WRITTEN: the value and the unit's symbol, `250.0 km`.
194
+ * A quantity as it is written: the value and the unit's symbol, `250.0 km`.
180
195
  *
181
196
  * For visible text that cannot take a node: an SVG `<text>`, a canvas label, a
182
197
  * chart annotation measured before it is drawn. Anywhere a node fits, use
@@ -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
- /** The rung the value was last shown at, so a value hovering on a boundary does not flicker. */
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
  /**
@@ -256,7 +282,7 @@ interface QuantityScale {
256
282
  /**
257
283
  * Build a {@link QuantityScale} whose rung is taken from `reference`.
258
284
  *
259
- * `reference` is the value that DEFINES the scale rather than a value on it:
285
+ * `reference` is the value that defines the scale rather than a value on it:
260
286
  * the top of an altimeter strip, an axis maximum. `opts.format` pins the rung
261
287
  * outright.
262
288
  *
@@ -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 KnownQuantityKind as d, type QuantityScale as e, speakQuantity as f, quantityScale as q, setQuantityLocale as s, writeQuantity as w };
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.21",
5
+ "version": "1.0.0-rc.27",
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.21"
82
+ "@ksp-gonogo/sitrep-sdk": "1.0.0-rc.27"
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
  }