@storybook/angular 10.4.0 → 10.4.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.
@@ -31,21 +31,23 @@ import {
31
31
  Input,
32
32
  Output,
33
33
  Pipe,
34
- \u0275ReflectionCapabilities as ReflectionCapabilities
34
+ \u0275ReflectionCapabilities as ReflectionCapabilities,
35
+ \u0275getComponentDef as getComponentDef
35
36
  } from "@angular/core";
36
37
  var reflectionCapabilities = new ReflectionCapabilities(), getComponentInputsOutputs = (component) => {
37
38
  let componentMetadata = getComponentDecoratorMetadata(component), componentPropsMetadata = getComponentPropsDecoratorMetadata(component), initialValue = {
38
39
  inputs: [],
39
40
  outputs: []
40
41
  };
41
- return componentMetadata && componentMetadata.inputs && initialValue.inputs.push(
42
+ componentMetadata && componentMetadata.inputs && initialValue.inputs.push(
42
43
  ...componentMetadata.inputs.map((i) => ({
43
44
  propName: typeof i == "string" ? i : i.name,
44
45
  templateName: typeof i == "string" ? i : i.alias
45
46
  }))
46
47
  ), componentMetadata && componentMetadata.outputs && initialValue.outputs.push(
47
48
  ...componentMetadata.outputs.map((i) => ({ propName: i, templateName: i }))
48
- ), componentPropsMetadata ? Object.entries(componentPropsMetadata).reduce((previousValue, [propertyName, values]) => {
49
+ );
50
+ let decoratorDerived = componentPropsMetadata ? Object.entries(componentPropsMetadata).reduce((previousValue, [propertyName, values]) => {
49
51
  let value = values.find((v) => v instanceof Input || v instanceof Output);
50
52
  if (value instanceof Input) {
51
53
  let inputToAdd = {
@@ -73,6 +75,28 @@ var reflectionCapabilities = new ReflectionCapabilities(), getComponentInputsOut
73
75
  }
74
76
  return previousValue;
75
77
  }, initialValue) : initialValue;
78
+ return addSignalInputsOutputs(component, decoratorDerived);
79
+ }, hasEntry = (list, propName, templateName) => list.some((e) => e.propName === propName || e.templateName === templateName), addSignalInputsOutputs = (component, base) => {
80
+ let result = {
81
+ inputs: [...base.inputs],
82
+ outputs: [...base.outputs]
83
+ }, def;
84
+ try {
85
+ def = getComponentDef(component);
86
+ } catch {
87
+ return result;
88
+ }
89
+ if (!def)
90
+ return result;
91
+ for (let templateName of Object.keys(def.inputs ?? {})) {
92
+ let rawPropName = def.inputs[templateName], propName = Array.isArray(rawPropName) ? rawPropName[0] ?? templateName : rawPropName ?? templateName;
93
+ hasEntry(result.inputs, propName, templateName) || result.inputs.push({ propName, templateName });
94
+ }
95
+ for (let templateName of Object.keys(def.outputs ?? {})) {
96
+ let propName = def.outputs[templateName] ?? templateName;
97
+ hasEntry(result.outputs, propName, templateName) || result.outputs.push({ propName, templateName });
98
+ }
99
+ return result;
76
100
  };
77
101
  var isComponent = (component) => component ? (reflectionCapabilities.annotations(component) || []).some((d) => d instanceof Component) : !1;
78
102
  var getComponentPropsDecoratorMetadata = (component) => reflectionCapabilities.propMetadata(component), getComponentDecoratorMetadata = (component) => reflectionCapabilities.annotations(component).reverse().find((d) => d instanceof Component);
@@ -3,7 +3,7 @@ import {
3
3
  computesTemplateFromComponent,
4
4
  render,
5
5
  renderToCanvas
6
- } from "./chunk-6PLRDPVY.js";
6
+ } from "./chunk-2UO6R2HQ.js";
7
7
 
8
8
  // src/client/config.ts
9
9
  var config_exports = {};
@@ -164,10 +164,15 @@ var getCompodocJson = () => global2.__STORYBOOK_COMPODOC_JSON__, checkValidCompo
164
164
  let typeAlias = getCompodocJson()?.miscellaneous?.typealiases?.find((x) => x.name === compodocType);
165
165
  return typeAlias ? resolveTypealias(typeAlias.rawtype) : compodocType;
166
166
  }, extractArgTypesFromData = (componentData) => {
167
- let sectionToItems = {}, componentClasses = FEATURES.angularFilterNonInputControls ? ["inputsClass"] : ["propertiesClass", "methodsClass", "inputsClass", "outputsClass"];
168
- (["component", "directive"].includes(componentData.type) ? componentClasses : ["properties", "methods"]).forEach((key) => {
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) => {
169
171
  (componentData[key] || []).forEach((item) => {
170
- let section = mapItemToSection(key, item), 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 = {
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 = {
171
176
  name: item.name,
172
177
  description: item.rawdescription || item.description,
173
178
  type,
@@ -183,6 +188,21 @@ var getCompodocJson = () => global2.__STORYBOOK_COMPODOC_JSON__, checkValidCompo
183
188
  };
184
189
  sectionToItems[section] || (sectionToItems[section] = []), sectionToItems[section].push(argType);
185
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);
186
206
  });
187
207
  let SECTIONS = [
188
208
  "properties",
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  __export,
3
3
  computesTemplateSourceFromComponent
4
- } from "./chunk-6PLRDPVY.js";
4
+ } from "./chunk-2UO6R2HQ.js";
5
5
 
6
6
  // src/client/docs/config.ts
7
7
  var config_exports = {};
@@ -1,15 +1,15 @@
1
1
  import {
2
2
  config_exports
3
- } from "./chunk-QQWSC6HR.js";
3
+ } from "./chunk-KH22LQ5L.js";
4
4
  import {
5
5
  config_exports as config_exports2
6
- } from "./chunk-KKFRD2ZH.js";
6
+ } from "./chunk-TTO6V6KM.js";
7
7
  import {
8
8
  computesTemplateFromComponent,
9
9
  formatPropInTemplate,
10
10
  isComponent,
11
11
  render_exports
12
- } from "./chunk-6PLRDPVY.js";
12
+ } from "./chunk-2UO6R2HQ.js";
13
13
 
