@gjsify/stories 0.36.0 → 0.37.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.
@@ -1,7 +1,4 @@
1
- /**
2
- * Value type for a single story argument — covers every {@link ControlType}.
3
- * `null` represents "not set".
4
- */
1
+ /** A single story argument, for every {@link ControlType}; `null` means "not set". */
5
2
  export type StoryArgValue = string | number | boolean | null;
6
3
  /** Map of story-argument name → current value. */
7
4
  export type StoryArgs = Record<string, StoryArgValue>;
@@ -20,14 +17,12 @@ export interface StorySelectOption {
20
17
  value: StoryArgValue;
21
18
  }
22
19
  interface StoryControlBase {
23
- /** Argument key this control drives (matches a key in {@link StoryArgs}). */
20
+ /** Argument key this control drives (a key in {@link StoryArgs}). */
24
21
  name: string;
25
- /** Human-readable label shown beside the control. */
26
22
  label: string;
27
- /** Optional help / tooltip text. */
23
+ /** Help / tooltip text. */
28
24
  description?: string;
29
25
  }
30
- /** Free-text control. */
31
26
  export interface StoryTextControl extends StoryControlBase {
32
27
  type: ControlType.TEXT;
33
28
  defaultValue?: string;
@@ -37,7 +32,6 @@ export interface StoryColorControl extends StoryControlBase {
37
32
  type: ControlType.COLOR;
38
33
  defaultValue?: string;
39
34
  }
40
- /** Toggle control. */
41
35
  export interface StoryBooleanControl extends StoryControlBase {
42
36
  type: ControlType.BOOLEAN;
43
37
  defaultValue?: boolean;
@@ -57,17 +51,14 @@ export interface StorySelectControl extends StoryControlBase {
57
51
  defaultValue?: StoryArgValue;
58
52
  }
59
53
  /**
60
- * A control descriptor — a discriminated union on `type` so per-kind fields are
61
- * compile-time-checked (`min`/`max`/`step` only on NUMBER/RANGE, `options` only
62
- * on SELECT).
54
+ * Discriminated on `type`, so per-kind fields are compile-time-checked: `min`/`max`/`step`
55
+ * only on NUMBER/RANGE, `options` only on SELECT.
63
56
  */
64
57
  export type StoryControl = StoryTextControl | StoryColorControl | StoryBooleanControl | StoryNumberControl | StorySelectControl;
65
58
  /**
66
- * Metadata describing one story (or a group of variants of one component).
67
- *
68
- * `TComponent` defaults to `unknown` to keep this contract platform-free — the
69
- * GTK renderer passes a `GObject.GType`, a future web renderer might pass a tag
70
- * name. It is display-only.
59
+ * Metadata for one story, or for a group of variants of one component. `TComponent`
60
+ * defaults to `unknown` to keep the contract platform-free — the GTK renderer passes a
61
+ * `GObject.GType`, a web renderer a tag name — and is display-only either way.
71
62
  */
72
63
  export interface StoryMeta<TComponent = unknown> {
73
64
  /** `"Category/Name"` — the slash-prefix groups the navigation sidebar. */
@@ -82,9 +73,8 @@ export interface StoryMeta<TComponent = unknown> {
82
73
  controls?: StoryControl[];
83
74
  }
84
75
  /**
85
- * A renderer's story-widget contract: a zero-arg constructor that also exposes
86
- * static metadata. Each renderer specializes `TWidget` with its own base class
87
- * (the GTK renderer's `StoryWidget`, a future web renderer's element).
76
+ * A renderer's story-widget contract: a zero-arg constructor that also exposes static
77
+ * metadata, with `TWidget` specialised to that renderer's own base class.
88
78
  */
89
79
  export interface StoryComponentConstructor<TWidget = unknown> {
90
80
  new (): TWidget;
@@ -99,9 +89,8 @@ export interface StoryModule<TWidget = unknown> {
99
89
  instances?: TWidget[];
100
90
  }
101
91
  /**
102
- * Wraps a story's content-build step — e.g. to install a shared action group or
103
- * a mock environment around every story in a module. Runs in the renderer's
104
- * initialize path: call `build()` to perform the default construction.
92
+ * Wraps a story's content-build step, e.g. to install a shared action group or a mock
93
+ * environment around every story in a module. Call `build()` for the default construction.
105
94
  */
106
95
  export type StoryDecorator<TWidget = unknown> = (build: () => void, widget: TWidget) => void;
107
96
  /** Narrowing guard — `true` when `value` is a {@link StoryModule}. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gjsify/stories",
3
- "version": "0.36.0",
3
+ "version": "0.37.0",
4
4
  "description": "Runtime-agnostic story-authoring contract (controls, args, metadata) shared by every gjsify storybook renderer",
5
5
  "type": "module",
6
6
  "module": "lib/esm/index.js",
@@ -35,8 +35,8 @@
35
35
  ],
36
36
  "dependencies": {},
37
37
  "devDependencies": {
38
- "@gjsify/cli": "^0.36.0",
39
- "@gjsify/unit": "^0.36.0",
38
+ "@gjsify/cli": "^0.37.0",
39
+ "@gjsify/unit": "^0.37.0",
40
40
  "@types/node": "^25.9.2",
41
41
  "typescript": "^6.0.3"
42
42
  },