@storybook/web-components 11.0.0-alpha.3 → 11.0.0-alpha.5

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.
@@ -125,7 +125,7 @@ var { Node: Node2 } = global, render = (args, context) => {
125
125
  `Unable to render story ${id} as the component annotation is missing from the default export`
126
126
  );
127
127
  let element = document.createElement(component);
128
- if (!global.FEATURES?.experimentalDocgenServer)
128
+ if (!global.FEATURES?.docgenServer)
129
129
  return Object.assign(element, args);
130
130
  let styleRules = bindArgs(element, args), fragment = document.createDocumentFragment();
131
131
  if (styleRules.length > 0) {
@@ -31,7 +31,7 @@ function sourceDecorator(storyFn, context) {
31
31
  }
32
32
 
33
33
  // src/entry-preview-docs.ts
34
- var decorators = [sourceDecorator], parameters = {
34
+ var useStaticServiceSnippets = "FEATURES" in globalThis && globalThis.FEATURES?.docgenServer, decorators = useStaticServiceSnippets ? [] : [sourceDecorator], parameters = {
35
35
  docs: {
36
36
  source: {
37
37
  type: SourceType2.DYNAMIC,
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  entry_preview_exports
3
- } from "./chunk-Z3YF52EY.js";
3
+ } from "./chunk-BNL7LBNI.js";
4
4
  import {
5
5
  entry_preview_docs_exports
6
- } from "./chunk-6ZSMINL7.js";
6
+ } from "./chunk-EGBR6PF2.js";
7
7
 
8
8
  // src/index.ts
9
9
  import { global as global3 } from "@storybook/global";
@@ -56,7 +56,11 @@ import { definePreview as definePreviewBase } from "storybook/internal/csf";
56
56
  function __definePreview(input) {
57
57
  return definePreviewBase({
58
58
  ...input,
59
- addons: [entry_preview_exports, entry_preview_docs_exports, ...input.addons ?? []]
59
+ addons: [
60
+ entry_preview_exports,
61
+ entry_preview_docs_exports,
62
+ ...input.addons ?? []
63
+ ]
60
64
  });
61
65
  }
62
66
 
@@ -1,10 +1,10 @@
1
- import CJS_COMPAT_NODE_URL_gxnqjb69o0i from 'node:url';
2
- import CJS_COMPAT_NODE_PATH_gxnqjb69o0i from 'node:path';
3
- import CJS_COMPAT_NODE_MODULE_gxnqjb69o0i from "node:module";
1
+ import CJS_COMPAT_NODE_URL_kx3y04w7glc from 'node:url';
2
+ import CJS_COMPAT_NODE_PATH_kx3y04w7glc from 'node:path';
3
+ import CJS_COMPAT_NODE_MODULE_kx3y04w7glc from "node:module";
4
4
 
5
- var __filename = CJS_COMPAT_NODE_URL_gxnqjb69o0i.fileURLToPath(import.meta.url);
6
- var __dirname = CJS_COMPAT_NODE_PATH_gxnqjb69o0i.dirname(__filename);
7
- var require = CJS_COMPAT_NODE_MODULE_gxnqjb69o0i.createRequire(import.meta.url);
5
+ var __filename = CJS_COMPAT_NODE_URL_kx3y04w7glc.fileURLToPath(import.meta.url);
6
+ var __dirname = CJS_COMPAT_NODE_PATH_kx3y04w7glc.dirname(__filename);
7
+ var require = CJS_COMPAT_NODE_MODULE_kx3y04w7glc.createRequire(import.meta.url);
8
8
 
9
9
  // ------------------------------------------------------------
10
10
  // end of CJS compatibility banner, injected by Storybook's esbuild configuration
@@ -43,6 +43,35 @@ function readCssPropertySyntax(property, typeProperty) {
43
43
  return property.syntax ?? readTypeText(property, typeProperty);
44
44
  }
45
45
 
46
+ // src/docgen/component-docgen/resolve-component/resolve-component.ts
47
+ import { loadCsf, unwrapExpression } from "storybook/internal/csf-tools";
48
+ import { recast, types as t } from "storybook/internal/babel";
49
+ import { readFileSync } from "node:fs";
50
+ function parseStoryFile(storyFilePath, title) {
51
+ try {
52
+ let source = readFileSync(storyFilePath, "utf8");
53
+ return loadCsf(source, { makeTitle: () => title }).parse();
54
+ } catch {
55
+ return;
56
+ }
57
+ }
58
+ var expressionFor = (node) => recast.print(node).code;
59
+ function tagFromNode(node) {
60
+ let expression = expressionFor(node), unwrapped = unwrapExpression(node);
61
+ if (t.isStringLiteral(unwrapped) && unwrapped.value !== "")
62
+ return { tag: unwrapped.value };
63
+ if (t.isTemplateLiteral(unwrapped) && unwrapped.expressions.length === 0) {
64
+ let tag = unwrapped.quasis[0]?.value.cooked;
65
+ if (tag)
66
+ return { tag };
67
+ }
68
+ return { reason: "component-not-a-tag", expression };
69
+ }
70
+ function resolveStoryComponent(csf) {
71
+ let component = csf._metaAnnotations.component;
72
+ return component ? tagFromNode(component) : { reason: "no-meta-component" };
73
+ }
74
+
46
75
  export {
47
76
  isRecord,
48
77
  namedItems,
@@ -52,5 +81,7 @@ export {
52
81
  firstValue,
53
82
  DEFAULT_TYPE_PROPERTY,
54
83
  readTypeText,
55
- readCssPropertySyntax
84
+ readCssPropertySyntax,
85
+ parseStoryFile,
86
+ resolveStoryComponent
56
87
  };
@@ -1,10 +1,10 @@
1
- import CJS_COMPAT_NODE_URL_gxnqjb69o0i from 'node:url';
2
- import CJS_COMPAT_NODE_PATH_gxnqjb69o0i from 'node:path';
3
- import CJS_COMPAT_NODE_MODULE_gxnqjb69o0i from "node:module";
1
+ import CJS_COMPAT_NODE_URL_kx3y04w7glc from 'node:url';
2
+ import CJS_COMPAT_NODE_PATH_kx3y04w7glc from 'node:path';
3
+ import CJS_COMPAT_NODE_MODULE_kx3y04w7glc from "node:module";
4
4
 
5
- var __filename = CJS_COMPAT_NODE_URL_gxnqjb69o0i.fileURLToPath(import.meta.url);
6
- var __dirname = CJS_COMPAT_NODE_PATH_gxnqjb69o0i.dirname(__filename);
7
- var require = CJS_COMPAT_NODE_MODULE_gxnqjb69o0i.createRequire(import.meta.url);
5
+ var __filename = CJS_COMPAT_NODE_URL_kx3y04w7glc.fileURLToPath(import.meta.url);
6
+ var __dirname = CJS_COMPAT_NODE_PATH_kx3y04w7glc.dirname(__filename);
7
+ var require = CJS_COMPAT_NODE_MODULE_kx3y04w7glc.createRequire(import.meta.url);
8
8
 
9
9
  // ------------------------------------------------------------
10
10
  // end of CJS compatibility banner, injected by Storybook's esbuild configuration
@@ -15,10 +15,12 @@ import {
15
15
  firstValue,
16
16
  isRecord,
17
17
  namedItems,
18
+ parseStoryFile,
18
19
  readCssPropertySyntax,
19
20
  readTypeText,
21
+ resolveStoryComponent,
20
22
  trimmedOrUndefined
21
- } from "./chunk-F7GJU26Y.js";
23
+ } from "./chunk-RKWQNNM2.js";
22
24
 
23
25
  // src/docgen/docgen-worker.ts
24
26
  import { createLazyDocgenMiddleware } from "storybook/internal/common";
@@ -516,35 +518,6 @@ function cssCustomPropertyControl(syntax) {
516
518
  return lowerSyntax === "<color>" ? { type: { name: "string" }, control: { type: "color" } } : lowerSyntax === "<number>" || lowerSyntax === "<integer>" ? { type: { name: "number" } } : { type: { name: "string" } };
517
519
  }
518
520
 
519
- // src/docgen/component-docgen/resolve-component/resolve-component.ts
520
- import { loadCsf, unwrapExpression } from "storybook/internal/csf-tools";
521
- import { recast, types as t } from "storybook/internal/babel";
522
- import { readFileSync } from "node:fs";
523
- function parseStoryFile(storyFilePath, title) {
524
- try {
525
- let source = readFileSync(storyFilePath, "utf8");
526
- return loadCsf(source, { makeTitle: () => title }).parse();
527
- } catch {
528
- return;
529
- }
530
- }
531
- var expressionFor = (node) => recast.print(node).code;
532
- function tagFromNode(node) {
533
- let expression = expressionFor(node), unwrapped = unwrapExpression(node);
534
- if (t.isStringLiteral(unwrapped) && unwrapped.value !== "")
535
- return { tag: unwrapped.value };
536
- if (t.isTemplateLiteral(unwrapped) && unwrapped.expressions.length === 0) {
537
- let tag = unwrapped.quasis[0]?.value.cooked;
538
- if (tag)
539
- return { tag };
540
- }
541
- return { reason: "component-not-a-tag", expression };
542
- }
543
- function resolveStoryComponent(csf) {
544
- let component = csf._metaAnnotations.component;
545
- return component ? tagFromNode(component) : { reason: "no-meta-component" };
546
- }
547
-
548
521
  // src/docgen/component-docgen/build-docgen.ts
549
522
  function buildDocgenPayload(input, context) {
550
523
  let storyImportPath = getStoryImportPathFromEntry(input.entry);
@@ -1,18 +1,18 @@
1
- import CJS_COMPAT_NODE_URL_gxnqjb69o0i from 'node:url';
2
- import CJS_COMPAT_NODE_PATH_gxnqjb69o0i from 'node:path';
3
- import CJS_COMPAT_NODE_MODULE_gxnqjb69o0i from "node:module";
1
+ import CJS_COMPAT_NODE_URL_kx3y04w7glc from 'node:url';
2
+ import CJS_COMPAT_NODE_PATH_kx3y04w7glc from 'node:path';
3
+ import CJS_COMPAT_NODE_MODULE_kx3y04w7glc from "node:module";
4
4
 
5
- var __filename = CJS_COMPAT_NODE_URL_gxnqjb69o0i.fileURLToPath(import.meta.url);
6
- var __dirname = CJS_COMPAT_NODE_PATH_gxnqjb69o0i.dirname(__filename);
7
- var require = CJS_COMPAT_NODE_MODULE_gxnqjb69o0i.createRequire(import.meta.url);
5
+ var __filename = CJS_COMPAT_NODE_URL_kx3y04w7glc.fileURLToPath(import.meta.url);
6
+ var __dirname = CJS_COMPAT_NODE_PATH_kx3y04w7glc.dirname(__filename);
7
+ var require = CJS_COMPAT_NODE_MODULE_kx3y04w7glc.createRequire(import.meta.url);
8
8
 
9
9
  // ------------------------------------------------------------
10
10
  // end of CJS compatibility banner, injected by Storybook's esbuild configuration
11
11
  // ------------------------------------------------------------
12
12
  import {
13
13
  createDocgenProvider
14
- } from "../_node-chunks/chunk-PEWWXGF7.js";
15
- import "../_node-chunks/chunk-F7GJU26Y.js";
14
+ } from "../_node-chunks/chunk-VL6TVWMP.js";
15
+ import "../_node-chunks/chunk-RKWQNNM2.js";
16
16
  export {
17
17
  createDocgenProvider
18
18
  };
@@ -1,10 +1,10 @@
1
- import CJS_COMPAT_NODE_URL_gxnqjb69o0i from 'node:url';
2
- import CJS_COMPAT_NODE_PATH_gxnqjb69o0i from 'node:path';
3
- import CJS_COMPAT_NODE_MODULE_gxnqjb69o0i from "node:module";
1
+ import CJS_COMPAT_NODE_URL_kx3y04w7glc from 'node:url';
2
+ import CJS_COMPAT_NODE_PATH_kx3y04w7glc from 'node:path';
3
+ import CJS_COMPAT_NODE_MODULE_kx3y04w7glc from "node:module";
4
4
 
5
- var __filename = CJS_COMPAT_NODE_URL_gxnqjb69o0i.fileURLToPath(import.meta.url);
6
- var __dirname = CJS_COMPAT_NODE_PATH_gxnqjb69o0i.dirname(__filename);
7
- var require = CJS_COMPAT_NODE_MODULE_gxnqjb69o0i.createRequire(import.meta.url);
5
+ var __filename = CJS_COMPAT_NODE_URL_kx3y04w7glc.fileURLToPath(import.meta.url);
6
+ var __dirname = CJS_COMPAT_NODE_PATH_kx3y04w7glc.dirname(__filename);
7
+ var require = CJS_COMPAT_NODE_MODULE_kx3y04w7glc.createRequire(import.meta.url);
8
8
 
9
9
  // ------------------------------------------------------------
10
10
  // end of CJS compatibility banner, injected by Storybook's esbuild configuration
@@ -12,10 +12,10 @@ var require = CJS_COMPAT_NODE_MODULE_gxnqjb69o0i.createRequire(import.meta.url);
12
12
  import {
13
13
  buildDocgenPayload,
14
14
  createDocgenProvider
15
- } from "../_node-chunks/chunk-PEWWXGF7.js";
15
+ } from "../_node-chunks/chunk-VL6TVWMP.js";
16
16
  import {
17
17
  DEFAULT_TYPE_PROPERTY
18
- } from "../_node-chunks/chunk-F7GJU26Y.js";
18
+ } from "../_node-chunks/chunk-RKWQNNM2.js";
19
19
  export {
20
20
  DEFAULT_TYPE_PROPERTY,
21
21
  buildDocgenPayload,
@@ -2,9 +2,9 @@ import {
2
2
  getCustomElements,
3
3
  isValidComponent,
4
4
  isValidMetaData
5
- } from "./_browser-chunks/chunk-ZTODZABH.js";
6
- import "./_browser-chunks/chunk-Z3YF52EY.js";
7
- import "./_browser-chunks/chunk-6ZSMINL7.js";
5
+ } from "./_browser-chunks/chunk-TXUT6K6E.js";
6
+ import "./_browser-chunks/chunk-BNL7LBNI.js";
7
+ import "./_browser-chunks/chunk-EGBR6PF2.js";
8
8
  import "./_browser-chunks/chunk-4BE7D4DS.js";
