storybook 9.1.0-beta.1 → 9.1.0-beta.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.
@@ -3851,18 +3851,24 @@ var be = class {
3851
3851
  this.teardownRender = /* @__PURE__ */ s(() => {
3852
3852
  }, "teardownRender");
3853
3853
  this.torndown = !1;
3854
- this.abortController = new yn(), d && (this.story = d, this.phase = "preparing");
3854
+ this.abortController = new yn(), this.renderId = Date.now(), d && (this.story = d, this.phase = "preparing");
3855
3855
  }
3856
3856
  static {
3857
3857
  s(this, "StoryRender");
3858
3858
  }
3859
3859
  async runPhase(e, t, o) {
3860
- this.phase = t, this.channel.emit(z.STORY_RENDER_PHASE_CHANGED, { newPhase: this.phase, storyId: this.id }), o && (await o(), this.checkIfAborted(
3861
- e));
3860
+ this.phase = t, this.channel.emit(z.STORY_RENDER_PHASE_CHANGED, {
3861
+ newPhase: this.phase,
3862
+ renderId: this.renderId,
3863
+ storyId: this.id
3864
+ }), o && (await o(), this.checkIfAborted(e));
3862
3865
  }
3863
3866
  checkIfAborted(e) {
3864
- return e.aborted ? (this.phase = "aborted", this.channel.emit(z.STORY_RENDER_PHASE_CHANGED, { newPhase: this.phase, storyId: this.id }),
3865
- !0) : !1;
3867
+ return e.aborted ? (this.phase = "aborted", this.channel.emit(z.STORY_RENDER_PHASE_CHANGED, {
3868
+ newPhase: this.phase,
3869
+ renderId: this.renderId,
3870
+ storyId: this.id
3871
+ }), !0) : !1;
3866
3872
  }
