@systemfsoftware/storybook-gherkin 3.0.7 → 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,11 @@
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
+
3
9
  ## 3.0.7
4
10
 
5
11
  ### Patch Changes
package/dist/index.d.ts CHANGED
@@ -34,14 +34,22 @@ export declare interface Capture<Name extends string = string, _A = unknown> ext
34
34
  readonly default: string | undefined;
35
35
  }
36
36
 
37
- export declare function capture<Name extends string, A>(name: Name, options: {
38
- readonly schema: Schema.Codec<A, string>;
39
- readonly default?: string;
40
- }): Capture<Name, A>;
41
-
42
- export declare function capture<Name extends string>(name: Name, options?: {
43
- readonly default?: string;
44
- }): 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
+ };
45
53
 
46
54
  export declare class CaptureDecodeFailed extends CaptureDecodeFailed_base {}
47
55
 
@@ -107,7 +115,10 @@ export declare interface Feature<M, TArgs = unknown> {
107
115
  * context interpreting each scenario's composed step program exactly once,
108
116
  * at the play edge.
109
117
  */
110
- 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
+ };
111
122
 
112
123
  export declare interface FeatureOptions {
113
124
  /**
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.7",
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,10 +65,7 @@
62
65
  "tsdown": "^0.23.0",
63
66
  "typescript": "^7",
64
67
  "vite": "^8",
65
- "vitest": "^5",
66
- "@systemfsoftware/oxlint-config-recommended": "^1.1.0",
67
- "@systemfsoftware/tsconfig": "^1.3.6",
68
- "@systemfsoftware/tsdown-config": "^0.1.0"
68
+ "vitest": "^5"
69
69
  },
70
70
  "publishConfig": {
71
71
  "provenance": true
@@ -73,9 +73,9 @@
73
73
  "scripts": {
74
74
  "clean": "rimraf dist",
75
75
  "build": "tsdown -l warn && pnpm dts:check && pnpm api:check",
76
- "typecheck": "tsc --noEmit --incremental",
76
+ "typecheck": "tsc -b",
77
77
  "lint": "f=${OXLINT_FORMAT:-${AGENT:+agent}}; oxlint . --config oxlint.config.ts --format=${f:-default}",
78
- "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}",
79
79
  "attw": "attw --pack .",
80
80
  "dts:check": "node scripts/check-dts.mjs",
81
81
  "storybook": "storybook dev -p 6006 --no-open",