emviz 0.1.1 → 0.1.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.
@@ -4,7 +4,7 @@
4
4
  <meta charset="UTF-8" />
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
6
  <title>emviz</title>
7
- <script type="module" crossorigin src="/assets/index-C8EHLSuD.js"></script>
7
+ <script type="module" crossorigin src="/assets/index-hk94UZzK.js"></script>
8
8
  <link rel="stylesheet" crossorigin href="/assets/index-BLzt2ai4.css">
9
9
  </head>
10
10
  <body>
package/dist/index.js CHANGED
@@ -13119,17 +13119,17 @@ import path2 from "node:path";
13119
13119
 
13120
13120
  // ../parser/dist/id.js
13121
13121
  function slugify(value) {
13122
- const normalized = value.replace(/([a-z0-9])([A-Z])/g, "$1-$2").replace(/[^a-zA-Z0-9]+/g, "-").replace(/^-+|-+$/g, "").toLowerCase();
13122
+ const normalized = value.normalize("NFKC").replace(/([a-z0-9])([A-Z])/g, "$1-$2").replace(/[^\p{L}\p{N}]+/gu, "-").replace(/^-+|-+$/g, "").toLowerCase();
13123
13123
  return normalized || "unnamed";
13124
13124
  }
13125
- function storyId(name) {
13126
- return `story_${slugify(name)}`;
13125
+ function storyId(sourcePath) {
13126
+ return `story_${slugify(sourcePath).replaceAll("-", "_")}`;
13127
13127
  }
13128
- function sliceId(title) {
13129
- return `slc_${slugify(title).replaceAll("-", "_")}`;
13128
+ function sliceId(sourcePath) {
13129
+ return `slc_${slugify(sourcePath).replaceAll("-", "_")}`;
13130
13130
  }
13131
- function screenId(sliceTitle, screenName) {
13132
- return `scr_${slugify(screenName || sliceTitle).replaceAll("-", "_")}`;
13131
+ function screenId(slicePath) {
13132
+ return `scr_${slugify(slicePath).replaceAll("-", "_")}`;
13133
13133
  }
13134
13134
  function commandId(name) {
13135
13135
  return `cmd_${slugify(name).replaceAll("-", "_")}`;
@@ -13298,9 +13298,12 @@ function buildGraph(project) {
13298
13298
  const nodes = [];
13299
13299
  const edges = [];
13300
13300
  const eventNodeIds = /* @__PURE__ */ new Map();
13301
+ const storyNodeIds = /* @__PURE__ */ new Map();
13301
13302
  for (const story of project.stories) {
13303
+ const id = storyId(story.path);
13304
+ storyNodeIds.set(story.name, id);
13302
13305
  nodes.push({
13303
- id: storyId(story.name),
13306
+ id,
13304
13307
  type: "story",
13305
13308
  label: story.name,
13306
13309
  sourcePath: story.path,
@@ -13321,8 +13324,8 @@ function buildGraph(project) {
13321
13324
  });
13322
13325
  }
13323
13326
  for (const slice of project.slices) {
13324
- const currentSliceId = sliceId(slice.title);
13325
- const currentScreenId = screenId(slice.title, slice.screen.name);
13327
+ const currentSliceId = sliceId(slice.path);
13328
+ const currentScreenId = screenId(slice.path);
13326
13329
  const screenType = slice.screen.type === "system" ? "processor" : "screen";
13327
13330
  nodes.push({
13328
13331
  id: currentSliceId,
@@ -13334,10 +13337,11 @@ function buildGraph(project) {
13334
13337
  raw: slice.raw
13335
13338
  });
13336
13339
  if (slice.storyName) {
13340
+ const currentStoryId = storyNodeIds.get(slice.storyName) ?? storyId(slice.storyName);
13337
13341
  edges.push({
13338
- id: edgeId("story-slice", storyId(slice.storyName), currentSliceId),
13342
+ id: edgeId("story-slice", currentStoryId, currentSliceId),
13339
13343
  kind: "story-slice",
13340
- source: storyId(slice.storyName),
13344
+ source: currentStoryId,
13341
13345
  target: currentSliceId
13342
13346
  });
13343
13347
  }