emviz 0.6.0 → 0.8.0

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,8 +4,8 @@
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-BPy52oF2.js"></script>
8
- <link rel="stylesheet" crossorigin href="/assets/index-v40nPJyy.css">
7
+ <script type="module" crossorigin src="/assets/index-BjtMTroD.js"></script>
8
+ <link rel="stylesheet" crossorigin href="/assets/index-BMJSOB4v.css">
9
9
  </head>
10
10
  <body>
11
11
  <div id="root"></div>
package/dist/index.js CHANGED
@@ -13119,6 +13119,32 @@ var import_yaml5 = __toESM(require_dist(), 1);
13119
13119
  import fs2 from "node:fs";
13120
13120
  import path2 from "node:path";
13121
13121
 
13122
+ // ../parser/dist/screen-link.js
13123
+ function safeScreenUrl(value) {
13124
+ if (typeof value !== "string" || !/^https?:\/\/[^/@]/i.test(value) || /[\s\u0000-\u001f\u007f\\]/u.test(value))
13125
+ return void 0;
13126
+ try {
13127
+ const url = new URL(value);
13128
+ if (!["https:", "http:"].includes(url.protocol) || !url.hostname || url.username || url.password)
13129
+ return void 0;
13130
+ if (value.split(/[/?#]/)[2].includes("@"))
13131
+ return void 0;
13132
+ return value;
13133
+ } catch {
13134
+ return void 0;
13135
+ }
13136
+ }
13137
+ function parseScreenLink(raw, path8 = "") {
13138
+ if (!raw || typeof raw !== "object" || Array.isArray(raw) || !Object.hasOwn(raw, "url"))
13139
+ return { link: {}, issues: [] };
13140
+ const screen = raw;
13141
+ const url = safeScreenUrl(screen.url);
13142
+ if (screen.type !== "system" && url !== void 0)
13143
+ return { link: { url }, issues: [] };
13144
+ const message = screen.type === "system" ? "screen.url is only supported on user screens." : "screen.url must be an absolute HTTP or HTTPS URL without credentials, whitespace, or control characters.";
13145
+ return { link: {}, issues: [{ check: "L10", path: path8, message }] };
13146
+ }
13147
+
13122
13148
  // ../parser/dist/features.js
13123
13149
  var import_yaml = __toESM(require_dist(), 1);
13124
13150
  function record(value) {
@@ -13136,7 +13162,7 @@ function documentIssues(content, path8, kind) {
13136
13162
  }
13137
13163
  if (!record(raw))
13138
13164
  return [];
13139
- const issues = [];
13165
+ const issues = kind === "slice" ? parseScreenLink(raw.screen, path8).issues : [];
13140
13166
  if (raw.kind !== void 0 && raw.kind !== kind) {
13141
13167
  issues.push({ check: "F1", path: path8, message: `Expected kind "${kind}", received "${String(raw.kind)}".` });
13142
13168
  }
@@ -13513,6 +13539,7 @@ function buildGraph(project) {
13513
13539
  ...slice.screen.type === "user" ? {
13514
13540
  actorDefinitions: slice.screen.actors.map((id2) => project.actors?.find((actor) => actor.id === id2)).filter((actor) => Boolean(actor))
13515
13541
  } : {},
13542
+ ...slice.screen.url === void 0 ? {} : { url: slice.screen.url },
13516
13543
  screenType: slice.screen.type
13517
13544
  });
13518
13545
  connect("slice-screen", currentSliceId, currentScreenId);
@@ -13667,6 +13694,7 @@ function parseScreen(raw) {
13667
13694
  type: raw?.type === "system" ? "system" : "user",
13668
13695
  name: typeof raw?.name === "string" ? raw.name : void 0,
13669
13696
  ...parseActorReferences(raw?.actors),
13697
+ ...parseScreenLink(raw).link,
13670
13698
  reads: asStringArray(raw?.reads),
13671
13699
  executes: asStringArray(raw?.executes)
13672
13700
  };
@@ -13823,6 +13851,7 @@ function parseScreen2(raw) {
13823
13851
  type: raw?.type === "system" ? "system" : "user",
13824
13852
  name: typeof raw?.name === "string" ? raw.name : void 0,
13825
13853
  ...parseActorReferences(raw?.actors),
13854
+ ...parseScreenLink(raw).link,
13826
13855
  reads: asStringArray2(raw?.reads),
13827
13856
  executes: asStringArray2(raw?.executes)
13828
13857
  };
@@ -14016,6 +14045,7 @@ function comparableNode(node) {
14016
14045
  actors: node.actors,
14017
14046
  actorDefinitions: node.actorDefinitions,
14018
14047
  screenType: node.screenType,
14048
+ url: node.url,
14019
14049
  fields: node.fields,
14020
14050
  description: node.description,
14021
14051
  given: node.given,