@storybook/angular 10.6.0-alpha.3 → 10.6.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.
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  config_exports
3
- } from "./chunk-6ADVROMB.js";
3
+ } from "./chunk-276WSTMN.js";
4
4
  import {
5
5
  config_exports as config_exports2
6
6
  } from "./chunk-RV6FL7AO.js";
@@ -1,10 +1,10 @@
1
- import CJS_COMPAT_NODE_URL_q5rwsanlq8 from 'node:url';
2
- import CJS_COMPAT_NODE_PATH_q5rwsanlq8 from 'node:path';
3
- import CJS_COMPAT_NODE_MODULE_q5rwsanlq8 from "node:module";
1
+ import CJS_COMPAT_NODE_URL_5hd9c8tco0c from 'node:url';
2
+ import CJS_COMPAT_NODE_PATH_5hd9c8tco0c from 'node:path';
3
+ import CJS_COMPAT_NODE_MODULE_5hd9c8tco0c from "node:module";
4
4
 
5
- var __filename = CJS_COMPAT_NODE_URL_q5rwsanlq8.fileURLToPath(import.meta.url);
6
- var __dirname = CJS_COMPAT_NODE_PATH_q5rwsanlq8.dirname(__filename);
7
- var require = CJS_COMPAT_NODE_MODULE_q5rwsanlq8.createRequire(import.meta.url);
5
+ var __filename = CJS_COMPAT_NODE_URL_5hd9c8tco0c.fileURLToPath(import.meta.url);
6
+ var __dirname = CJS_COMPAT_NODE_PATH_5hd9c8tco0c.dirname(__filename);
7
+ var require = CJS_COMPAT_NODE_MODULE_5hd9c8tco0c.createRequire(import.meta.url);
8
8
 
9
9
  // ------------------------------------------------------------
10
10
  // end of CJS compatibility banner, injected by Storybook's esbuild configuration
@@ -1,10 +1,10 @@
1
- import CJS_COMPAT_NODE_URL_q5rwsanlq8 from 'node:url';
2
- import CJS_COMPAT_NODE_PATH_q5rwsanlq8 from 'node:path';
3
- import CJS_COMPAT_NODE_MODULE_q5rwsanlq8 from "node:module";
1
+ import CJS_COMPAT_NODE_URL_5hd9c8tco0c from 'node:url';
2
+ import CJS_COMPAT_NODE_PATH_5hd9c8tco0c from 'node:path';
3
+ import CJS_COMPAT_NODE_MODULE_5hd9c8tco0c from "node:module";
4
4
 
5
- var __filename = CJS_COMPAT_NODE_URL_q5rwsanlq8.fileURLToPath(import.meta.url);
6
- var __dirname = CJS_COMPAT_NODE_PATH_q5rwsanlq8.dirname(__filename);
7
- var require = CJS_COMPAT_NODE_MODULE_q5rwsanlq8.createRequire(import.meta.url);
5
+ var __filename = CJS_COMPAT_NODE_URL_5hd9c8tco0c.fileURLToPath(import.meta.url);
6
+ var __dirname = CJS_COMPAT_NODE_PATH_5hd9c8tco0c.dirname(__filename);
7
+ var require = CJS_COMPAT_NODE_MODULE_5hd9c8tco0c.createRequire(import.meta.url);
8
8
 
9
9
  // ------------------------------------------------------------
10
10
  // end of CJS compatibility banner, injected by Storybook's esbuild configuration
@@ -1,17 +1,17 @@
1
- import CJS_COMPAT_NODE_URL_q5rwsanlq8 from 'node:url';
2
- import CJS_COMPAT_NODE_PATH_q5rwsanlq8 from 'node:path';
3
- import CJS_COMPAT_NODE_MODULE_q5rwsanlq8 from "node:module";
1
+ import CJS_COMPAT_NODE_URL_5hd9c8tco0c from 'node:url';
2
+ import CJS_COMPAT_NODE_PATH_5hd9c8tco0c from 'node:path';
3
+ import CJS_COMPAT_NODE_MODULE_5hd9c8tco0c from "node:module";
4
4
 
