@allurereport/web-commons 3.6.2 → 3.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.
package/dist/prose.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const proseStyles = "\nhtml, body {\n margin: 0;\n padding: 0;\n overflow-x: hidden;\n overflow-y: hidden;\n background: var(--bg-base-primary);\n}\n\nbody {\n color: var(--on-text-primary);\n font-family: var(--font-family);\n font-size: var(--font-size-m);\n line-height: var(--line-height-m);\n}\n\np {\n margin-bottom: 10px;\n}\n\np:last-child {\n margin-bottom: 0;\n}\n\nh1,\nh2,\nh3,\nh4,\nh5,\nh6 {\n font-weight: var(--font-weight-bold) !important;\n line-height: var(--line-height-l) !important;\n margin: 16px 0 10px;\n}\n\nh1:first-child,\nh2:first-child,\nh3:first-child,\nh4:first-child,\nh5:first-child,\nh6:first-child {\n margin-top: 0;\n}\n\nh1 {\n font-size: var(--font-size-xl) !important;\n}\n\nh2,\nh3 {\n font-size: var(--font-size-l) !important;\n}\n\nh4 {\n font-size: var(--font-size-m) !important;\n}\n\nh5,\nh6 {\n font-size: var(--font-size-s) !important;\n}\n\nh6 {\n color: var(--on-text-secondary);\n}\n\nstrong,\nb {\n font-weight: var(--font-weight-bold) !important;\n}\n\nem,\ni {\n font-style: italic !important;\n}\n\ndel,\ns {\n text-decoration: line-through;\n}\n\na {\n color: var(--on-text-primary);\n text-decoration: underline;\n}\n\na:hover {\n color: var(--on-text-secondary);\n}\n\ncode {\n font-family: var(--font-family-mono) !important;\n font-size: var(--font-size-m-code) !important;\n padding: 0.2em 0.4em;\n background: var(--bg-control-secondary);\n border-radius: 4px;\n}\n\npre {\n font-family: var(--font-family-mono) !important;\n font-size: var(--font-size-s) !important;\n line-height: 1.45 !important;\n padding: 16px;\n overflow: auto;\n background: var(--bg-control-secondary);\n border-radius: 6px;\n margin-bottom: 16px;\n}\n\npre code {\n padding: 0;\n background: transparent;\n font-size: inherit !important;\n border-radius: 0;\n}\n\nblockquote {\n padding: 0 1em;\n border-left: 0.25em solid var(--on-border-primary);\n color: var(--on-text-secondary);\n margin-bottom: 16px;\n}\n\nul,\nol {\n padding-left: 2em;\n margin-bottom: 10px;\n}\n\nul {\n list-style: disc !important;\n}\n\nol {\n list-style: decimal !important;\n}\n\nli + li {\n margin-top: 0.25em;\n}\n\nhr {\n height: 0.25em;\n padding: 0;\n margin: 24px 0;\n background-color: var(--on-border-primary);\n border: 0 !important;\n}\n\ntable {\n border-spacing: 0;\n border-collapse: collapse;\n margin-bottom: 16px;\n display: block;\n width: max-content;\n max-width: 100%;\n overflow-x: auto;\n overflow-y: hidden;\n transform: translateZ(0);\n contain: layout paint;\n}\n\nth,\ntd {\n padding: 6px 13px;\n border: 1px solid var(--on-border-primary) !important;\n white-space: nowrap;\n}\n\nth {\n font-weight: var(--font-weight-bold) !important;\n position: sticky;\n top: 0;\n z-index: 1;\n background: var(--bg-base-primary);\n}\n\ntr:nth-child(2n) {\n background: var(--bg-control-secondary);\n}\n\nimg {\n max-width: 100% !important;\n height: auto !important;\n display: inline-block !important;\n vertical-align: middle !important;\n}\n\nabbr,\nabbr[title] {\n text-decoration: underline dotted;\n cursor: help;\n border-bottom: none;\n}\n\nkbd {\n display: inline-block;\n padding: 3px 5px;\n font-family: var(--font-family-mono) !important;\n font-size: 11px;\n line-height: 10px;\n color: var(--on-text-primary);\n vertical-align: middle;\n background-color: var(--bg-control-secondary);\n border: solid 1px var(--on-border-medium);\n border-bottom-color: var(--on-border-medium);\n border-radius: 6px;\n box-shadow: inset 0 -1px 0 var(--on-border-medium);\n}\n\nsamp {\n font-family: var(--font-family-mono) !important;\n font-size: 85% !important;\n}\n\nvar {\n font-family: var(--font-family-mono) !important;\n font-style: italic !important;\n font-weight: var(--font-weight-bold) !important;\n}\n\nmark {\n background-color: var(--bg-support-aldebaran);\n color: var(--on-text-primary);\n padding: 0.1em 0.2em;\n border-radius: 2px;\n}\n\nsmall {\n font-size: 85% !important;\n}\n\nsub,\nsup {\n font-size: 75% !important;\n line-height: 0 !important;\n position: relative !important;\n vertical-align: baseline !important;\n}\n\nsub {\n bottom: -0.25em !important;\n}\n\nsup {\n top: -0.5em !important;\n}\n\nins {\n text-decoration: underline;\n background-color: var(--bg-support-gliese);\n color: var(--on-text-primary);\n text-decoration-color: var(--on-support-gliese);\n}\n\ndfn {\n font-style: italic !important;\n font-weight: var(--font-weight-bold) !important;\n}\n\ncite {\n font-style: italic !important;\n}\n\nq {\n font-style: italic !important;\n}\n\nq::before {\n content: open-quote;\n}\n\nq::after {\n content: close-quote;\n}\n\ntime {\n font-variant-numeric: tabular-nums;\n}\n\ndl {\n padding: 0;\n margin-bottom: 16px;\n}\n\ndt {\n padding: 0;\n margin-top: 16px;\n font-size: 1em;\n font-style: italic;\n font-weight: var(--font-weight-bold) !important;\n}\n\ndt:first-child {\n margin-top: 0;\n}\n\ndd {\n padding: 0 0 0 16px;\n margin-left: 0;\n margin-bottom: 16px;\n}\n\nfigure {\n margin: 16px 0;\n display: block;\n}\n\nfigcaption {\n margin-top: 8px;\n font-size: var(--font-size-s) !important;\n color: var(--on-text-secondary);\n font-style: italic;\n text-align: center;\n}\n\ndetails {\n display: block;\n margin-bottom: 16px;\n}\n\nsummary {\n display: list-item;\n cursor: pointer;\n font-weight: var(--font-weight-bold) !important;\n margin-bottom: 8px;\n}\n\nsummary:hover {\n color: var(--on-text-secondary);\n}\n\nsummary::marker {\n color: var(--on-text-secondary);\n}\n\ndetails[open] summary {\n margin-bottom: 16px;\n}\n\narticle,\nsection,\naside,\nnav {\n display: block;\n margin-bottom: 16px;\n}\n\nheader,\nfooter {\n display: block;\n margin-bottom: 16px;\n}\n\naddress {\n display: block;\n font-style: italic;\n margin-bottom: 16px;\n}\n";
1
+ export declare const proseStyles = "\nhtml, body {\n margin: 0;\n padding: 0;\n overflow-x: hidden;\n overflow-y: hidden;\n background: var(--bg-base-primary);\n}\n\nbody {\n color: var(--on-text-primary);\n font-family: var(--font-family);\n font-size: var(--font-size-m);\n line-height: var(--line-height-m);\n}\n\np {\n margin-top: 0;\n margin-bottom: 10px;\n}\n\np:last-child {\n margin-bottom: 0;\n}\n\nh1,\nh2,\nh3,\nh4,\nh5,\nh6 {\n font-weight: var(--font-weight-bold) !important;\n line-height: var(--line-height-l) !important;\n margin: 16px 0 10px;\n}\n\nh1:first-child,\nh2:first-child,\nh3:first-child,\nh4:first-child,\nh5:first-child,\nh6:first-child {\n margin-top: 0;\n}\n\nh1 {\n font-size: var(--font-size-xl) !important;\n}\n\nh2,\nh3 {\n font-size: var(--font-size-l) !important;\n}\n\nh4 {\n font-size: var(--font-size-m) !important;\n}\n\nh5,\nh6 {\n font-size: var(--font-size-s) !important;\n}\n\nh6 {\n color: var(--on-text-secondary);\n}\n\nstrong,\nb {\n font-weight: var(--font-weight-bold) !important;\n}\n\nem,\ni {\n font-style: italic !important;\n}\n\ndel,\ns {\n text-decoration: line-through;\n}\n\na {\n color: var(--on-text-primary);\n text-decoration: underline;\n}\n\na:hover {\n color: var(--on-text-secondary);\n}\n\ncode {\n font-family: var(--font-family-mono) !important;\n font-size: var(--font-size-m-code) !important;\n padding: 0.2em 0.4em;\n background: var(--bg-control-secondary);\n border-radius: 4px;\n}\n\npre {\n font-family: var(--font-family-mono) !important;\n font-size: var(--font-size-s) !important;\n line-height: 1.45 !important;\n padding: 16px;\n overflow: auto;\n background: var(--bg-control-secondary);\n border-radius: 6px;\n margin-bottom: 16px;\n}\n\npre code {\n padding: 0;\n background: transparent;\n font-size: inherit !important;\n border-radius: 0;\n}\n\nblockquote {\n padding: 0 1em;\n border-left: 0.25em solid var(--on-border-primary);\n color: var(--on-text-secondary);\n margin-bottom: 16px;\n}\n\nul,\nol {\n padding-left: 2em;\n margin-bottom: 10px;\n}\n\nul {\n list-style: disc !important;\n}\n\nol {\n list-style: decimal !important;\n}\n\nli + li {\n margin-top: 0.25em;\n}\n\nhr {\n height: 0.25em;\n padding: 0;\n margin: 24px 0;\n background-color: var(--on-border-primary);\n border: 0 !important;\n}\n\ntable {\n border-spacing: 0;\n border-collapse: collapse;\n margin-bottom: 16px;\n display: block;\n width: max-content;\n max-width: 100%;\n overflow-x: auto;\n overflow-y: hidden;\n transform: translateZ(0);\n contain: layout paint;\n}\n\nth,\ntd {\n padding: 6px 13px;\n border: 1px solid var(--on-border-primary) !important;\n white-space: nowrap;\n}\n\nth {\n font-weight: var(--font-weight-bold) !important;\n position: sticky;\n top: 0;\n z-index: 1;\n background: var(--bg-base-primary);\n}\n\ntr:nth-child(2n) {\n background: var(--bg-control-secondary);\n}\n\nimg {\n max-width: 100% !important;\n height: auto !important;\n display: inline-block !important;\n vertical-align: middle !important;\n}\n\nabbr,\nabbr[title] {\n text-decoration: underline dotted;\n cursor: help;\n border-bottom: none;\n}\n\nkbd {\n display: inline-block;\n padding: 3px 5px;\n font-family: var(--font-family-mono) !important;\n font-size: 11px;\n line-height: 10px;\n color: var(--on-text-primary);\n vertical-align: middle;\n background-color: var(--bg-control-secondary);\n border: solid 1px var(--on-border-medium);\n border-bottom-color: var(--on-border-medium);\n border-radius: 6px;\n box-shadow: inset 0 -1px 0 var(--on-border-medium);\n}\n\nsamp {\n font-family: var(--font-family-mono) !important;\n font-size: 85% !important;\n}\n\nvar {\n font-family: var(--font-family-mono) !important;\n font-style: italic !important;\n font-weight: var(--font-weight-bold) !important;\n}\n\nmark {\n background-color: var(--bg-support-aldebaran);\n color: var(--on-text-primary);\n padding: 0.1em 0.2em;\n border-radius: 2px;\n}\n\nsmall {\n font-size: 85% !important;\n}\n\nsub,\nsup {\n font-size: 75% !important;\n line-height: 0 !important;\n position: relative !important;\n vertical-align: baseline !important;\n}\n\nsub {\n bottom: -0.25em !important;\n}\n\nsup {\n top: -0.5em !important;\n}\n\nins {\n text-decoration: underline;\n background-color: var(--bg-support-gliese);\n color: var(--on-text-primary);\n text-decoration-color: var(--on-support-gliese);\n}\n\ndfn {\n font-style: italic !important;\n font-weight: var(--font-weight-bold) !important;\n}\n\ncite {\n font-style: italic !important;\n}\n\nq {\n font-style: italic !important;\n}\n\nq::before {\n content: open-quote;\n}\n\nq::after {\n content: close-quote;\n}\n\ntime {\n font-variant-numeric: tabular-nums;\n}\n\ndl {\n padding: 0;\n margin-bottom: 16px;\n}\n\ndt {\n padding: 0;\n margin-top: 16px;\n font-size: 1em;\n font-style: italic;\n font-weight: var(--font-weight-bold) !important;\n}\n\ndt:first-child {\n margin-top: 0;\n}\n\ndd {\n padding: 0 0 0 16px;\n margin-left: 0;\n margin-bottom: 16px;\n}\n\nfigure {\n margin: 16px 0;\n display: block;\n}\n\nfigcaption {\n margin-top: 8px;\n font-size: var(--font-size-s) !important;\n color: var(--on-text-secondary);\n font-style: italic;\n text-align: center;\n}\n\ndetails {\n display: block;\n margin-bottom: 16px;\n}\n\nsummary {\n display: list-item;\n cursor: pointer;\n font-weight: var(--font-weight-bold) !important;\n margin-bottom: 8px;\n}\n\nsummary:hover {\n color: var(--on-text-secondary);\n}\n\nsummary::marker {\n color: var(--on-text-secondary);\n}\n\ndetails[open] summary {\n margin-bottom: 16px;\n}\n\narticle,\nsection,\naside,\nnav {\n display: block;\n margin-bottom: 16px;\n}\n\nheader,\nfooter {\n display: block;\n margin-bottom: 16px;\n}\n\naddress {\n display: block;\n font-style: italic;\n margin-bottom: 16px;\n}\n";
2
2
  export declare const resolveCssVarDeclarations: (cssText: string) => string;
