@symbo.ls/router 2.29.27 → 2.29.55

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.
Files changed (2) hide show
  1. package/index.js +11 -1
  2. package/package.json +3 -3
package/index.js CHANGED
@@ -51,6 +51,8 @@ const defaultOptions = {
51
51
  scrollToOptions: { behavior: 'smooth' }
52
52
  }
53
53
 
54
+ let lastElement = {}
55
+
54
56
  // eslint-disable-next-line default-param-last
55
57
  export async function router (path = '/', el, state = {}, passedOptions = {}) {
56
58
  const element = el || (this && this.getRoot())
@@ -63,7 +65,9 @@ export async function router (path = '/', el, state = {}, passedOptions = {}) {
63
65
  options.event.preventDefault()
64
66
  options.event.stopPropagation()
65
67
  }
66
- return element.call('closeModal')
68
+ element.call('closeModal')
69
+ if (options.event) options.event.preventDefault()
70
+ return
67
71
  }
68
72
 
69
73
  const urlObj = new options.window.URL(options.window.location.origin + path)
@@ -112,12 +116,14 @@ export async function router (path = '/', el, state = {}, passedOptions = {}) {
112
116
 
113
117
  if (pathChanged || !hashChanged) {
114
118
  // || (!rootRouteHasChanged && { preventUpdateTriggerStateUpdate: true, preventContentUpdate: true })
119
+ // console.log('ROUTER SETTING')
115
120
 
116
121
  if (options.updateState) {
117
122
  await element.state.update(
118
123
  { route, hash, routeInContent, debugging: false },
119
124
  {
120
125
  preventUpdate: [options.preventUpdate, 'content'],
126
+ // preventContentUpdate: true, // prevent only platform.content
121
127
  updateByRouter: true,
122
128
  ...options.updateStateOptions
123
129
  }
@@ -134,6 +140,7 @@ export async function router (path = '/', el, state = {}, passedOptions = {}) {
134
140
  }
135
141
  )
136
142
  } else {
143
+ lastElement.content = content
137
144
  await element.set(
138
145
  {
139
146
  tag: options.useFragment && 'fragment',
@@ -141,7 +148,10 @@ export async function router (path = '/', el, state = {}, passedOptions = {}) {
141
148
  },
142
149
  {
143
150
  // ...(!isInitial && wasModal && !options.forceContentUpdate && { preventContentUpdate: true }),
151
+ lastElement,
152
+ routerContentElement: content,
144
153
  preventUpdate: options.preventUpdate,
154
+
145
155
  ...options.setOptions
146
156
  }
147
157
  )
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@symbo.ls/router",
3
- "version": "2.29.27",
3
+ "version": "2.29.55",
4
4
  "main": "index.js",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -8,8 +8,8 @@
8
8
  "vpatch": "npm version patch && npm publish --access public"
9
9
  },
10
10
  "dependencies": {
11
- "@domql/utils": "^2.29.27"
11
+ "@domql/utils": "^2.29.55"
12
12
  },
13
- "gitHead": "8c4454632bbd7643c1b63ca0ce33ebd3651bef5a",
13
+ "gitHead": "7d09091d21bdf6f6668a4cba3c581406f768c0fe",
14
14
  "source": "index.js"
15
15
  }