executable-stories-showcase 0.0.0-stage → 0.1.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/LICENSE +202 -0
- package/README.md +17 -2
- package/dist/adapters/cookies.d.ts +11 -0
- package/dist/adapters/cookies.js +27 -0
- package/dist/adapters/cookies.js.map +1 -0
- package/dist/adapters/redux.d.ts +23 -0
- package/dist/adapters/redux.js +28 -0
- package/dist/adapters/redux.js.map +1 -0
- package/dist/adapters/tanstack-query.d.ts +17 -0
- package/dist/adapters/tanstack-query.js +43 -0
- package/dist/adapters/tanstack-query.js.map +1 -0
- package/dist/adapters/xstate.d.ts +33 -0
- package/dist/adapters/xstate.js +36 -0
- package/dist/adapters/xstate.js.map +1 -0
- package/dist/adapters/zustand.d.ts +17 -0
- package/dist/adapters/zustand.js +16 -0
- package/dist/adapters/zustand.js.map +1 -0
- package/dist/capture-CIKR46QE.js +10 -0
- package/dist/capture-CIKR46QE.js.map +1 -0
- package/dist/capture.d.ts +26 -0
- package/dist/catalog.d.ts +27 -0
- package/dist/chunk-BK4EEQXV.js +98 -0
- package/dist/chunk-BK4EEQXV.js.map +1 -0
- package/dist/chunk-C755RCRL.js +125 -0
- package/dist/chunk-C755RCRL.js.map +1 -0
- package/dist/chunk-COLHEOSE.js +148 -0
- package/dist/chunk-COLHEOSE.js.map +1 -0
- package/dist/chunk-DETES767.js +43 -0
- package/dist/chunk-DETES767.js.map +1 -0
- package/dist/chunk-ESIS3D6R.js +47 -0
- package/dist/chunk-ESIS3D6R.js.map +1 -0
- package/dist/chunk-MCC3CAWQ.js +208 -0
- package/dist/chunk-MCC3CAWQ.js.map +1 -0
- package/dist/chunk-XLNYICOI.js +234 -0
- package/dist/chunk-XLNYICOI.js.map +1 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.js +531 -0
- package/dist/index.js.map +1 -0
- package/dist/jwt.d.ts +7 -0
- package/dist/link.d.ts +33 -0
- package/dist/network-I5SB4F6T.js +7 -0
- package/dist/network-I5SB4F6T.js.map +1 -0
- package/dist/network.d.ts +3 -0
- package/dist/next.d.ts +21 -0
- package/dist/next.js +30 -0
- package/dist/next.js.map +1 -0
- package/dist/no-msw-browser.d.ts +2 -0
- package/dist/no-msw-browser.js +8 -0
- package/dist/no-msw-browser.js.map +1 -0
- package/dist/panel.d.ts +30 -0
- package/dist/panel.js +607 -0
- package/dist/panel.js.map +1 -0
- package/dist/playwright.d.ts +31 -0
- package/dist/playwright.js +92 -0
- package/dist/playwright.js.map +1 -0
- package/dist/ready-4MENAMNI.js +13 -0
- package/dist/ready-4MENAMNI.js.map +1 -0
- package/dist/ready.d.ts +39 -0
- package/dist/record.d.ts +49 -0
- package/dist/redact.d.ts +18 -0
- package/dist/runtime.d.ts +191 -0
- package/dist/save.d.ts +27 -0
- package/dist/schema.d.ts +161 -0
- package/dist/vite.d.ts +11 -0
- package/dist/vite.js +26 -0
- package/dist/vite.js.map +1 -0
- package/package.json +118 -3
package/dist/link.d.ts
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { Scenario } from './schema.js';
|
|
2
|
+
declare global {
|
|
3
|
+
/** Requests the active scenario didn't cover, for tests and agents (see `unhandledRequests`). */
|
|
4
|
+
var executableStoriesShowcaseUnhandled: string[] | undefined;
|
|
5
|
+
}
|
|
6
|
+
export declare const PARAM = "scenario";
|
|
7
|
+
/** Fail unmatched requests instead of letting them reach the network. */
|
|
8
|
+
export declare const STRICT_PARAM = "scenario-strict";
|
|
9
|
+
/** Record real responses so they can be saved as a scenario. */
|
|
10
|
+
export declare const RECORD_PARAM = "scenario-record";
|
|
11
|
+
/** Dev-server route the `executable-stories-showcase/vite` plugin serves for the panel's "Save to project". */
|
|
12
|
+
export declare const SAVE_ENDPOINT = "/__executable-stories-showcase/save";
|
|
13
|
+
export declare const LOOPBACK: Set<string>;
|
|
14
|
+
/**
|
|
15
|
+
* Whether a save URL the app's save route hands the panel is a loopback save server, such as
|
|
16
|
+
* the one the Next.js route starts on 127.0.0.1. The panel posts captured state there, so a
|
|
17
|
+
* URL on any other host is refused.
|
|
18
|
+
*/
|
|
19
|
+
export declare const isLoopbackSaveUrl: (value: string) => boolean;
|
|
20
|
+
/** Inline scenario JSON, kept in the URL hash so it never reaches a server. */
|
|
21
|
+
export declare const DATA_KEY = "scenario-data";
|
|
22
|
+
/**
|
|
23
|
+
* A shareable URL that opens the app in a resolved scenario.
|
|
24
|
+
* `inline` embeds the flattened scenario, so the link works without the catalog.
|
|
25
|
+
*/
|
|
26
|
+
export declare function scenarioHref(resolved: Scenario, { base, inline, strict, record }?: {
|
|
27
|
+
base?: string | undefined;
|
|
28
|
+
inline?: boolean | undefined;
|
|
29
|
+
strict?: boolean | undefined;
|
|
30
|
+
record?: boolean | undefined;
|
|
31
|
+
}): string;
|
|
32
|
+
/** Inline scenario JSON from a URL hash, if present. */
|
|
33
|
+
export declare const readInline: (hash: string) => string | null;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
package/dist/next.d.ts
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export interface SaveRouteOptions {
|
|
2
|
+
/** Folder the panel's "Save to project" writes into, relative to the project root. Default "src/scenarios". */
|
|
3
|
+
dir?: string;
|
|
4
|
+
}
|
|
5
|
+
declare global {
|
|
6
|
+
/** One save server per folder for the life of the dev process, across route reloads. */
|
|
7
|
+
var executableStoriesShowcaseSaveServers: Map<string, Promise<string>> | undefined;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* The route handler behind the panel's "Save to project" in Next.js (App Router). Put it at
|
|
11
|
+
* `app/%5F%5Fexecutable-stories-showcase/save/route.ts` (`%5F` is an underscore; a plain `_` folder is
|
|
12
|
+
* private and never routes):
|
|
13
|
+
*
|
|
14
|
+
* export const { GET } = createSaveRoute({ dir: 'scenarios' });
|
|
15
|
+
*
|
|
16
|
+
* `next dev` listens on the network, so this route only tells the panel where to save: a
|
|
17
|
+
* server on 127.0.0.1 that other machines can't reach. Outside `next dev` it answers 404.
|
|
18
|
+
*/
|
|
19
|
+
export declare function createSaveRoute({ dir }?: SaveRouteOptions): {
|
|
20
|
+
GET: (request: Request) => Promise<Response>;
|
|
21
|
+
};
|
package/dist/next.js
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import {
|
|
2
|
+
startSaveServer
|
|
3
|
+
} from "./chunk-COLHEOSE.js";
|
|
4
|
+
import "./chunk-ESIS3D6R.js";
|
|
5
|
+
import "./chunk-BK4EEQXV.js";
|
|
6
|
+
|
|
7
|
+
// src/next.ts
|
|
8
|
+
import { relative, resolve } from "path";
|
|
9
|
+
function createSaveRoute({ dir = "src/scenarios" } = {}) {
|
|
10
|
+
const GET = async (request) => {
|
|
11
|
+
if (process.env.NODE_ENV !== "development") return new Response(null, { status: 404 });
|
|
12
|
+
const root = process.cwd();
|
|
13
|
+
const target = resolve(root, dir);
|
|
14
|
+
const port = process.env.PORT ?? new URL(request.url).port;
|
|
15
|
+
const origins = ["localhost", "127.0.0.1", "[::1]"].map((host) => `http://${host}:${port}`);
|
|
16
|
+
const servers = globalThis.executableStoriesShowcaseSaveServers ??= /* @__PURE__ */ new Map();
|
|
17
|
+
let url = servers.get(target);
|
|
18
|
+
if (!url) {
|
|
19
|
+
url = startSaveServer({ dir: target, root, origins });
|
|
20
|
+
servers.set(target, url);
|
|
21
|
+
url.catch(() => servers.delete(target));
|
|
22
|
+
}
|
|
23
|
+
return Response.json({ dir: relative(root, target).replaceAll("\\", "/"), url: await url });
|
|
24
|
+
};
|
|
25
|
+
return { GET };
|
|
26
|
+
}
|
|
27
|
+
export {
|
|
28
|
+
createSaveRoute
|
|
29
|
+
};
|
|
30
|
+
//# sourceMappingURL=next.js.map
|
package/dist/next.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/next.ts"],"sourcesContent":["import { relative, resolve } from 'node:path';\nimport { startSaveServer } from './save.js';\n\nexport interface SaveRouteOptions {\n /** Folder the panel's \"Save to project\" writes into, relative to the project root. Default \"src/scenarios\". */\n dir?: string;\n}\n\ndeclare global {\n /** One save server per folder for the life of the dev process, across route reloads. */\n var executableStoriesShowcaseSaveServers: Map<string, Promise<string>> | undefined;\n}\n\n/**\n * The route handler behind the panel's \"Save to project\" in Next.js (App Router). Put it at\n * `app/%5F%5Fexecutable-stories-showcase/save/route.ts` (`%5F` is an underscore; a plain `_` folder is\n * private and never routes):\n *\n * export const { GET } = createSaveRoute({ dir: 'scenarios' });\n *\n * `next dev` listens on the network, so this route only tells the panel where to save: a\n * server on 127.0.0.1 that other machines can't reach. Outside `next dev` it answers 404.\n */\nexport function createSaveRoute({ dir = 'src/scenarios' }: SaveRouteOptions = {}) {\n const GET = async (request: Request): Promise<Response> => {\n if (process.env.NODE_ENV !== 'development') return new Response(null, { status: 404 });\n\n const root = process.cwd();\n const target = resolve(root, dir);\n const port = process.env.PORT ?? new URL(request.url).port;\n const origins = ['localhost', '127.0.0.1', '[::1]'].map((host) => `http://${host}:${port}`);\n\n const servers = (globalThis.executableStoriesShowcaseSaveServers ??= new Map());\n let url = servers.get(target);\n\n if (!url) {\n url = startSaveServer({ dir: target, root, origins });\n servers.set(target, url);\n // A failed start (port exhaustion, say) retries on the next request.\n url.catch(() => servers.delete(target));\n }\n\n return Response.json({ dir: relative(root, target).replaceAll('\\\\', '/'), url: await url });\n };\n\n return { GET };\n}\n"],"mappings":";;;;;;;AAAA,SAAS,UAAU,eAAe;AAuB3B,SAAS,gBAAgB,EAAE,MAAM,gBAAgB,IAAsB,CAAC,GAAG;AAChF,QAAM,MAAM,OAAO,YAAwC;AACzD,QAAI,QAAQ,IAAI,aAAa,cAAe,QAAO,IAAI,SAAS,MAAM,EAAE,QAAQ,IAAI,CAAC;AAErF,UAAM,OAAO,QAAQ,IAAI;AACzB,UAAM,SAAS,QAAQ,MAAM,GAAG;AAChC,UAAM,OAAO,QAAQ,IAAI,QAAQ,IAAI,IAAI,QAAQ,GAAG,EAAE;AACtD,UAAM,UAAU,CAAC,aAAa,aAAa,OAAO,EAAE,IAAI,CAAC,SAAS,UAAU,IAAI,IAAI,IAAI,EAAE;AAE1F,UAAM,UAAW,WAAW,yCAAyC,oBAAI,IAAI;AAC7E,QAAI,MAAM,QAAQ,IAAI,MAAM;AAE5B,QAAI,CAAC,KAAK;AACR,YAAM,gBAAgB,EAAE,KAAK,QAAQ,MAAM,QAAQ,CAAC;AACpD,cAAQ,IAAI,QAAQ,GAAG;AAEvB,UAAI,MAAM,MAAM,QAAQ,OAAO,MAAM,CAAC;AAAA,IACxC;AAEA,WAAO,SAAS,KAAK,EAAE,KAAK,SAAS,MAAM,MAAM,EAAE,WAAW,MAAM,GAAG,GAAG,KAAK,MAAM,IAAI,CAAC;AAAA,EAC5F;AAEA,SAAO,EAAE,IAAI;AACf;","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/no-msw-browser.ts"],"sourcesContent":["import type { setupWorker as SetupWorker } from 'msw/browser';\n\n// What `#msw-browser` resolves to on the server: msw/browser has no Node build, and SSR\n// bundlers (Next.js) compile client components for the server too. The worker only starts in a browser.\nexport const setupWorker: typeof SetupWorker = () => {\n throw new Error('executable-stories-showcase: the MSW worker only runs in a browser');\n};\n"],"mappings":";AAIO,IAAM,cAAkC,MAAM;AACnD,QAAM,IAAI,MAAM,oEAAoE;AACtF;","names":[]}
|
package/dist/panel.d.ts
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { ScenarioSession } from './runtime.js';
|
|
2
|
+
export interface PanelOptions {
|
|
3
|
+
/** Corner to dock in, e.g. to avoid a chat widget. Default "bottom-right". */
|
|
4
|
+
position?: 'bottom-right' | 'bottom-left' | 'top-right' | 'top-left';
|
|
5
|
+
/** Default: the maximum, so the panel stays above app overlays. */
|
|
6
|
+
zIndex?: number;
|
|
7
|
+
/** "auto" follows the OS colour scheme. Default "auto". */
|
|
8
|
+
theme?: 'auto' | 'light' | 'dark';
|
|
9
|
+
/**
|
|
10
|
+
* Relative `$schema` path stamped on Download JSON, e.g. `../scenario.schema.json`.
|
|
11
|
+
* Copy link stays schema-free.
|
|
12
|
+
*/
|
|
13
|
+
schemaPath?: string;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Add the floating scenario panel to the page. Framework-agnostic.
|
|
17
|
+
* Remove it with `panel.remove()`; it unsubscribes from the session.
|
|
18
|
+
*/
|
|
19
|
+
export declare function mountPanel(session: ScenarioSession, options?: PanelOptions): ScenarioPanel;
|
|
20
|
+
declare const Base: typeof HTMLElement;
|
|
21
|
+
declare class ScenarioPanel extends Base {
|
|
22
|
+
session: ScenarioSession;
|
|
23
|
+
schemaPath?: string;
|
|
24
|
+
private render?;
|
|
25
|
+
private unsubscribe?;
|
|
26
|
+
private stopPick?;
|
|
27
|
+
disconnectedCallback(): void;
|
|
28
|
+
connectedCallback(): void;
|
|
29
|
+
}
|
|
30
|
+
export {};
|