5
- var __filename = CJS_COMPAT_NODE_URL_q5rwsanlq8.fileURLToPath(import.meta.url);
6
- var __dirname = CJS_COMPAT_NODE_PATH_q5rwsanlq8.dirname(__filename);
7
- var require = CJS_COMPAT_NODE_MODULE_q5rwsanlq8.createRequire(import.meta.url);
5
+ var __filename = CJS_COMPAT_NODE_URL_5hd9c8tco0c.fileURLToPath(import.meta.url);
6
+ var __dirname = CJS_COMPAT_NODE_PATH_5hd9c8tco0c.dirname(__filename);
7
+ var require = CJS_COMPAT_NODE_MODULE_5hd9c8tco0c.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
  up
14
- } from "./chunk-P3MSOE7P.js";
14
+ } from "./chunk-OQZZRNKP.js";
15
15
 
16
16
  // ../../../node_modules/empathic/package.mjs
17
17
  function up2(options) {
@@ -1,10 +1,10 @@
1
- import CJS_COMPAT_NODE_URL_q5rwsanlq8 from 'node:url';
2
- import CJS_COMPAT_NODE_PATH_q5rwsanlq8 from 'node:path';
3
- import CJS_COMPAT_NODE_MODULE_q5rwsanlq8 from "node:module";
1
+ import CJS_COMPAT_NODE_URL_5hd9c8tco0c from 'node:url';
2
+ import CJS_COMPAT_NODE_PATH_5hd9c8tco0c from 'node:path';
3
+ import CJS_COMPAT_NODE_MODULE_5hd9c8tco0c from "node:module";
4
4
 
5
- var __filename = CJS_COMPAT_NODE_URL_q5rwsanlq8.fileURLToPath(import.meta.url);
6
- var __dirname = CJS_COMPAT_NODE_PATH_q5rwsanlq8.dirname(__filename);
7
- var require = CJS_COMPAT_NODE_MODULE_q5rwsanlq8.createRequire(import.meta.url);
5
+ var __filename = CJS_COMPAT_NODE_URL_5hd9c8tco0c.fileURLToPath(import.meta.url);
6
+ var __dirname = CJS_COMPAT_NODE_PATH_5hd9c8tco0c.dirname(__filename);
7
+ var require = CJS_COMPAT_NODE_MODULE_5hd9c8tco0c.createRequire(import.meta.url);
8
8
 
9
9
  // ------------------------------------------------------------
10
10
  // end of CJS compatibility banner, injected by Storybook's esbuild configuration
@@ -14,10 +14,10 @@ import {
14
14
  printErrorDetails,
15
15
  runCompodoc,
16
16
  up as up2
17
- } from "../../_node-chunks/chunk-BFZD6CBM.js";
17
+ } from "../../_node-chunks/chunk-XDL2WC2S.js";
18
18
  import {
19
19
  up
20
- } from "../../_node-chunks/chunk-P3MSOE7P.js";
20
+ } from "../../_node-chunks/chunk-OQZZRNKP.js";
21
21
 
22
22
  // src/builders/build-storybook/index.ts
23
23
  import { readFileSync } from "node:fs";
@@ -1,10 +1,10 @@
1
- import CJS_COMPAT_NODE_URL_q5rwsanlq8 from 'node:url';
2
- import CJS_COMPAT_NODE_PATH_q5rwsanlq8 from 'node:path';
3
- import CJS_COMPAT_NODE_MODULE_q5rwsanlq8 from "node:module";
1
+ import CJS_COMPAT_NODE_URL_5hd9c8tco0c from 'node:url';
2
+ import CJS_COMPAT_NODE_PATH_5hd9c8tco0c from 'node:path';
3
+ import CJS_COMPAT_NODE_MODULE_5hd9c8tco0c from "node:module";
4
4
 