14
14
  // src/client/portable-stories.ts
15
15
  import {
@@ -1,10 +1,10 @@
1
- import CJS_COMPAT_NODE_URL_7kp79pg59aq from 'node:url';
2
- import CJS_COMPAT_NODE_PATH_7kp79pg59aq from 'node:path';
3
- import CJS_COMPAT_NODE_MODULE_7kp79pg59aq from "node:module";
1
+ import CJS_COMPAT_NODE_URL_lvwwjzc9499 from 'node:url';
2
+ import CJS_COMPAT_NODE_PATH_lvwwjzc9499 from 'node:path';
3
+ import CJS_COMPAT_NODE_MODULE_lvwwjzc9499 from "node:module";
4
4
 
5
- var __filename = CJS_COMPAT_NODE_URL_7kp79pg59aq.fileURLToPath(import.meta.url);
6
- var __dirname = CJS_COMPAT_NODE_PATH_7kp79pg59aq.dirname(__filename);
7
- var require = CJS_COMPAT_NODE_MODULE_7kp79pg59aq.createRequire(import.meta.url);
5
+ var __filename = CJS_COMPAT_NODE_URL_lvwwjzc9499.fileURLToPath(import.meta.url);
6
+ var __dirname = CJS_COMPAT_NODE_PATH_lvwwjzc9499.dirname(__filename);
7
+ var require = CJS_COMPAT_NODE_MODULE_lvwwjzc9499.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_7kp79pg59aq from 'node:url';
2
- import CJS_COMPAT_NODE_PATH_7kp79pg59aq from 'node:path';
3
- import CJS_COMPAT_NODE_MODULE_7kp79pg59aq from "node:module";
1
+ import CJS_COMPAT_NODE_URL_lvwwjzc9499 from 'node:url';
2
+ import CJS_COMPAT_NODE_PATH_lvwwjzc9499 from 'node:path';
3
+ import CJS_COMPAT_NODE_MODULE_lvwwjzc9499 from "node:module";
4
4
 
5
- var __filename = CJS_COMPAT_NODE_URL_7kp79pg59aq.fileURLToPath(import.meta.url);
6
- var __dirname = CJS_COMPAT_NODE_PATH_7kp79pg59aq.dirname(__filename);
7
- var require = CJS_COMPAT_NODE_MODULE_7kp79pg59aq.createRequire(import.meta.url);
5
+ var __filename = CJS_COMPAT_NODE_URL_lvwwjzc9499.fileURLToPath(import.meta.url);
6
+ var __dirname = CJS_COMPAT_NODE_PATH_lvwwjzc9499.dirname(__filename);
7
+ var require = CJS_COMPAT_NODE_MODULE_lvwwjzc9499.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_7kp79pg59aq from 'node:url';
2
- import CJS_COMPAT_NODE_PATH_7kp79pg59aq from 'node:path';
3
- import CJS_COMPAT_NODE_MODULE_7kp79pg59aq from "node:module";
1
+ import CJS_COMPAT_NODE_URL_lvwwjzc9499 from 'node:url';
2
+ import CJS_COMPAT_NODE_PATH_lvwwjzc9499 from 'node:path';
3
+ import CJS_COMPAT_NODE_MODULE_lvwwjzc9499 from "node:module";
4
4
 
5
- var __filename = CJS_COMPAT_NODE_URL_7kp79pg59aq.fileURLToPath(import.meta.url);
6
- var __dirname = CJS_COMPAT_NODE_PATH_7kp79pg59aq.dirname(__filename);
7
- var require = CJS_COMPAT_NODE_MODULE_7kp79pg59aq.createRequire(import.meta.url);
5
+ var __filename = CJS_COMPAT_NODE_URL_lvwwjzc9499.fileURLToPath(import.meta.url);
6
+ var __dirname = CJS_COMPAT_NODE_PATH_lvwwjzc9499.dirname(__filename);
7
+ var require = CJS_COMPAT_NODE_MODULE_lvwwjzc9499.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-UQKGSRAW.js";
14
+ } from "./chunk-7SBAZG2D.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_7kp79pg59aq from 'node:url';
2
- import CJS_COMPAT_NODE_PATH_7kp79pg59aq from 'node:path';
3
- import CJS_COMPAT_NODE_MODULE_7kp79pg59aq from "node:module";
1
+ import CJS_COMPAT_NODE_URL_lvwwjzc9499 from 'node:url';
2
+ import CJS_COMPAT_NODE_PATH_lvwwjzc9499 from 'node:path';
3
+ import CJS_COMPAT_NODE_MODULE_lvwwjzc9499 from "node:module";
4
4
 
