@gtkx/storybook 0.0.1 → 2.0.0-beta.11

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 +1 @@
1
- {"version":3,"file":"compose.js","sourceRoot":"","sources":["../src/compose.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAUtC,OAAO,EAAE,uBAAuB,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAEvE,MAAM,aAAa,GAAG,CAAC,KAAc,EAAQ,EAAE;IAC3C,IAAI,KAAK,KAAK,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QACtE,MAAM,IAAI,SAAS,CAAC,mCAAmC,CAAC,CAAC;IAC7D,CAAC;AACL,CAAC,CAAC;AAEF;;;;;;;;;;;GAWG;AACH,MAAM,YAAY,GAAG,CACjB,KAAuC,EACvC,IAA0B,EAC1B,UAAmB,EAAE,EACrB,UAAmB,EACC,EAAE;IACtB,aAAa,CAAC,KAAK,CAAC,CAAC;IACrB,aAAa,CAAC,IAAI,CAAC,CAAC;IACpB,aAAa,CAAC,OAAO,CAAC,CAAC;IAEvB,IAAI,CAAC,KAAK,CAAC,MAAM,IAAI,CAAC,IAAI,CAAC,MAAM,IAAI,CAAC,OAAO,CAAC,MAAM,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,CAAC;QACtE,MAAM,IAAI,SAAS,CAAC,8CAA8C,CAAC,CAAC;IACxE,CAAC;IAED,OAAO,uBAAuB,CAAC,KAAK,EAAE,EAAE,GAAG,IAAI,EAAE,EAAE,OAAO,EAAE;QACxD,MAAM,EAAE,CAAC,IAAI,EAAE,EAAE;YACb,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,CAAC;gBAClB,MAAM,IAAI,SAAS,CAAC,8CAA8C,CAAC,CAAC;YACxE,CAAC;YAED,OAAO,aAAa,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;QAC/C,CAAC;KACJ,EAAE,UAAU,CAAC,CAAC;AACnB,CAAC,CAAC;AAEF;;;;;;;;;GASG;AACH,MAAM,cAAc,GAAG,CACnB,OAAgB,EAChB,UAAmB,EAAE,EACG,EAAE;IAC1B,aAAa,CAAC,OAAO,CAAC,CAAC;IACvB,aAAa,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;IAC/B,aAAa,CAAC,OAAO,CAAC,CAAC;IAEvB,MAAM,IAAI,GAAG,OAAO,CAAC,OAA8B,CAAC;IACpD,MAAM,QAAQ,GAAsC,EAAE,CAAC;IAEvD,KAAK,MAAM,CAAC,UAAU,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC;QACxD,IAAI,UAAU,KAAK,SAAS,IAAI,UAAU,KAAK,qBAAqB,IAAI,CAAC,aAAa,CAAC,UAAU,EAAE,IAAI,CAAC,EAAE,CAAC;YACvG,SAAS;QACb,CAAC;QAED,aAAa,CAAC,KAAK,CAAC,CAAC;QACrB,MAAM,CAAC,cAAc,CAAC,QAAQ,EAAE,UAAU,EAAE;YACxC,KAAK,EAAE,YAAY,CAAC,KAA+B,EAAE,IAAI,EAAE,OAAO,EAAE,UAAU,CAAC;YAC/E,UAAU,EAAE,IAAI;YAChB,YAAY,EAAE,IAAI;YAClB,QAAQ,EAAE,IAAI;SACjB,CAAC,CAAC;IACP,CAAC;IAED,OAAO,QAAoC,CAAC;AAChD,CAAC,CAAC;AAEF,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,CAAC","sourcesContent":["import { createElement } from \"react\";\nimport type {\n Args,\n ComponentMeta,\n ComposedStories,\n ComposedStory,\n Preview,\n StoryAnnotations,\n StoryModule,\n} from \"./types.js\";\nimport { composeStoryAnnotations, isExportStory } from \"./upstream.js\";\n\nconst requireObject = (value: unknown): void => {\n if (value === null || typeof value !== \"object\" || Array.isArray(value)) {\n throw new TypeError(\"Expected a CSF3 annotation object\");\n }\n};\n\n/**\n * Composes a CSF3 story into a native React component with resolved defaults and decorators.\n * Compose outside render to preserve component identity. Rendering props override the composed args.\n * This function does not create an application, window, or Storybook preview lifecycle.\n *\n * @param story The named story's annotations.\n * @param meta The module's default component metadata.\n * @param preview Shared project annotations, scoped to this composition.\n * @param exportName Export name used for the story identifier and default display name.\n * @returns A renderable component exposing its composed annotations.\n * @throws If an annotation is not an object or no component or render function is available.\n */\nconst composeStory = <TArgs extends object>(\n story: StoryAnnotations<NoInfer<TArgs>>,\n meta: ComponentMeta<TArgs>,\n preview: Preview = {},\n exportName?: string,\n): ComposedStory<TArgs> => {\n requireObject(story);\n requireObject(meta);\n requireObject(preview);\n\n if (!story.render && !meta.render && !preview.render && !meta.component) {\n throw new TypeError(\"A story needs a component or render function\");\n }\n\n return composeStoryAnnotations(story, { ...meta }, preview, {\n render: (args) => {\n if (!meta.component) {\n throw new TypeError(\"A story needs a component or render function\");\n }\n\n return createElement(meta.component, args);\n },\n }, exportName);\n};\n\n/**\n * Composes the selected CSF3 exports of a module into native React components.\n * The default export supplies metadata; its includeStories and excludeStories select named exports.\n * Returned keys retain the original export names.\n *\n * @param stories A story module containing default metadata and named story objects.\n * @param preview Shared project annotations, scoped to the returned compositions.\n * @returns Composed components keyed by the selected export names.\n * @throws If metadata or a selected export is invalid, or a selected story has no renderer.\n */\nconst composeStories = <TModule extends StoryModule>(\n stories: TModule,\n preview: Preview = {},\n): ComposedStories<TModule> => {\n requireObject(stories);\n requireObject(stories.default);\n requireObject(preview);\n\n const meta = stories.default as ComponentMeta<Args>;\n const composed: Partial<ComposedStories<TModule>> = {};\n\n for (const [exportName, story] of Object.entries(stories)) {\n if (exportName === \"default\" || exportName === \"__namedExportsOrder\" || !isExportStory(exportName, meta)) {\n continue;\n }\n\n requireObject(story);\n Object.defineProperty(composed, exportName, {\n value: composeStory(story as StoryAnnotations<Args>, meta, preview, exportName),\n enumerable: true,\n configurable: true,\n writable: true,\n });\n }\n\n return composed as ComposedStories<TModule>;\n};\n\nexport { composeStory, composeStories };\n"]}
1
+ {"version":3,"file":"compose.js","sourceRoot":"","sources":["../src/compose.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAUtC,OAAO,EAAE,uBAAuB,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAEvE,MAAM,aAAa,GAAG,CAAC,KAAc,EAAQ,EAAE;IAC3C,IAAI,KAAK,KAAK,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QACtE,MAAM,IAAI,SAAS,CAAC,mCAAmC,CAAC,CAAC;IAC7D,CAAC;AACL,CAAC,CAAC;AAEF;;;;;;;;;;;GAWG;AACH,MAAM,YAAY,GAAG,CACjB,KAAuC,EACvC,IAA0B,EAC1B,UAAmB,EAAE,EACrB,UAAmB,EACC,EAAE;IACtB,IAAI,CAAC,KAAK,CAAC,MAAM,IAAI,CAAC,IAAI,CAAC,MAAM,IAAI,CAAC,OAAO,CAAC,MAAM,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,CAAC;QACtE,MAAM,IAAI,SAAS,CAAC,8CAA8C,CAAC,CAAC;IACxE,CAAC;IAED,OAAO,uBAAuB,CAAC,KAAK,EAAE,EAAE,GAAG,IAAI,EAAE,EAAE,OAAO,EAAE;QACxD,MAAM,EAAE,CAAC,IAAI,EAAE,EAAE;YACb,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,CAAC;gBAClB,MAAM,IAAI,SAAS,CAAC,8CAA8C,CAAC,CAAC;YACxE,CAAC;YAED,OAAO,aAAa,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;QAC/C,CAAC;KACJ,EAAE,UAAU,CAAC,CAAC;AACnB,CAAC,CAAC;AAEF;;;;;;;;;GASG;AACH,MAAM,cAAc,GAAG,CACnB,OAAgB,EAChB,UAAmB,EAAE,EACG,EAAE;IAC1B,aAAa,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;IAE/B,MAAM,IAAI,GAAG,OAAO,CAAC,OAA8B,CAAC;IACpD,MAAM,QAAQ,GAAsC,EAAE,CAAC;IAEvD,KAAK,MAAM,CAAC,UAAU,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC;QACxD,IAAI,UAAU,KAAK,SAAS,IAAI,UAAU,KAAK,qBAAqB,IAAI,CAAC,aAAa,CAAC,UAAU,EAAE,IAAI,CAAC,EAAE,CAAC;YACvG,SAAS;QACb,CAAC;QAED,aAAa,CAAC,KAAK,CAAC,CAAC;QACrB,MAAM,CAAC,cAAc,CAAC,QAAQ,EAAE,UAAU,EAAE;YACxC,KAAK,EAAE,YAAY,CAAC,KAA+B,EAAE,IAAI,EAAE,OAAO,EAAE,UAAU,CAAC;YAC/E,UAAU,EAAE,IAAI;YAChB,YAAY,EAAE,IAAI;YAClB,QAAQ,EAAE,IAAI;SACjB,CAAC,CAAC;IACP,CAAC;IAED,OAAO,QAAoC,CAAC;AAChD,CAAC,CAAC;AAEF,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,CAAC","sourcesContent":["import { createElement } from \"react\";\nimport type {\n Args,\n ComponentMeta,\n ComposedStories,\n ComposedStory,\n Preview,\n StoryAnnotations,\n StoryModule,\n} from \"./types.js\";\nimport { composeStoryAnnotations, isExportStory } from \"./upstream.js\";\n\nconst requireObject = (value: unknown): void => {\n if (value === null || typeof value !== \"object\" || Array.isArray(value)) {\n throw new TypeError(\"Expected a CSF3 annotation object\");\n }\n};\n\n/**\n * Composes a CSF3 story into a native React component with resolved defaults and decorators.\n * Compose outside render to preserve component identity. Rendering props override the composed args.\n * This function does not create an application, window, or Storybook preview lifecycle.\n *\n * @param story The named story's annotations.\n * @param meta The module's default component metadata.\n * @param preview Shared project annotations, scoped to this composition.\n * @param exportName Export name used for the story identifier and default display name.\n * @returns A renderable component exposing its composed annotations.\n * @throws If an annotation is not an object or no component or render function is available.\n */\nconst composeStory = <TArgs extends object>(\n story: StoryAnnotations<NoInfer<TArgs>>,\n meta: ComponentMeta<TArgs>,\n preview: Preview = {},\n exportName?: string,\n): ComposedStory<TArgs> => {\n if (!story.render && !meta.render && !preview.render && !meta.component) {\n throw new TypeError(\"A story needs a component or render function\");\n }\n\n return composeStoryAnnotations(story, { ...meta }, preview, {\n render: (args) => {\n if (!meta.component) {\n throw new TypeError(\"A story needs a component or render function\");\n }\n\n return createElement(meta.component, args);\n },\n }, exportName);\n};\n\n/**\n * Composes the selected CSF3 exports of a module into native React components.\n * The default export supplies metadata; its includeStories and excludeStories select named exports.\n * Returned keys retain the original export names.\n *\n * @param stories A story module containing default metadata and named story objects.\n * @param preview Shared project annotations, scoped to the returned compositions.\n * @returns Composed components keyed by the selected export names.\n * @throws If metadata or a selected export is invalid, or a selected story has no renderer.\n */\nconst composeStories = <TModule extends StoryModule>(\n stories: TModule,\n preview: Preview = {},\n): ComposedStories<TModule> => {\n requireObject(stories.default);\n\n const meta = stories.default as ComponentMeta<Args>;\n const composed: Partial<ComposedStories<TModule>> = {};\n\n for (const [exportName, story] of Object.entries(stories)) {\n if (exportName === \"default\" || exportName === \"__namedExportsOrder\" || !isExportStory(exportName, meta)) {\n continue;\n }\n\n requireObject(story);\n Object.defineProperty(composed, exportName, {\n value: composeStory(story as StoryAnnotations<Args>, meta, preview, exportName),\n enumerable: true,\n configurable: true,\n writable: true,\n });\n }\n\n return composed as ComposedStories<TModule>;\n};\n\nexport { composeStory, composeStories };\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"controls.d.ts","sourceRoot":"","sources":["../src/controls.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAKvC,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEjD,KAAK,aAAa,GAAG;IAAE,QAAQ,EAAE,QAAQ,CAAC;IAAC,IAAI,EAAE,IAAI,CAAC;IAAC,QAAQ,EAAE,CAAC,MAAM,EAAE,IAAI,KAAK,IAAI,CAAA;CAAE,CAAC;AAwK1F,QAAA,MAAM,QAAQ,GAAI,8BAA8B,aAAa,KAAG,SA4B/D,CAAC;AAEF,OAAO,EAAE,QAAQ,EAAE,CAAC"}
1
+ {"version":3,"file":"controls.d.ts","sourceRoot":"","sources":["../src/controls.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAKvC,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEjD,KAAK,aAAa,GAAG;IAAE,QAAQ,EAAE,QAAQ,CAAC;IAAC,IAAI,EAAE,IAAI,CAAC;IAAC,QAAQ,EAAE,CAAC,MAAM,EAAE,IAAI,KAAK,IAAI,CAAA;CAAE,CAAC;AA8K1F,QAAA,MAAM,QAAQ,GAAI,8BAA8B,aAAa,KAAG,SA4B/D,CAAC;AAEF,OAAO,EAAE,QAAQ,EAAE,CAAC"}
package/dist/controls.js CHANGED
@@ -3,6 +3,8 @@ import { ComboRow } from "@gtkx/components";
3
3
  import { markupEscapeText } from "@gtkx/gi/glib";
4
4
  import { AdwActionRow, AdwEntryRow, AdwPreferencesGroup, AdwSpinRow, AdwSwitchRow } from "@gtkx/jsx/adw";
5
5
  import { GtkAdjustment } from "@gtkx/jsx/gtk";
6
+ const NO_SELECTION_ID = "no-selection";
7
+ const NO_SELECTION_LABEL = "Choose option...";
6
8
  const isObject = (value) => value !== null && typeof value === "object" && !Array.isArray(value);
7
9
  const isWithinBoundsOrAbsent = (value, min, max) => value === undefined || (typeof value === "number" && Number.isFinite(value) && value >= min && value <= max);
8
10
  const controlTitle = (name, argument) => typeof name === "string" ? name : argument;
@@ -24,8 +26,7 @@ const NumberControl = ({ argument, title, value, settings, isDisabled, onChange,
24
26
  }
25
27
  const currentValue = typeof value === "number" ? value : Math.max(min, Math.min(0, max));
26
28
  return (_jsx(AdwSpinRow, { name: `storybook-control-${argument}`, title: markupEscapeText(title, -1), sensitive: !isDisabled, value: currentValue, digits: numberDigits(step), numeric: true, widthChars: 8, adjustment: (_jsx(GtkAdjustment, { lower: min, upper: max, stepIncrement: step, pageIncrement: Math.min(Number.MAX_VALUE, step * 10), value: currentValue })), onNotifyValue: (next) => {
27
- if (typeof next === "number" && Number.isFinite(next) &&
28
- next >= min && next <= max && !Object.is(next, value)) {
29
+ if (!Object.is(next, value)) {
29
30
  onChange({ [argument]: next });
30
31
  }
31
32
  } }));
@@ -38,15 +39,19 @@ const SelectControl = (props) => {
38
39
  const values = options;
39
40
  const selected = values.findIndex((option) => Object.is(option, value));
40
41
  const labels = isObject(settings.labels) ? settings.labels : {};
41
- const items = values.map((option, index) => {
42
- const label = labels[String(option)];
43
- return { id: String(index), value: typeof label === "string" ? label : String(option) };
44
- });
45
- return (_jsx(ComboRow, { name: `storybook-control-${argument}`, title: markupEscapeText(title, -1), sensitive: !isDisabled, items: items, selectedId: selected === -1 ? null : String(selected), onSelectionChanged: (id) => {
46
- const index = Number(id);
47
- if (Number.isSafeInteger(index) && index >= 0 && index < values.length) {
48
- onChange({ [argument]: values[index] });
42
+ const items = [{ id: NO_SELECTION_ID, value: NO_SELECTION_LABEL }, ...values.map((option, index) => {
43
+ const label = labels[String(option)];
44
+ return { id: String(index), value: typeof label === "string" ? label : String(option) };
45
+ })];
46
+ return (_jsx(ComboRow, { name: `storybook-control-${argument}`, title: markupEscapeText(title, -1), sensitive: !isDisabled, items: items, selectedId: selected === -1 ? NO_SELECTION_ID : String(selected), onSelectionChanged: (id) => {
47
+ if (id === NO_SELECTION_ID) {
48
+ onChange({ [argument]: undefined });
49
+ return;
49
50
  }
51
+ if (id === null) {
52
+ return;
53
+ }
54
+ onChange({ [argument]: values[Number(id)] });
50
55
  } }));
51
56
  };
52
57
  const Control = (props) => {
@@ -54,14 +59,14 @@ const Control = (props) => {
54
59
  switch (type) {
55
60
  case "boolean": {
56
61
  return (_jsx(AdwSwitchRow, { name: `storybook-control-${argument}`, title: markupEscapeText(title, -1), sensitive: !isDisabled, active: value === true, onNotifyActive: (active) => {
57
- if (typeof active === "boolean" && !Object.is(active, value)) {
62
+ if (!Object.is(active, value)) {
58
63
  onChange({ [argument]: active });
59
64
  }
60
65
  } }));
61
66
  }
62
67
  case "text": {
63
68
  return (_jsx(AdwEntryRow, { name: `storybook-control-${argument}`, title: markupEscapeText(title, -1), sensitive: !isDisabled, text: typeof value === "string" ? value : "", onNotifyText: (text) => {
64
- if (typeof text === "string" && !Object.is(text, value)) {
69
+ if (!Object.is(text, value)) {
65
70
  onChange({ [argument]: text });
66
71
  }
67
72
  } }));
@@ -82,13 +87,13 @@ const Control = (props) => {
82
87
  };
83
88
  const Controls = ({ argTypes, args, onChange }) => (_jsx(AdwPreferencesGroup, { title: "Controls", children: Object.entries(argTypes).map(([argument, annotation]) => {
84
89
  const control = annotation?.control;
85
- const table = annotation?.table;
86
- if (control === undefined || control === false || (isObject(table) && table.disable === true)) {
90
+ const table = isObject(annotation?.table) ? annotation.table : {};
91
+ if (control === undefined || control === false || table.disable === true) {
87
92
  return null;
88
93
  }
89
94
  const settings = isObject(control) ? control : {};
90
95
  const type = typeof control === "string" ? control : settings.type;
91
- return (_jsx(Control, { argument: argument, title: controlTitle(annotation?.name, argument), value: args[argument], type: typeof type === "string" ? type : "unknown", settings: settings, options: annotation?.options, isDisabled: settings.disable === true, onChange: onChange }, argument));
96
+ return (_jsx(Control, { argument: argument, title: controlTitle(annotation?.name, argument), value: args[argument], type: typeof type === "string" ? type : "unknown", settings: settings, options: annotation?.options, isDisabled: settings.disable === true || table.readonly === true, onChange: onChange }, argument));
92
97
  }) }));
93
98
  export { Controls };
94
99
  //# sourceMappingURL=controls.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"controls.js","sourceRoot":"","sources":["../src/controls.tsx"],"names":[],"mappings":";AACA,OAAO,EAA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AI,OAAO,KAAK,KAAK,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,OAAO,KAAK,IAAI,CAAC,EAAE,CAAC;YAC5F,OAAO,IAAI,CAAC;QAChB,CAAC;QAED,MAAM,QAAQ,GAAG,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC;QAClD,MAAM,IAAI,GAAG,OAAO,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC;QAEnE,OAAO,CACH,KAAC,OAAO,IAEJ,QAAQ,EAAE,QAAQ,EAClB,KAAK,EAAE,YAAY,CAAC,UAAU,EAAE,IAAI,EAAE,QAAQ,CAAC,EAC/C,KAAK,EAAE,IAAI,CAAC,QAAQ,CAAC,EACrB,IAAI,EAAE,OAAO,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,EACjD,QAAQ,EAAE,QAAQ,EAClB,OAAO,EAAE,UAAU,EAAE,OAAO,EAC5B,UAAU,EAAE,QAAQ,CAAC,OAAO,KAAK,IAAI,EACrC,QAAQ,EAAE,QAAQ,IARb,QAAQ,CASf,CACL,CAAC;IACN,CAAC,CAAC,GACgB,CACzB,CAAC;AAEF,OAAO,EAAE,QAAQ,EAAE,CAAC","sourcesContent":["import type { ReactNode } from \"react\";\nimport { ComboRow } from \"@gtkx/components\";\nimport { markupEscapeText } from \"@gtkx/gi/glib\";\nimport { AdwActionRow, AdwEntryRow, AdwPreferencesGroup, AdwSpinRow, AdwSwitchRow } from \"@gtkx/jsx/adw\";\nimport { GtkAdjustment } from \"@gtkx/jsx/gtk\";\nimport type { Args, ArgTypes } from \"./types.js\";\n\ntype ControlsProps = { argTypes: ArgTypes; args: Args; onChange: (update: Args) => void };\n\ntype ControlProps = {\n argument: string;\n title: string;\n value: unknown;\n type: string;\n settings: Args;\n options: unknown;\n isDisabled: boolean;\n onChange: (update: Args) => void;\n};\n\nconst isObject = (value: unknown): value is Args =>\n value !== null && typeof value === \"object\" && !Array.isArray(value);\n\nconst isWithinBoundsOrAbsent = (value: unknown, min: number, max: number): boolean =>\n value === undefined || (typeof value === \"number\" && Number.isFinite(value) && value >= min && value <= max);\n\nconst controlTitle = (name: unknown, argument: string): string => typeof name === \"string\" ? name : argument;\n\nconst numberDigits = (step: number): number => {\n const [coefficient = \"\", exponent = \"0\"] = String(step).split(\"e\", 2);\n const fraction = coefficient.split(\".\", 2)[1]?.length ?? 0;\n const digits = Math.max(0, fraction - Number(exponent));\n\n return Math.min(20, digits);\n};\n\nconst UnsupportedControl = ({ title, description }: { title: string; description: string }): ReactNode => (\n <AdwActionRow title={markupEscapeText(title, -1)} subtitle={markupEscapeText(description, -1)} sensitive={false} />\n);\n\nconst NumberControl = ({\n argument,\n title,\n value,\n settings,\n isDisabled,\n onChange,\n}: Omit<ControlProps, \"type\" | \"options\">): ReactNode => {\n const min = settings.min ?? -Number.MAX_SAFE_INTEGER;\n const max = settings.max ?? Number.MAX_SAFE_INTEGER;\n const step = settings.step ?? 1;\n\n if (\n typeof min !== \"number\" || typeof max !== \"number\" || typeof step !== \"number\" ||\n !Number.isFinite(min) || !Number.isFinite(max) || !Number.isFinite(step) ||\n step <= 0 || min > max || !isWithinBoundsOrAbsent(value, min, max)\n ) {\n return <UnsupportedControl title={title} description=\"Provide a finite number and valid bounds.\" />;\n }\n\n const currentValue = typeof value === \"number\" ? value : Math.max(min, Math.min(0, max));\n\n return (\n <AdwSpinRow\n name={`storybook-control-${argument}`}\n title={markupEscapeText(title, -1)}\n sensitive={!isDisabled}\n value={currentValue}\n digits={numberDigits(step)}\n numeric\n widthChars={8}\n adjustment={(\n <GtkAdjustment\n lower={min}\n upper={max}\n stepIncrement={step}\n pageIncrement={Math.min(Number.MAX_VALUE, step * 10)}\n value={currentValue}\n />\n )}\n onNotifyValue={(next) => {\n if (\n typeof next === \"number\" && Number.isFinite(next) &&\n next >= min && next <= max && !Object.is(next, value)\n ) {\n onChange({ [argument]: next });\n }\n }}\n />\n );\n};\n\nconst SelectControl = (props: Omit<ControlProps, \"type\">): ReactNode => {\n const { argument, title, value, options, settings, isDisabled, onChange } = props;\n if (!Array.isArray(options) || options.length === 0 || options.some((option: unknown) =>\n option !== null && typeof option !== \"string\" && typeof option !== \"number\" && typeof option !== \"boolean\")) {\n return <UnsupportedControl title={title} description=\"Provide a list of text, number, or boolean options.\" />;\n }\n\n const values: unknown[] = options;\n const selected = values.findIndex((option) => Object.is(option, value));\n const labels = isObject(settings.labels) ? settings.labels : {};\n const items = values.map((option, index) => {\n const label = labels[String(option)];\n\n return { id: String(index), value: typeof label === \"string\" ? label : String(option) };\n });\n\n return (\n <ComboRow\n name={`storybook-control-${argument}`}\n title={markupEscapeText(title, -1)}\n sensitive={!isDisabled}\n items={items}\n selectedId={selected === -1 ? null : String(selected)}\n onSelectionChanged={(id) => {\n const index = Number(id);\n\n if (Number.isSafeInteger(index) && index >= 0 && index < values.length) {\n onChange({ [argument]: values[index] });\n }\n }}\n />\n );\n};\n\nconst Control = (props: ControlProps): ReactNode => {\n const { argument, title, value, type, isDisabled, onChange } = props;\n\n switch (type) {\n case \"boolean\": {\n return (\n <AdwSwitchRow\n name={`storybook-control-${argument}`}\n title={markupEscapeText(title, -1)}\n sensitive={!isDisabled}\n active={value === true}\n onNotifyActive={(active) => {\n if (typeof active === \"boolean\" && !Object.is(active, value)) {\n onChange({ [argument]: active });\n }\n }}\n />\n );\n }\n case \"text\": {\n return (\n <AdwEntryRow\n name={`storybook-control-${argument}`}\n title={markupEscapeText(title, -1)}\n sensitive={!isDisabled}\n text={typeof value === \"string\" ? value : \"\"}\n onNotifyText={(text) => {\n if (typeof text === \"string\" && !Object.is(text, value)) {\n onChange({ [argument]: text });\n }\n }}\n />\n );\n }\n case \"number\":\n case \"range\": {\n return <NumberControl {...props} />;\n }\n case \"select\":\n case \"radio\":\n case \"inline-radio\": {\n return <SelectControl {...props} />;\n }\n default: {\n return <UnsupportedControl title={title} description={`Unsupported control: ${type}`} />;\n }\n }\n};\n\nconst Controls = ({ argTypes, args, onChange }: ControlsProps): ReactNode => (\n <AdwPreferencesGroup title=\"Controls\">\n {Object.entries(argTypes).map(([argument, annotation]) => {\n const control: unknown = annotation?.control;\n const table: unknown = annotation?.table;\n\n if (control === undefined || control === false || (isObject(table) && table.disable === true)) {\n return null;\n }\n\n const settings = isObject(control) ? control : {};\n const type = typeof control === \"string\" ? control : settings.type;\n\n return (\n <Control\n key={argument}\n argument={argument}\n title={controlTitle(annotation?.name, argument)}\n value={args[argument]}\n type={typeof type === \"string\" ? type : \"unknown\"}\n settings={settings}\n options={annotation?.options}\n isDisabled={settings.disable === true}\n onChange={onChange}\n />\n );\n })}\n </AdwPreferencesGroup>\n);\n\nexport { Controls };\n"]}
1
+ {"version":3,"file":"controls.js","sourceRoot":"","sources":["../src/controls.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,mBAAmB,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AACzG,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAK9C,MAAM,eAAe,GAAG,cAAc,CAAC;AACvC,MAAM,kBAAkB,GAAG,kBAAkB,CAAC;AAa9C,MAAM,QAAQ,GAAG,CAAC,KAAc,EAAiB,EAAE,CAC/C,KAAK,KAAK,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAEzE,MAAM,sBAAsB,GAAG,CAAC,KAAc,EAAE,GAAW,EAAE,GAAW,EAAW,EAAE,CACjF,KAAK,KAAK,SAAS,IAAI,CAAC,OAAO,KAAK,KAAK,QAAQ,IA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AI,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,EACjD,QAAQ,EAAE,QAAQ,EAClB,OAAO,EAAE,UAAU,EAAE,OAAO,EAC5B,UAAU,EAAE,QAAQ,CAAC,OAAO,KAAK,IAAI,IAAI,KAAK,CAAC,QAAQ,KAAK,IAAI,EAChE,QAAQ,EAAE,QAAQ,IARb,QAAQ,CASf,CACL,CAAC;IACN,CAAC,CAAC,GACgB,CACzB,CAAC;AAEF,OAAO,EAAE,QAAQ,EAAE,CAAC","sourcesContent":["import type { ReactNode } from \"react\";\nimport { ComboRow } from \"@gtkx/components\";\nimport { markupEscapeText } from \"@gtkx/gi/glib\";\nimport { AdwActionRow, AdwEntryRow, AdwPreferencesGroup, AdwSpinRow, AdwSwitchRow } from \"@gtkx/jsx/adw\";\nimport { GtkAdjustment } from \"@gtkx/jsx/gtk\";\nimport type { Args, ArgTypes } from \"./types.js\";\n\ntype ControlsProps = { argTypes: ArgTypes; args: Args; onChange: (update: Args) => void };\n\nconst NO_SELECTION_ID = \"no-selection\";\nconst NO_SELECTION_LABEL = \"Choose option...\";\n\ntype ControlProps = {\n argument: string;\n title: string;\n value: unknown;\n type: string;\n settings: Args;\n options: unknown;\n isDisabled: boolean;\n onChange: (update: Args) => void;\n};\n\nconst isObject = (value: unknown): value is Args =>\n value !== null && typeof value === \"object\" && !Array.isArray(value);\n\nconst isWithinBoundsOrAbsent = (value: unknown, min: number, max: number): boolean =>\n value === undefined || (typeof value === \"number\" && Number.isFinite(value) && value >= min && value <= max);\n\nconst controlTitle = (name: unknown, argument: string): string => typeof name === \"string\" ? name : argument;\n\nconst numberDigits = (step: number): number => {\n const [coefficient = \"\", exponent = \"0\"] = String(step).split(\"e\", 2);\n const fraction = coefficient.split(\".\", 2)[1]?.length ?? 0;\n const digits = Math.max(0, fraction - Number(exponent));\n\n return Math.min(20, digits);\n};\n\nconst UnsupportedControl = ({ title, description }: { title: string; description: string }): ReactNode => (\n <AdwActionRow title={markupEscapeText(title, -1)} subtitle={markupEscapeText(description, -1)} sensitive={false} />\n);\n\nconst NumberControl = ({\n argument,\n title,\n value,\n settings,\n isDisabled,\n onChange,\n}: Omit<ControlProps, \"type\" | \"options\">): ReactNode => {\n const min = settings.min ?? -Number.MAX_SAFE_INTEGER;\n const max = settings.max ?? Number.MAX_SAFE_INTEGER;\n const step = settings.step ?? 1;\n\n if (\n typeof min !== \"number\" || typeof max !== \"number\" || typeof step !== \"number\" ||\n !Number.isFinite(min) || !Number.isFinite(max) || !Number.isFinite(step) ||\n step <= 0 || min > max || !isWithinBoundsOrAbsent(value, min, max)\n ) {\n return <UnsupportedControl title={title} description=\"Provide a finite number and valid bounds.\" />;\n }\n\n const currentValue = typeof value === \"number\" ? value : Math.max(min, Math.min(0, max));\n\n return (\n <AdwSpinRow\n name={`storybook-control-${argument}`}\n title={markupEscapeText(title, -1)}\n sensitive={!isDisabled}\n value={currentValue}\n digits={numberDigits(step)}\n numeric\n widthChars={8}\n adjustment={(\n <GtkAdjustment\n lower={min}\n upper={max}\n stepIncrement={step}\n pageIncrement={Math.min(Number.MAX_VALUE, step * 10)}\n value={currentValue}\n />\n )}\n onNotifyValue={(next) => {\n if (!Object.is(next, value)) {\n onChange({ [argument]: next });\n }\n }}\n />\n );\n};\n\nconst SelectControl = (props: Omit<ControlProps, \"type\">): ReactNode => {\n const { argument, title, value, options, settings, isDisabled, onChange } = props;\n if (!Array.isArray(options) || options.length === 0 || options.some((option: unknown) =>\n option !== null && typeof option !== \"string\" && typeof option !== \"number\" && typeof option !== \"boolean\")) {\n return <UnsupportedControl title={title} description=\"Provide a list of text, number, or boolean options.\" />;\n }\n\n const values: unknown[] = options;\n const selected = values.findIndex((option) => Object.is(option, value));\n const labels = isObject(settings.labels) ? settings.labels : {};\n const items = [{ id: NO_SELECTION_ID, value: NO_SELECTION_LABEL }, ...values.map((option, index) => {\n const label = labels[String(option)];\n\n return { id: String(index), value: typeof label === \"string\" ? label : String(option) };\n })];\n\n return (\n <ComboRow\n name={`storybook-control-${argument}`}\n title={markupEscapeText(title, -1)}\n sensitive={!isDisabled}\n items={items}\n selectedId={selected === -1 ? NO_SELECTION_ID : String(selected)}\n onSelectionChanged={(id) => {\n if (id === NO_SELECTION_ID) {\n onChange({ [argument]: undefined });\n\n return;\n }\n\n if (id === null) {\n return;\n }\n\n onChange({ [argument]: values[Number(id)] });\n }}\n />\n );\n};\n\nconst Control = (props: ControlProps): ReactNode => {\n const { argument, title, value, type, isDisabled, onChange } = props;\n\n switch (type) {\n case \"boolean\": {\n return (\n <AdwSwitchRow\n name={`storybook-control-${argument}`}\n title={markupEscapeText(title, -1)}\n sensitive={!isDisabled}\n active={value === true}\n onNotifyActive={(active) => {\n if (!Object.is(active, value)) {\n onChange({ [argument]: active });\n }\n }}\n />\n );\n }\n case \"text\": {\n return (\n <AdwEntryRow\n name={`storybook-control-${argument}`}\n title={markupEscapeText(title, -1)}\n sensitive={!isDisabled}\n text={typeof value === \"string\" ? value : \"\"}\n onNotifyText={(text) => {\n if (!Object.is(text, value)) {\n onChange({ [argument]: text });\n }\n }}\n />\n );\n }\n case \"number\":\n case \"range\": {\n return <NumberControl {...props} />;\n }\n case \"select\":\n case \"radio\":\n case \"inline-radio\": {\n return <SelectControl {...props} />;\n }\n default: {\n return <UnsupportedControl title={title} description={`Unsupported control: ${type}`} />;\n }\n }\n};\n\nconst Controls = ({ argTypes, args, onChange }: ControlsProps): ReactNode => (\n <AdwPreferencesGroup title=\"Controls\">\n {Object.entries(argTypes).map(([argument, annotation]) => {\n const control: unknown = annotation?.control;\n const table = isObject(annotation?.table) ? annotation.table : {};\n\n if (control === undefined || control === false || table.disable === true) {\n return null;\n }\n\n const settings = isObject(control) ? control : {};\n const type = typeof control === \"string\" ? control : settings.type;\n\n return (\n <Control\n key={argument}\n argument={argument}\n title={controlTitle(annotation?.name, argument)}\n value={args[argument]}\n type={typeof type === \"string\" ? type : \"unknown\"}\n settings={settings}\n options={annotation?.options}\n isDisabled={settings.disable === true || table.readonly === true}\n onChange={onChange}\n />\n );\n })}\n </AdwPreferencesGroup>\n);\n\nexport { Controls };\n"]}
package/dist/types.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import type * as Gtk from "@gtkx/gi/gtk";
2
2
  import type { ComponentType, ReactNode } from "react";
3
- import type { ComponentAnnotations, GlobalTypes, Renderer, ArgTypes as StorybookArgTypes, StoryContext as StorybookContext } from "storybook/internal/types";
3
+ import type { ArgsFromMeta, ComponentAnnotations, GlobalTypes, Renderer, StoryAnnotations as StorybookAnnotations, ArgTypes as StorybookArgTypes, StoryContext as StorybookContext } from "storybook/internal/types";
4
4
  /** Named values supplied to a story, including component props and custom render args. */
5
5
  type Args = Record<string, unknown>;
6
6
  /** Storybook renderer types for React content rendered as native GTK widgets. */
@@ -60,22 +60,12 @@ type ComponentOrProps<T> = T extends ComponentType<infer Props extends object> ?
60
60
  type Simplify<T> = {
61
61
  [Key in keyof T]: T[Key];
62
62
  };
63
- /** Combines the argument requirements of every member of a union. */
64
- type UnionToIntersection<T> = (T extends unknown ? (value: T) => void : never) extends (value: infer Intersection) => void ? Intersection : never;
65
- /** Retains explicitly named args while removing broad index signatures. */
66
- type DeclaredArgs<T> = {
67
- [Key in keyof T as string extends Key ? never : number extends Key ? never : symbol extends Key ? never : Key]: T[Key];
68
- };
69
- /** Extracts the args accepted by a custom render function. */
70
- type RenderArgs<T> = T extends (args: infer Props extends object, context: never) => ReactNode ? Props : object;
71
- /** Combines the args required by a metadata object's decorators. */
72
- type DecoratorArgs<T> = T extends readonly (infer Item)[] ? UnionToIntersection<Item extends Decorator<infer Props extends object> ? Props : object> : object;
73
63
  /** Infers story args from component props, render functions, decorators, or declared defaults. */
74
64
  type ArgsFrom<T> = T extends {
75
65
  component?: infer Component;
76
- render?: infer Render;
77
- decorators?: infer Decorators;
78
- } ? Simplify<(NonNullable<Component> extends ComponentType<infer Props extends object> ? Props : object) & DeclaredArgs<RenderArgs<NonNullable<Render>> & DecoratorArgs<NonNullable<Decorators>>>> : T extends {
66
+ render?: unknown;
67
+ decorators?: unknown;
68
+ } ? Simplify<(NonNullable<Component> extends ComponentType<infer Props extends object> ? Props : object) & ArgsFromMeta<NativeRenderer, T>> : T extends {
79
69
  args: infer Defaults extends object;
80
70
  } ? Defaults : Args;
81
71
  /** CSF3 default export metadata typed from a React component or an explicit args type. */
@@ -99,11 +89,7 @@ type StoryObj<T = Args> = T extends {
99
89
  render?: unknown;
100
90
  decorators?: unknown;
101
91
  args?: unknown;
102
- } ? StoryAnnotations<ArgsFrom<T>> & (Record<never, never> extends RequiredStoryArgs<T, ArgsFrom<T>> ? {
103
- args?: RequiredStoryArgs<T, ArgsFrom<T>>;
104
- } : {
105
- args: RequiredStoryArgs<T, ArgsFrom<T>>;
106
- }) : StoryAnnotations<ComponentOrProps<T>>;
92
+ } ? StoryAnnotations<ArgsFrom<T>> & Pick<StorybookAnnotations<NativeRenderer<ArgsFrom<T>>, ArgsFrom<T>, RequiredStoryArgs<T, ArgsFrom<T>>>, "args"> : StoryAnnotations<ComponentOrProps<T>>;
107
93
  /** Project annotations shared by all composed stories. */
108
94
  type Preview = Annotations<Args> & {
109
95
  /** Initial global values available in story rendering and decorators. */
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,GAAG,MAAM,cAAc,CAAC;AACzC,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACtD,OAAO,KAAK,EACR,oBAAoB,EACpB,WAAW,EACX,QAAQ,EACR,QAAQ,IAAI,iBAAiB,EAC7B,YAAY,IAAI,gBAAgB,EACnC,MAAM,0BAA0B,CAAC;AAElC,0FAA0F;AAC1F,KAAK,IAAI,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAEpC,iFAAiF;AACjF,KAAK,cAAc,CAAC,KAAK,SAAS,MAAM,GAAG,IAAI,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B,CAAC,QAAQ,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,GAC/D,GAAG,GACH,KAAK;CAClB,CAAC,MAAM,OAAO,CAAC,GAAG,MAAM,CAAC;AAE1B,8DAA8D;AAC9D,KAAK,eAAe,CAAC,OAAO,SAAS,WAAW,IAAI,MAAM,CACtD,SAAS,CAAC,OAAO,CAAC,EAClB,aAAa,CAAC,QAAQ,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,CAC9C,CAAC;AAEF,YAAY,EACR,IAAI,EACJ,QAAQ,EACR,aAAa,EACb,eAAe,EACf,aAAa,EACb,SAAS,EACT,IAAI,EACJ,OAAO,EACP,gBAAgB,EAChB,YAAY,EACZ,kBAAkB,EAClB,WAAW,EACX,QAAQ,EACR,WAAW,GACd,CAAC"}
package/dist/types.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"","sourcesContent":["import type * as Gtk from \"@gtkx/gi/gtk\";\nimport type { ComponentType, ReactNode } from \"react\";\nimport type {\n ComponentAnnotations,\n GlobalTypes,\n Renderer,\n ArgTypes as StorybookArgTypes,\n StoryContext as StorybookContext,\n} from \"storybook/internal/types\";\n\n/** Named values supplied to a story, including component props and custom render args. */\ntype Args = Record<string, unknown>;\n\n/** Storybook renderer types for React content rendered as native GTK widgets. */\ntype NativeRenderer<TArgs extends object = Args> = Renderer & {\n /** React component receiving the story's args. */\n component: ComponentType<TArgs>;\n /** React content returned by story rendering. */\n storyResult: ReactNode;\n /** Native widget type representing the preview canvas. */\n canvasElement: Gtk.Widget;\n};\n\n/** Explicit argument metadata used to configure native controls and named actions. */\ntype ArgTypes<TArgs extends object = Args> = Partial<StorybookArgTypes<TArgs>>;\n\n/** Composed story identity, args, and annotations available to render functions and decorators. */\ntype StoryContext<TArgs extends object = Args> = Pick<\n StorybookContext<NativeRenderer<TArgs>, TArgs>,\n \"id\" | \"name\" | \"title\" | \"args\" | \"initialArgs\" | \"argTypes\" | \"viewMode\"\n> & {\n /** Parameters merged from preview, component metadata, and the story. */\n parameters: Args;\n /** Global values after applying preview defaults and metadata or story overrides. */\n globals: Args;\n};\n\n/** Renders native React content from the current story args and composition context. */\ntype StoryRender<TArgs extends object = Args> = (args: TArgs, context: StoryContext<TArgs>) => ReactNode;\n\n/** Values a decorator can override when invoking the decorated story. */\ntype StoryContextUpdate<TArgs extends object = Args> = {\n /** Partial args merged into the current invocation without changing composed defaults. */\n args?: Partial<TArgs>;\n /** Global values overridden for the decorated invocation. */\n globals?: Args;\n};\n\n/** Wraps story content and can override args or globals when invoking the supplied Story function. */\ntype Decorator<TArgs extends object = Args> = (\n Story: (update?: StoryContextUpdate<TArgs>) => ReactNode,\n context: StoryContext<TArgs>,\n) => ReactNode;\n\n/** Shared CSF annotations accepted at preview, component, and story scope. */\ntype Annotations<TArgs extends object> = {\n /** Default args, with more specific annotation scopes taking precedence. */\n args?: Partial<TArgs>;\n /** Explicit argument descriptions, controls, and action registrations. */\n argTypes?: ArgTypes<TArgs>;\n /** Parameters merged across scopes, including native preview and layout settings. */\n parameters?: Args;\n /** Wrappers composed around the story's render function. */\n decorators?: Decorator<TArgs>[];\n /** Custom renderer used in place of the component or a less specific render annotation. */\n render?: StoryRender<TArgs>;\n /** Storybook tags composed with tags from other annotation scopes. */\n tags?: string[];\n};\n\n/** Default export metadata describing a component's stories and their shared annotations. */\ntype ComponentMeta<TArgs extends object> = Annotations<TArgs> & Pick<\n ComponentAnnotations<NativeRenderer<TArgs>, TArgs>,\n \"title\" | \"id\" | \"includeStories\" | \"excludeStories\"\n> & {\n /** Component rendered with story args when no custom render annotation applies. */\n component?: ComponentType<TArgs>;\n /** Global overrides shared by this component's stories. */\n globals?: Args;\n};\n\n/** Resolves a component's props or accepts an explicitly supplied args object type. */\ntype ComponentOrProps<T> = T extends ComponentType<infer Props extends object>\n ? Props\n : T extends object ? T : Args;\n\n/** Presents combined inferred args as a single object type. */\ntype Simplify<T> = { [Key in keyof T]: T[Key] };\n\n/** Combines the argument requirements of every member of a union. */\ntype UnionToIntersection<T> = (\n T extends unknown ? (value: T) => void : never\n) extends (value: infer Intersection) => void ? Intersection : never;\n\n/** Retains explicitly named args while removing broad index signatures. */\ntype DeclaredArgs<T> = {\n [Key in keyof T as string extends Key\n ? never\n : number extends Key ? never : symbol extends Key ? never : Key]: T[Key];\n};\n\n/** Extracts the args accepted by a custom render function. */\ntype RenderArgs<T> = T extends (args: infer Props extends object, context: never) => ReactNode ? Props : object;\n\n/** Combines the args required by a metadata object's decorators. */\ntype DecoratorArgs<T> = T extends readonly (infer Item)[]\n ? UnionToIntersection<Item extends Decorator<infer Props extends object> ? Props : object>\n : object;\n\n/** Infers story args from component props, render functions, decorators, or declared defaults. */\ntype ArgsFrom<T> = T extends { component?: infer Component; render?: infer Render; decorators?: infer Decorators }\n ? Simplify<\n (NonNullable<Component> extends ComponentType<infer Props extends object> ? Props : object) &\n DeclaredArgs<RenderArgs<NonNullable<Render>> & DecoratorArgs<NonNullable<Decorators>>>\n >\n : T extends { args: infer Defaults extends object } ? Defaults : Args;\n\n/** CSF3 default export metadata typed from a React component or an explicit args type. */\ntype Meta<T = Args> = ComponentMeta<ComponentOrProps<T>>;\n\n/** Annotations for one CSF3 story object, including its display name and global overrides. */\ntype StoryAnnotations<TArgs extends object> = Annotations<TArgs> & {\n /** Display name overriding the name derived from the story's named export. */\n name?: string;\n /** Global overrides applied specifically to this story. */\n globals?: Args;\n};\n\n/** Extracts args already defaulted by component metadata. */\ntype DefaultArgs<T> = T extends { args: infer Defaults } ? Defaults : Record<never, never>;\n\n/** Makes args with metadata defaults optional while preserving other required args. */\ntype RequiredStoryArgs<T, TArgs extends object> =\n Omit<TArgs, keyof DefaultArgs<T>> & Partial<Pick<TArgs, keyof TArgs & keyof DefaultArgs<T>>>;\n\n/** CSF3 story object inferred from metadata, a React component, or an explicit args type. */\ntype StoryObj<T = Args> = T extends { component?: unknown; render?: unknown; decorators?: unknown; args?: unknown }\n ? StoryAnnotations<ArgsFrom<T>> & (Record<never, never> extends RequiredStoryArgs<T, ArgsFrom<T>>\n ? { args?: RequiredStoryArgs<T, ArgsFrom<T>> }\n : { args: RequiredStoryArgs<T, ArgsFrom<T>> })\n : StoryAnnotations<ComponentOrProps<T>>;\n\n/** Project annotations shared by all composed stories. */\ntype Preview = Annotations<Args> & {\n /** Initial global values available in story rendering and decorators. */\n initialGlobals?: Args;\n /** Storybook metadata describing global values; native toolbar controls are not provided. */\n globalTypes?: GlobalTypes;\n};\n\n/** Renderable story with merged annotations; props override its composed default args. */\ntype ComposedStory<TArgs extends object = Args> = ((args: Partial<TArgs>) => ReactNode) & {\n /** Default args merged across preview, component metadata, and story annotations. */\n args: Partial<TArgs>;\n /** Composed argument metadata available to native controls and actions. */\n argTypes: ArgTypes<TArgs>;\n /** Composed parameters available to the renderer and explorer. */\n parameters: Args;\n /** Composed global values available in story context. */\n globals: Args;\n /** Storybook identifier derived from component identity and the story export. */\n id: string;\n /** Story name attached by Storybook's portable composition API. */\n storyName: string;\n /** Tags resulting from composition across annotation scopes. */\n tags: string[];\n};\n\n/** Imported CSF module containing default metadata and named story exports. */\ntype StoryModule = {\n /** Component metadata validated when the module is composed. */\n default: unknown;\n};\n\n/** Named module exports whose types match CSF3 stories, excluding module bookkeeping. */\ntype StoryKeys<TModule extends StoryModule> = {\n [Key in keyof TModule]: Key extends \"default\" | \"__esModule\" | \"__namedExportsOrder\"\n ? never\n : TModule[Key] extends StoryAnnotations<ArgsFrom<TModule[\"default\"]>>\n ? Key\n : never;\n}[keyof TModule] & string;\n\n/** Composed stories keyed by their original named exports. */\ntype ComposedStories<TModule extends StoryModule> = Record<\n StoryKeys<TModule>,\n ComposedStory<ArgsFrom<TModule[\"default\"]>>\n>;\n\nexport type {\n Args,\n ArgTypes,\n ComponentMeta,\n ComposedStories,\n ComposedStory,\n Decorator,\n Meta,\n Preview,\n StoryAnnotations,\n StoryContext,\n StoryContextUpdate,\n StoryModule,\n StoryObj,\n StoryRender,\n};\n"]}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"","sourcesContent":["import type * as Gtk from \"@gtkx/gi/gtk\";\nimport type { ComponentType, ReactNode } from \"react\";\nimport type {\n ArgsFromMeta,\n ComponentAnnotations,\n GlobalTypes,\n Renderer,\n StoryAnnotations as StorybookAnnotations,\n ArgTypes as StorybookArgTypes,\n StoryContext as StorybookContext,\n} from \"storybook/internal/types\";\n\n/** Named values supplied to a story, including component props and custom render args. */\ntype Args = Record<string, unknown>;\n\n/** Storybook renderer types for React content rendered as native GTK widgets. */\ntype NativeRenderer<TArgs extends object = Args> = Renderer & {\n /** React component receiving the story's args. */\n component: ComponentType<TArgs>;\n /** React content returned by story rendering. */\n storyResult: ReactNode;\n /** Native widget type representing the preview canvas. */\n canvasElement: Gtk.Widget;\n};\n\n/** Explicit argument metadata used to configure native controls and named actions. */\ntype ArgTypes<TArgs extends object = Args> = Partial<StorybookArgTypes<TArgs>>;\n\n/** Composed story identity, args, and annotations available to render functions and decorators. */\ntype StoryContext<TArgs extends object = Args> = Pick<\n StorybookContext<NativeRenderer<TArgs>, TArgs>,\n \"id\" | \"name\" | \"title\" | \"args\" | \"initialArgs\" | \"argTypes\" | \"viewMode\"\n> & {\n /** Parameters merged from preview, component metadata, and the story. */\n parameters: Args;\n /** Global values after applying preview defaults and metadata or story overrides. */\n globals: Args;\n};\n\n/** Renders native React content from the current story args and composition context. */\ntype StoryRender<TArgs extends object = Args> = (args: TArgs, context: StoryContext<TArgs>) => ReactNode;\n\n/** Values a decorator can override when invoking the decorated story. */\ntype StoryContextUpdate<TArgs extends object = Args> = {\n /** Partial args merged into the current invocation without changing composed defaults. */\n args?: Partial<TArgs>;\n /** Global values overridden for the decorated invocation. */\n globals?: Args;\n};\n\n/** Wraps story content and can override args or globals when invoking the supplied Story function. */\ntype Decorator<TArgs extends object = Args> = (\n Story: (update?: StoryContextUpdate<TArgs>) => ReactNode,\n context: StoryContext<TArgs>,\n) => ReactNode;\n\n/** Shared CSF annotations accepted at preview, component, and story scope. */\ntype Annotations<TArgs extends object> = {\n /** Default args, with more specific annotation scopes taking precedence. */\n args?: Partial<TArgs>;\n /** Explicit argument descriptions, controls, and action registrations. */\n argTypes?: ArgTypes<TArgs>;\n /** Parameters merged across scopes, including native preview and layout settings. */\n parameters?: Args;\n /** Wrappers composed around the story's render function. */\n decorators?: Decorator<TArgs>[];\n /** Custom renderer used in place of the component or a less specific render annotation. */\n render?: StoryRender<TArgs>;\n /** Storybook tags composed with tags from other annotation scopes. */\n tags?: string[];\n};\n\n/** Default export metadata describing a component's stories and their shared annotations. */\ntype ComponentMeta<TArgs extends object> = Annotations<TArgs> & Pick<\n ComponentAnnotations<NativeRenderer<TArgs>, TArgs>,\n \"title\" | \"id\" | \"includeStories\" | \"excludeStories\"\n> & {\n /** Component rendered with story args when no custom render annotation applies. */\n component?: ComponentType<TArgs>;\n /** Global overrides shared by this component's stories. */\n globals?: Args;\n};\n\n/** Resolves a component's props or accepts an explicitly supplied args object type. */\ntype ComponentOrProps<T> = T extends ComponentType<infer Props extends object>\n ? Props\n : T extends object ? T : Args;\n\n/** Presents combined inferred args as a single object type. */\ntype Simplify<T> = { [Key in keyof T]: T[Key] };\n\n/** Infers story args from component props, render functions, decorators, or declared defaults. */\ntype ArgsFrom<T> = T extends { component?: infer Component; render?: unknown; decorators?: unknown }\n ? Simplify<\n (NonNullable<Component> extends ComponentType<infer Props extends object> ? Props : object) &\n ArgsFromMeta<NativeRenderer, T>\n >\n : T extends { args: infer Defaults extends object } ? Defaults : Args;\n\n/** CSF3 default export metadata typed from a React component or an explicit args type. */\ntype Meta<T = Args> = ComponentMeta<ComponentOrProps<T>>;\n\n/** Annotations for one CSF3 story object, including its display name and global overrides. */\ntype StoryAnnotations<TArgs extends object> = Annotations<TArgs> & {\n /** Display name overriding the name derived from the story's named export. */\n name?: string;\n /** Global overrides applied specifically to this story. */\n globals?: Args;\n};\n\n/** Extracts args already defaulted by component metadata. */\ntype DefaultArgs<T> = T extends { args: infer Defaults } ? Defaults : Record<never, never>;\n\n/** Makes args with metadata defaults optional while preserving other required args. */\ntype RequiredStoryArgs<T, TArgs extends object> =\n Omit<TArgs, keyof DefaultArgs<T>> & Partial<Pick<TArgs, keyof TArgs & keyof DefaultArgs<T>>>;\n\n/** CSF3 story object inferred from metadata, a React component, or an explicit args type. */\ntype StoryObj<T = Args> = T extends { component?: unknown; render?: unknown; decorators?: unknown; args?: unknown }\n ? StoryAnnotations<ArgsFrom<T>> & Pick<\n StorybookAnnotations<NativeRenderer<ArgsFrom<T>>, ArgsFrom<T>, RequiredStoryArgs<T, ArgsFrom<T>>>,\n \"args\"\n >\n : StoryAnnotations<ComponentOrProps<T>>;\n\n/** Project annotations shared by all composed stories. */\ntype Preview = Annotations<Args> & {\n /** Initial global values available in story rendering and decorators. */\n initialGlobals?: Args;\n /** Storybook metadata describing global values; native toolbar controls are not provided. */\n globalTypes?: GlobalTypes;\n};\n\n/** Renderable story with merged annotations; props override its composed default args. */\ntype ComposedStory<TArgs extends object = Args> = ((args: Partial<TArgs>) => ReactNode) & {\n /** Default args merged across preview, component metadata, and story annotations. */\n args: Partial<TArgs>;\n /** Composed argument metadata available to native controls and actions. */\n argTypes: ArgTypes<TArgs>;\n /** Composed parameters available to the renderer and explorer. */\n parameters: Args;\n /** Composed global values available in story context. */\n globals: Args;\n /** Storybook identifier derived from component identity and the story export. */\n id: string;\n /** Story name attached by Storybook's portable composition API. */\n storyName: string;\n /** Tags resulting from composition across annotation scopes. */\n tags: string[];\n};\n\n/** Imported CSF module containing default metadata and named story exports. */\ntype StoryModule = {\n /** Component metadata validated when the module is composed. */\n default: unknown;\n};\n\n/** Named module exports whose types match CSF3 stories, excluding module bookkeeping. */\ntype StoryKeys<TModule extends StoryModule> = {\n [Key in keyof TModule]: Key extends \"default\" | \"__esModule\" | \"__namedExportsOrder\"\n ? never\n : TModule[Key] extends StoryAnnotations<ArgsFrom<TModule[\"default\"]>>\n ? Key\n : never;\n}[keyof TModule] & string;\n\n/** Composed stories keyed by their original named exports. */\ntype ComposedStories<TModule extends StoryModule> = Record<\n StoryKeys<TModule>,\n ComposedStory<ArgsFrom<TModule[\"default\"]>>\n>;\n\nexport type {\n Args,\n ArgTypes,\n ComponentMeta,\n ComposedStories,\n ComposedStory,\n Decorator,\n Meta,\n Preview,\n StoryAnnotations,\n StoryContext,\n StoryContextUpdate,\n StoryModule,\n StoryObj,\n StoryRender,\n};\n"]}
package/package.json CHANGED
@@ -1,86 +1,85 @@
1
1
  {
2
- "name": "@gtkx/storybook",
3
- "version": "0.0.1",
4
- "description": "Native story explorer and portable Component Story Format fixtures for GTKX applications.",
5
- "keywords": [
6
- "gtkx",
7
- "gtk",
8
- "gtk4",
9
- "adwaita",
10
- "react",
11
- "storybook",
12
- "csf",
13
- "linux"
14
- ],
15
- "homepage": "https://gtkx.dev",
16
- "bugs": {
17
- "url": "https://github.com/gtkx-org/gtkx/issues"
2
+ "name": "@gtkx/storybook",
3
+ "version": "2.0.0-beta.11",
4
+ "description": "Explore GTKX components as native stories.",
5
+ "keywords": [
6
+ "gtkx",
7
+ "gtk",
8
+ "gtk4",
9
+ "adwaita",
10
+ "react",
11
+ "storybook",
12
+ "csf",
13
+ "linux"
14
+ ],
15
+ "homepage": "https://gtkx.dev",
16
+ "bugs": {
17
+ "url": "https://github.com/gtkx-org/gtkx/issues"
18
+ },
19
+ "repository": {
20
+ "type": "git",
21
+ "url": "git+https://github.com/gtkx-org/gtkx.git",
22
+ "directory": "packages/storybook"
23
+ },
24
+ "license": "MPL-2.0",
25
+ "author": "Eugenio Depalo <eugeniodepalo@gmail.com>",
26
+ "type": "module",
27
+ "exports": {
28
+ "./package.json": "./package.json",
29
+ ".": {
30
+ "types": "./dist/index.d.ts",
31
+ "import": "./dist/index.js",
32
+ "require": null,
33
+ "default": "./dist/index.js"
18
34
  },
19
- "repository": {
20
- "type": "git",
21
- "url": "git+https://github.com/gtkx-org/gtkx.git",
22
- "directory": "packages/storybook"
35
+ "./config": {
36
+ "types": "./dist/config.d.ts",
37
+ "import": "./dist/config.js",
38
+ "require": null,
39
+ "default": "./dist/config.js"
23
40
  },
24
- "license": "MPL-2.0",
25
- "author": "Eugenio Depalo <eugeniodepalo@gmail.com>",
26
- "type": "module",
27
- "exports": {
28
- "./package.json": "./package.json",
29
- ".": {
30
- "source": "./src/index.ts",
31
- "types": "./dist/index.d.ts",
32
- "import": "./dist/index.js",
33
- "require": null,
34
- "default": "./dist/index.js"
35
- },
36
- "./config": {
37
- "source": "./src/config.ts",
38
- "types": "./dist/config.d.ts",
39
- "import": "./dist/config.js",
40
- "require": null,
41
- "default": "./dist/config.js"
42
- },
43
- "./explorer": {
44
- "source": "./src/explorer.ts",
45
- "types": "./dist/explorer.d.ts",
46
- "import": "./dist/explorer.js",
47
- "require": null,
48
- "default": "./dist/explorer.js"
49
- }
50
- },
51
- "sideEffects": false,
52
- "files": [
53
- "dist",
54
- "src"
55
- ],
56
- "scripts": {
57
- "release": "tsx ../../scripts/release-package.ts"
58
- },
59
- "nx": {
60
- "targets": {
61
- "lint": {
62
- "options": {
63
- "cwd": ".",
64
- "command": "eslint {projectRoot}"
65
- }
66
- }
41
+ "./explorer": {
42
+ "types": "./dist/explorer.d.ts",
43
+ "import": "./dist/explorer.js",
44
+ "require": null,
45
+ "default": "./dist/explorer.js"
46
+ }
47
+ },
48
+ "sideEffects": false,
49
+ "files": [
50
+ "dist",
51
+ "src"
52
+ ],
53
+ "nx": {
54
+ "targets": {
55
+ "lint": {
56
+ "options": {
57
+ "cwd": ".",
58
+ "command": "eslint {projectRoot}"
67
59
  }
68
- },
69
- "engines": {
70
- "node": ">=26.7.0"
71
- },
72
- "dependencies": {
73
- "@gtkx/components": "workspace:*",
74
- "@gtkx/react": "workspace:*",
75
- "storybook": "10.6.0"
76
- },
77
- "peerDependencies": {
78
- "react": "^19.2"
79
- },
80
- "devDependencies": {
81
- "@gtkx/config": "workspace:*",
82
- "@gtkx/testing": "workspace:*",
83
- "@gtkx/vitest": "workspace:*",
84
- "vitest": "catalog:"
60
+ }
85
61
  }
86
- }
62
+ },
63
+ "engines": {
64
+ "node": ">=26.7.0"
65
+ },
66
+ "dependencies": {
67
+ "@gtkx/components": "2.0.0-beta.11",
68
+ "@gtkx/react": "2.0.0-beta.11",
69
+ "storybook": "10.6.0"
70
+ },
71
+ "peerDependencies": {
72
+ "@types/react": "^19.3",
73
+ "react": "^19.3"
74
+ },
75
+ "devDependencies": {
76
+ "@gtkx/config": "2.0.0-beta.11",
77
+ "@gtkx/testing": "2.0.0-beta.11",
78
+ "@gtkx/vitest": "2.0.0-beta.11",
79
+ "@types/react": "^19.3.0",
80
+ "vitest": "^5.0.1"
81
+ },
82
+ "scripts": {
83
+ "release": "tsx ../../scripts/release-package.ts"
84
+ }
85
+ }
package/src/actions.ts CHANGED
@@ -6,7 +6,6 @@ type ActionEntry = {
6
6
  id: number;
7
7
  name: string;
8
8
  args: string[];
9
- timestamp: number;
10
9
  error?: string;
11
10
  };
12
11
 
@@ -81,7 +80,6 @@ class ActionStore {
81
80
  private entries: ActionEntry[] = [];
82
81
  private readonly listeners: Set<() => void> = new Set();
83
82
  private nextId = 0;
84
- private readonly limit: number;
85
83
 
86
84
  getSnapshot = (): ActionEntry[] => this.entries;
87
85
 
@@ -97,14 +95,6 @@ class ActionStore {
97
95
  this.publish([]);
98
96
  };
99
97
 
100
- constructor(limit: number = DEFAULT_HISTORY_LIMIT) {
101
- if (!Number.isSafeInteger(limit) || limit < 1) {
102
- throw new RangeError("Action history needs a positive integer limit");
103
- }
104
-
105
- this.limit = limit;
106
- }
107
-
108
98
  private publish(entries: ActionEntry[]): void {
109
99
  this.entries = entries;
110
100
 
@@ -118,10 +108,9 @@ class ActionStore {
118
108
  id: this.nextId++,
119
109
  name,
120
110
  args: args.slice(0, 8).map((value) => formatArgument(value)),
121
- timestamp: Date.now(),
122
111
  ...(error !== undefined && { error: error.message.slice(0, MAX_ARGUMENT_LENGTH) }),
123
112
  };
124
- this.publish([...this.entries, entry].slice(-this.limit));
113
+ this.publish([...this.entries, entry].slice(-DEFAULT_HISTORY_LIMIT));
125
114
  }
126
115
  }
127
116
 
package/src/catalog.ts CHANGED
@@ -80,7 +80,7 @@ const explicitControls = (
80
80
  continue;
81
81
  }
82
82
 
83
- controls[argument] = { ...annotation, control: control === false ? false : annotation?.control ?? control };
83
+ controls[argument] = { ...annotation, control: control !== false && (annotation?.control ?? control) };
84
84
  }
85
85
 
86
86
  return controls;
package/src/compose.ts CHANGED
@@ -34,10 +34,6 @@ const composeStory = <TArgs extends object>(
34
34
  preview: Preview = {},
35
35
  exportName?: string,
36
36
  ): ComposedStory<TArgs> => {
37
- requireObject(story);
38
- requireObject(meta);
39
- requireObject(preview);
40
-
41
37
  if (!story.render && !meta.render && !preview.render && !meta.component) {
42
38
  throw new TypeError("A story needs a component or render function");
43
39
  }
@@ -67,9 +63,7 @@ const composeStories = <TModule extends StoryModule>(
67
63
  stories: TModule,
68
64
  preview: Preview = {},
69
65
  ): ComposedStories<TModule> => {
70
- requireObject(stories);
71
66
  requireObject(stories.default);
72
- requireObject(preview);
73
67
 
74
68
  const meta = stories.default as ComponentMeta<Args>;
75
69
  const composed: Partial<ComposedStories<TModule>> = {};