@escape-game-over/atlas 0.1.4 → 0.1.6

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.
package/src/url.ts CHANGED
@@ -46,6 +46,26 @@ export function isUrlPath(path: string): path is UrlPath {
46
46
  return path.startsWith("/");
47
47
  }
48
48
 
49
+ /**
50
+ * A fragment on whatever page is being rendered: `#booking`, `#Scenarios`.
51
+ *
52
+ * The one link target lib cannot resolve and does not need to. A route id
53
+ * becomes a different path in every language and an `https://` URL points
54
+ * somewhere else entirely; a fragment names an element of the document it is
55
+ * written in, so it is already the whole answer and passes through untouched.
56
+ *
57
+ * Typed as its own shape rather than folded into `UrlPath` because they are not
58
+ * interchangeable: `/booking` navigates and `#booking` scrolls, and a leading
59
+ * character is the only thing that distinguishes them. See `LinkTarget`, which
60
+ * tells the four apart by exactly that.
61
+ */
62
+ export type Hash = `#${string}`;
63
+
64
+ /** The runtime half of `Hash`. See `isHttpsUrl`. */
65
+ export function isHash(value: string): value is Hash {
66
+ return value.startsWith("#");
67
+ }
68
+
49
69
  /**
50
70
  * An origin without its trailing slash.
51
71
  *