@kitlangton/knobs 0.4.0-next.14 → 0.4.0-next.16

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.
@@ -1,15 +1,7 @@
1
1
  import type { StoragePort } from "../core/storage.js";
2
- import type { MountPanelOptions, SectionFolded } from "../core/store.js";
2
+ import type { FoldSummaryInfo, MountPanelOptions, SectionFolded } from "../core/store.js";
3
3
  import type { Panel } from "./panel.js";
4
- /** What a folded card's or section's summary is made of (see `MountPageOptions.groupSummary`). */
5
- export interface FoldSummaryInfo {
6
- /** The group preset its values match (its name), "Custom" when none does; null without any. */
7
- readonly preset: string | null;
8
- /** How many of its rows differ from their defaults (a spring's two keys count once). */
9
- readonly changed: number;
10
- /** Its value keys. */
11
- readonly keys: readonly string[];
12
- }
4
+ export type { FoldSummaryInfo };
13
5
  export interface MountPageOptions extends MountPanelOptions {
14
6
  /** Section order; sections not listed follow in the order they first appear. */
15
7
  readonly sections?: readonly string[];
@@ -39,11 +31,6 @@ export interface MountPageOptions extends MountPanelOptions {
39
31
  * opening it if it's folded.
40
32
  */
41
33
  readonly nav?: boolean;
42
- /**
43
- * What a folded group card's header says. By default "<matching preset, or Custom> · N
44
- * changed", leaving out what doesn't apply. `null` shows nothing.
45
- */
46
- readonly groupSummary?: (group: string, info: FoldSummaryInfo) => string | Node | null;
47
34
  /** What a folded section's heading says ("N changed · M cards" by default; `preset` is null). */
48
35
  readonly sectionSummary?: (section: string, info: FoldSummaryInfo) => string | Node | null;
49
36
  }
@@ -0,0 +1,22 @@
1
+ import type { Controls } from "../core/store.js";
2
+ /** A row of a folded panel card, as its summary reads it. */
3
+ export interface SummaryRow {
4
+ /** Its value as text ("CSS orb", "12 px"), or "" where it has no short form. */
5
+ readonly value: string;
6
+ /** Whether it differs from its default. */
7
+ readonly changed: boolean;
8
+ /** Whether it's a choice (the likeliest to say what the card is set to). */
9
+ readonly choice: boolean;
10
+ }
11
+ /**
12
+ * A folded panel card's summary, by default: a one-row card's value; otherwise the most telling
13
+ * value (its matching group preset, else its first changed value, else its first choice) and
14
+ * "N changed", each only where it applies. `preset` is null for a card without group presets.
15
+ */
16
+ export declare function panelFoldSummary(rows: readonly SummaryRow[], preset: string | null): string;
17
+ /**
18
+ * Which presets the values are measured against (the panel's, each scope's and each group's).
19
+ * It changes when one is chosen or saved even if no value moves, which still changes what counts
20
+ * as changed: marks, resets and folded summaries follow it.
21
+ */
22
+ export declare const baseSignature: (controls: Pick<Controls<any>, "activePreset" | "activeGroupPreset" | "scopes" | "groupPresets">) => string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kitlangton/knobs",
3
- "version": "0.4.0-next.14",
3
+ "version": "0.4.0-next.16",
4
4
  "description": "Per-component tuning controls. Explore in development, ship constants.",
5
5
  "type": "module",
6
6
  "license": "MIT",