@weasel-js/forge 1.9.4 → 1.10.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.
Files changed (48) hide show
  1. package/README.md +13 -7
  2. package/dist/{FrameController-BQjKhdwk.d.ts → FrameController-UeTY7ubF.d.ts} +25 -1
  3. package/dist/{chunk-B3PPHJTS.js → chunk-AP3DRQLI.js} +16 -16
  4. package/dist/chunk-AP3DRQLI.js.map +1 -0
  5. package/dist/{chunk-MQSFPRF6.js → chunk-BIAEGWGJ.js} +37 -19
  6. package/dist/chunk-BIAEGWGJ.js.map +1 -0
  7. package/dist/{chunk-JHL4ERDA.js → chunk-DFKCLZKS.js} +3 -3
  8. package/dist/chunk-DFKCLZKS.js.map +1 -0
  9. package/dist/{chunk-FRUA5WJF.js → chunk-DKWHGSBZ.js} +3 -3
  10. package/dist/{chunk-FRUA5WJF.js.map → chunk-DKWHGSBZ.js.map} +1 -1
  11. package/dist/{chunk-ZZCCIXEJ.js → chunk-E2FHBDNQ.js} +16 -25
  12. package/dist/chunk-E2FHBDNQ.js.map +1 -0
  13. package/dist/{chunk-TXLWQFF6.js → chunk-FL2MUPUL.js} +2 -2
  14. package/dist/chunk-FL2MUPUL.js.map +1 -0
  15. package/dist/{chunk-5KI5YSQ5.js → chunk-GB6PRJET.js} +3 -3
  16. package/dist/{chunk-5KI5YSQ5.js.map → chunk-GB6PRJET.js.map} +1 -1
  17. package/dist/{chunk-HRGPFQBW.js → chunk-ZAWXMUGZ.js} +6 -3
  18. package/dist/chunk-ZAWXMUGZ.js.map +1 -0
  19. package/dist/{config-Dfu-NKxd.d.ts → config-Cz7ZyGF-.d.ts} +5 -5
  20. package/dist/csf/preview-api.d.ts +5 -2
  21. package/dist/csf/preview-api.js +2 -2
  22. package/dist/csf/preview-api.js.map +1 -1
  23. package/dist/frame/index.css +19 -2
  24. package/dist/frame/index.css.map +1 -1
  25. package/dist/frame/index.d.ts +2 -2
  26. package/dist/frame/index.js +5 -5
  27. package/dist/frame/index.js.map +1 -1
  28. package/dist/index.d.ts +4 -4
  29. package/dist/index.js +3 -3
  30. package/dist/shell/index.css +41 -5
  31. package/dist/shell/index.css.map +1 -1
  32. package/dist/shell/index.d.ts +7 -6
  33. package/dist/shell/index.js +537 -334
  34. package/dist/shell/index.js.map +1 -1
  35. package/dist/test/index.d.ts +1 -1
  36. package/dist/test/index.js +6 -6
  37. package/dist/test/play.d.ts +3 -5
  38. package/dist/test/play.js.map +1 -1
  39. package/dist/vite/index.d.ts +28 -1
  40. package/dist/vite/index.js +413 -79
  41. package/dist/vite/index.js.map +1 -1
  42. package/package.json +10 -5
  43. package/dist/chunk-B3PPHJTS.js.map +0 -1
  44. package/dist/chunk-HRGPFQBW.js.map +0 -1
  45. package/dist/chunk-JHL4ERDA.js.map +0 -1
  46. package/dist/chunk-MQSFPRF6.js.map +0 -1
  47. package/dist/chunk-TXLWQFF6.js.map +0 -1
  48. package/dist/chunk-ZZCCIXEJ.js.map +0 -1
@@ -1,4 +1,4 @@
1
- import { F as FrameSetup } from '../FrameController-BQjKhdwk.js';
1
+ import { F as FrameSetup } from '../FrameController-UeTY7ubF.js';
2
2
  import '@weasel-js/labkit/config';
3
3
  import 'react';