3867
3873
  async prepare() {
3868
3874
  if (await this.runPhase(this.abortController.signal, "preparing", async () => {
@@ -4518,7 +4524,7 @@ var Ye = class {
4518
4524
  this.torndown = !1;
4519
4525
  this.disableKeyListeners = !1;
4520
4526
  this.preparing = !1;
4521
- this.id = o.id;
4527
+ this.id = o.id, this.renderId = Date.now();
4522
4528
  }
4523
4529
  static {
4524
4530
  s(this, "CsfDocsRender");
@@ -4589,7 +4595,7 @@ var Ke = class {
4589
4595
  this.torndown = !1;
4590
4596
  this.disableKeyListeners = !1;
4591
4597
  this.preparing = !1;
4592
- this.id = o.id;
4598
+ this.id = o.id, this.renderId = Date.now();
4593
4599
  }
4594
4600
  static {
4595
4601
  s(this, "MdxDocsRender");
@@ -4885,18 +4891,16 @@ var Te = class extends Se {
4885
4891
  }
4886
4892
  // renderException is used if we fail to render the story and it is uncaught by the app layer
4887
4893
  renderException(t, o) {
4888
- let { name: n = "Error", message: i = String(o), stack: a } = o;
4894
+ let { name: n = "Error", message: i = String(o), stack: a } = o, l = this.currentRender?.renderId;
4889
4895
  this.channel.emit(E.STORY_THREW_EXCEPTION, { name: n, message: i, stack: a }), this.channel.emit(E.STORY_RENDER_PHASE_CHANGED, { newPhase: "\
4890
- errored", storyId: t }), this.view.showErrorDisplay(o), Xe.logger.error(`Error rendering story '${t}':`), Xe.logger.error(o);
4896
+ errored", renderId: l, storyId: t }), this.view.showErrorDisplay(o), Xe.logger.error(`Error rendering story '${t}':`), Xe.logger.error(o);
4891
4897
  }
4892
4898
  // renderError is used by the various app layers to inform the user they have done something
4893
4899
  // wrong -- for instance returned the wrong thing from a story
4894
4900
  renderError(t, { title: o, description: n }) {
4895
- Xe.logger.error(`Error rendering story ${o}: ${n}`), this.channel.emit(E.STORY_ERRORED, { title: o, description: n }), this.channel.emit(
4896
- E.STORY_RENDER_PHASE_CHANGED, { newPhase: "errored", storyId: t }), this.view.showErrorDisplay({
4897
- message: o,
4898
- stack: n
4899
- });
4901
+ let i = this.currentRender?.renderId;
4902
+ this.channel.emit(E.STORY_ERRORED, { title: o, description: n }), this.channel.emit(E.STORY_RENDER_PHASE_CHANGED, { newPhase: "errored",
4903
+ renderId: i, storyId: t }), this.view.showErrorDisplay({ message: o, stack: n }), Xe.logger.error(`Error rendering story ${o}: ${n}`);
4900
4904
  }
4901
4905
  };
4902
4906
 
@@ -638,6 +638,7 @@ type RenderType = 'story' | 'docs';
638
638
  * - Tracking what is rendered to know if a change requires re-rendering or teardown + recreation.
639
639
  */
640
640
  interface Render<TRenderer extends Renderer> {
641
+ renderId: number;
641
642
  type: RenderType;
642
643
  id: StoryId;
643
644
  isPreparing: () => boolean;
@@ -666,6 +667,7 @@ declare class CsfDocsRender<TRenderer extends Renderer> implements Render<TRende
666
667
  protected store: StoryStore<TRenderer>;
667
668
  entry: IndexEntry;
668
669
  private callbacks;
670
+ readonly renderId: number;
669
671
  readonly type: RenderType;
670
672
  readonly subtype = "csf";
671
673
  readonly id: StoryId;
@@ -704,6 +706,7 @@ declare class MdxDocsRender<TRenderer extends Renderer> implements Render<TRende
704
706
  protected store: StoryStore<TRenderer>;
705
707
  entry: IndexEntry;
706
708
  private callbacks;
709
+ readonly renderId: number;
707
710
  readonly type: RenderType;
708
711
  readonly subtype = "mdx";
709
712
  readonly id: StoryId;
@@ -736,6 +739,7 @@ declare class StoryRender<TRenderer extends Renderer> implements Render<TRendere
736
739
  id: StoryId;
737
740
  viewMode: StoryContext<TRenderer>['viewMode'];
738
741
  renderOptions: StoryRenderOptions;
742
+ readonly renderId: number;
739
743
  type: RenderType;
740
744
  story?: PreparedStory<TRenderer>;
741
745
  phase?: RenderPhase;
@@ -3851,13 +3851,21 @@ var Jr = class Jr {
3851
3851
  this.teardownRender = /* @__PURE__ */ n(() => {
3852
3852
  }, "teardownRender");
3853
3853
  this.torndown = !1;
3854
- this.abortController = new Io(), c && (this.story = c, this.phase = "preparing");
3854
+ this.abortController = new Io(), this.renderId = Date.now(), c && (this.story = c, this.phase = "preparing");
3855
3855
  }
3856
3856
  async runPhase(e, t, o) {
3857
- this.phase = t, this.channel.emit(Fo, { newPhase: this.phase, storyId: this.id }), o && (await o(), this.checkIfAborted(e));
3857
+ this.phase = t, this.channel.emit(Fo, {
3858
+ newPhase: this.phase,
3859
+ renderId: this.renderId,
3860
+ storyId: this.id
3861
+ }), o && (await o(), this.checkIfAborted(e));
3858
3862
  }
3859
3863
  checkIfAborted(e) {
3860
- return e.aborted ? (this.phase = "aborted", this.channel.emit(Fo, { newPhase: this.phase, storyId: this.id }), !0) : !1;
3864
+ return e.aborted ? (this.phase = "aborted", this.channel.emit(Fo, {
3865
+ newPhase: this.phase,
3866
+ renderId: this.renderId,
3867
+ storyId: this.id
3868
+ }), !0) : !1;
3861
3869
  }
3862
3870
  async prepare() {
3863
3871
  if (await this.runPhase(this.abortController.signal, "preparing", async () => {
@@ -4535,7 +4543,7 @@ var rt = class rt {
4535
4543
  this.torndown = !1;
4536
4544
  this.disableKeyListeners = !1;
4537
4545
  this.preparing = !1;
4538
- this.id = o.id;
4546
+ this.id = o.id, this.renderId = Date.now();
4539
4547
  }
4540
4548
  isPreparing() {
4541
4549
  return this.preparing;
@@ -4605,7 +4613,7 @@ var tt = class tt {
4605
4613
  this.torndown = !1;
4606
4614
  this.disableKeyListeners = !1;
4607
4615
  this.preparing = !1;
4608
- this.id = o.id;
4616
+ this.id = o.id, this.renderId = Date.now();
4609
4617
  }
4610
4618
  isPreparing() {
4611
4619
  return this.preparing;
@@ -4896,18 +4904,16 @@ var st = class st extends Te {
4896
4904
  }
4897
4905
  // renderException is used if we fail to render the story and it is uncaught by the app layer
4898
4906
  renderException(t, o) {
4899
- let { name: s = "Error", message: i = String(o), stack: a } = o;
4900
- this.channel.emit(Vi, { name: s, message: i, stack: a }), this.channel.emit(Lo, { newPhase: "errored", storyId: t }), this.view.showErrorDisplay(
4901
- o), or.error(`Error rendering story '${t}':`), or.error(o);
4907
+ let { name: s = "Error", message: i = String(o), stack: a } = o, l = this.currentRender?.renderId;
4908
+ this.channel.emit(Vi, { name: s, message: i, stack: a }), this.channel.emit(Lo, { newPhase: "errored", renderId: l, storyId: t }), this.
4909
+ view.showErrorDisplay(o), or.error(`Error rendering story '${t}':`), or.error(o);
4902
4910
  }
4903
4911
  // renderError is used by the various app layers to inform the user they have done something
4904
4912
  // wrong -- for instance returned the wrong thing from a story
4905
4913
  renderError(t, { title: o, description: s }) {
4906
- or.error(`Error rendering story ${o}: ${s}`), this.channel.emit(Gi, { title: o, description: s }), this.channel.emit(Lo, { newPhase: "er\
4907
- rored", storyId: t }), this.view.showErrorDisplay({
4908
- message: o,
4909
- stack: s
4910
- });
4914
+ let i = this.currentRender?.renderId;
4915
+ this.channel.emit(Gi, { title: o, description: s }), this.channel.emit(Lo, { newPhase: "errored", renderId: i, storyId: t }), this.view.
4916
+ showErrorDisplay({ message: o, stack: s }), or.error(`Error rendering story ${o}: ${s}`);
4911
4917
  }
4912
4918
  };
4913
4919
  n(st, "PreviewWithSelection");
@@ -4128,7 +4128,7 @@ async function Gn(t) {
4128
4128
  i(Gn, "findPackage");
4129
4129
 
4130
4130
  // package.json
4131
- var wt = "9.1.0-beta.1";
4131
+ var wt = "9.1.0-beta.3";
4132
4132
 
4133
4133
  // src/cli/globalSettings.ts
4134
4134
  var Rt = T(require("node:fs/promises"), 1), ws = require("node:os"), Zt = require("node:path"), Ne = T(gs(), 1);
@@ -4133,7 +4133,7 @@ async function In(t) {
4133
4133
  i(In, "findPackage");
4134
4134
 
4135
4135
  // package.json
4136
- var ut = "9.1.0-beta.1";
4136
+ var ut = "9.1.0-beta.3";
4137
4137
 
4138
4138
  // src/cli/globalSettings.ts
4139
4139
  var Pe = J(Yn(), 1);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "storybook",
3
- "version": "9.1.0-beta.1",
3
+ "version": "9.1.0-beta.3",
4
4
  "description": "Storybook framework-agnostic API",
5
5
  "keywords": [
6
6
  "storybook"
@@ -567,6 +567,7 @@
567
567
  "react-transition-group": "^4.4.5",
568
568
  "require-from-string": "^2.0.2",
569
569
  "resolve-from": "^5.0.0",
570
+ "resolve.exports": "^2.0.3",
570
571
  "sirv": "^2.0.4",
571
572
  "slash": "^5.0.0",
572
573
  "source-map": "^0.7.4",