@storybook/angular-vite 11.0.0-rc.1 → 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.
@@ -1,14 +1,10 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __export = (target, all) => {
4
- for (var name in all)
5
- __defProp(target, name, { get: all[name], enumerable: !0 });
6
- };
7
- var __decorateClass = (decorators, target, key, kind) => {
8
- for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
9
- (decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
10
- return kind && result && __defProp(target, key, result), result;
11
- }, __decorateParam = (index, decorator) => (target, key) => decorator(target, key, index);
1
+ import {
2
+ __decorateClass,
3
+ __decorateParam,
4
+ __export,
5
+ inputBinding,
6
+ isValidIdentifier
7
+ } from "./chunk-T4WQC6BZ.js";
12
8
 
13
9
  // src/client/render.ts
14
10
  var render_exports = {};
@@ -25,29 +21,6 @@ import { bootstrapApplication } from "@angular/platform-browser";
25
21
  import { BehaviorSubject } from "rxjs";
26
22
  import { stringify } from "telejson";
27
23
 
28
- // src/snippet-values.ts
29
- var isValidIdentifier = (name) => /^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(name), quoteExpressionString = (value) => `'${value.replace(/\\/g, "\\\\").replace(/'/g, "\\'").replace(/\n/g, "\\n").replace(/\r/g, "\\r")}'`, printExpressionValue = (value, unprintable) => {
30
- let parents = /* @__PURE__ */ new Set(), print = (value2) => {
31
- if (typeof value2 == "string")
32
- return quoteExpressionString(value2);
33
- if (unprintable && hasNoExpression(value2, parents))
34
- return unprintable();
35
- if (typeof value2 != "object" || value2 === null)
36
- return `${value2}`;
37
- parents.add(value2);
38
- let printed = Array.isArray(value2) ? `[${value2.map((element) => print(element ?? null)).join(", ")}]` : `{${Object.entries(value2).filter(([, entryValue]) => entryValue !== void 0).map(
39
- ([key, entryValue]) => `${isValidIdentifier(key) ? key : quoteExpressionString(key)}: ${print(entryValue)}`
40
- ).join(", ")}}`;
41
- return parents.delete(value2), printed;
42
- };
43
- return print(value);
44
- }, hasNoExpression = (value, parents) => {
45
- if (typeof value != "object" || value === null)
46
- return typeof value == "function" || typeof value == "symbol" || typeof value == "bigint";
47
- let prototype = Object.getPrototypeOf(value);
48
- return parents.has(value) || !Array.isArray(value) && prototype !== Object.prototype && prototype !== null;
49
- }, escapeAttributeExpression = (expression) => expression.replace(/&(?=#|\w+;)/g, "&").replace(/"/g, """), escapeTemplateLiteral = (template) => template.replace(/\\/g, "\\\\").replace(/`/g, "\\`").replace(/\$\{/g, "\\${"), inputBinding = (name, expression) => `[${name}]="${expression}"`, textValue = (value) => typeof value == "string" ? value : typeof value == "number" || typeof value == "boolean" ? String(value) : void 0, angularText = (text) => text.includes("{{") ? void 0 : text.replace(/[{}@]|\$$/g, (syntax) => `&#${syntax.charCodeAt(0)};`);
50
-
51
24
  // src/template-grammar.ts
52
25
  var formatPropInTemplate = (propertyName) => isValidIdentifier(propertyName) ? propertyName : `this['${propertyName}']`, stringifyCircular = (obj) => {
53
26
  let seen = /* @__PURE__ */ new Set();
@@ -743,13 +716,6 @@ async function renderToCanvas({
743
716
  }
744
717
 
745
718
  export {
746
- __export,
747
- printExpressionValue,
748
- escapeAttributeExpression,
749
- escapeTemplateLiteral,
750
- inputBinding,
751
- textValue,
752
- angularText,
753
719
  formatPropInTemplate,
754
720
  isComponent,
755
721
  computesTemplateFromComponent,
@@ -1,9 +1,11 @@
1
1
  import {
2
- __export,
3
2
  computesTemplateFromComponent,
4
3
  render,
5
4
  renderToCanvas
6
- } from "./chunk-NEJ4XYRC.js";
5
+ } from "./chunk-6VSOLSRX.js";
6
+ import {
7
+ __export
8
+ } from "./chunk-T4WQC6BZ.js";
7
9
 
8
10
  // src/client/config.ts
9
11
  var config_exports = {};
@@ -1,13 +1,9 @@
1
1
  import {
2
- __export,
3
- angularText,
4
- computesTemplateSourceFromComponent,
5
- escapeAttributeExpression,
6
- escapeTemplateLiteral,
7
- inputBinding,
8
- printExpressionValue,
9
- textValue
10
- } from "./chunk-NEJ4XYRC.js";
2
+ computesTemplateSourceFromComponent
3
+ } from "./chunk-6VSOLSRX.js";
4
+ import {
5
+ __export
6
+ } from "./chunk-T4WQC6BZ.js";
11
7
 
12
8
  // src/client/docs/config.ts
13
9
  var config_exports = {};
@@ -17,34 +13,6 @@ __export(config_exports, {
17
13
  });
18
14
  import { SourceType as SourceType2, getSourceSnippetRuntime } from "storybook/internal/docs-tools";
19
15
 
20
- // src/client/docs/print-hole.ts
21
- import {
22
- UnprintableArgError,
23
- unknownHoleKind
24
- } from "storybook/internal/docs-tools";
25
- var printHole = (hole, value) => {
26
- let arg = hole.arg ?? "", unprintable = () => {
27
- throw new UnprintableArgError(arg);
28
- }, expression = () => escapeAttributeExpression(printExpressionValue(value, unprintable));
29
- switch (hole.kind) {
30
- case "bind":
31
- return escapeTemplateLiteral(expression());
32
- case "prop":
33
- return value === void 0 || typeof value == "function" ? "" : escapeTemplateLiteral(inputBinding(arg, expression()));
34
- case "field":
35
- return printExpressionValue(value, unprintable);
36
- case "text":
37
- return escapeTemplateLiteral(text(value) ?? unprintable());
38
- default:
39
- return unknownHoleKind(hole.kind);
40
- }
41
- }, text = (value) => {
42
- if (value === void 0)
43
- return "";
44
- let printed = textValue(value);
45
- return printed === void 0 ? void 0 : angularText(printed);
46
- };
47
-
48
16
  // src/client/docs/sourceDecorator.ts
49
17
  import { SourceType } from "storybook/internal/docs-tools";
50
18
  import { useRef, emitTransformCode, useEffect } from "storybook/preview-api";
@@ -70,8 +38,7 @@ var snippetRuntime = getSourceSnippetRuntime(), parameters = {
70
38
  source: {
71
39
  type: SourceType2.DYNAMIC,
72
40
  // The server snippet is the TypeScript host component that renders the story.
73
- language: snippetRuntime === "server" ? "ts" : "html",
74
- ...snippetRuntime === "server" ? { printHole } : {}
41
+ language: snippetRuntime === "server" ? "ts" : "html"
75
42
  }
76
43
  }
77
44
  }, decorators = snippetRuntime === "preview" ? [sourceDecorator] : [];
@@ -0,0 +1,47 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __export = (target, all) => {
4
+ for (var name in all)
5
+ __defProp(target, name, { get: all[name], enumerable: !0 });
6
+ };
7
+ var __decorateClass = (decorators, target, key, kind) => {
8
+ for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
9
+ (decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
10
+ return kind && result && __defProp(target, key, result), result;
11
+ }, __decorateParam = (index, decorator) => (target, key) => decorator(target, key, index);
12
+
13
+ // src/snippet-values.ts
14
+ var isValidIdentifier = (name) => /^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(name), quoteExpressionString = (value) => `'${value.replace(/\\/g, "\\\\").replace(/'/g, "\\'").replace(/\n/g, "\\n").replace(/\r/g, "\\r")}'`, printExpressionValue = (value, unprintable) => {
15
+ let parents = /* @__PURE__ */ new Set(), print = (value2) => {
16
+ if (typeof value2 == "string")
17
+ return quoteExpressionString(value2);
18
+ if (unprintable && hasNoExpression(value2, parents))
19
+ return unprintable();
20
+ if (typeof value2 != "object" || value2 === null)
21
+ return `${value2}`;
22
+ parents.add(value2);
23
+ let printed = Array.isArray(value2) ? `[${value2.map((element) => print(element ?? null)).join(", ")}]` : `{${Object.entries(value2).filter(([, entryValue]) => entryValue !== void 0).map(
24
+ ([key, entryValue]) => `${isValidIdentifier(key) ? key : quoteExpressionString(key)}: ${print(entryValue)}`
25
+ ).join(", ")}}`;
26
+ return parents.delete(value2), printed;
27
+ };
28
+ return print(value);
29
+ }, hasNoExpression = (value, parents) => {
30
+ if (typeof value != "object" || value === null)
31
+ return typeof value == "function" || typeof value == "symbol" || typeof value == "bigint";
32
+ let prototype = Object.getPrototypeOf(value);
33
+ return parents.has(value) || !Array.isArray(value) && prototype !== Object.prototype && prototype !== null;
34
+ }, escapeAttributeExpression = (expression) => expression.replace(/&(?=#|\w+;)/g, "&").replace(/"/g, """), escapeTemplateLiteral = (template) => template.replace(/\\/g, "\\\\").replace(/`/g, "\\`").replace(/\$\{/g, "\\${"), inputBinding = (name, expression) => `[${name}]="${expression}"`, textValue = (value) => typeof value == "string" ? value : typeof value == "number" || typeof value == "boolean" ? String(value) : void 0, angularText = (text) => text.includes("{{") ? void 0 : text.replace(/[{}@]|\$$/g, (syntax) => `&#${syntax.charCodeAt(0)};`);
35
+
36
+ export {
37
+ __export,
38
+ __decorateClass,
39
+ __decorateParam,
40
+ isValidIdentifier,
41
+ printExpressionValue,
42
+ escapeAttributeExpression,
43
+ escapeTemplateLiteral,
44
+ inputBinding,
45
+ textValue,
46
+ angularText
47
+ };
@@ -1,15 +1,15 @@
1
1
  import {
2
2
  config_exports
3
- } from "./chunk-UOYFF56J.js";
3
+ } from "./chunk-IFJFIE3P.js";
4
4
  import {
5
5
  config_exports as config_exports2
6
- } from "./chunk-GGZHMF2V.js";
6
+ } from "./chunk-S752VTMD.js";
7
7
  import {
8
8
  computesTemplateFromComponent,
9
9
  formatPropInTemplate,
10
10
  isComponent,
11
11
  render_exports
12
- } from "./chunk-NEJ4XYRC.js";
12
+ } from "./chunk-6VSOLSRX.js";
13
13
 
14
14
  // src/client/portable-stories.ts
15
15
  import {
@@ -0,0 +1,42 @@
1
+ import {
2
+ angularText,
3
+ escapeAttributeExpression,
4
+ escapeTemplateLiteral,
5
+ inputBinding,
6
+ printExpressionValue,
7
+ textValue
8
+ } from "./chunk-T4WQC6BZ.js";
9
+
10
+ // src/client/docs/register-print-hole.ts
11
+ import { registerPrintHole } from "storybook/internal/docs-tools/snippets";
12
+
13
+ // src/client/docs/print-hole.ts
14
+ import {
15
+ UnprintableArgError,
16
+ unknownHoleKind
17
+ } from "storybook/internal/docs-tools/snippets";
18
+ var printHole = (hole, value) => {
19
+ let arg = hole.arg ?? "", unprintable = () => {
20
+ throw new UnprintableArgError(arg);
21
+ }, expression = () => escapeAttributeExpression(printExpressionValue(value, unprintable));
22
+ switch (hole.kind) {
23
+ case "bind":
24
+ return escapeTemplateLiteral(expression());
25
+ case "prop":
26
+ return value === void 0 || typeof value == "function" ? "" : escapeTemplateLiteral(inputBinding(arg, expression()));
27
+ case "field":
28
+ return printExpressionValue(value, unprintable);
29
+ case "text":
30
+ return escapeTemplateLiteral(text(value) ?? unprintable());
31
+ default:
32
+ return unknownHoleKind(hole.kind);
33
+ }
34
+ }, text = (value) => {
35
+ if (value === void 0)
36
+ return "";
37
+ let printed = textValue(value);
38
+ return printed === void 0 ? void 0 : angularText(printed);
39
+ };
40
+
41
+ // src/client/docs/register-print-hole.ts
42
+ registerPrintHole(printHole);
@@ -2,11 +2,12 @@ import {
2
2
  argTypesEnhancers,
3
3
  decorateStory,
4
4
  parameters
5
- } from "../_browser-chunks/chunk-UOYFF56J.js";
5
+ } from "../_browser-chunks/chunk-IFJFIE3P.js";
6
6
  import {
7
7
  render,
8
8
  renderToCanvas
9
- } from "../_browser-chunks/chunk-NEJ4XYRC.js";
9
+ } from "../_browser-chunks/chunk-6VSOLSRX.js";
10
+ import "../_browser-chunks/chunk-T4WQC6BZ.js";
10
11
  export {
11
12
  decorateStory as applyDecorators,
12
13
  argTypesEnhancers,
@@ -1,8 +1,10 @@
1
1
  import {
2
2
  decorators,
3
3
  parameters
4
- } from "../../_browser-chunks/chunk-GGZHMF2V.js";
5
- import "../../_browser-chunks/chunk-NEJ4XYRC.js";
4
+ } from "../../_browser-chunks/chunk-S752VTMD.js";
5
+ import "../../_browser-chunks/chunk-YS33I6LM.js";
6
+ import "../../_browser-chunks/chunk-6VSOLSRX.js";
7
+ import "../../_browser-chunks/chunk-T4WQC6BZ.js";
6
8
  export {
7
9
  decorators,
8
10
  parameters
@@ -0,0 +1,2 @@
1
+ import "../../_browser-chunks/chunk-YS33I6LM.js";
2
+ import "../../_browser-chunks/chunk-T4WQC6BZ.js";
@@ -5,10 +5,12 @@ import {
5
5
  componentWrapperDecorator,
6
6
  moduleMetadata,
7
7
  setProjectAnnotations
8
- } from "../_browser-chunks/chunk-BERN5EPJ.js";
9
- import "../_browser-chunks/chunk-UOYFF56J.js";
10
- import "../_browser-chunks/chunk-GGZHMF2V.js";
11
- import "../_browser-chunks/chunk-NEJ4XYRC.js";
8
+ } from "../_browser-chunks/chunk-Y5SREGLY.js";
9
+ import "../_browser-chunks/chunk-IFJFIE3P.js";
10
+ import "../_browser-chunks/chunk-S752VTMD.js";
11
+ import "../_browser-chunks/chunk-YS33I6LM.js";
12
+ import "../_browser-chunks/chunk-6VSOLSRX.js";
13
+ import "../_browser-chunks/chunk-T4WQC6BZ.js";
12
14
  export {
13
15
  __definePreview,
14
16
  applicationConfig,
package/dist/index.js CHANGED
@@ -5,10 +5,12 @@ import {
5
5
  componentWrapperDecorator,
6
6
  moduleMetadata,
7
7
  setProjectAnnotations
8
- } from "./_browser-chunks/chunk-BERN5EPJ.js";
9
- import "./_browser-chunks/chunk-UOYFF56J.js";
10
- import "./_browser-chunks/chunk-GGZHMF2V.js";
11
- import "./_browser-chunks/chunk-NEJ4XYRC.js";
8
+ } from "./_browser-chunks/chunk-Y5SREGLY.js";
9
+ import "./_browser-chunks/chunk-IFJFIE3P.js";
10
+ import "./_browser-chunks/chunk-S752VTMD.js";
11
+ import "./_browser-chunks/chunk-YS33I6LM.js";
12
+ import "./_browser-chunks/chunk-6VSOLSRX.js";
13
+ import "./_browser-chunks/chunk-T4WQC6BZ.js";
12
14
  export {
13
15
  __definePreview,
14
16
  applicationConfig,
package/dist/preset.js CHANGED
@@ -1148,7 +1148,10 @@ var warnedMissingDocgenService = !1, getDocgenPayload = async (componentId) => {
1148
1148
  }, experimental_storyDocsProvider = createWorkerGatedStoryDocsProvider({
1149
1149
  label: "Angular",
1150
1150
  docgenWorker: fileURLToPath2(import.meta.resolve(DOCGEN_WORKER_SPECIFIER)),
1151
- build: (input) => buildStoryDocsPayload(input, { getDocgenPayload })
1151
+ build: (input) => buildStoryDocsPayload(input, { getDocgenPayload }),
1152
+ printHole: fileURLToPath2(
1153
+ import.meta.resolve("@storybook/angular-vite/internal/register-print-hole")
1154
+ )
1152
1155
  });
1153
1156
 
1154
1157
  // src/preset.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@storybook/angular-vite",
3
- "version": "11.0.0-rc.1",
3
+ "version": "11.0.0-rc.2",
4
4
  "description": "Storybook for Angular: Develop, document, and test UI components in isolation",
5
5
  "keywords": [
6
6
  "storybook",
@@ -37,6 +37,7 @@
37
37
  "./client/docs/config": "./dist/client/docs/config.js",
38
38
  "./client/preview-prod": "./dist/client/preview-prod.js",
39
39
  "./internal/docgen-worker": "./dist/docgen/docgen-worker.js",
40
+ "./internal/register-print-hole": "./dist/client/docs/register-print-hole.js",
40
41
  "./internal/vitest-compiler-setup": "./dist/client/vitest-compiler-setup.js",
41
42
  "./node": {
42
43
  "types": "./dist/node/index.d.ts",
@@ -64,7 +65,7 @@
64
65
  "!src/**/*"
65
66
  ],
66
67
  "dependencies": {
67
- "@storybook/builder-vite": "11.0.0-rc.1",
68
+ "@storybook/builder-vite": "11.0.0-rc.2",
68
69
  "telejson": "8.0.0",
69
70
  "ts-dedent": "^2.2.0",
70
71
  "vite": ">=8.0.0"
@@ -81,9 +82,9 @@
81
82
  "@angular/forms": "^21.2.14",
82
83
  "@angular/platform-browser": "^21.2.14",
83
84
  "@angular/platform-browser-dynamic": "^21.2.14",
84
- "@storybook/angular-cm": "11.0.0-rc.1",
85
- "@storybook/angular-compodoc": "11.0.0-rc.1",
86
- "@storybook/component-meta-typescript": "11.0.0-rc.1",
85
+ "@storybook/angular-cm": "11.0.0-rc.2",
86
+ "@storybook/angular-compodoc": "11.0.0-rc.2",
87
+ "@storybook/component-meta-typescript": "11.0.0-rc.2",
87
88
  "@types/node": "^22.19.1",
88
89
  "empathic": "^2.0.0",
89
90
  "memfs": "^4.11.1",
@@ -106,7 +107,7 @@
106
107
  "rxjs": "^7.4.0",
107
108
  "sass": "^1.0.0",
108
109
  "sass-embedded": "^1.0.0",
109
- "storybook": "^11.0.0-rc.1",
110
+ "storybook": "^11.0.0-rc.2",
110
111
  "typescript": "^5.9.0 || ^6.0.0 || ^7.0.0",
111
112
  "vite": ">=8.0.0",
112
113
  "zone.js": ">=0.14.0"