@hybridly/core 0.7.9 → 0.7.11

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/index.cjs CHANGED
@@ -378,7 +378,8 @@ function getUrlRegexForRoute(name) {
378
378
  });
379
379
  return RegExp(urlRegexPattern);
380
380
  }
381
- function urlMatchesRoute(url, name, routeParameters) {
381
+ function urlMatchesRoute(fullUrl, name, routeParameters) {
382
+ const url = makeUrl(fullUrl, { hash: "" }).toString();
382
383
  const parameters = routeParameters || {};
383
384
  const definition = getRouting().routes[name];
384
385
  if (!definition) {
@@ -839,7 +840,7 @@ async function performHybridNavigation(options) {
839
840
  }
840
841
  utils.debug.router("The response respects the Hybridly protocol.");
841
842
  const payload = response.data;
842
- if ((options.only?.length ?? options.except?.length) && payload.view.component === context.view.component) {
843
+ if (payload.view && (options.only?.length ?? options.except?.length) && payload.view.component === context.view.component) {
843
844
  utils.debug.router(`Merging ${options.only ? '"only"' : '"except"'} properties.`, payload.view.properties);
844
845
  payload.view.properties = utils.merge(context.view.properties, payload.view.properties);
845
846
  utils.debug.router("Merged properties:", payload.view.properties);
@@ -928,11 +929,13 @@ function isHybridResponse(response) {
928
929
  return !!response?.headers[HYBRIDLY_HEADER];
929
930
  }
930
931
  async function navigate(options) {
932
+ var _a;
931
933
  const context = getRouterContext();
932
934
  options.hasDialog ?? (options.hasDialog = !!options.payload?.dialog);
933
935
  utils.debug.router("Making an internal navigation:", { context, options });
934
936
  await runHooks("navigating", {}, options, context);
935
937
  options.payload ?? (options.payload = payloadFromContext());
938
+ (_a = options.payload).view ?? (_a.view = payloadFromContext().view);
936
939
  function evaluateConditionalOption(option) {
937
940
  return typeof option === "function" ? option(options) : option;
938
941
  }
package/dist/index.mjs CHANGED
@@ -371,7 +371,8 @@ function getUrlRegexForRoute(name) {
371
371
  });
372
372
  return RegExp(urlRegexPattern);
373
373
  }
374
- function urlMatchesRoute(url, name, routeParameters) {
374
+ function urlMatchesRoute(fullUrl, name, routeParameters) {
375
+ const url = makeUrl(fullUrl, { hash: "" }).toString();
375
376
  const parameters = routeParameters || {};
376
377
  const definition = getRouting().routes[name];
377
378
  if (!definition) {
@@ -832,7 +833,7 @@ async function performHybridNavigation(options) {
832
833
  }
833
834
  debug.router("The response respects the Hybridly protocol.");
834
835
  const payload = response.data;
835
- if ((options.only?.length ?? options.except?.length) && payload.view.component === context.view.component) {
836
+ if (payload.view && (options.only?.length ?? options.except?.length) && payload.view.component === context.view.component) {
836
837
  debug.router(`Merging ${options.only ? '"only"' : '"except"'} properties.`, payload.view.properties);
837
838
  payload.view.properties = merge(context.view.properties, payload.view.properties);
838
839
  debug.router("Merged properties:", payload.view.properties);
@@ -921,11 +922,13 @@ function isHybridResponse(response) {
921
922
  return !!response?.headers[HYBRIDLY_HEADER];
922
923
  }
923
924
  async function navigate(options) {
925
+ var _a;
924
926
  const context = getRouterContext();
925
927
  options.hasDialog ?? (options.hasDialog = !!options.payload?.dialog);
926
928
  debug.router("Making an internal navigation:", { context, options });
927
929
  await runHooks("navigating", {}, options, context);
928
930
  options.payload ?? (options.payload = payloadFromContext());
931
+ (_a = options.payload).view ?? (_a.view = payloadFromContext().view);
929
932
  function evaluateConditionalOption(option) {
930
933
  return typeof option === "function" ? option(options) : option;
931
934
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@hybridly/core",
3
3
  "type": "module",
4
- "version": "0.7.9",
4
+ "version": "0.7.11",
5
5
  "description": "Core functionality of Hybridly",
6
6
  "author": "Enzo Innocenzi <enzo@innocenzi.dev>",
7
7
  "license": "MIT",
@@ -43,7 +43,7 @@
43
43
  "dependencies": {
44
44
  "qs": "^6.12.1",
45
45
  "superjson": "^2.2.1",
46
- "@hybridly/utils": "0.7.9"
46
+ "@hybridly/utils": "0.7.11"
47
47
  },
48
48
  "devDependencies": {
49
49
  "defu": "^6.1.4"