4
4
 
@@ -1,10 +1,10 @@
1
- import { StoryTrial } from '../chunk-ZZCCIXEJ.js';
2
- import '../chunk-JHL4ERDA.js';
3
- import { loadStories } from '../chunk-B3PPHJTS.js';
1
+ import { StoryTrial } from '../chunk-E2FHBDNQ.js';
2
+ import '../chunk-DFKCLZKS.js';
3
+ import { loadStories } from '../chunk-AP3DRQLI.js';
4
4
  import '../chunk-L5XM5VKB.js';
5
- import '../chunk-HRGPFQBW.js';
6
- import '../chunk-5KI5YSQ5.js';
7
- import '../chunk-TXLWQFF6.js';
5
+ import '../chunk-ZAWXMUGZ.js';
6
+ import '../chunk-GB6PRJET.js';
7
+ import '../chunk-FL2MUPUL.js';
8
8
  import { withValueAtPath } from '@weasel-js/labkit/config';
9
9
  import { useState, useEffect } from 'react';
10
10
  import { createRoot } from 'react-dom/client';
@@ -5,12 +5,10 @@ export { default as userEvent } from '@testing-library/user-event';
5
5
  /**
6
6
  * What a CSF `play` function asserts with.
7
7
  *
8
- * A play runs in the test page beside the story — a real browser document,
9
- * driven by `forgeTest` under vitest; the workshop never runs one — so it
10
- * cannot import `vitest`, whose entry only exists inside a test worker. This module assembles the same
8
+ * A play runs in the test page beside the story, so it cannot import `vitest`,
9
+ * whose entry only exists inside a test worker. This module assembles the same
11
10
  * `expect` vitest hands a test: chai carrying `@vitest/expect`'s jest-style
12
- * matchers. Queries and input come from testing-library, which is already
13
- * browser-only.
11
+ * matchers.
14
12
  *
15
13
  * No jest-dom matchers. They install through `expect.extend`, which wants the
16
14
  * matcher state a test worker sets up, and there is none here — the call
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/test/play.ts"],"names":["expect"],"mappings":";;;;;;AAmBK,IAAA,CAAA,GAAA,CAAI,UAAU,CAAA;AACd,IAAA,CAAA,GAAA,CAAI,cAAc,CAAA;AAClB,IAAA,CAAA,GAAA,CAAI,sBAAsB,CAAA;AAGxB,IAAMA,OAAAA,GAAc,IAAA,CAAA","file":"play.js","sourcesContent":["/**\n * What a CSF `play` function asserts with.\n *\n * A play runs in the test page beside the story — a real browser document,\n * driven by `forgeTest` under vitest; the workshop never runs one — so it\n * cannot import `vitest`, whose entry only exists inside a test worker. This module assembles the same\n * `expect` vitest hands a test: chai carrying `@vitest/expect`'s jest-style\n * matchers. Queries and input come from testing-library, which is already\n * browser-only.\n *\n * No jest-dom matchers. They install through `expect.extend`, which wants the\n * matcher state a test worker sets up, and there is none here — the call\n * throws at module scope. Assert on the DOM directly instead:\n * `expect(el.textContent).toBe(…)` for `toHaveTextContent`,\n * `expect(el).not.toBeNull()` for `toBeInTheDocument`.\n */\nimport { type ExpectStatic, JestAsymmetricMatchers, JestChaiExpect, JestExtend } from '@vitest/expect';\nimport * as chai from 'chai';\n\nchai.use(JestExtend);\nchai.use(JestChaiExpect);\nchai.use(JestAsymmetricMatchers);\n\n/** `expect`, with jest's matchers. */\nexport const expect = chai.expect as unknown as ExpectStatic;\n\nexport { screen, waitFor, within } from '@testing-library/dom';\nexport { default as userEvent } from '@testing-library/user-event';\n"]}
1
+ {"version":3,"sources":["../../src/test/play.ts"],"names":["expect"],"mappings":";;;;;;AAiBK,IAAA,CAAA,GAAA,CAAI,UAAU,CAAA;AACd,IAAA,CAAA,GAAA,CAAI,cAAc,CAAA;AAClB,IAAA,CAAA,GAAA,CAAI,sBAAsB,CAAA;AAGxB,IAAMA,OAAAA,GAAc,IAAA,CAAA","file":"play.js","sourcesContent":["/**\n * What a CSF `play` function asserts with.\n *\n * A play runs in the test page beside the story, so it cannot import `vitest`,\n * whose entry only exists inside a test worker. This module assembles the same\n * `expect` vitest hands a test: chai carrying `@vitest/expect`'s jest-style\n * matchers.\n *\n * No jest-dom matchers. They install through `expect.extend`, which wants the\n * matcher state a test worker sets up, and there is none here — the call\n * throws at module scope. Assert on the DOM directly instead:\n * `expect(el.textContent).toBe(…)` for `toHaveTextContent`,\n * `expect(el).not.toBeNull()` for `toBeInTheDocument`.\n */\nimport { type ExpectStatic, JestAsymmetricMatchers, JestChaiExpect, JestExtend } from '@vitest/expect';\nimport * as chai from 'chai';\n\nchai.use(JestExtend);\nchai.use(JestChaiExpect);\nchai.use(JestAsymmetricMatchers);\n\n/** `expect`, with jest's matchers. */\nexport const expect = chai.expect as unknown as ExpectStatic;\n\nexport { screen, waitFor, within } from '@testing-library/dom';\nexport { default as userEvent } from '@testing-library/user-event';\n"]}
@@ -1,5 +1,14 @@
1
1
  import { Plugin } from 'vite';
