aberdeen 1.5.0 → 1.7.0
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/README.md +5 -11
- package/dist/aberdeen.d.ts +234 -128
- package/dist/aberdeen.js +212 -103
- package/dist/aberdeen.js.map +3 -3
- package/dist/dispatcher.d.ts +10 -7
- package/dist/dispatcher.js +11 -10
- package/dist/dispatcher.js.map +3 -3
- package/dist/route.d.ts +17 -0
- package/dist/route.js +65 -23
- package/dist/route.js.map +3 -3
- package/dist-min/aberdeen.js +9 -7
- package/dist-min/aberdeen.js.map +3 -3
- package/dist-min/dispatcher.js +2 -2
- package/dist-min/dispatcher.js.map +3 -3
- package/dist-min/route.js +2 -2
- package/dist-min/route.js.map +3 -3
- package/html-to-aberdeen +3 -6
- package/package.json +5 -2
- package/skill/SKILL.md +791 -206
- package/skill/aberdeen.md +2338 -0
- package/skill/dispatcher.md +129 -0
- package/skill/prediction.md +73 -0
- package/skill/route.md +277 -0
- package/skill/transitions.md +59 -0
- package/src/aberdeen.ts +490 -244
- package/src/dispatcher.ts +16 -13
- package/src/route.ts +93 -22
- package/skill/references/prediction.md +0 -45
- package/skill/references/routing.md +0 -81
- package/skill/references/transitions.md +0 -52
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
[**Aberdeen v1.7.0**](README.md)
|
|
2
|
+
|
|
3
|
+
***
|
|
4
|
+
|
|
5
|
+
[Aberdeen](README.md) / dispatcher
|
|
6
|
+
|
|
7
|
+
# dispatcher
|
|
8
|
+
|
|
9
|
+
## Classes
|
|
10
|
+
|
|
11
|
+
### Dispatcher
|
|
12
|
+
|
|
13
|
+
Defined in: [dispatcher.ts:61](https://github.com/vanviegen/aberdeen/blob/876d65e85fa77c9453fc72e223d2239e9c745656/src/dispatcher.ts#L61)
|
|
14
|
+
|
|
15
|
+
Simple route matcher and dispatcher.
|
|
16
|
+
|
|
17
|
+
Example usage:
|
|
18
|
+
|
|
19
|
+
```ts
|
|
20
|
+
import * as route from 'aberdeen/route';
|
|
21
|
+
import { Dispatcher, MATCH_REST } from 'aberdeen/dispatcher';
|
|
22
|
+
|
|
23
|
+
const dispatcher = new Dispatcher();
|
|
24
|
+
|
|
25
|
+
dispatcher.addRoute("user", Number, "stream", String, (id, stream) => {
|
|
26
|
+
console.log(`User ${id}, stream ${stream}`);
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
dispatcher.dispatch(["user", "42", "stream", "music"]);
|
|
30
|
+
// Logs: User 42, stream music
|
|
31
|
+
|
|
32
|
+
dispatcher.addRoute("search", MATCH_REST, (terms: string[]) => {
|
|
33
|
+
console.log("Search terms:", terms);
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
dispatcher.dispatch(["search", "classical", "piano"]);
|
|
37
|
+
// Logs: Search terms: [ 'classical', 'piano' ]
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
#### Constructors
|
|
41
|
+
|
|
42
|
+
##### Constructor
|
|
43
|
+
|
|
44
|
+
> **new Dispatcher**(): [`Dispatcher`](#dispatcher)
|
|
45
|
+
|
|
46
|
+
###### Returns
|
|
47
|
+
|
|
48
|
+
[`Dispatcher`](#dispatcher)
|
|
49
|
+
|
|
50
|
+
#### Methods
|
|
51
|
+
|
|
52
|
+
##### addRoute()
|
|
53
|
+
|
|
54
|
+
> **addRoute**\<`T`, `H`\>(...`args`): `void`
|
|
55
|
+
|
|
56
|
+
Defined in: [dispatcher.ts:73](https://github.com/vanviegen/aberdeen/blob/876d65e85fa77c9453fc72e223d2239e9c745656/src/dispatcher.ts#L73)
|
|
57
|
+
|
|
58
|
+
Add a route with matchers and a handler function.
|
|
59
|
+
|
|
60
|
+
###### Type Parameters
|
|
61
|
+
|
|
62
|
+
###### T
|
|
63
|
+
|
|
64
|
+
`T` *extends* `Matcher`[]
|
|
65
|
+
|
|
66
|
+
Array of matcher types.
|
|
67
|
+
|
|
68
|
+
###### H
|
|
69
|
+
|
|
70
|
+
`H` *extends* (...`args`) => `void`
|
|
71
|
+
|
|
72
|
+
Handler function type, inferred from the matchers.
|
|
73
|
+
|
|
74
|
+
###### Parameters
|
|
75
|
+
|
|
76
|
+
###### args
|
|
77
|
+
|
|
78
|
+
...\[`...T[]`, `H`\]
|
|
79
|
+
|
|
80
|
+
An array of matchers followed by a handler function. Each matcher can be:
|
|
81
|
+
- A string: matches exactly that string.
|
|
82
|
+
- A function: takes a string segment and returns a value (of any type) if it matches, or [MATCH\_FAILED](#match_failed) if it doesn't match. The return value (if not `MATCH_FAILED` and not `NaN`) is passed as a parameter to the handler function. The standard JavaScript functions `Number` and `String` can be used to match numeric and string segments respectively.
|
|
83
|
+
- The special [MATCH\_REST](#match_rest) symbol: matches the rest of the segments as an array of strings. Only one `MATCH_REST` is allowed.
|
|
84
|
+
|
|
85
|
+
###### Returns
|
|
86
|
+
|
|
87
|
+
`void`
|
|
88
|
+
|
|
89
|
+
##### dispatch()
|
|
90
|
+
|
|
91
|
+
> **dispatch**(`segments`): `boolean`
|
|
92
|
+
|
|
93
|
+
Defined in: [dispatcher.ts:94](https://github.com/vanviegen/aberdeen/blob/876d65e85fa77c9453fc72e223d2239e9c745656/src/dispatcher.ts#L94)
|
|
94
|
+
|
|
95
|
+
Dispatches the given segments to the first route handler that matches.
|
|
96
|
+
|
|
97
|
+
###### Parameters
|
|
98
|
+
|
|
99
|
+
###### segments
|
|
100
|
+
|
|
101
|
+
`string`[]
|
|
102
|
+
|
|
103
|
+
Array of string segments to match against the added routes. When using this class with the Aberdeen `route` module, one would typically pass `route.current.p`.
|
|
104
|
+
|
|
105
|
+
###### Returns
|
|
106
|
+
|
|
107
|
+
`boolean`
|
|
108
|
+
|
|
109
|
+
True if a matching route was found and handled, false otherwise.
|
|
110
|
+
|
|
111
|
+
## Variables
|
|
112
|
+
|
|
113
|
+
### MATCH\_FAILED
|
|
114
|
+
|
|
115
|
+
> `const` **MATCH\_FAILED**: unique `symbol`
|
|
116
|
+
|
|
117
|
+
Defined in: [dispatcher.ts:4](https://github.com/vanviegen/aberdeen/blob/876d65e85fa77c9453fc72e223d2239e9c745656/src/dispatcher.ts#L4)
|
|
118
|
+
|
|
119
|
+
Symbol to return when a custom [Dispatcher.addRoute](#addroute) matcher cannot match a segment.
|
|
120
|
+
|
|
121
|
+
***
|
|
122
|
+
|
|
123
|
+
### MATCH\_REST
|
|
124
|
+
|
|
125
|
+
> `const` **MATCH\_REST**: unique `symbol`
|
|
126
|
+
|
|
127
|
+
Defined in: [dispatcher.ts:9](https://github.com/vanviegen/aberdeen/blob/876d65e85fa77c9453fc72e223d2239e9c745656/src/dispatcher.ts#L9)
|
|
128
|
+
|
|
129
|
+
Special [Dispatcher.addRoute](#addroute) matcher that matches the rest of the segments as an array of strings.
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
[**Aberdeen v1.7.0**](README.md)
|
|
2
|
+
|
|
3
|
+
***
|
|
4
|
+
|
|
5
|
+
[Aberdeen](README.md) / prediction
|
|
6
|
+
|
|
7
|
+
# prediction
|
|
8
|
+
|
|
9
|
+
## Functions
|
|
10
|
+
|
|
11
|
+
### applyCanon()
|
|
12
|
+
|
|
13
|
+
> **applyCanon**(`canonFunc?`, `dropPredictions?`): `void`
|
|
14
|
+
|
|
15
|
+
Defined in: [prediction.ts:115](https://github.com/vanviegen/aberdeen/blob/876d65e85fa77c9453fc72e223d2239e9c745656/src/prediction.ts#L115)
|
|
16
|
+
|
|
17
|
+
Temporarily revert all outstanding predictions, optionally run the provided function
|
|
18
|
+
(which will generally make authoritative changes to the data based on a server response),
|
|
19
|
+
and then attempt to reapply the predictions on top of the new canonical state, dropping
|
|
20
|
+
any predictions that can no longer be applied cleanly (the data has been modified) or
|
|
21
|
+
that were specified in `dropPredictions`.
|
|
22
|
+
|
|
23
|
+
All of this is done such that redraws are only triggered if the overall effect is an
|
|
24
|
+
actual change to an `Observable`.
|
|
25
|
+
|
|
26
|
+
#### Parameters
|
|
27
|
+
|
|
28
|
+
##### canonFunc?
|
|
29
|
+
|
|
30
|
+
() => `void`
|
|
31
|
+
|
|
32
|
+
The function to run without any predictions applied. This will typically
|
|
33
|
+
make authoritative changes to the data, based on a server response.
|
|
34
|
+
|
|
35
|
+
##### dropPredictions?
|
|
36
|
+
|
|
37
|
+
`Patch`[] = `[]`
|
|
38
|
+
|
|
39
|
+
An optional list of predictions (as returned by `applyPrediction`)
|
|
40
|
+
to undo. Typically, when a server response for a certain request is being handled,
|
|
41
|
+
you'd want to drop the prediction that was done for that request.
|
|
42
|
+
|
|
43
|
+
#### Returns
|
|
44
|
+
|
|
45
|
+
`void`
|
|
46
|
+
|
|
47
|
+
***
|
|
48
|
+
|
|
49
|
+
### applyPrediction()
|
|
50
|
+
|
|
51
|
+
> **applyPrediction**(`predictFunc`): `Patch`
|
|
52
|
+
|
|
53
|
+
Defined in: [prediction.ts:93](https://github.com/vanviegen/aberdeen/blob/876d65e85fa77c9453fc72e223d2239e9c745656/src/prediction.ts#L93)
|
|
54
|
+
|
|
55
|
+
Run the provided function, while treating all changes to Observables as predictions,
|
|
56
|
+
meaning they will be reverted when changes come back from the server (or some other
|
|
57
|
+
async source).
|
|
58
|
+
|
|
59
|
+
#### Parameters
|
|
60
|
+
|
|
61
|
+
##### predictFunc
|
|
62
|
+
|
|
63
|
+
() => `void`
|
|
64
|
+
|
|
65
|
+
The function to run. It will generally modify some Observables
|
|
66
|
+
to immediately reflect state (as closely as possible) that we expect the server
|
|
67
|
+
to communicate back to us later on.
|
|
68
|
+
|
|
69
|
+
#### Returns
|
|
70
|
+
|
|
71
|
+
`Patch`
|
|
72
|
+
|
|
73
|
+
A `Patch` object. Don't modify it. This is only meant to be passed to `applyCanon`.
|
package/skill/route.md
ADDED
|
@@ -0,0 +1,277 @@
|
|
|
1
|
+
[**Aberdeen v1.7.0**](README.md)
|
|
2
|
+
|
|
3
|
+
***
|
|
4
|
+
|
|
5
|
+
[Aberdeen](README.md) / route
|
|
6
|
+
|
|
7
|
+
# route
|
|
8
|
+
|
|
9
|
+
## Interfaces
|
|
10
|
+
|
|
11
|
+
### Route
|
|
12
|
+
|
|
13
|
+
Defined in: [route.ts:8](https://github.com/vanviegen/aberdeen/blob/876d65e85fa77c9453fc72e223d2239e9c745656/src/route.ts#L8)
|
|
14
|
+
|
|
15
|
+
The class for the global `route` object.
|
|
16
|
+
|
|
17
|
+
#### Properties
|
|
18
|
+
|
|
19
|
+
##### depth
|
|
20
|
+
|
|
21
|
+
> **depth**: `number`
|
|
22
|
+
|
|
23
|
+
Defined in: [route.ts:20](https://github.com/vanviegen/aberdeen/blob/876d65e85fa77c9453fc72e223d2239e9c745656/src/route.ts#L20)
|
|
24
|
+
|
|
25
|
+
The navigation depth of the current session. Starts at 1. Writing to this property has no effect.
|
|
26
|
+
|
|
27
|
+
##### hash
|
|
28
|
+
|
|
29
|
+
> **hash**: `string`
|
|
30
|
+
|
|
31
|
+
Defined in: [route.ts:14](https://github.com/vanviegen/aberdeen/blob/876d65e85fa77c9453fc72e223d2239e9c745656/src/route.ts#L14)
|
|
32
|
+
|
|
33
|
+
The hash fragment including the leading `#`, or an empty string. For instance `"#my_section"` or `""`.
|
|
34
|
+
|
|
35
|
+
##### nav
|
|
36
|
+
|
|
37
|
+
> **nav**: `NavType`
|
|
38
|
+
|
|
39
|
+
Defined in: [route.ts:28](https://github.com/vanviegen/aberdeen/blob/876d65e85fa77c9453fc72e223d2239e9c745656/src/route.ts#L28)
|
|
40
|
+
|
|
41
|
+
The navigation action that got us to this page. Writing to this property has no effect.
|
|
42
|
+
- `"load"`: An initial page load.
|
|
43
|
+
- `"back"` or `"forward"`: When we navigated backwards or forwards in the stack.
|
|
44
|
+
- `"go"`: When we added a new page on top of the stack.
|
|
45
|
+
- `"push"`: When we added a new page on top of the stack, merging with the current page.
|
|
46
|
+
Mostly useful for page transition animations. Writing to this property has no effect.
|
|
47
|
+
|
|
48
|
+
##### p
|
|
49
|
+
|
|
50
|
+
> **p**: `string`[]
|
|
51
|
+
|
|
52
|
+
Defined in: [route.ts:12](https://github.com/vanviegen/aberdeen/blob/876d65e85fa77c9453fc72e223d2239e9c745656/src/route.ts#L12)
|
|
53
|
+
|
|
54
|
+
An convenience array containing path segments, mapping to `path`. For instance `[]` (for `"/"`) or `['users', '123', 'feed']` (for `"/users/123/feed"`).
|
|
55
|
+
|
|
56
|
+
##### path
|
|
57
|
+
|
|
58
|
+
> **path**: `string`
|
|
59
|
+
|
|
60
|
+
Defined in: [route.ts:10](https://github.com/vanviegen/aberdeen/blob/876d65e85fa77c9453fc72e223d2239e9c745656/src/route.ts#L10)
|
|
61
|
+
|
|
62
|
+
The current path of the URL as a string. For instance `"/"` or `"/users/123/feed"`. Paths are normalized to always start with a `/` and never end with a `/` (unless it's the root path).
|
|
63
|
+
|
|
64
|
+
##### search
|
|
65
|
+
|
|
66
|
+
> **search**: `Record`\<`string`, `string`\>
|
|
67
|
+
|
|
68
|
+
Defined in: [route.ts:16](https://github.com/vanviegen/aberdeen/blob/876d65e85fa77c9453fc72e223d2239e9c745656/src/route.ts#L16)
|
|
69
|
+
|
|
70
|
+
The query string interpreted as search parameters. So `"a=x&b=y"` becomes `{a: "x", b: "y"}`.
|
|
71
|
+
|
|
72
|
+
##### state
|
|
73
|
+
|
|
74
|
+
> **state**: `Record`\<`string`, `any`\>
|
|
75
|
+
|
|
76
|
+
Defined in: [route.ts:18](https://github.com/vanviegen/aberdeen/blob/876d65e85fa77c9453fc72e223d2239e9c745656/src/route.ts#L18)
|
|
77
|
+
|
|
78
|
+
An object to be used for any additional data you want to associate with the current page. Data should be JSON-compatible.
|
|
79
|
+
|
|
80
|
+
## Variables
|
|
81
|
+
|
|
82
|
+
### current
|
|
83
|
+
|
|
84
|
+
> `const` **current**: [`Route`](#route)
|
|
85
|
+
|
|
86
|
+
Defined in: [route.ts:332](https://github.com/vanviegen/aberdeen/blob/876d65e85fa77c9453fc72e223d2239e9c745656/src/route.ts#L332)
|
|
87
|
+
|
|
88
|
+
The global [Route](#route) object reflecting the current URL and browser history state. Changes you make to this affect the current browser history item (modifying the URL if needed).
|
|
89
|
+
|
|
90
|
+
## Functions
|
|
91
|
+
|
|
92
|
+
### back()
|
|
93
|
+
|
|
94
|
+
> **back**(`target`): `void`
|
|
95
|
+
|
|
96
|
+
Defined in: [route.ts:190](https://github.com/vanviegen/aberdeen/blob/876d65e85fa77c9453fc72e223d2239e9c745656/src/route.ts#L190)
|
|
97
|
+
|
|
98
|
+
Try to go back in history to the first entry that matches the given target. If none is found, the given state will replace the current page. This is useful for "cancel" or "close" actions that should return to the previous page if possible, but create a new page if not (for instance when arriving at the current page through a direct link).
|
|
99
|
+
|
|
100
|
+
Consider using [up](#up) to go up in the path hierarchy.
|
|
101
|
+
|
|
102
|
+
#### Parameters
|
|
103
|
+
|
|
104
|
+
##### target
|
|
105
|
+
|
|
106
|
+
`RouteTarget` = `{}`
|
|
107
|
+
|
|
108
|
+
The target route to go back to. May be a subset of [Route](#route), or a string (for `path`), or an array of strings (for `p`).
|
|
109
|
+
|
|
110
|
+
#### Returns
|
|
111
|
+
|
|
112
|
+
`void`
|
|
113
|
+
|
|
114
|
+
***
|
|
115
|
+
|
|
116
|
+
### go()
|
|
117
|
+
|
|
118
|
+
> **go**(`target`, `nav`): `void`
|
|
119
|
+
|
|
120
|
+
Defined in: [route.ts:156](https://github.com/vanviegen/aberdeen/blob/876d65e85fa77c9453fc72e223d2239e9c745656/src/route.ts#L156)
|
|
121
|
+
|
|
122
|
+
Navigate to a new URL by pushing a new history entry.
|
|
123
|
+
|
|
124
|
+
Note that this happens synchronously, immediately updating `route` and processing any reactive updates based on that.
|
|
125
|
+
|
|
126
|
+
#### Parameters
|
|
127
|
+
|
|
128
|
+
##### target
|
|
129
|
+
|
|
130
|
+
`RouteTarget`
|
|
131
|
+
|
|
132
|
+
A subset of the [Route](#route) properties to navigate to. If neither `p` nor `path` is given, the current path is used. For other properties, an empty/default value is assumed if not given. For convenience:
|
|
133
|
+
- You may pass a string instead of an object, which is interpreted as the `path`.
|
|
134
|
+
- You may pass an array instead of an object, which is interpreted as the `p` array.
|
|
135
|
+
- If you pass `p`, it may contain numbers, which will be converted to strings.
|
|
136
|
+
- If you pass `search`, its values may be numbers, which will be converted to strings.
|
|
137
|
+
|
|
138
|
+
Examples:
|
|
139
|
+
```js
|
|
140
|
+
// Navigate to /users/123
|
|
141
|
+
route.go("/users/123");
|
|
142
|
+
|
|
143
|
+
// Navigate to /users/123?tab=feed#top
|
|
144
|
+
route.go({p: ["users", 123], search: {tab: "feed"}, hash: "top"});
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
##### nav
|
|
148
|
+
|
|
149
|
+
`NavType` = `"go"`
|
|
150
|
+
|
|
151
|
+
#### Returns
|
|
152
|
+
|
|
153
|
+
`void`
|
|
154
|
+
|
|
155
|
+
***
|
|
156
|
+
|
|
157
|
+
### interceptLinks()
|
|
158
|
+
|
|
159
|
+
> **interceptLinks**(): `void`
|
|
160
|
+
|
|
161
|
+
Defined in: [route.ts:277](https://github.com/vanviegen/aberdeen/blob/876d65e85fa77c9453fc72e223d2239e9c745656/src/route.ts#L277)
|
|
162
|
+
|
|
163
|
+
Intercept clicks and Enter key presses on links (`<a>` tags) and use Aberdeen routing
|
|
164
|
+
instead of browser navigation for local paths (paths without a protocol or host).
|
|
165
|
+
|
|
166
|
+
This allows you to use regular HTML anchor tags for navigation without needing to
|
|
167
|
+
manually attach click handlers to each link.
|
|
168
|
+
|
|
169
|
+
#### Returns
|
|
170
|
+
|
|
171
|
+
`void`
|
|
172
|
+
|
|
173
|
+
#### Example
|
|
174
|
+
|
|
175
|
+
```js
|
|
176
|
+
// In your root component:
|
|
177
|
+
route.interceptLinks();
|
|
178
|
+
|
|
179
|
+
// Now you can use regular anchor tags:
|
|
180
|
+
$('a text=About href=/corporate/about');
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
***
|
|
184
|
+
|
|
185
|
+
### persistScroll()
|
|
186
|
+
|
|
187
|
+
> **persistScroll**(`name`): `void`
|
|
188
|
+
|
|
189
|
+
Defined in: [route.ts:242](https://github.com/vanviegen/aberdeen/blob/876d65e85fa77c9453fc72e223d2239e9c745656/src/route.ts#L242)
|
|
190
|
+
|
|
191
|
+
Restore and store the vertical and horizontal scroll position for
|
|
192
|
+
the parent element to the page state.
|
|
193
|
+
|
|
194
|
+
#### Parameters
|
|
195
|
+
|
|
196
|
+
##### name
|
|
197
|
+
|
|
198
|
+
`string` = `"main"`
|
|
199
|
+
|
|
200
|
+
A unique (within this page) name for this
|
|
201
|
+
scrollable element. Defaults to 'main'.
|
|
202
|
+
|
|
203
|
+
The scroll position will be persisted in `route.aux.scroll.<name>`.
|
|
204
|
+
|
|
205
|
+
#### Returns
|
|
206
|
+
|
|
207
|
+
`void`
|
|
208
|
+
|
|
209
|
+
***
|
|
210
|
+
|
|
211
|
+
### push()
|
|
212
|
+
|
|
213
|
+
> **push**(`target`): `void`
|
|
214
|
+
|
|
215
|
+
Defined in: [route.ts:177](https://github.com/vanviegen/aberdeen/blob/876d65e85fa77c9453fc72e223d2239e9c745656/src/route.ts#L177)
|
|
216
|
+
|
|
217
|
+
Modify the current route by merging `target` into it (using [merge](aberdeen.md#merge)), pushing a new history entry.
|
|
218
|
+
|
|
219
|
+
This is useful for things like opening modals or side panels, where you want a browser back action to return to the previous state.
|
|
220
|
+
|
|
221
|
+
#### Parameters
|
|
222
|
+
|
|
223
|
+
##### target
|
|
224
|
+
|
|
225
|
+
`RouteTarget`
|
|
226
|
+
|
|
227
|
+
Same as for [go](#go), but merged into the current route instead deleting all state.
|
|
228
|
+
|
|
229
|
+
#### Returns
|
|
230
|
+
|
|
231
|
+
`void`
|
|
232
|
+
|
|
233
|
+
***
|
|
234
|
+
|
|
235
|
+
### setLog()
|
|
236
|
+
|
|
237
|
+
> **setLog**(`value`): `void`
|
|
238
|
+
|
|
239
|
+
Defined in: [route.ts:37](https://github.com/vanviegen/aberdeen/blob/876d65e85fa77c9453fc72e223d2239e9c745656/src/route.ts#L37)
|
|
240
|
+
|
|
241
|
+
Configure logging on route changes.
|
|
242
|
+
|
|
243
|
+
#### Parameters
|
|
244
|
+
|
|
245
|
+
##### value
|
|
246
|
+
|
|
247
|
+
`true` to enable logging to console, `false` to disable logging, or a custom logging function. Defaults to `false`.
|
|
248
|
+
|
|
249
|
+
`boolean` | (...`args`) => `void`
|
|
250
|
+
|
|
251
|
+
#### Returns
|
|
252
|
+
|
|
253
|
+
`void`
|
|
254
|
+
|
|
255
|
+
***
|
|
256
|
+
|
|
257
|
+
### up()
|
|
258
|
+
|
|
259
|
+
> **up**(`stripCount`): `void`
|
|
260
|
+
|
|
261
|
+
Defined in: [route.ts:215](https://github.com/vanviegen/aberdeen/blob/876d65e85fa77c9453fc72e223d2239e9c745656/src/route.ts#L215)
|
|
262
|
+
|
|
263
|
+
Navigate up in the path hierarchy, by going back to the first history entry
|
|
264
|
+
that has a shorter path than the current one. If there's none, we just shorten
|
|
265
|
+
the current path.
|
|
266
|
+
|
|
267
|
+
Note that going back in browser history happens asynchronously, so `route` will not be updated immediately.
|
|
268
|
+
|
|
269
|
+
#### Parameters
|
|
270
|
+
|
|
271
|
+
##### stripCount
|
|
272
|
+
|
|
273
|
+
`number` = `1`
|
|
274
|
+
|
|
275
|
+
#### Returns
|
|
276
|
+
|
|
277
|
+
`void`
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
[**Aberdeen v1.7.0**](README.md)
|
|
2
|
+
|
|
3
|
+
***
|
|
4
|
+
|
|
5
|
+
[Aberdeen](README.md) / transitions
|
|
6
|
+
|
|
7
|
+
# transitions
|
|
8
|
+
|
|
9
|
+
## Functions
|
|
10
|
+
|
|
11
|
+
### grow()
|
|
12
|
+
|
|
13
|
+
> **grow**(`el`): `Promise`\<`void`\>
|
|
14
|
+
|
|
15
|
+
Defined in: [transitions.ts:33](https://github.com/vanviegen/aberdeen/blob/876d65e85fa77c9453fc72e223d2239e9c745656/src/transitions.ts#L33)
|
|
16
|
+
|
|
17
|
+
Do a grow transition for the given element. This is meant to be used as a
|
|
18
|
+
handler for the `create` property.
|
|
19
|
+
|
|
20
|
+
#### Parameters
|
|
21
|
+
|
|
22
|
+
##### el
|
|
23
|
+
|
|
24
|
+
`HTMLElement`
|
|
25
|
+
|
|
26
|
+
The element to transition.
|
|
27
|
+
|
|
28
|
+
The transition doesn't look great for table elements, and may have problems
|
|
29
|
+
for other specific cases as well.
|
|
30
|
+
|
|
31
|
+
#### Returns
|
|
32
|
+
|
|
33
|
+
`Promise`\<`void`\>
|
|
34
|
+
|
|
35
|
+
***
|
|
36
|
+
|
|
37
|
+
### shrink()
|
|
38
|
+
|
|
39
|
+
> **shrink**(`el`): `Promise`\<`void`\>
|
|
40
|
+
|
|
41
|
+
Defined in: [transitions.ts:56](https://github.com/vanviegen/aberdeen/blob/876d65e85fa77c9453fc72e223d2239e9c745656/src/transitions.ts#L56)
|
|
42
|
+
|
|
43
|
+
Do a shrink transition for the given element, and remove it from the DOM
|
|
44
|
+
afterwards. This is meant to be used as a handler for the `destroy` property.
|
|
45
|
+
|
|
46
|
+
#### Parameters
|
|
47
|
+
|
|
48
|
+
##### el
|
|
49
|
+
|
|
50
|
+
`HTMLElement`
|
|
51
|
+
|
|
52
|
+
The element to transition and remove.
|
|
53
|
+
|
|
54
|
+
The transition doesn't look great for table elements, and may have problems
|
|
55
|
+
for other specific cases as well.
|
|
56
|
+
|
|
57
|
+
#### Returns
|
|
58
|
+
|
|
59
|
+
`Promise`\<`void`\>
|