@systemfsoftware/storybook-gherkin 3.0.6 → 4.0.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @systemfsoftware/storybook-gherkin
2
2
 
3
+ ## 4.0.0
4
+
5
+ ### Major Changes
6
+
7
+ - `feature` now requires its options argument, and it can be called data-last as `feature(options)(meta)`. `capture`, and the step helpers that took their subject first, gain the same data-last form. Write `feature(meta)` as `feature(meta, {})`.
8
+
9
+ ## 3.0.7
10
+
11
+ ### Patch Changes
12
+
13
+ - Unconstrained type holes are defaulted type parameters (`<A = unknown>`) instead of a type argument `unknown`. Calls that omit those arguments are unchanged.
14
+
3
15
  ## 3.0.6
4
16
 
5
17
  ### Patch Changes
package/dist/index.d.ts CHANGED
@@ -9,6 +9,12 @@ import { YieldableError } from 'effect/Cause';
9
9
 
10
10
  export declare const And: StepCtor;
11
11
 
12
+ declare type AnyConstraintDecoder$1<A = unknown> = Schema.ConstraintDecoder<A>;
13
+
14
+ declare type AnyConstraintDecoder<A = unknown> = Schema.ConstraintDecoder<A>;
15
+
16
+ declare type AnyValue<V = unknown> = V;
17
+
12
18
  export declare class BackgroundNotGiven extends BackgroundNotGiven_base {}
13
19
 
