@storybook/web-components 11.0.0-rc.0 → 11.0.0-rc.2
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/dist/_browser-chunks/{chunk-XOX44XZE.js → chunk-4V46YO6H.js} +3 -4
- package/dist/_browser-chunks/{chunk-OL6OKC2Z.js → chunk-COYSB7GX.js} +8 -15
- package/dist/_browser-chunks/chunk-KNMTEI4Z.js +50 -0
- package/dist/_browser-chunks/{chunk-YZWJIPOA.js → chunk-US4H5NRT.js} +6 -51
- package/dist/docs/register-print-hole.js +2 -0
- package/dist/entry-preview-argtypes.js +4 -3
- package/dist/entry-preview-docs.js +2 -1
- package/dist/entry-preview.js +1 -1
- package/dist/index.js +4 -3
- package/dist/preset.js +4 -1
- package/package.json +3 -3
- package/template/components/Button.js +0 -2
- package/template/components/Form.js +0 -2
- package/template/components/Html.js +0 -2
- package/template/components/Pre.js +0 -2
- package/template/components/index.js +0 -2
- package/template/stories/demo-wc-card/DemoWcCard.js +0 -4
|
@@ -11,7 +11,6 @@ __export(entry_preview_exports, {
|
|
|
11
11
|
});
|
|
12
12
|
|
|
13
13
|
// src/render.ts
|
|
14
|
-
import { global } from "@storybook/global";
|
|
15
14
|
import { render as litRender } from "lit";
|
|
16
15
|
import { isTemplateResult } from "lit/directive-helpers.js";
|
|
17
16
|
import { simulateDOMContentLoaded, simulatePageLoad } from "storybook/preview-api";
|
|
@@ -125,14 +124,14 @@ function styleRule(selector, value) {
|
|
|
125
124
|
}
|
|
126
125
|
|
|
127
126
|
// src/render.ts
|
|
128
|
-
var
|
|
127
|
+
var render = (args, context) => {
|
|
129
128
|
let { id, component } = context;
|
|
130
129
|
if (!component)
|
|
131
130
|
throw new Error(
|
|
132
131
|
`Unable to render story ${id} as the component annotation is missing from the default export`
|
|
133
132
|
);
|
|
134
133
|
let element = document.createElement(component);
|
|
135
|
-
if (!
|
|
134
|
+
if (!globalThis.FEATURES?.docgenServer)
|
|
136
135
|
return Object.assign(element, args);
|
|
137
136
|
let styleRules = bindArgs(element, args), fragment = document.createDocumentFragment();
|
|
138
137
|
if (styleRules.length > 0) {
|
|
@@ -152,7 +151,7 @@ function renderToCanvas({ storyFn, title, name, showMain, showError, forceRemoun
|
|
|
152
151
|
litRender(element, renderTo), simulatePageLoad(canvasElement);
|
|
153
152
|
} else if (typeof element == "string")
|
|
154
153
|
canvasElement.innerHTML = element, simulatePageLoad(canvasElement);
|
|
155
|
-
else if (element instanceof
|
|
154
|
+
else if (element instanceof globalThis.Node) {
|
|
156
155
|
if (canvasElement.firstChild === element && !forceRemount)
|
|
157
156
|
return;
|
|
158
157
|
canvasElement.innerHTML = "", canvasElement.appendChild(element), simulateDOMContentLoaded();
|
|
@@ -1,20 +1,14 @@
|
|
|
1
1
|
import {
|
|
2
2
|
entry_preview_exports
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-4V46YO6H.js";
|
|
4
4
|
import {
|
|
5
5
|
entry_preview_docs_exports
|
|
6
|
-
} from "./chunk-
|
|
7
|
-
|
|
8
|
-
// src/index.ts
|
|
9
|
-
import { global as global3 } from "@storybook/global";
|
|
6
|
+
} from "./chunk-KNMTEI4Z.js";
|
|
10
7
|
|
|
11
8
|
// src/globals.ts
|
|
12
|
-
|
|
13
|
-
var { window: globalWindow } = global;
|
|
14
|
-
globalWindow.STORYBOOK_ENV = "web-components";
|
|
9
|
+
globalThis.STORYBOOK_ENV = "web-components";
|
|
15
10
|
|
|
16
11
|
// src/framework-api.ts
|
|
17
|
-
import { global as global2 } from "@storybook/global";
|
|
18
12
|
import { deprecate } from "storybook/internal/client-logger";
|
|
19
13
|
var RUNTIME_MANIFEST_DEPRECATION = "The runtime Custom Elements Manifest is deprecated and will be removed in Storybook 12. Set framework.options.customElementsManifest in .storybook/main and enable features.docgenServer instead.";
|
|
20
14
|
function isValidComponent(tagName) {
|
|
@@ -34,13 +28,13 @@ function isValidMetaData(customElements) {
|
|
|
34
28
|
);
|
|
35
29
|
}
|
|
36
30
|
function setCustomElements(customElements) {
|
|
37
|
-
deprecate(`setCustomElements() is deprecated: ${RUNTIME_MANIFEST_DEPRECATION}`),
|
|
31
|
+
deprecate(`setCustomElements() is deprecated: ${RUNTIME_MANIFEST_DEPRECATION}`), globalThis.__STORYBOOK_CUSTOM_ELEMENTS__ = customElements;
|
|
38
32
|
}
|
|
39
33
|
function setCustomElementsManifest(customElements) {
|
|
40
|
-
deprecate(`setCustomElementsManifest() is deprecated: ${RUNTIME_MANIFEST_DEPRECATION}`),
|
|
34
|
+
deprecate(`setCustomElementsManifest() is deprecated: ${RUNTIME_MANIFEST_DEPRECATION}`), globalThis.__STORYBOOK_CUSTOM_ELEMENTS_MANIFEST__ = customElements;
|
|
41
35
|
}
|
|
42
36
|
function getCustomElements() {
|
|
43
|
-
return
|
|
37
|
+
return globalThis.__STORYBOOK_CUSTOM_ELEMENTS_MANIFEST__ || globalThis.__STORYBOOK_CUSTOM_ELEMENTS__;
|
|
44
38
|
}
|
|
45
39
|
|
|
46
40
|
// src/portable-stories.ts
|
|
@@ -68,11 +62,10 @@ function __definePreview(input) {
|
|
|
68
62
|
}
|
|
69
63
|
|
|
70
64
|
// src/index.ts
|
|
71
|
-
|
|
72
|
-
typeof module < "u" && module?.hot?.decline && (module.hot.decline(), new EventSource("__webpack_hmr").addEventListener("message", function(event) {
|
|
65
|
+
typeof module < "u" && module?.hot?.decline && (module.hot.decline(), new globalThis.EventSource("__webpack_hmr").addEventListener("message", function(event) {
|
|
73
66
|
try {
|
|
74
67
|
let { action } = JSON.parse(event.data);
|
|
75
|
-
action === "built" && window.location.reload();
|
|
68
|
+
action === "built" && globalThis.window.location.reload();
|
|
76
69
|
} catch {
|
|
77
70
|
}
|
|
78
71
|
}));
|
|
@@ -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
|
-
|
|
2
|
-
|
|
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) =>
|
|
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/
|
|
311
|
-
|
|
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);
|
|
@@ -2,9 +2,10 @@ import {
|
|
|
2
2
|
getCustomElements,
|
|
3
3
|
isValidComponent,
|
|
4
4
|
isValidMetaData
|
|
5
|
-
} from "./_browser-chunks/chunk-
|
|
6
|
-
import "./_browser-chunks/chunk-
|
|
7
|
-
import "./_browser-chunks/chunk-
|
|
5
|
+
} from "./_browser-chunks/chunk-COYSB7GX.js";
|
|
6
|
+
import "./_browser-chunks/chunk-4V46YO6H.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
|
package/dist/entry-preview.js
CHANGED
package/dist/index.js
CHANGED
|
@@ -6,9 +6,10 @@ import {
|
|
|
6
6
|
setCustomElements,
|
|
7
7
|
setCustomElementsManifest,
|
|
8
8
|
setProjectAnnotations
|
|
9
|
-
} from "./_browser-chunks/chunk-
|
|
10
|
-
import "./_browser-chunks/chunk-
|
|
11
|
-
import "./_browser-chunks/chunk-
|
|
9
|
+
} from "./_browser-chunks/chunk-COYSB7GX.js";
|
|
10
|
+
import "./_browser-chunks/chunk-4V46YO6H.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.
|
|
3
|
+
"version": "11.0.0-rc.2",
|
|
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
|
},
|
|
@@ -53,7 +54,6 @@
|
|
|
53
54
|
"!src/**/*"
|
|
54
55
|
],
|
|
55
56
|
"dependencies": {
|
|
56
|
-
"@storybook/global": "^5.0.0",
|
|
57
57
|
"@wc-toolkit/cem-generator": "^0.2.1",
|
|
58
58
|
"@wc-toolkit/cem-generator-lit": "^0.1.16",
|
|
59
59
|
"custom-elements-manifest": "^2.1.0",
|
|
@@ -74,7 +74,7 @@
|
|
|
74
74
|
},
|
|
75
75
|
"peerDependencies": {
|
|
76
76
|
"lit": "^2.0.0 || ^3.0.0",
|
|
77
|
-
"storybook": "^11.0.0-rc.
|
|
77
|
+
"storybook": "^11.0.0-rc.2",
|
|
78
78
|
"typescript": "^5.9.0 || ^6.0.0 || ^7.0.0"
|
|
79
79
|
},
|
|
80
80
|
"publishConfig": {
|
|
@@ -1,11 +1,7 @@
|
|
|
1
|
-
import { global } from '@storybook/global';
|
|
2
|
-
|
|
3
1
|
import { LitElement, html } from 'lit';
|
|
4
2
|
|
|
5
3
|
import { demoWcCardStyle } from './demoWcCardStyle.css.js';
|
|
6
4
|
|
|
7
|
-
const { CustomEvent } = global;
|
|
8
|
-
|
|
9
5
|
/**
|
|
10
6
|
* This is a container looking like a card with a back and front side you can switch
|
|
11
7
|
*
|