9
9
 
10
10
  // src/entry-preview-argtypes.ts
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  decorators,
3
3
  parameters
4
- } from "./_browser-chunks/chunk-6ZSMINL7.js";
4
+ } from "./_browser-chunks/chunk-EGBR6PF2.js";
5
5
  import "./_browser-chunks/chunk-4BE7D4DS.js";
6
6
  export {
7
7
  decorators,
@@ -2,7 +2,7 @@ import {
2
2
  parameters,
3
3
  render,
4
4
  renderToCanvas
5
- } from "./_browser-chunks/chunk-Z3YF52EY.js";
5
+ } from "./_browser-chunks/chunk-BNL7LBNI.js";
6
6
  import "./_browser-chunks/chunk-4BE7D4DS.js";
7
7
  export {
8
8
  parameters,
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { AnnotatedStoryFn, ArgTypes, Args, Args as Args$1, ArgsStoryFn, ComponentAnnotations, DecoratorFunction, LoaderFunction, NamedOrDefaultProjectAnnotations, NormalizedProjectAnnotations, Parameters, ProjectAnnotations, StoryAnnotations, StoryContext as StoryContext$1, StrictArgs, StrictArgs as StrictArgs$1, WebRenderer } from "storybook/internal/types";
2
2
  import { SVGTemplateResult, TemplateResult } from "lit";
3
- import { AddonTypes, InferTypes, Meta as Meta$1, MetaInput, MetaTypes, Preview as Preview$1, PreviewAddon, Story, StoryArgs, TypedMetaArgKeys, WithRenderArgs } from "storybook/internal/csf";
3
+ import { AddonTypes, InferTypes, Meta as Meta$1, MetaInput, MetaTypes, Preview as Preview$1, PreviewAddonEntry, Story, StoryArgs, TypedMetaArgKeys, WithRenderArgs } from "storybook/internal/csf";
4
4
 
5
5
  //#region code/renderers/web-components/.dts-emit/code/renderers/web-components/src/types.d.ts
6
6
  type WebComponentsFrameworkOptions = {
@@ -159,7 +159,7 @@ type Simplify<T> = { [KeyType in keyof T]: T[KeyType] } & {};
159
159
  * });
160
160
  * ```
161
161
  */
162
- declare function __definePreview<Addons extends PreviewAddon<never>[]>(input: {
162
+ declare function __definePreview<Addons extends PreviewAddonEntry[]>(input: {
163
163
  addons: Addons;
164
164
  } & ProjectAnnotations<WebComponentsTypes & InferTypes<Addons>>): WebComponentsPreview<WebComponentsTypes & InferTypes<Addons>>;
165
165
  /**
package/dist/index.js CHANGED
@@ -6,9 +6,9 @@ import {
6
6
  setCustomElements,
7
7
  setCustomElementsManifest,
8
8
  setProjectAnnotations
9
- } from "./_browser-chunks/chunk-ZTODZABH.js";
10
- import "./_browser-chunks/chunk-Z3YF52EY.js";
11
- import "./_browser-chunks/chunk-6ZSMINL7.js";
9
+ } from "./_browser-chunks/chunk-TXUT6K6E.js";
10
+ import "./_browser-chunks/chunk-BNL7LBNI.js";
11
+ import "./_browser-chunks/chunk-EGBR6PF2.js";
12
12
  import "./_browser-chunks/chunk-4BE7D4DS.js";
13
13
  export {
14
14
  __definePreview,