@storybook/web-components 11.0.0-rc.1 → 11.0.0-rc.3

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.
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk-4V46YO6H.js";
4
4
  import {
5
5
  entry_preview_docs_exports
6
- } from "./chunk-YZWJIPOA.js";
6
+ } from "./chunk-KNMTEI4Z.js";
7
7
 
8
8
  // src/globals.ts
9
9
  globalThis.STORYBOOK_ENV = "web-components";
@@ -0,0 +1,50 @@
1
+ import {
2
+ __export
3
+ } from "./chunk-4BE7D4DS.js";
4
+
5
+ // src/entry-preview-docs.ts
6
+ var entry_preview_docs_exports = {};
7
+ __export(entry_preview_docs_exports, {
8
+ decorators: () => decorators,
9
+ parameters: () => parameters
10
+ });
11
+ import { SourceType as SourceType2, getSourceSnippetRuntime } from "storybook/internal/docs-tools";
12
+
13
+ // src/docs/sourceDecorator.ts
14
+ import { SourceType } from "storybook/internal/docs-tools";
15
+ import { render } from "lit";
16
+ import { emitTransformCode, useEffect } from "storybook/preview-api";
17
+ var LIT_EXPRESSION_COMMENTS = /<!--\?lit\$[0-9]+\$-->|<!--\??-->/g;
18
+ function skipSourceRender(context) {
19
+ let sourceParams = context?.parameters.docs?.source, isArgsStory = context?.parameters.__isArgsStory;
20
+ return sourceParams?.type === SourceType.DYNAMIC ? !1 : !isArgsStory || sourceParams?.code || sourceParams?.type === SourceType.CODE;
21
+ }
22
+ function renderStorySource(storyResult) {
23
+ if (typeof storyResult == "string")
24
+ return storyResult.replace(LIT_EXPRESSION_COMMENTS, "");
25
+ let container = window.document.createElement("div");
26
+ return storyResult instanceof DocumentFragment ? render(storyResult.cloneNode(!0), container) : render(storyResult, container), container.innerHTML.replace(LIT_EXPRESSION_COMMENTS, "");
27
+ }
28
+ function sourceDecorator(storyFn, context) {
29
+ let story = storyFn(), renderedForSource = context?.parameters.docs?.source?.excludeDecorators ? context.originalStoryFn(context.args, context) : story, source;
30
+ return useEffect(() => {
31
+ source && emitTransformCode(source, context);
32
+ }), skipSourceRender(context) || (source = renderStorySource(renderedForSource)), story;
33
+ }
34
+
35
+ // src/entry-preview-docs.ts
36
+ var snippetRuntime = getSourceSnippetRuntime(), decorators = snippetRuntime === "preview" ? [sourceDecorator] : [], parameters = {
37
+ docs: {
38
+ source: {
39
+ type: SourceType2.DYNAMIC,
40
+ language: "html"
41
+ },
42
+ story: { inline: !0 }
43
+ }
44
+ };
45
+
46
+ export {
47
+ decorators,
48
+ parameters,
49
+ entry_preview_docs_exports
50
+ };
@@ -1,22 +1,12 @@
1
- import {
2
- __export
3
- } from "./chunk-4BE7D4DS.js";
4
-
5
- // src/entry-preview-docs.ts
6
- var entry_preview_docs_exports = {};
7
- __export(entry_preview_docs_exports, {
8
- decorators: () => decorators,
9
- parameters: () => parameters
10
- });
11
- import { SourceType as SourceType2, getSourceSnippetRuntime } from "storybook/internal/docs-tools";
1
+ // src/docs/register-print-hole.ts
2
+ import { registerPrintHole } from "storybook/internal/docs-tools/snippets";
12
3
 
13
4
  // src/docs/print-hole.ts
14
- import { isDirectiveResult, isTemplateResult } from "lit/directive-helpers.js";
15
5
  import {
16
6
  UnprintableArgError,
17
7
  printValue,
18
8
  unknownHoleKind
19
- } from "storybook/internal/docs-tools";
9
+ } from "storybook/internal/docs-tools/snippets";
20
10
 
21
11
  // src/html-parse.ts