5
- var __filename = CJS_COMPAT_NODE_URL_q5rwsanlq8.fileURLToPath(import.meta.url);
6
- var __dirname = CJS_COMPAT_NODE_PATH_q5rwsanlq8.dirname(__filename);
7
- var require = CJS_COMPAT_NODE_MODULE_q5rwsanlq8.createRequire(import.meta.url);
5
+ var __filename = CJS_COMPAT_NODE_URL_5hd9c8tco0c.fileURLToPath(import.meta.url);
6
+ var __dirname = CJS_COMPAT_NODE_PATH_5hd9c8tco0c.dirname(__filename);
7
+ var require = CJS_COMPAT_NODE_MODULE_5hd9c8tco0c.createRequire(import.meta.url);
8
8
 
9
9
  // ------------------------------------------------------------
10
10
  // end of CJS compatibility banner, injected by Storybook's esbuild configuration
@@ -14,10 +14,10 @@ import {
14
14
  printErrorDetails,
15
15
  runCompodoc,
16
16
  up as up2
17
- } from "../../_node-chunks/chunk-BFZD6CBM.js";
17
+ } from "../../_node-chunks/chunk-XDL2WC2S.js";
18
18
  import {
19
19
  up
20
- } from "../../_node-chunks/chunk-P3MSOE7P.js";
20
+ } from "../../_node-chunks/chunk-OQZZRNKP.js";
21
21
 
22
22
  // src/builders/start-storybook/index.ts
23
23
  import { readFileSync } from "node:fs";
@@ -2,7 +2,7 @@ import {
2
2
  argTypesEnhancers,
3
3
  decorateStory,
4
4
  parameters
5
- } from "../_browser-chunks/chunk-6ADVROMB.js";
5
+ } from "../_browser-chunks/chunk-276WSTMN.js";
6
6
  import {
7
7
  render,
8
8
  renderToCanvas
@@ -5,8 +5,8 @@ import {
5
5
  componentWrapperDecorator,
6
6
  moduleMetadata,
7
7
  setProjectAnnotations
8
- } from "../_browser-chunks/chunk-4SOAXBXK.js";
9
- import "../_browser-chunks/chunk-6ADVROMB.js";
8
+ } from "../_browser-chunks/chunk-HQ7BK4IK.js";
9
+ import "../_browser-chunks/chunk-276WSTMN.js";
10
10
  import "../_browser-chunks/chunk-RV6FL7AO.js";
11
11
  import "../_browser-chunks/chunk-FPQDYJYM.js";
12
12
  export {
package/dist/index.js CHANGED
@@ -5,8 +5,8 @@ import {
5
5
  componentWrapperDecorator,
6
6
  moduleMetadata,
7
7
  setProjectAnnotations
8
- } from "./_browser-chunks/chunk-4SOAXBXK.js";
9
- import "./_browser-chunks/chunk-6ADVROMB.js";
8
+ } from "./_browser-chunks/chunk-HQ7BK4IK.js";
9
+ import "./_browser-chunks/chunk-276WSTMN.js";
10
10
  import "./_browser-chunks/chunk-RV6FL7AO.js";
11
11
  import "./_browser-chunks/chunk-FPQDYJYM.js";