package/dist/prose.js CHANGED
@@ -15,6 +15,7 @@ body {
15
15
  }
16
16
 
17
17
  p {
18
+ margin-top: 0;
18
19
  margin-bottom: 10px;
19
20
  }
20
21
 
@@ -1,6 +1,6 @@
1
1
  import { computed } from "@preact/signals-core";
2
2
  import { paramsToSearchParams } from "../url/helpers.js";
3
- import { currentUrl, goTo } from "../url/index.js";
3
+ import { currentUrl, getCurrentUrl, goTo } from "../url/index.js";
4
4
  export const router = computed(() => {
5
5
  const hash = currentUrl.value.hash.startsWith("#") ? currentUrl.value.hash.slice(1) : currentUrl.value.hash;
6
6
  return {
@@ -31,9 +31,9 @@ const createRouteUrl = (path, params) => {
31
31
  };
32
32
  export const navigateTo = (to) => {
33
33
  const { path, params = {}, replace = false, searchParams = {}, keepSearchParams = false } = to;
34
- const currentPathname = currentUrl.value.pathname;
35
- const newUrl = new URL(currentPathname, currentUrl.value.origin);
34
+ const newUrl = new URL(getCurrentUrl());
36
35
  const routeUrl = createRouteUrl(path, params);
36
+ newUrl.search = "";
37
37
  newUrl.hash = routeUrl === "" || routeUrl === "/" ? "" : `#${routeUrl}`;
38
38
  if (keepSearchParams) {
39
39
  paramsToSearchParams(currentUrl.value.params, newUrl.searchParams);
@@ -5,6 +5,9 @@ type NavigateTo = URL | string | {
5
5
  type NavigateToOptions = {
6
6
  replace?: boolean;
7
7
  };
8
+ export declare const isSameDocumentUrl: (url: URL, currentHref?: string) => boolean;
9
+ export declare const toSameDocumentHistoryUrl: (url: URL) => string;
10
+ export declare const getHistoryUrl: (to: NavigateTo, currentHref?: string) => string | URL;
8
11
  export declare const goTo: (to: NavigateTo, options?: NavigateToOptions) => void;
9
12
  export declare const getCurrentUrl: () => string;
10
13
  export declare const paramsToSearchParams: (params: Record<string, string | string[]>, searchParams?: URLSearchParams) => URLSearchParams;
@@ -22,11 +22,42 @@ const getUrl = (to) => {
22
22
  }
23
23
  return new URL(to.path, getCurrentUrl());
24
24
  };
25
+ export const isSameDocumentUrl = (url, currentHref = getCurrentUrl()) => {
26
+ try {
27
+ const currentUrl = new URL(currentHref);
28
+ return url.protocol === currentUrl.protocol && url.host === currentUrl.host && url.pathname === currentUrl.pathname;
29
+ }
30
+ catch {
31
+ return false;
32
+ }
33
+ };
34
+ export const toSameDocumentHistoryUrl = (url) => {
35
+ if (url.search) {
36
+ return `${url.search}${url.hash}`;
37
+ }
38
+ if (url.hash) {
39
+ return url.hash;
40
+ }
41
+ return url.pathname.split("/").pop() || ".";
42
+ };
43
+ export const getHistoryUrl = (to, currentHref = getCurrentUrl()) => {
44
+ const url = getUrl(to);
45
+ if (url instanceof URL) {
46
+ return isSameDocumentUrl(url, currentHref) ? toSameDocumentHistoryUrl(url) : url;
47
+ }
48
+ try {
49
+ const absoluteUrl = new URL(url, currentHref);
50
+ return isSameDocumentUrl(absoluteUrl, currentHref) ? toSameDocumentHistoryUrl(absoluteUrl) : url;
51
+ }
52
+ catch {
53
+ return url;
54
+ }
55
+ };
25
56
  export const goTo = (to, options) => {
26
57
  if (typeof window === "undefined") {
27
58
  return;
28
59
  }
29
- const url = getUrl(to);
60
+ const url = getHistoryUrl(to);
30
61
  if (options?.replace) {
31
62
  window.history.replaceState(null, "", url);
32
63
  window.dispatchEvent(new Event("replaceState"));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@allurereport/web-commons",
3
- "version": "3.6.2",
3
+ "version": "3.8.0",
4
4
  "description": "Collection of utilities used across the web Allure reports",
5
5
  "keywords": [
6
6
  "allure",
@@ -26,10 +26,10 @@
26
26
  "lint:fix": "oxlint --import-plugin --fix src test features stories"
27
27
  },
28
28
  "dependencies": {
29
- "@allurereport/aql": "3.6.2",
30
- "@allurereport/charts-api": "3.6.2",
31
- "@allurereport/core-api": "3.6.2",
32
- "@allurereport/plugin-api": "3.6.2",
29
+ "@allurereport/aql": "3.8.0",
30
+ "@allurereport/charts-api": "3.8.0",
31
+ "@allurereport/core-api": "3.8.0",
32
+ "@allurereport/plugin-api": "3.8.0",
33
33
  "@preact/signals": "^2.6.1",
34
34
  "@preact/signals-core": "^1.12.2",
35
35
  "ansi-to-html": "^0.7.2",