5
- var __filename = CJS_COMPAT_NODE_URL_7kp79pg59aq.fileURLToPath(import.meta.url);
6
- var __dirname = CJS_COMPAT_NODE_PATH_7kp79pg59aq.dirname(__filename);
7
- var require = CJS_COMPAT_NODE_MODULE_7kp79pg59aq.createRequire(import.meta.url);
5
+ var __filename = CJS_COMPAT_NODE_URL_lvwwjzc9499.fileURLToPath(import.meta.url);
6
+ var __dirname = CJS_COMPAT_NODE_PATH_lvwwjzc9499.dirname(__filename);
7
+ var require = CJS_COMPAT_NODE_MODULE_lvwwjzc9499.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-YOBZXZKF.js";
17
+ } from "../../_node-chunks/chunk-W6QLQ44O.js";
18
18
  import {
19
19
  up
20
- } from "../../_node-chunks/chunk-UQKGSRAW.js";
20
+ } from "../../_node-chunks/chunk-7SBAZG2D.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_7kp79pg59aq from 'node:url';
2
- import CJS_COMPAT_NODE_PATH_7kp79pg59aq from 'node:path';
3
- import CJS_COMPAT_NODE_MODULE_7kp79pg59aq from "node:module";
1
+ import CJS_COMPAT_NODE_URL_lvwwjzc9499 from 'node:url';
2
+ import CJS_COMPAT_NODE_PATH_lvwwjzc9499 from 'node:path';
3
+ import CJS_COMPAT_NODE_MODULE_lvwwjzc9499 from "node:module";
4
4
 
