@storybook/angular 6.4.8 → 6.5.0-alpha.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.
@@ -38,6 +38,19 @@ export declare abstract class AbstractRenderer {
38
38
  parameters: Parameters;
39
39
  targetDOMNode: HTMLElement;
40
40
  }): Promise<void>;
41
+ /**
42
+ * Only ASCII alphanumerics can be used as HTML tag name.
43
+ * https://html.spec.whatwg.org/#elements-2
44
+ *
45
+ * Therefore, stories break when non-ASCII alphanumerics are included in target selector.
46
+ * https://github.com/storybookjs/storybook/issues/15147
47
+ *
48
+ * This method returns storyId when it doesn't contain any non-ASCII alphanumerics.
49
+ * Otherwise, it generates a valid HTML tag name from storyId by removing non-ASCII alphanumerics from storyId, prefixing "sb-", and suffixing "-component"
50
+ * @protected
51
+ * @memberof AbstractRenderer
52
+ */
53
+ protected generateTargetSelectorFromStoryId(): string;
41
54
  protected initAngularRootElement(targetDOMNode: HTMLElement, targetSelector: string): void;
42
55
  private fullRendererRequired;
43
56
  }
@@ -38,6 +38,19 @@ export declare abstract class AbstractRenderer {
38
38
  parameters: Parameters;
39
39
  targetDOMNode: HTMLElement;
40
40
  }): Promise<void>;
41
+ /**
42
+ * Only ASCII alphanumerics can be used as HTML tag name.
43
+ * https://html.spec.whatwg.org/#elements-2
44
+ *
45
+ * Therefore, stories break when non-ASCII alphanumerics are included in target selector.
46
+ * https://github.com/storybookjs/storybook/issues/15147
47
+ *
48
+ * This method returns storyId when it doesn't contain any non-ASCII alphanumerics.
49
+ * Otherwise, it generates a valid HTML tag name from storyId by removing non-ASCII alphanumerics from storyId, prefixing "sb-", and suffixing "-component"
50
+ * @protected
51
+ * @memberof AbstractRenderer
52
+ */
53
+ protected generateTargetSelectorFromStoryId(): string;
41
54
  protected initAngularRootElement(targetDOMNode: HTMLElement, targetSelector: string): void;
42
55
  private fullRendererRequired;
43
56
  }
@@ -125,7 +125,7 @@ var AbstractRenderer = /** @class */ (function () {
125
125
  return __generator(this, function (_c) {
126
126
  switch (_c.label) {
127
127
  case 0:
128
- targetSelector = "" + this.storyId;
128
+ targetSelector = "" + this.generateTargetSelectorFromStoryId();
129
129
  newStoryProps$ = new rxjs_1.BehaviorSubject(storyFnAngular.props);
130
130
  moduleMetadata = StorybookModule_1.getStorybookModuleMetadata({ storyFnAngular: storyFnAngular, component: component, targetSelector: targetSelector }, newStoryProps$);
131
131
  if (!this.fullRendererRequired({
@@ -156,6 +156,25 @@ var AbstractRenderer = /** @class */ (function () {
156
156
  });
157
157
  });
158
158
  };
159
+ /**
160
+ * Only ASCII alphanumerics can be used as HTML tag name.
161
+ * https://html.spec.whatwg.org/#elements-2
162
+ *
163
+ * Therefore, stories break when non-ASCII alphanumerics are included in target selector.
164
+ * https://github.com/storybookjs/storybook/issues/15147
165
+ *
166
+ * This method returns storyId when it doesn't contain any non-ASCII alphanumerics.
167
+ * Otherwise, it generates a valid HTML tag name from storyId by removing non-ASCII alphanumerics from storyId, prefixing "sb-", and suffixing "-component"
168
+ * @protected
169
+ * @memberof AbstractRenderer
170
+ */
171
+ AbstractRenderer.prototype.generateTargetSelectorFromStoryId = function () {
172
+ var invalidHtmlTag = /[^A-Za-z0-9-]/g;
173
+ var storyIdIsInvalidHtmlTagName = invalidHtmlTag.test(this.storyId);
174
+ return storyIdIsInvalidHtmlTagName
175
+ ? "sb-" + this.storyId.replace(invalidHtmlTag, '') + "-component"
176
+ : this.storyId;
177
+ };
159
178
  AbstractRenderer.prototype.initAngularRootElement = function (targetDOMNode, targetSelector) {
160
179
  // Adds DOM element that angular will use as bootstrap component
161
180
  // eslint-disable-next-line no-param-reassign
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@storybook/angular",
3
- "version": "6.4.8",
3
+ "version": "6.5.0-alpha.3",
4
4
  "description": "Storybook for Angular: Develop Angular Components in isolation with Hot Reloading.",
5
5
  "keywords": [
6
6
  "storybook"
@@ -45,15 +45,16 @@
45
45
  "prepare": "node ../../scripts/prepare.js"
46
46
  },
47
47
  "dependencies": {
48
- "@storybook/addons": "6.4.8",
49
- "@storybook/api": "6.4.8",
50
- "@storybook/core": "6.4.8",
51
- "@storybook/core-common": "6.4.8",
52
- "@storybook/core-events": "6.4.8",
48
+ "@storybook/addons": "6.5.0-alpha.3",
49
+ "@storybook/api": "6.5.0-alpha.3",
50
+ "@storybook/core": "6.5.0-alpha.3",
51
+ "@storybook/core-common": "6.5.0-alpha.3",
52
+ "@storybook/core-events": "6.5.0-alpha.3",
53
53
  "@storybook/csf": "0.0.2--canary.87bc651.0",
54
- "@storybook/node-logger": "6.4.8",
54
+ "@storybook/node-logger": "6.5.0-alpha.3",
55
55
  "@storybook/semver": "^7.3.2",
56
- "@storybook/store": "6.4.8",
56
+ "@storybook/store": "6.5.0-alpha.3",
57
+ "@types/node": "^14.14.20 || ^16.0.0",
57
58
  "@types/webpack-env": "^1.16.0",
58
59
  "autoprefixer": "^9.8.6",
59
60
  "core-js": "^3.8.2",
@@ -69,7 +70,7 @@
69
70
  "regenerator-runtime": "^0.13.7",
70
71
  "sass-loader": "^10.1.0",
71
72
  "strip-json-comments": "3.1.1",
72
- "telejson": "^5.3.2",
73
+ "telejson": "^5.3.3",
73
74
  "ts-dedent": "^2.0.0",
74
75
  "ts-loader": "^8.0.14",
75
76
  "tsconfig-paths-webpack-plugin": "^3.3.0",
@@ -138,5 +139,5 @@
138
139
  "access": "public"
139
140
  },
140
141
  "builders": "dist/ts3.9/builders/builders.json",
141
- "gitHead": "d6b59f78a528a5c7922e71d28b583dd31ad67e7d"
142
+ "gitHead": "4d971f7d493ecb388017a150a9943e87c7770d98"
142
143
  }