@vaadin/component-base 24.5.0-alpha9 → 24.5.0-beta1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vaadin/component-base",
3
- "version": "24.5.0-alpha9",
3
+ "version": "24.5.0-beta1",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -38,9 +38,9 @@
38
38
  "lit": "^3.0.0"
39
39
  },
40
40
  "devDependencies": {
41
- "@vaadin/chai-plugins": "24.5.0-alpha9",
41
+ "@vaadin/chai-plugins": "24.5.0-beta1",
42
42
  "@vaadin/testing-helpers": "^1.0.0",
43
43
  "sinon": "^18.0.0"
44
44
  },
45
- "gitHead": "804744762f3bec0a2247c4bbcbbb204dbcd78bc0"
45
+ "gitHead": "da4b57724d7089e3766d59d01068159322adb2b8"
46
46
  }
package/src/define.js CHANGED
@@ -9,7 +9,7 @@ export function defineCustomElement(CustomElement) {
9
9
  if (!defined) {
10
10
  Object.defineProperty(CustomElement, 'version', {
11
11
  get() {
12
- return '24.5.0-alpha9';
12
+ return '24.5.0-beta1';
13
13
  },
14
14
  });
15
15
 
@@ -19,9 +19,6 @@ export class MediaQueryController implements ReactiveController {
19
19
  */
20
20
  protected callback: (matches: boolean) => void;
21
21
 
22
- /**
23
- * @param {HTMLElement} host
24
- */
25
22
  constructor(query: string, callback: (matches: boolean) => void);
26
23
 
27
24
  hostConnected(): void;
package/src/url-utils.js CHANGED
@@ -27,15 +27,17 @@ function containsQueryParams(actual, expected) {
27
27
  *
28
28
  * @param {string} actual The actual URL to match.
29
29
  * @param {string} expected The expected URL to match.
30
+ * @param {Object} matchOptions Options for path matching.
30
31
  */
31
- export function matchPaths(actual, expected) {
32
+ export function matchPaths(actual, expected, matchOptions = { matchNested: false }) {
32
33
  const base = document.baseURI;
33
34
  const actualUrl = new URL(actual, base);
34
35
  const expectedUrl = new URL(expected, base);
35
36
 
36
- return (
37
- actualUrl.origin === expectedUrl.origin &&
38
- actualUrl.pathname === expectedUrl.pathname &&
39
- containsQueryParams(actualUrl.searchParams, expectedUrl.searchParams)
40
- );
37
+ const matchesOrigin = actualUrl.origin === expectedUrl.origin;
38
+ const matchesPath = matchOptions.matchNested
39
+ ? actualUrl.pathname === expectedUrl.pathname || actualUrl.pathname.startsWith(`${expectedUrl.pathname}/`)
40
+ : actualUrl.pathname === expectedUrl.pathname;
41
+
42
+ return matchesOrigin && matchesPath && containsQueryParams(actualUrl.searchParams, expectedUrl.searchParams);
41
43
  }