You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/routes/api/core/functions/+page.md
+5-28Lines changed: 5 additions & 28 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,10 +2,13 @@
2
2
title: Functions
3
3
description: Complete API reference for utility functions in Svelte Router including navigation, HREF building, and active behaviors
4
4
---
5
+
:::caution[Don't Import from @svelte-router/core/kernel]
6
+
The sub-module `@svelte-router/core/kernel` has been deprecated as of **v1.0.4**. While it is still possible to use it, it must not be used. **It will be removed in v2.0 without fail**.
5
7
6
-
## `activeBehavior`
8
+
This change responds to the fact that sometimes, in micro-frontend scenarios, people will externalize the routing library. To avoid headaches regarding different module names, the submodule is now completely discouraged.
This is a utility function whose primary objective is help in cross-universe redirection scenarios where one of the universes is the path routing universe.
@@ -27,8 +28,6 @@ It takes an optional third argument with options. Currently, only the `preserveQ
Calculates a hash fragment that preserves all currently-existing named hash paths, plus it modifies/adds/removes the named hash paths enumerated in its only argument.
@@ -71,8 +68,6 @@ Specify new named hash paths or modify existing ones by passing a POJO object wi
71
68
72
69
## `calculateState`
73
70
74
-
Import from: `@svelte-router/core/kernel`
75
-
76
71
`calculateState(state: any): State`
77
72
78
73
`calculateState(hash: Hash, state: any): State`
@@ -83,16 +78,12 @@ Use this function when not depending on the `Link` component or `location.naviga
Returns a Boolean value that indicates if the route with the specified key is currently matching (is active) according to the provided router or route status data.
157
140
158
141
## `joinPaths`
159
142
160
-
Import from: `@svelte-router/core`
161
-
162
143
`joinPaths(...paths: string[]): string`
163
144
164
145
Joins any number of path segments into one, making sure slashes are not repeated.
Function that can be used to preserve query string (search parameters) key/value pairs when building URL’s. While typically used by extension packages only, it could be used by users with very specific needs.
Copy file name to clipboardExpand all lines: src/routes/api/core/objects-and-classes/+page.md
+13-8Lines changed: 13 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,22 +2,27 @@
2
2
title: Objects & Classes
3
3
description: API reference for core objects, classes, and interfaces in Svelte Router including RouterEngine and Location
4
4
---
5
+
:::caution[Don't Import from @svelte-router/core/kernel]
6
+
The sub-module `@svelte-router/core/kernel` has been deprecated as of **v1.0.4**. While it is still possible to use it, it must not be used. **It will be removed in v2.0 without fail**.
7
+
8
+
This change responds to the fact that sometimes, in micro-frontend scenarios, people will externalize the routing library. To avoid headaches regarding different module names, the submodule is now completely discouraged.
9
+
:::
5
10
6
11
## `InterceptedHistoryApi`
7
12
8
13
:::info[Usage]
9
14
Only used by extension packages. Read the [Creating an Extension Package](/docs/creating-an-extension-package) document in this guide for details.
This is the global object that provides URL reactivity to all other library assets. This object is created by the library’s `init()` function, based on the options given to it.
23
28
@@ -83,7 +88,7 @@ Only available in full library mode, allows subscription to the `beforeNavigate`
83
88
Only used by extension packages. Read the [Creating an Extension Package](/docs/creating-an-extension-package) document in this guide for details.
This is the main stock implementation of the `Location` interface. Extension packages may use it when all the extension does is provide a custom implementation of the `HistoryApi` or `FullModeHistoryApi` interfaces. Using this class locks the library in **lite** mode.
89
94
@@ -95,7 +100,7 @@ It can also serve as a base class per the standard rules of the JavaScript langu
95
100
Only used by extension packages. Read the [Creating an Extension Package](/docs/creating-an-extension-package) document in this guide for details.
This is the stock implementation of the `Location` interface used when the library is initialized in **full** mode. Its constructor only accepts **FullModeHistoryApi** implementations. Use it in extension packages that don’t create custom **Location** implementations, but desire to provide a custom full mode experience by customizing the behavior of the backing environment History manager.
101
106
@@ -107,7 +112,7 @@ It can also serve as a base class per the standard rules of the JavaScript langu
107
112
Only used by extension packages. Read the [Creating an Extension Package](/docs/creating-an-extension-package) document in this guide for details.
This is a very simple class that merely initializes 2 public fields: The `url` field is initialized with a `SvelteURL` instance; the `state` field initializes with a state object that is conformant with the `State` data type.
113
118
@@ -117,7 +122,7 @@ The class’ constructor currently accepts two optional parameters. The first on
Use this class inside components to enable automatic URL redirection. It is used to keep deprecated URL’s out of sight but still functional. It allows routing in the same routing universe as well as routing from one routing universe to another.
123
128
@@ -129,7 +134,7 @@ Array used to register redirections. Redirections are objects that define the sh
This class powers all `Router` components and can be used directly. Note, however, that when directly used you’re the responsible for creating proper parent-child relationships between `RouterEngine` instances.
135
140
@@ -213,7 +218,7 @@ You don’t need to dispose a `RouterEngine` instance that has been given to or
213
218
Only used by extension packages. Read the [Creating an Extension Package](/docs/creating-an-extension-package) document in this guide for details.
This is the stock implementation of the `HistoryApi` interface. It is the default class used by the `LocationLite` class whenever the library runs in **lite** mode.
Helper function that combines multiple HREF's into a single HREF using `@svelte-router/core`'s `calculateHref` function **for the path routing universe**.
0 commit comments