2
2
 
3
+ /** Narrows which props get a control. */
4
+ interface PropControlsOptions {
5
+ /**
6
+ * Leaves out a prop declared in a file this answers true for, given the file's absolute path. Props that React's
7
+ * types or TypeScript's libraries declare are always left out.
8
+ */
9
+ skip?: (declaredIn: string) => boolean;
10
+ }
11
+
3
12
  /** Options for the `forge` vite plugin. */
4
13
  interface ForgeOptions {
5
14
  /** Globs of story files, relative to the vite root. */
@@ -12,6 +21,12 @@ interface ForgeOptions {
12
21
  frameStyles?: string[];
13
22
  /** Alias Storybook's runtime modules to forge shims. Default true. */
14
23
  storybookShims?: boolean;
24
+ /**
25
+ * Give a CSF story a control for each prop of its meta's `component`, read from the component's TypeScript types;
26
+ * the story's own `args` and `argTypes` refine them. Needs `typescript` installed. Default true; an object narrows
27
+ * which props are read.
28
+ */
29
+ propControls?: boolean | PropControlsOptions;
15
30
  }
16
31
  /**
17
32
  * The vite plugin that serves the workshop: it indexes the story files, serves the workshop at `/` and the frame
@@ -34,4 +49,16 @@ interface ForgeTestOptions {
34
49
  */
35
50
  declare function forgeTest(options: ForgeTestOptions): Plugin[];
36
51
 
37
- export { type ForgeOptions, type ForgeTestOptions, forge, forgeTest };
52
+ /** Options for the `watchProbe` vite plugin. */
53
+ interface WatchProbeOptions {
54
+ /**
55
+ * Answers whether the OS is reporting file changes: false makes the plugin log its warning. Called once, as the
56
+ * dev server starts, and not at all where the server polls or does not watch. Default: {@link fileEventsArrive},
57
+ * which writes a temp file and waits five seconds for the report.
58
+ */
59
+ probe?: () => Promise<boolean>;
60
+ }
61
+ /** A plugin giving any dev server the warning forge's own gives when the OS reports no file changes. */
62
+ declare function watchProbe({ probe }?: WatchProbeOptions): Plugin;
63
+
64
+ export { type ForgeOptions, type ForgeTestOptions, type PropControlsOptions, type WatchProbeOptions, forge, forgeTest, watchProbe };