@domql/router 2.3.136 → 2.4.7

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/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2016 symbo.ls
3
+ Copyright (c) 2023 symbo.ls
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/dist/cjs/index.js CHANGED
@@ -25,8 +25,8 @@ __export(router_exports, {
25
25
  router: () => router
26
26
  });
27
27
  module.exports = __toCommonJS(router_exports);
28
- var import_globals = require("@domql/globals");
29
- const getActiveRoute = (level = 0, route = import_globals.window.location.pathname) => {
28
+ var import_utils = require("@domql/utils");
29
+ const getActiveRoute = (level = 0, route = import_utils.window.location.pathname) => {
30
30
  const routeArray = route.split("/");
31
31
  const activeRoute = routeArray[level + 1];
32
32
  if (activeRoute)
@@ -40,7 +40,7 @@ const defaultOptions = {
40
40
  initialRender: false,
41
41
  scrollToTop: true,
42
42
  scrollToNode: false,
43
- scrollNode: import_globals.document && import_globals.document.documentElement,
43
+ scrollNode: import_utils.document && import_utils.document.documentElement,
44
44
  scrollBody: false,
45
45
  useFragment: false,
46
46
  updateState: true,
@@ -55,13 +55,13 @@ const router = (path, element, state = {}, passedOptions = {}) => {
55
55
  const route = getActiveRoute(options.level, pathname);
56
56
  const content = element.routes[route || "/"] || element.routes["/*"];
57
57
  const scrollNode = options.scrollToNode ? rootNode : options.scrollNode;
58
- const hashChanged = hash && hash !== import_globals.window.location.hash.slice(1);
58
+ const hashChanged = hash && hash !== import_utils.window.location.hash.slice(1);
59
59
  const pathChanged = pathname !== lastPathname;
60
60
  lastPathname = pathname;
61
61
  if (!content)
62
62
  return;
63
63
  if (options.pushState) {
64
- import_globals.window.history.pushState(state, null, pathname + (hash ? `#${hash}` : ""));
64
+ import_utils.window.history.pushState(state, null, pathname + (hash ? `#${hash}` : ""));
65
65
  }
66
66
  if (pathChanged || !hashChanged) {
67
67
  if (options.updateState) {
@@ -87,7 +87,7 @@ const router = (path, element, state = {}, passedOptions = {}) => {
87
87
  });
88
88
  }
89
89
  if (hash) {
90
- const activeNode = import_globals.document.getElementById(hash);
90
+ const activeNode = import_utils.document.getElementById(hash);
91
91
  if (activeNode) {
92
92
  const top = activeNode.getBoundingClientRect().top + rootNode.scrollTop - options.scrollToOffset || 0;
93
93
  scrollNode.scrollTo({
package/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  'use strict'
2
2
 
3
- import { document, window } from '@domql/globals'
3
+ import { document, window } from '@domql/utils'
4
4
 
5
5
  export const getActiveRoute = (level = 0, route = window.location.pathname) => {
6
6
  const routeArray = route.split('/')
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@domql/router",
3
- "version": "2.3.136",
3
+ "version": "2.4.7",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "module": "dist/esm/index.js",
@@ -14,7 +14,7 @@
14
14
  "dist"
15
15
  ],
16
16
  "scripts": {
17
- "copy:package:cjs": "cp ../../.build/package-cjs.json dist/cjs/package.json",
17
+ "copy:package:cjs": "cp ../../build/package-cjs.json dist/cjs/package.json",
18
18
  "build:esm": "npx esbuild *.js --target=es2019 --format=esm --outdir=dist/esm",
19
19
  "build:cjs": "npx esbuild *.js --target=node16 --format=cjs --outdir=dist/cjs",
20
20
  "build:iife": "npx esbuild *.js --target=node16 --format=iife --outdir=dist/iife",
@@ -25,7 +25,7 @@
25
25
  "@domql/globals": "latest",
26
26
  "@domql/utils": "latest"
27
27
  },
28
- "gitHead": "4014d9ecfc6c7b6c1dd7019848786c9b6a0e41e3",
28
+ "gitHead": "fd9683a7d42893983463967fa512ac095a6a36e9",
29
29
  "devDependencies": {
30
30
  "@babel/core": "^7.12.0"
31
31
  }