12
12
  export {
@@ -1,10 +1,10 @@
1
- import CJS_COMPAT_NODE_URL_q5rwsanlq8 from 'node:url';
2
- import CJS_COMPAT_NODE_PATH_q5rwsanlq8 from 'node:path';
3
- import CJS_COMPAT_NODE_MODULE_q5rwsanlq8 from "node:module";
1
+ import CJS_COMPAT_NODE_URL_5hd9c8tco0c from 'node:url';
2
+ import CJS_COMPAT_NODE_PATH_5hd9c8tco0c from 'node:path';
3
+ import CJS_COMPAT_NODE_MODULE_5hd9c8tco0c from "node:module";
4
4
 
5
- var __filename = CJS_COMPAT_NODE_URL_q5rwsanlq8.fileURLToPath(import.meta.url);
6
- var __dirname = CJS_COMPAT_NODE_PATH_q5rwsanlq8.dirname(__filename);
7
- var require = CJS_COMPAT_NODE_MODULE_q5rwsanlq8.createRequire(import.meta.url);
5
+ var __filename = CJS_COMPAT_NODE_URL_5hd9c8tco0c.fileURLToPath(import.meta.url);
6
+ var __dirname = CJS_COMPAT_NODE_PATH_5hd9c8tco0c.dirname(__filename);
7
+ var require = CJS_COMPAT_NODE_MODULE_5hd9c8tco0c.createRequire(import.meta.url);
8
8
 
9
9
  // ------------------------------------------------------------
10
10
  // end of CJS compatibility banner, injected by Storybook's esbuild configuration
package/dist/preset.js CHANGED
@@ -1,10 +1,10 @@
1
- import CJS_COMPAT_NODE_URL_q5rwsanlq8 from 'node:url';
2
- import CJS_COMPAT_NODE_PATH_q5rwsanlq8 from 'node:path';
3
- import CJS_COMPAT_NODE_MODULE_q5rwsanlq8 from "node:module";
1
+ import CJS_COMPAT_NODE_URL_5hd9c8tco0c from 'node:url';
2
+ import CJS_COMPAT_NODE_PATH_5hd9c8tco0c from 'node:path';
3
+ import CJS_COMPAT_NODE_MODULE_5hd9c8tco0c from "node:module";
4
4
 
5
- var __filename = CJS_COMPAT_NODE_URL_q5rwsanlq8.fileURLToPath(import.meta.url);
6
- var __dirname = CJS_COMPAT_NODE_PATH_q5rwsanlq8.dirname(__filename);
7
- var require = CJS_COMPAT_NODE_MODULE_q5rwsanlq8.createRequire(import.meta.url);
5
+ var __filename = CJS_COMPAT_NODE_URL_5hd9c8tco0c.fileURLToPath(import.meta.url);
6
+ var __dirname = CJS_COMPAT_NODE_PATH_5hd9c8tco0c.dirname(__filename);
7
+ var require = CJS_COMPAT_NODE_MODULE_5hd9c8tco0c.createRequire(import.meta.url);
8
8
 
9
9
  // ------------------------------------------------------------
10
10
  // end of CJS compatibility banner, injected by Storybook's esbuild configuration
@@ -1,17 +1,17 @@
1
- import CJS_COMPAT_NODE_URL_q5rwsanlq8 from 'node:url';
2
- import CJS_COMPAT_NODE_PATH_q5rwsanlq8 from 'node:path';
3
- import CJS_COMPAT_NODE_MODULE_q5rwsanlq8 from "node:module";
1
+ import CJS_COMPAT_NODE_URL_5hd9c8tco0c from 'node:url';
2
+ import CJS_COMPAT_NODE_PATH_5hd9c8tco0c from 'node:path';
3
+ import CJS_COMPAT_NODE_MODULE_5hd9c8tco0c from "node:module";
4
4
 
5
- var __filename = CJS_COMPAT_NODE_URL_q5rwsanlq8.fileURLToPath(import.meta.url);
6
- var __dirname = CJS_COMPAT_NODE_PATH_q5rwsanlq8.dirname(__filename);
7
- var require = CJS_COMPAT_NODE_MODULE_q5rwsanlq8.createRequire(import.meta.url);
5
+ var __filename = CJS_COMPAT_NODE_URL_5hd9c8tco0c.fileURLToPath(import.meta.url);
6
+ var __dirname = CJS_COMPAT_NODE_PATH_5hd9c8tco0c.dirname(__filename);
7
+ var require = CJS_COMPAT_NODE_MODULE_5hd9c8tco0c.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
  up
14
- } from "../_node-chunks/chunk-P3MSOE7P.js";
14
+ } from "../_node-chunks/chunk-OQZZRNKP.js";
15
15
 
16
16
  // src/server/framework-preset-angular-cli.ts
17
17
  import { logger } from "storybook/internal/node-logger";
