aberdeen 1.7.0 → 1.7.1

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/skill/route.md CHANGED
@@ -1,4 +1,4 @@
1
- [**Aberdeen v1.7.0**](README.md)
1
+ [**Aberdeen v1.7.1**](README.md)
2
2
 
3
3
  ***
4
4
 
@@ -10,7 +10,7 @@
10
10
 
11
11
  ### Route
12
12
 
13
- Defined in: [route.ts:8](https://github.com/vanviegen/aberdeen/blob/876d65e85fa77c9453fc72e223d2239e9c745656/src/route.ts#L8)
13
+ Defined in: [route.ts:8](https://github.com/vanviegen/aberdeen/blob/bfa4e24ebd7624d1d66bdae5c920bbdd10f3fa80/src/route.ts#L8)
14
14
 
15
15
  The class for the global `route` object.
16
16
 
@@ -20,7 +20,7 @@ The class for the global `route` object.
20
20
 
21
21
  > **depth**: `number`
22
22
 
23
- Defined in: [route.ts:20](https://github.com/vanviegen/aberdeen/blob/876d65e85fa77c9453fc72e223d2239e9c745656/src/route.ts#L20)
23
+ Defined in: [route.ts:20](https://github.com/vanviegen/aberdeen/blob/bfa4e24ebd7624d1d66bdae5c920bbdd10f3fa80/src/route.ts#L20)
24
24
 
25
25
  The navigation depth of the current session. Starts at 1. Writing to this property has no effect.
26
26
 
@@ -28,7 +28,7 @@ The navigation depth of the current session. Starts at 1. Writing to this proper
28
28
 
29
29
  > **hash**: `string`
30
30
 
31
- Defined in: [route.ts:14](https://github.com/vanviegen/aberdeen/blob/876d65e85fa77c9453fc72e223d2239e9c745656/src/route.ts#L14)
31
+ Defined in: [route.ts:14](https://github.com/vanviegen/aberdeen/blob/bfa4e24ebd7624d1d66bdae5c920bbdd10f3fa80/src/route.ts#L14)
32
32
 
33
33
  The hash fragment including the leading `#`, or an empty string. For instance `"#my_section"` or `""`.
34
34
 
@@ -36,7 +36,7 @@ The hash fragment including the leading `#`, or an empty string. For instance `"
36
36
 
37
37
  > **nav**: `NavType`
38
38
 
39
- Defined in: [route.ts:28](https://github.com/vanviegen/aberdeen/blob/876d65e85fa77c9453fc72e223d2239e9c745656/src/route.ts#L28)
39
+ Defined in: [route.ts:28](https://github.com/vanviegen/aberdeen/blob/bfa4e24ebd7624d1d66bdae5c920bbdd10f3fa80/src/route.ts#L28)
40
40
 
41
41
  The navigation action that got us to this page. Writing to this property has no effect.
42
42
  - `"load"`: An initial page load.
@@ -49,7 +49,7 @@ Mostly useful for page transition animations. Writing to this property has no ef
49
49
 
50
50
  > **p**: `string`[]
51
51
 
52
- Defined in: [route.ts:12](https://github.com/vanviegen/aberdeen/blob/876d65e85fa77c9453fc72e223d2239e9c745656/src/route.ts#L12)
52
+ Defined in: [route.ts:12](https://github.com/vanviegen/aberdeen/blob/bfa4e24ebd7624d1d66bdae5c920bbdd10f3fa80/src/route.ts#L12)
53
53
 
54
54
  An convenience array containing path segments, mapping to `path`. For instance `[]` (for `"/"`) or `['users', '123', 'feed']` (for `"/users/123/feed"`).
55
55
 
@@ -57,7 +57,7 @@ An convenience array containing path segments, mapping to `path`. For instance `
57
57
 
58
58
  > **path**: `string`
59
59
 
60
- Defined in: [route.ts:10](https://github.com/vanviegen/aberdeen/blob/876d65e85fa77c9453fc72e223d2239e9c745656/src/route.ts#L10)
60
+ Defined in: [route.ts:10](https://github.com/vanviegen/aberdeen/blob/bfa4e24ebd7624d1d66bdae5c920bbdd10f3fa80/src/route.ts#L10)
61
61
 
62
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
63
 
@@ -65,7 +65,7 @@ The current path of the URL as a string. For instance `"/"` or `"/users/123/feed
65
65
 
66
66
  > **search**: `Record`\<`string`, `string`\>
67
67
 
68
- Defined in: [route.ts:16](https://github.com/vanviegen/aberdeen/blob/876d65e85fa77c9453fc72e223d2239e9c745656/src/route.ts#L16)
68
+ Defined in: [route.ts:16](https://github.com/vanviegen/aberdeen/blob/bfa4e24ebd7624d1d66bdae5c920bbdd10f3fa80/src/route.ts#L16)
69
69
 
70
70
  The query string interpreted as search parameters. So `"a=x&b=y"` becomes `{a: "x", b: "y"}`.
71
71
 
@@ -73,7 +73,7 @@ The query string interpreted as search parameters. So `"a=x&b=y"` becomes `{a: "
73
73
 
74
74
  > **state**: `Record`\<`string`, `any`\>
75
75
 
76
- Defined in: [route.ts:18](https://github.com/vanviegen/aberdeen/blob/876d65e85fa77c9453fc72e223d2239e9c745656/src/route.ts#L18)
76
+ Defined in: [route.ts:18](https://github.com/vanviegen/aberdeen/blob/bfa4e24ebd7624d1d66bdae5c920bbdd10f3fa80/src/route.ts#L18)
77
77
 
78
78
  An object to be used for any additional data you want to associate with the current page. Data should be JSON-compatible.
79
79
 
@@ -83,7 +83,7 @@ An object to be used for any additional data you want to associate with the curr
83
83
 
84
84
  > `const` **current**: [`Route`](#route)
85
85
 
86
- Defined in: [route.ts:332](https://github.com/vanviegen/aberdeen/blob/876d65e85fa77c9453fc72e223d2239e9c745656/src/route.ts#L332)
86
+ Defined in: [route.ts:332](https://github.com/vanviegen/aberdeen/blob/bfa4e24ebd7624d1d66bdae5c920bbdd10f3fa80/src/route.ts#L332)
87
87
 
88
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
89
 
@@ -93,7 +93,7 @@ The global [Route](#route) object reflecting the current URL and browser history
93
93
 
94
94
  > **back**(`target`): `void`
95
95
 
96
- Defined in: [route.ts:190](https://github.com/vanviegen/aberdeen/blob/876d65e85fa77c9453fc72e223d2239e9c745656/src/route.ts#L190)
96
+ Defined in: [route.ts:190](https://github.com/vanviegen/aberdeen/blob/bfa4e24ebd7624d1d66bdae5c920bbdd10f3fa80/src/route.ts#L190)
97
97
 
98
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
99
 
@@ -117,7 +117,7 @@ The target route to go back to. May be a subset of [Route](#route), or a string
117
117
 
118
118
  > **go**(`target`, `nav`): `void`
119
119
 
120
- Defined in: [route.ts:156](https://github.com/vanviegen/aberdeen/blob/876d65e85fa77c9453fc72e223d2239e9c745656/src/route.ts#L156)
120
+ Defined in: [route.ts:156](https://github.com/vanviegen/aberdeen/blob/bfa4e24ebd7624d1d66bdae5c920bbdd10f3fa80/src/route.ts#L156)
121
121
 
122
122
  Navigate to a new URL by pushing a new history entry.
123
123
 
@@ -158,7 +158,7 @@ route.go({p: ["users", 123], search: {tab: "feed"}, hash: "top"});
158
158
 
159
159
  > **interceptLinks**(): `void`
160
160
 
161
- Defined in: [route.ts:277](https://github.com/vanviegen/aberdeen/blob/876d65e85fa77c9453fc72e223d2239e9c745656/src/route.ts#L277)
161
+ Defined in: [route.ts:277](https://github.com/vanviegen/aberdeen/blob/bfa4e24ebd7624d1d66bdae5c920bbdd10f3fa80/src/route.ts#L277)
162
162
 
163
163
  Intercept clicks and Enter key presses on links (`<a>` tags) and use Aberdeen routing
164
164
  instead of browser navigation for local paths (paths without a protocol or host).
@@ -186,7 +186,7 @@ $('a text=About href=/corporate/about');
186
186
 
187
187
  > **persistScroll**(`name`): `void`
188
188
 
189
- Defined in: [route.ts:242](https://github.com/vanviegen/aberdeen/blob/876d65e85fa77c9453fc72e223d2239e9c745656/src/route.ts#L242)
189
+ Defined in: [route.ts:242](https://github.com/vanviegen/aberdeen/blob/bfa4e24ebd7624d1d66bdae5c920bbdd10f3fa80/src/route.ts#L242)
190
190
 
191
191
  Restore and store the vertical and horizontal scroll position for
192
192
  the parent element to the page state.
@@ -212,7 +212,7 @@ The scroll position will be persisted in `route.aux.scroll.<name>`.
212
212
 
213
213
  > **push**(`target`): `void`
214
214
 
215
- Defined in: [route.ts:177](https://github.com/vanviegen/aberdeen/blob/876d65e85fa77c9453fc72e223d2239e9c745656/src/route.ts#L177)
215
+ Defined in: [route.ts:177](https://github.com/vanviegen/aberdeen/blob/bfa4e24ebd7624d1d66bdae5c920bbdd10f3fa80/src/route.ts#L177)
216
216
 
217
217
  Modify the current route by merging `target` into it (using [merge](aberdeen.md#merge)), pushing a new history entry.
218
218
 
@@ -236,7 +236,7 @@ Same as for [go](#go), but merged into the current route instead deleting all st
236
236
 
237
237
  > **setLog**(`value`): `void`
238
238
 
239
- Defined in: [route.ts:37](https://github.com/vanviegen/aberdeen/blob/876d65e85fa77c9453fc72e223d2239e9c745656/src/route.ts#L37)
239
+ Defined in: [route.ts:37](https://github.com/vanviegen/aberdeen/blob/bfa4e24ebd7624d1d66bdae5c920bbdd10f3fa80/src/route.ts#L37)
240
240
 
241
241
  Configure logging on route changes.
242
242
 
@@ -258,7 +258,7 @@ Configure logging on route changes.
258
258
 
259
259
  > **up**(`stripCount`): `void`
260
260
 
261
- Defined in: [route.ts:215](https://github.com/vanviegen/aberdeen/blob/876d65e85fa77c9453fc72e223d2239e9c745656/src/route.ts#L215)
261
+ Defined in: [route.ts:215](https://github.com/vanviegen/aberdeen/blob/bfa4e24ebd7624d1d66bdae5c920bbdd10f3fa80/src/route.ts#L215)
262
262
 
263
263
  Navigate up in the path hierarchy, by going back to the first history entry
264
264
  that has a shorter path than the current one. If there's none, we just shorten
@@ -1,4 +1,4 @@
1
- [**Aberdeen v1.7.0**](README.md)
1
+ [**Aberdeen v1.7.1**](README.md)
2
2
 
3
3
  ***
4
4
 
@@ -12,7 +12,7 @@
12
12
 
13
13
  > **grow**(`el`): `Promise`\<`void`\>
14
14
 
15
- Defined in: [transitions.ts:33](https://github.com/vanviegen/aberdeen/blob/876d65e85fa77c9453fc72e223d2239e9c745656/src/transitions.ts#L33)
15
+ Defined in: [transitions.ts:33](https://github.com/vanviegen/aberdeen/blob/bfa4e24ebd7624d1d66bdae5c920bbdd10f3fa80/src/transitions.ts#L33)
16
16
 
17
17
  Do a grow transition for the given element. This is meant to be used as a
18
18
  handler for the `create` property.
@@ -38,7 +38,7 @@ for other specific cases as well.
38
38
 
39
39
  > **shrink**(`el`): `Promise`\<`void`\>
40
40
 
41
- Defined in: [transitions.ts:56](https://github.com/vanviegen/aberdeen/blob/876d65e85fa77c9453fc72e223d2239e9c745656/src/transitions.ts#L56)
41
+ Defined in: [transitions.ts:56](https://github.com/vanviegen/aberdeen/blob/bfa4e24ebd7624d1d66bdae5c920bbdd10f3fa80/src/transitions.ts#L56)
42
42
 
43
43
  Do a shrink transition for the given element, and remove it from the DOM
44
44
  afterwards. This is meant to be used as a handler for the `destroy` property.
package/src/aberdeen.ts CHANGED
@@ -2353,6 +2353,16 @@ export function insertCss(style: string | object): string {
2353
2353
  return prefix;
2354
2354
  }
2355
2355
 
2356
+ function combinePrefixSelector(prefix: string, key: string): string {
2357
+ const sel = [];
2358
+ for(const p of prefix.split(',')) {
2359
+ for(const k of key.split(',')) {
2360
+ sel.push(k.includes("&") ? k.trim().replace(/&/g, p) : `${p} ${k.trim()}`.trim());
2361
+ }
2362
+ }
2363
+ return sel.join(',');
2364
+ }
2365
+
2356
2366
  function objectToCss(style: object, prefix: string): string {
2357
2367
  let css = "";
2358
2368
 
@@ -2364,10 +2374,7 @@ function objectToCss(style: object, prefix: string): string {
2364
2374
  css += `${key}{\n${objectToCss(val, prefix)}}\n`;
2365
2375
  } else {
2366
2376
  // Regular nested selector
2367
- const sel = key === '&' ? prefix :
2368
- key.includes("&") ? key.replace(/&/g, prefix) :
2369
- `${prefix} ${key}`.trim();
2370
- css += objectToCss(val, sel);
2377
+ css += objectToCss(val, combinePrefixSelector(prefix, key));
2371
2378
  }
2372
2379
  } else if (typeof val === 'string') {
2373
2380
  if (key.startsWith("@")) {
@@ -2375,8 +2382,7 @@ function objectToCss(style: object, prefix: string): string {
2375
2382
  css += `${key}{\n${styleStringToCss(val, prefix)}}\n`;
2376
2383
  } else {
2377
2384
  // String value - parse as style string
2378
- const sel = key.includes("&") ? key.replace(/&/g, prefix) : `${prefix} ${key}`.trim();
2379
- css += styleStringToCss(val, sel);
2385
+ css += styleStringToCss(val, combinePrefixSelector(prefix, key));
2380
2386
  }
2381
2387
  }
2382
2388
  }