@forgebook/story-format 0.2.0 → 0.2.1

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/src/csf.d.ts CHANGED
@@ -123,6 +123,12 @@ export type ArgType = {
123
123
  export type ArgTypes<TArgs> = {
124
124
  readonly [Name in keyof TArgs]?: ArgType;
125
125
  } & Readonly<Record<string, ArgType>>;
126
+ /**
127
+ * Where a component's required props are listed in its API reference and Props tab: `in-groups` puts them first
128
+ * inside each group (and in the props that name none), `section` lists them all in one "Required" section before
129
+ * every group, each naming its group, and `false` keeps the order of the source.
130
+ */
131
+ export type RequiredFirst = "in-groups" | "section" | false;
126
132
  /** A component's or a story's design, in the tool it was drawn in. */
127
133
  export type StoryDesign = {
128
134
  /**
@@ -209,6 +215,13 @@ export type StoryParameters = {
209
215
  * first appear. Written plainly, a list of string literals (the index reads it).
210
216
  */
211
217
  readonly propGroups?: readonly string[];
218
+ /**
219
+ * Where the required props are listed (`RequiredFirst`): on a meta, for the component's page and every story's
220
+ * Props tab; on a story, for its own Props tab, over the meta's. Both win over the catalogue's `requiredFirst`;
221
+ * a reader's "Required first" switch turns the ordering on or off over all three, never choosing the layout.
222
+ * `in-groups` by default. Written plainly, `"in-groups"`, `"section"` or `false` (the index reads it).
223
+ */
224
+ readonly requiredFirst?: RequiredFirst;
212
225
  /** CSF's documentation block; the catalogue reads the component's one-line description from it. */
213
226
  readonly docs?: {
214
227
  readonly description?: {
@@ -12,7 +12,7 @@
12
12
  *
13
13
  * @module
14
14
  */
15
- import type { StoryDeviceSetting, StoryGroup } from "./csf.ts";
15
+ import type { RequiredFirst, StoryDeviceSetting, StoryGroup } from "./csf.ts";
16
16
  import type { StoryTextTable } from "./texts.ts";
17
17
  /** What a Figma file is, as the embed's address names it. */
18
18
  export type FigmaFileKind = "design" | "proto" | "board" | "slides" | "deck";
@@ -70,6 +70,8 @@ export type StoryIndexEntry = {
70
70
  readonly isLogic?: boolean;
71
71
  /** The story's own `parameters.device`, when it sets one: the device it is shown in by default. */
72
72
  readonly device?: StoryDeviceSetting;
73
+ /** The story's own `parameters.requiredFirst`, when it sets one: where its Props tab lists the required props. */
74
+ readonly requiredFirst?: RequiredFirst;
73
75
  /**
74
76
  * The first sentence of the story's TSDoc, or its `parameters.docs.description.story`: what it shows and what to
75
77
  * notice.
@@ -107,6 +109,11 @@ export type StoryFileIndex = {
107
109
  readonly isLogic?: boolean;
108
110
  /** The meta's `parameters.device`, when it sets one: every story's device unless it sets its own fields. */
109
111
  readonly device?: StoryDeviceSetting;
112
+ /**
113
+ * The meta's `parameters.requiredFirst`, when it sets one: where the component's page and its stories' Props tabs
114
+ * list the required props, unless a story says otherwise.
115
+ */
116
+ readonly requiredFirst?: RequiredFirst;
110
117
  /** The meta's `alsoIn`, when it sets one: the other places the component is listed in. */
111
118
  readonly alsoIn?: readonly string[];
112
119
  /** The meta's `related`, when it sets one: the titles of the components its page names at its top. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@forgebook/story-format",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "description": "The story format of Forgebook: the CSF 3 types a story file is written with, generic over a framework, the StorySource a package hands a catalogue, the texts inside the stories in the shown language, and the story clock a Live story reads. No dependency: a library's stories depend on their framework's package, never on the catalogue that shows them.",
5
5
  "keywords": [
6
6
  "stories",