@@ -89,7 +89,7 @@ var relative = function(from, to) {
89
89
  async function webpackFinal(baseConfig, options) {
90
90
  if (!resolvePackageDir("@angular-devkit/build-angular"))
91
91
  return logger.info('Using base config because "@angular-devkit/build-angular" is not installed'), baseConfig;
92
- let { WebpackDefinePlugin, WebpackIgnorePlugin } = await import("@storybook/builder-webpack5"), { getWebpackConfig: getCustomWebpackConfig } = await import("../_node-chunks/angular-cli-webpack-7KMGK3HE.js");
92
+ let { WebpackDefinePlugin, WebpackIgnorePlugin } = await import("@storybook/builder-webpack5"), { getWebpackConfig: getCustomWebpackConfig } = await import("../_node-chunks/angular-cli-webpack-YPMJERPD.js");
93
93
  checkForLegacyBuildOptions(options);
94
94
  let builderContext = getBuilderContext(options), builderOptions = await getBuilderOptions(options, builderContext), webpackConfig = await getCustomWebpackConfig(baseConfig, {
95
95
  builderOptions: {
@@ -1,10 +1,10 @@
1
- import CJS_COMPAT_NODE_URL_q5rwsanlq8 from 'node:url';
2
- import CJS_COMPAT_NODE_PATH_q5rwsanlq8 from 'node:path';
3
- import CJS_COMPAT_NODE_MODULE_q5rwsanlq8 from "node:module";
1
+ import CJS_COMPAT_NODE_URL_5hd9c8tco0c from 'node:url';
2
+ import CJS_COMPAT_NODE_PATH_5hd9c8tco0c from 'node:path';
3
+ import CJS_COMPAT_NODE_MODULE_5hd9c8tco0c from "node:module";
4
4
 
5
- var __filename = CJS_COMPAT_NODE_URL_q5rwsanlq8.fileURLToPath(import.meta.url);
6
- var __dirname = CJS_COMPAT_NODE_PATH_q5rwsanlq8.dirname(__filename);
7
- var require = CJS_COMPAT_NODE_MODULE_q5rwsanlq8.createRequire(import.meta.url);
5
+ var __filename = CJS_COMPAT_NODE_URL_5hd9c8tco0c.fileURLToPath(import.meta.url);
6
+ var __dirname = CJS_COMPAT_NODE_PATH_5hd9c8tco0c.dirname(__filename);
7
+ var require = CJS_COMPAT_NODE_MODULE_5hd9c8tco0c.createRequire(import.meta.url);
8
8
 
9
9
  // ------------------------------------------------------------
10
10
  // end of CJS compatibility banner, injected by Storybook's esbuild configuration
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@storybook/angular",
3
- "version": "10.6.0-alpha.3",
3
+ "version": "10.6.0-alpha.5",
4
4
  "description": "Storybook for Angular: Develop, document, and test UI components in isolation",
5
5
  "keywords": [
6
6
  "storybook",
@@ -59,7 +59,7 @@
59
59
  "!src/**/*"
60
60
  ],
61
61
  "dependencies": {
62
- "@storybook/builder-webpack5": "10.6.0-alpha.3",
62
+ "@storybook/builder-webpack5": "10.6.0-alpha.5",
63
63
  "@storybook/global": "^5.0.0",
64
64
  "telejson": "8.0.0",
65
65
  "ts-dedent": "^2.0.0",
@@ -79,7 +79,8 @@
79
79
  "@angular/forms": "^19.1.1",
80
80
  "@angular/platform-browser": "^19.1.1",
81
81
  "@angular/platform-browser-dynamic": "^19.1.1",
82
- "@storybook/core-webpack": "10.6.0-alpha.3",
82
+ "@storybook/angular-compodoc": "10.6.0-alpha.5",
83
+ "@storybook/core-webpack": "10.6.0-alpha.5",
83
84
  "@types/node": "^22.19.1",
84
85
  "empathic": "^2.0.0",
85
86
  "rimraf": "^6.0.1",
@@ -100,7 +101,7 @@
100
101
  "@angular/platform-browser": ">=18.0.0 < 23.0.0",
101
102
  "@angular/platform-browser-dynamic": ">=18.0.0 < 23.0.0",
102
103
  "rxjs": "^6.5.3 || ^7.4.0",
103
- "storybook": "^10.6.0-alpha.3",
104
+ "storybook": "^10.6.0-alpha.5",
104
105
  "typescript": "^4.9.0 || ^5.0.0 || ^6.0.0",
105
106
  "zone.js": ">=0.14.0"
106
107
  },
@@ -1,246 +0,0 @@
1
- import {
2
- __export,
3
- computesTemplateFromComponent,
4
- render,
5
- renderToCanvas
6
- } from "./chunk-FPQDYJYM.js";
7
-
8
- // src/client/config.ts
9
- var config_exports = {};
10
- __export(config_exports, {
11
- applyDecorators: () => decorateStory,
12
- argTypesEnhancers: () => argTypesEnhancers,
13
- parameters: () => parameters,
14
- render: () => render,
15
- renderToCanvas: () => renderToCanvas
16
- });
17
-
18
- // src/client/globals.ts
19
- import { global } from "@storybook/global";
20
- global.STORYBOOK_ENV = "angular";
21
-
22
- // src/client/decorateStory.ts
23
- import { sanitizeStoryContextUpdate } from "storybook/preview-api";
24
- function decorateStory(mainStoryFn, decorators) {
25
- return [cleanArgsDecorator, ...decorators].reduce(
26
- (previousStoryFn, decorator) => (context) => decorator((update) => previousStoryFn({
27
- ...context,
28
- ...sanitizeStoryContextUpdate(update)
29
- }), context),
30
- (context) => prepareMain(mainStoryFn(context), context)
31
- );
32
- }
33
- var prepareMain = (story, context) => {
34
- let { template } = story, { component } = context, userDefinedTemplate = !hasNoTemplate(template);
35
- return !userDefinedTemplate && component && (template = computesTemplateFromComponent(component, story.props, "")), {
36
- ...story,
37
- ...template ? { template, userDefinedTemplate } : {}
38
- };
39
- };
40
- function hasNoTemplate(template) {
41
- return template == null;
42
- }
43
- var cleanArgsDecorator = (storyFn, context) => {
44
- if (!context.argTypes || !context.args)
45
- return storyFn();
46
- let argsToClean = context.args;
47
- return context.args = Object.entries(argsToClean).reduce((obj, [key, arg]) => {
48
- let argType = context.argTypes[key];
49
- return argType?.action || argType?.control ? { ...obj, [key]: arg } : obj;
50
- }, {}), storyFn();
51
- };
52
-
53
- // src/client/config.ts
54
- import { enhanceArgTypes } from "storybook/internal/docs-tools";
55
-
56
- // src/client/compodoc.ts
57
- import { logger } from "storybook/internal/client-logger";
58
- import { global as global2 } from "@storybook/global";
59
- var { FEATURES } = global2, isMethod = (methodOrProp) => methodOrProp.args !== void 0;
60
- var getCompodocJson = () => global2.__STORYBOOK_COMPODOC_JSON__, checkValidComponentOrDirective = (component) => {
61
- if (!component.name)
62
- throw new Error(`Invalid component ${JSON.stringify(component)}`);
63
- }, checkValidCompodocJson = (compodocJson) => {
64
- if (!compodocJson || !compodocJson.components)
65
- throw new Error("Invalid compodoc JSON");
66
- }, hasDecorator = (item, decoratorName) => item.decorators && item.decorators.find((x) => x.name === decoratorName), mapPropertyToSection = (item) => hasDecorator(item, "ViewChild") ? "view child" : hasDecorator(item, "ViewChildren") ? "view children" : hasDecorator(item, "ContentChild") ? "content child" : hasDecorator(item, "ContentChildren") ? "content children" : "properties", mapItemToSection = (key, item) => {
67
- switch (key) {
68
- case "methods":
69
- case "methodsClass":
70
- return "methods";
71
- case "inputsClass":
72
- return "inputs";
73
- case "outputsClass":
74
- return "outputs";
75
- case "properties":
76
- case "propertiesClass":
77
- if (isMethod(item))
78
- throw new Error("Cannot be of type Method if key === 'propertiesClass'");
79
- return mapPropertyToSection(item);
80
- default:
81
- throw new Error(`Unknown key: ${key}`);
82
- }
83
- }, findComponentByName = (name, compodocJson) => compodocJson.components.find((c) => c.name === name) || compodocJson.directives.find((c) => c.name === name) || compodocJson.pipes.find((c) => c.name === name) || compodocJson.injectables.find((c) => c.name === name) || compodocJson.classes.find((c) => c.name === name), getComponentData = (component) => {
84
- if (!component)
85
- return null;
86
- checkValidComponentOrDirective(component);
87
- let compodocJson = getCompodocJson();
88
- if (!compodocJson)
89
- return null;
90
- checkValidCompodocJson(compodocJson);
91
- let { name } = component, metadata = findComponentByName(name, compodocJson);
92
- return metadata || logger.warn(`Component not found in compodoc JSON: '${name}'`), metadata;
93
- }, displaySignature = (item) => `(${item.args.map(
94
- (arg) => `${arg.name}${arg.optional ? "?" : ""}: ${arg.type}`
95
- ).join(", ")}) => ${item.returnType}`, extractTypeFromValue = (defaultValue) => {
96
- let valueType = typeof defaultValue;
97
- return defaultValue || valueType === "number" || valueType === "boolean" || valueType === "string" ? valueType : null;
98
- }, extractEnumValues = (compodocType) => {
99
- let enumType = getCompodocJson()?.miscellaneous?.enumerations?.find((x) => x.name === compodocType);
100
- if (enumType?.childs.every((x) => x.value))
101
- return enumType.childs.map((x) => x.value);
102
- if (typeof compodocType != "string" || compodocType.indexOf("|") === -1)
103
- return null;
104
- try {
105
- return compodocType.split("|").map((value) => JSON.parse(value));
106
- } catch {
107
- return null;
108
- }
109
- }, extractType = (property, defaultValue) => {
110
- let compodocType = property.type || extractTypeFromValue(defaultValue);
111
- switch (compodocType) {
112
- case "string":
113
- case "boolean":
114
- case "number":
115
- return { name: compodocType };
116
- case void 0:
117
- case null:
118
- return { name: "other", value: "void" };
119
- default: {
120
- let resolvedType = resolveTypealias(compodocType), enumValues = extractEnumValues(resolvedType);
121
- return enumValues ? { name: "enum", value: enumValues } : { name: "other", value: "empty-enum" };
122
- }
123
- }
124
- }, castDefaultValue = (property, defaultValue) => {
125
- let compodocType = property.type;
126
- if (["boolean", "number", "string", "EventEmitter"].includes(compodocType))
127
- switch (compodocType) {
128
- case "boolean":
129
- return defaultValue === "true";
130
- case "number":
131
- return Number(defaultValue);
132
- case "EventEmitter":
133
- return;
134
- default:
135
- return defaultValue;
136
- }
137
- else
138
- switch (defaultValue) {
139
- case "true":
140
- return !0;
141
- case "false":
142
- return !1;
143
- case "null":
144
- return null;
145
- case "undefined":
146
- return;
147
- default:
148
- return defaultValue;
149
- }
150
- }, extractDefaultValueFromComments = (property, value) => {
151
- let commentValue = value;
152
- return property.jsdoctags.forEach((tag) => {
153
- ["default", "defaultvalue"].includes(tag.tagName.escapedText) && (commentValue = new global2.DOMParser().parseFromString(tag.comment, "text/html").body.textContent);
154
- }), commentValue;
155
- }, extractDefaultValue = (property) => {
156
- try {
157
- let value = property.defaultValue?.replace(/^'(.*)'$/, "$1");
158
- return value = castDefaultValue(property, value), value == null && property.jsdoctags?.length > 0 && (value = extractDefaultValueFromComments(property, value)), value;
159
- } catch {
160
- logger.debug(`Error extracting ${property.name}: ${property.defaultValue}`);
161
- return;
162
- }
163
- }, resolveTypealias = (compodocType) => {
164
- let typeAlias = getCompodocJson()?.miscellaneous?.typealiases?.find((x) => x.name === compodocType);
165
- return typeAlias ? resolveTypealias(typeAlias.rawtype) : compodocType;
166
- }, extractArgTypesFromData = (componentData) => {
167
- let sectionToItems = {}, componentClasses = FEATURES.angularFilterNonInputControls ? ["inputsClass"] : ["propertiesClass", "methodsClass", "inputsClass", "outputsClass"], compodocClasses = ["component", "directive"].includes(componentData.type) ? componentClasses : ["properties", "methods"], inputClassNames = new Set(
168
- (componentData.inputsClass || []).map((item) => item.name)
169
- ), modelProperties = (componentData.outputsClass || []).filter((item) => inputClassNames.has(item.name)), modelPropertyNames = new Set(modelProperties.map((item) => item.name));
170
- compodocClasses.forEach((key) => {
171
- (componentData[key] || []).forEach((item) => {
172
- let section = mapItemToSection(key, item);
173
- if (key === "outputsClass" && !isMethod(item) && modelPropertyNames.has(item.name))
174
- return;
175
- let defaultValue = isMethod(item) ? void 0 : extractDefaultValue(item), type = isMethod(item) || section !== "inputs" && section !== "properties" ? { name: "other", value: "void" } : extractType(item, defaultValue), action = section === "outputs" ? { action: item.name } : {}, argType = {
176
- name: item.name,
177
- description: item.rawdescription || item.description,
178
- type,
179
- ...action,
180
- table: {
181
- category: section,
182
- type: {
183
- summary: isMethod(item) ? displaySignature(item) : item.type,
184
- required: isMethod(item) ? !1 : !item.optional
185
- },
186
- defaultValue: { summary: defaultValue }
187
- }
188
- };
189
- sectionToItems[section] || (sectionToItems[section] = []), sectionToItems[section].push(argType);
190
- });
191
- }), modelProperties.forEach((item) => {
192
- let changeName = `${item.name}Change`, argType = {
193
- name: changeName,
194
- description: item.rawdescription || item.description,
195
- type: { name: "other", value: "void" },
196
- action: changeName,
197
- table: {
198
- category: "outputs",
199
- type: {
200
- summary: `(e: ${item.type}) => void`,
201
- required: !item.optional
202
- }
203
- }
204
- };
205
- sectionToItems.outputs || (sectionToItems.outputs = []), sectionToItems.outputs.push(argType);
206
- });
207
- let SECTIONS = [
208
- "properties",
209
- "inputs",
210
- "outputs",
211
- "methods",
212
- "view child",
213
- "view children",
214
- "content child",
215
- "content children"
216
- ], argTypes = {};
217
- return SECTIONS.forEach((section) => {
218
- let items = sectionToItems[section];
219
- items && items.forEach((argType) => {
220
- argTypes[argType.name] = argType;
221
- });
222
- }), argTypes;
223
- }, extractArgTypes = (component) => {
224
- let componentData = getComponentData(component);
225
- return componentData && extractArgTypesFromData(componentData);
226
- }, extractComponentDescription = (component) => {
227
- let componentData = getComponentData(component);
228
- return componentData && (componentData.rawdescription || componentData.description);
229
- };
230
-
231
- // src/client/config.ts
232
- var parameters = {
233
- renderer: "angular",
234
- docs: {
235
- story: { inline: !0 },
236
- extractArgTypes,
237
- extractComponentDescription
238
- }
239
- }, argTypesEnhancers = [enhanceArgTypes];
240
-
241
- export {
242
- decorateStory,
243
- parameters,
244
- argTypesEnhancers,
245
- config_exports
246
- };