5
- var __filename = CJS_COMPAT_NODE_URL_7kp79pg59aq.fileURLToPath(import.meta.url);
6
- var __dirname = CJS_COMPAT_NODE_PATH_7kp79pg59aq.dirname(__filename);
7
- var require = CJS_COMPAT_NODE_MODULE_7kp79pg59aq.createRequire(import.meta.url);
5
+ var __filename = CJS_COMPAT_NODE_URL_lvwwjzc9499.fileURLToPath(import.meta.url);
6
+ var __dirname = CJS_COMPAT_NODE_PATH_lvwwjzc9499.dirname(__filename);
7
+ var require = CJS_COMPAT_NODE_MODULE_lvwwjzc9499.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-YOBZXZKF.js";
17
+ } from "../../_node-chunks/chunk-W6QLQ44O.js";
18
18
  import {
19
19
  up
20
- } from "../../_node-chunks/chunk-UQKGSRAW.js";
20
+ } from "../../_node-chunks/chunk-7SBAZG2D.js";
21
21
 
22
22
  // src/builders/start-storybook/index.ts
23
23
  import { readFileSync } from "node:fs";
@@ -2,11 +2,11 @@ import {
2
2
  argTypesEnhancers,
3
3
  decorateStory,
4
4
  parameters
5
- } from "../_browser-chunks/chunk-QQWSC6HR.js";
5
+ } from "../_browser-chunks/chunk-KH22LQ5L.js";
6
6
  import {
7
7
  render,
8
8
  renderToCanvas
9
- } from "../_browser-chunks/chunk-6PLRDPVY.js";
9
+ } from "../_browser-chunks/chunk-2UO6R2HQ.js";
10
10
  export {
11
11
  decorateStory as applyDecorators,
12
12
  argTypesEnhancers,
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  decorators,
3
3
  parameters
4
- } from "../../_browser-chunks/chunk-KKFRD2ZH.js";
5
- import "../../_browser-chunks/chunk-6PLRDPVY.js";
4
+ } from "../../_browser-chunks/chunk-TTO6V6KM.js";
5
+ import "../../_browser-chunks/chunk-2UO6R2HQ.js";
6
6
  export {
7
7
  decorators,
8
8
  parameters
@@ -5,10 +5,10 @@ import {
5
5
  componentWrapperDecorator,
6
6
  moduleMetadata,
7
7
  setProjectAnnotations
8
- } from "../_browser-chunks/chunk-6IPUGLI5.js";
9
- import "../_browser-chunks/chunk-QQWSC6HR.js";
10
- import "../_browser-chunks/chunk-KKFRD2ZH.js";
11
- import "../_browser-chunks/chunk-6PLRDPVY.js";
8
+ } from "../_browser-chunks/chunk-XHXUBY4P.js";
9
+ import "../_browser-chunks/chunk-KH22LQ5L.js";
10
+ import "../_browser-chunks/chunk-TTO6V6KM.js";
11
+ import "../_browser-chunks/chunk-2UO6R2HQ.js";
12
12
  export {
13
13
  __definePreview,
14
14
  applicationConfig,