14
20
  declare const BackgroundNotGiven_base: Schema.Class<BackgroundNotGiven, Schema.TaggedStruct<"BackgroundNotGiven", {
@@ -24,18 +30,26 @@ export declare type CapsOf<THoles extends readonly Hole[]> = THoles extends read
24
30
 
25
31
  export declare interface Capture<Name extends string = string, _A = unknown> extends CaptureTag {
26
32
  readonly name: Name;
27
- readonly schema: Schema.ConstraintDecoder<unknown> | undefined;
33
+ readonly schema: AnyConstraintDecoder$1 | undefined;
28
34
  readonly default: string | undefined;
29
35
  }
30
36
 
31
- export declare function capture<Name extends string, A>(name: Name, options: {
32
- readonly schema: Schema.Codec<A, string>;
33
- readonly default?: string;
34
- }): Capture<Name, A>;
35
-
36
- export declare function capture<Name extends string>(name: Name, options?: {
37
- readonly default?: string;
38
- }): Capture<Name, string>;
37
+ export declare const capture: {
38
+ <Name extends string, A>(options: {
39
+ readonly schema: Schema.Codec<A, string>;
40
+ readonly default?: string;
41
+ }): (name: Name) => Capture<Name, A>;
42
+ <Name extends string>(options?: {
43
+ readonly default?: string;
44
+ }): (name: Name) => Capture<Name, string>;
45
+ <Name extends string, A>(name: Name, options: {
46
+ readonly schema: Schema.Codec<A, string>;
47
+ readonly default?: string;
48
+ }): Capture<Name, A>;
49
+ <Name extends string>(name: Name, options?: {
50
+ readonly default?: string;
51
+ }): Capture<Name, string>;
52
+ };
39
53
 
40
54
  export declare class CaptureDecodeFailed extends CaptureDecodeFailed_base {}
41
55
 
@@ -49,7 +63,7 @@ declare const CaptureDecodeFailed_base: Schema.Class<CaptureDecodeFailed, Schema
49
63
  export declare interface CaptureModel {
50
64
  readonly name: string;
51
65
  /** Service-free decode view — the v4 counterpart of the removed no-context alias. */
52
- readonly schema: Schema.ConstraintDecoder<unknown> | undefined;
66
+ readonly schema: AnyConstraintDecoder | undefined;
53
67
  readonly default: string | undefined;
54
68
  }
55
69
 
@@ -101,7 +115,10 @@ export declare interface Feature<M, TArgs = unknown> {
101
115
  * context interpreting each scenario's composed step program exactly once,
102
116
  * at the play edge.
103
117
  */
104
- export declare const feature: <M>(meta: M, options?: FeatureOptions) => Feature<M>;
118
+ export declare const feature: {
119
+ <M>(options: FeatureOptions): (meta: M) => Feature<M>;
120
+ <M>(meta: M, options: FeatureOptions): Feature<M>;
121
+ };
105
122
 
106
123
  export declare interface FeatureOptions {
107
124
  /**
@@ -173,17 +190,17 @@ export declare interface PlayContext<TArgs = unknown> {
173
190
  readonly step: StepFn;
174
191
  readonly userEvent: UserEventObject;
175
192
  readonly args: TArgs;
176
- readonly globals: Record<string, unknown>;
177
- readonly parameters: Record<string, unknown>;
178
- readonly loaded: Record<string, unknown>;
193
+ readonly globals: Record<string, AnyValue>;
194
+ readonly parameters: Record<string, AnyValue>;
195
+ readonly loaded: Record<string, AnyValue>;
179
196
  readonly abortSignal: AbortSignal;
180
197
  readonly reporting: ReportingAPI;
181
198
  }
182
199
 
183
- declare interface Report_2 {
200
+ declare interface Report_2<Result = unknown> {
184
201
  readonly type: string;
185
202
  readonly version?: number;
186
- readonly result: unknown;
203
+ readonly result: Result;
187
204
  readonly status: 'failed' | 'passed' | 'warning';
188
205
  }
189
206
  export { Report_2 as Report }
@@ -247,9 +264,9 @@ export declare interface StepContext<TArgs = unknown> {
247
264
  readonly userEvent: UserEventObject;
248
265
  readonly step: StepFn;
249
266
  readonly args: TArgs;
250
- readonly globals: Record<string, unknown>;
251
- readonly parameters: Record<string, unknown>;
252
- readonly loaded: Record<string, unknown>;
267
+ readonly globals: Record<string, AnyValue>;
268
+ readonly parameters: Record<string, AnyValue>;
269
+ readonly loaded: Record<string, AnyValue>;
253
270
  readonly canvasElement: HTMLElement;
254
271
  /**
255
272
  * Fires on story teardown (remount, navigation, HMR). Since the 2026-08-09
package/dist/index.mjs CHANGED
@@ -1,8 +1,9 @@
1
+ import { dual } from "effect/Function";
1
2
  import { Array as Array$1, Cause, Context, Deferred, Effect, Exit, Fiber, Match, Schema } from "effect";
2
3
  import { screen } from "storybook/test";
3
4
  //#region src/Capture.ts
4
5
  const CaptureTag = { _tag: "Capture" };
5
- function capture(name, options) {
6
+ function captureImpl(name, options) {
6
7
  const resolved = options ?? {};
7
8
  return {
8
9
  ...CaptureTag,
@@ -11,6 +12,7 @@ function capture(name, options) {
11
12
  default: resolved.default
12
13
  };
13
14
  }
15
+ const capture = dual((args) => typeof args[0] === "string", captureImpl);
14
16
  //#endregion
15
17
  //#region src/Errors.schema.ts
16
18
  const ConcreteKeywordSchema = Schema.Literals([
@@ -83,7 +85,8 @@ const holeText = (cap, values) => {
83
85
  if (fromValues !== void 0) return fromValues;
84
86
  return firstString(cap.default, `{${cap.name}}`);
85
87
  };
86
- const renderStepText = (step, values) => joinStep(step, (cap) => holeText(cap, values));
88
+ const renderStepTextImpl = (step, values) => joinStep(step, (cap) => holeText(cap, values));
89
+ const renderStepText = dual(2, renderStepTextImpl);
87
90
  const resolveKeyword = (keyword, previous) => Match.value(keyword).pipe(Match.when("Given", () => "Given"), Match.when("When", () => "When"), Match.when("Then", () => "Then"), Match.when("And", () => previous), Match.when("But", () => previous), Match.when("Star", () => previous), Match.exhaustive);
88
91
  const resolveKeywords = (steps) => {
89
92
  return Array$1.mapAccum(steps, "Given", (previous, s) => {
@@ -466,13 +469,14 @@ const contextOf = (options) => {
466
469
  if (options.context === void 0) return Context.empty();
467
470
  return options.context;
468
471
  };
472
+ const featureImpl = (meta, options) => makeFeature(meta, contextOf(options));
469
473
  /**
470
474
  * Declare a feature: a story set whose scenarios execute as CSF `play`
471
475
  * functions. `options.context` (default `Context.empty()`) is the Effect
472
476
  * context interpreting each scenario's composed step program exactly once,
473
477
  * at the play edge.
474
478
  */
475
- const feature = (meta, options = {}) => makeFeature(meta, contextOf(options));
479
+ const feature = dual(2, featureImpl);
476
480
  const Steps = (...steps) => [...steps];
477
481
  const From = (story) => {
478
482
  const play = story.play;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@systemfsoftware/storybook-gherkin",
3
3
  "license": "Apache-2.0",
4
- "version": "3.0.6",
4
+ "version": "4.0.0",
5
5
  "author": "Ryan Lee <drdgvhbh@gmail.com>",
6
6
  "repository": {
7
7
  "type": "git",
@@ -47,6 +47,9 @@
47
47
  "@storybook/addon-vitest": "^10.6.0",
48
48
  "@storybook/react-vite": "^10.6.0",
49
49
  "@systemfsoftware/arethetypeswrong-cli": "^4.2.0",
50
+ "@systemfsoftware/oxlint-config-recommended": "^2.0.0",
51
+ "@systemfsoftware/tsconfig": "^2.0.0",
52
+ "@systemfsoftware/tsdown-config": "^0.1.0",
50
53
  "@types/node": "^26",
51
54
  "@types/react": "^19.3.0",
52
55
  "@types/react-dom": "^19.3.0",
@@ -62,11 +65,7 @@
62
65
  "tsdown": "^0.23.0",
63
66
  "typescript": "^7",
64
67
  "vite": "^8",
65
- "vitest": "^5",
66
- "@systemfsoftware/all": "^2.1.2",
67
- "@systemfsoftware/oxlint-config": "^0.1.0",
68
- "@systemfsoftware/tsdown-config": "^0.1.0",
69
- "@systemfsoftware/tsconfig": "^1.3.6"
68
+ "vitest": "^5"
70
69
  },
71
70
  "publishConfig": {
72
71
  "provenance": true
@@ -74,9 +73,9 @@
74
73
  "scripts": {
75
74
  "clean": "rimraf dist",
76
75
  "build": "tsdown -l warn && pnpm dts:check && pnpm api:check",
77
- "typecheck": "tsc --noEmit --incremental",
76
+ "typecheck": "tsc -b",
78
77
  "lint": "f=${OXLINT_FORMAT:-${AGENT:+agent}}; oxlint . --config oxlint.config.ts --format=${f:-default}",
79
- "lint:tsgo": "effect-tsgo diagnostics --project tsconfig.json --format ${TSGO_FORMAT:-text}",
78
+ "lint:tsgo": "effect-tsgo diagnostics --project tsconfig.app.json --format ${TSGO_FORMAT:-text} && effect-tsgo diagnostics --project tsconfig.test.json --format ${TSGO_FORMAT:-text}",
80
79
  "attw": "attw --pack .",
81
80
  "dts:check": "node scripts/check-dts.mjs",
82
81
  "storybook": "storybook dev -p 6006 --no-open",