22
12
  var RAW_TEXT_ELEMENTS = /* @__PURE__ */ new Set(["pre", "script", "style", "textarea", "title"]), VOID_ELEMENTS = /* @__PURE__ */ new Set([
@@ -285,42 +275,7 @@ function printable(arg, value) {
285
275
  throw new UnprintableArgError(arg);
286
276
  return value;
287
277
  }
288
- var isLitValue = (value) => isTemplateResult(value) || isDirectiveResult(value);
289
-
290
- // src/docs/sourceDecorator.ts
291
- import { SourceType } from "storybook/internal/docs-tools";
292
- import { render } from "lit";
293
- import { emitTransformCode, useEffect } from "storybook/preview-api";
294
- var LIT_EXPRESSION_COMMENTS = /<!--\?lit\$[0-9]+\$-->|<!--\??-->/g;
295
- function skipSourceRender(context) {
296
- let sourceParams = context?.parameters.docs?.source, isArgsStory = context?.parameters.__isArgsStory;
297
- return sourceParams?.type === SourceType.DYNAMIC ? !1 : !isArgsStory || sourceParams?.code || sourceParams?.type === SourceType.CODE;
298
- }
299
- function renderStorySource(storyResult) {
300
- let container = window.document.createElement("div");
301
- return storyResult instanceof DocumentFragment ? render(storyResult.cloneNode(!0), container) : render(storyResult, container), container.innerHTML.replace(LIT_EXPRESSION_COMMENTS, "");
302
- }
303
- function sourceDecorator(storyFn, context) {
304
- let story = storyFn(), renderedForSource = context?.parameters.docs?.source?.excludeDecorators ? context.originalStoryFn(context.args, context) : story, source;
305
- return useEffect(() => {
306
- source && emitTransformCode(source, context);
307
- }), skipSourceRender(context) || (source = renderStorySource(renderedForSource)), story;
308
- }
278
+ var isLitValue = (value) => typeof value == "object" && value !== null && ("_$litType$" in value && value._$litType$ !== void 0 || "_$litDirective$" in value && value._$litDirective$ !== void 0);
309
279
 
310
- // src/entry-preview-docs.ts
311
- var snippetRuntime = getSourceSnippetRuntime(), decorators = snippetRuntime === "preview" ? [sourceDecorator] : [], parameters = {
312
- docs: {
313
- source: {
314
- type: SourceType2.DYNAMIC,
315
- language: "html",
316
- ...snippetRuntime === "server" ? { printHole } : {}
317
- },
318
- story: { inline: !0 }
319
- }
320
- };
321
-
322
- export {
323
- decorators,
324
- parameters,
325
- entry_preview_docs_exports
326
- };
280
+ // src/docs/register-print-hole.ts
281
+ registerPrintHole(printHole);
@@ -0,0 +1,2 @@
1
+ import "../_browser-chunks/chunk-US4H5NRT.js";
2
+ import "../_browser-chunks/chunk-4BE7D4DS.js";
@@ -2,9 +2,10 @@ import {
2
2
  getCustomElements,
3
3
  isValidComponent,
4
4
  isValidMetaData
5
- } from "./_browser-chunks/chunk-OP7DF6LE.js";
5
+ } from "./_browser-chunks/chunk-COYSB7GX.js";
6
6
  import "./_browser-chunks/chunk-4V46YO6H.js";
7
- import "./_browser-chunks/chunk-YZWJIPOA.js";
7
+ import "./_browser-chunks/chunk-KNMTEI4Z.js";
8
+ import "./_browser-chunks/chunk-US4H5NRT.js";
8
9
  import "./_browser-chunks/chunk-4BE7D4DS.js";
9
10
 
10
11
  // src/entry-preview-argtypes.ts
@@ -1,7 +1,8 @@
1
1
  import {
2
2
  decorators,
3
3
  parameters
4
- } from "./_browser-chunks/chunk-YZWJIPOA.js";
4
+ } from "./_browser-chunks/chunk-KNMTEI4Z.js";
5
+ import "./_browser-chunks/chunk-US4H5NRT.js";
5
6
  import "./_browser-chunks/chunk-4BE7D4DS.js";
6
7
  export {
7
8
  decorators,
package/dist/index.js CHANGED
@@ -6,9 +6,10 @@ import {
6
6
  setCustomElements,
7
7
  setCustomElementsManifest,
8
8
  setProjectAnnotations
9
- } from "./_browser-chunks/chunk-OP7DF6LE.js";
9
+ } from "./_browser-chunks/chunk-COYSB7GX.js";
10
10
  import "./_browser-chunks/chunk-4V46YO6H.js";
11
- import "./_browser-chunks/chunk-YZWJIPOA.js";
11
+ import "./_browser-chunks/chunk-KNMTEI4Z.js";
12
+ import "./_browser-chunks/chunk-US4H5NRT.js";
12
13
  import "./_browser-chunks/chunk-4BE7D4DS.js";
13
14
  export {
14
15
  __definePreview,
package/dist/preset.js CHANGED
@@ -1084,7 +1084,10 @@ var warnedMissingDocgenService = !1, getDocgenPayload = async (componentId) => {
1084
1084
  }, experimental_storyDocsProvider = createWorkerGatedStoryDocsProvider({
1085
1085
  label: "Web Components",
1086
1086
  docgenWorker: fileURLToPath2(import.meta.resolve(DOCGEN_WORKER_SPECIFIER)),
1087
- build: (input) => buildStoryDocsPayload(input, { getDocgenPayload })
1087
+ build: (input) => buildStoryDocsPayload(input, { getDocgenPayload }),
1088
+ printHole: fileURLToPath2(
1089
+ import.meta.resolve("@storybook/web-components/internal/register-print-hole")
1090
+ )
1088
1091
  });
1089
1092
 
1090
1093
  // src/preset.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@storybook/web-components",
3
- "version": "11.0.0-rc.1",
3
+ "version": "11.0.0-rc.3",
4
4
  "description": "Storybook Web Components renderer: Develop, document, and test UI components in isolation",
5
5
  "keywords": [
6
6
  "storybook",
@@ -41,6 +41,7 @@
41
41
  "default": "./dist/docgen/index.js"
42
42
  },
43
43
  "./internal/docgen-worker": "./dist/docgen/docgen-worker.js",
44
+ "./internal/register-print-hole": "./dist/docs/register-print-hole.js",
44
45
  "./package.json": "./package.json",
45
46
  "./preset": "./dist/preset.js"
46
47
  },
@@ -73,7 +74,7 @@
73
74
  },
74
75
  "peerDependencies": {
75
76
  "lit": "^2.0.0 || ^3.0.0",
76
- "storybook": "^11.0.0-rc.1",
77
+ "storybook": "^11.0.0-rc.3",
77
78
  "typescript": "^5.9.0 || ^6.0.0 || ^7.0.0"
78
79
  },
79
80
  "publishConfig": {