piral-aurelia 1.9.0-beta.8186 → 1.9.0-beta.8209
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 +23 -32
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -2,15 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
# [Piral Aurelia](https://piral.io) · [](https://github.com/smapiot/piral/blob/main/LICENSE) [](https://www.npmjs.com/package/piral-aurelia) [](https://jestjs.io) [](https://discord.gg/kKJ2FZmK8t)
|
|
4
4
|
|
|
5
|
-
This is a plugin that only has a peer dependency to `aurelia-framework` and related packages. What `piral-aurelia` brings to the table is a
|
|
5
|
+
This is a plugin that only has a peer dependency to `aurelia-framework` and related packages. What `piral-aurelia` brings to the table is a converter for pilets using Aurelia.
|
|
6
6
|
|
|
7
|
-
The
|
|
8
|
-
|
|
9
|
-
By default, these API extensions are not integrated in `piral`, so you'd need to add them to your Piral instance.
|
|
7
|
+
The converter includes an Aurelia converter for any component registration, as well as a `fromAurelia` shortcut and a `AureliaExtension` component.
|
|
10
8
|
|
|
11
9
|
## Documentation
|
|
12
10
|
|
|
13
|
-
|
|
11
|
+
This package provides a converter that can be used to render Aurelia components in Piral.
|
|
14
12
|
|
|
15
13
|
### `fromAurelia()`
|
|
16
14
|
|
|
@@ -22,18 +20,19 @@ The extension slot component to be used in Aurelia component. This is not really
|
|
|
22
20
|
|
|
23
21
|
## Usage
|
|
24
22
|
|
|
25
|
-
::: summary:
|
|
23
|
+
::: summary: Modern Use (recommended)
|
|
26
24
|
|
|
27
|
-
|
|
25
|
+
The recommended way is to use `piral-aurelia` from your pilets. In this case, no registration in the Piral instance is required.
|
|
28
26
|
|
|
29
27
|
Example use:
|
|
30
28
|
|
|
31
29
|
```ts
|
|
32
30
|
import { PiletApi } from '<name-of-piral-instance>';
|
|
31
|
+
import { fromAurelia } from 'piral-aurelia/convert';
|
|
33
32
|
import { AureliaPage } from './AureliaPage';
|
|
34
33
|
|
|
35
34
|
export function setup(piral: PiletApi) {
|
|
36
|
-
piral.registerPage('/sample',
|
|
35
|
+
piral.registerPage('/sample', fromAurelia(AureliaPage));
|
|
37
36
|
}
|
|
38
37
|
```
|
|
39
38
|
|
|
@@ -43,38 +42,17 @@ Within Aurelia components the Piral Aurelia extension component can be used by r
|
|
|
43
42
|
<extension-component name="name-of-extension"></extension-component>
|
|
44
43
|
```
|
|
45
44
|
|
|
46
|
-
Alternatively, if `piral-aurelia` has not been added to the Piral instance you can install and use the package also from a pilet directly.
|
|
47
|
-
|
|
48
|
-
```ts
|
|
49
|
-
import { PiletApi } from '<name-of-piral-instance>';
|
|
50
|
-
import { fromAurelia } from 'piral-aurelia/convert';
|
|
51
|
-
import { AureliaPage } from './AureliaPage';
|
|
52
|
-
|
|
53
|
-
export function setup(piral: PiletApi) {
|
|
54
|
-
piral.registerPage('/sample', fromAurelia(AureliaPage));
|
|
55
|
-
}
|
|
56
|
-
```
|
|
57
|
-
|
|
58
45
|
:::
|
|
59
46
|
|
|
60
|
-
::: summary:
|
|
47
|
+
::: summary: Legacy Use
|
|
61
48
|
|
|
62
|
-
|
|
49
|
+
For backwards compatibility, you can also install `piral-aurelia` in your Piral instance. In this case, the `fromAurelia` function is automatically exposed on the Pilet API.
|
|
63
50
|
|
|
64
|
-
|
|
65
|
-
- `aurelia-framework`: 1.x
|
|
66
|
-
- `aurelia-history-browser`: 1.x
|
|
67
|
-
- `aurelia-pal-browser`: 1.x
|
|
68
|
-
- `aurelia-templating-binding`: 1.x
|
|
69
|
-
- `aurelia-templating-resources`: 1.x
|
|
51
|
+
The integration looks like:
|
|
70
52
|
|
|
71
53
|
```ts
|
|
72
54
|
import { createAureliaApi } from 'piral-aurelia';
|
|
73
|
-
```
|
|
74
|
-
|
|
75
|
-
The integration looks like:
|
|
76
55
|
|
|
77
|
-
```ts
|
|
78
56
|
const instance = createInstance({
|
|
79
57
|
// important part
|
|
80
58
|
plugins: [createAureliaApi()],
|
|
@@ -82,6 +60,19 @@ const instance = createInstance({
|
|
|
82
60
|
});
|
|
83
61
|
```
|
|
84
62
|
|
|
63
|
+
Now, in your pilets you can use the `fromAurelia` function from the Pilet API to convert your Aurelia components to components usable by your Piral instance.
|
|
64
|
+
|
|
65
|
+
Example use:
|
|
66
|
+
|
|
67
|
+
```ts
|
|
68
|
+
import { PiletApi } from '<name-of-piral-instance>';
|
|
69
|
+
import { AureliaPage } from './AureliaPage';
|
|
70
|
+
|
|
71
|
+
export function setup(piral: PiletApi) {
|
|
72
|
+
piral.registerPage('/sample', piral.fromAurelia(AureliaPage));
|
|
73
|
+
}
|
|
74
|
+
```
|
|
75
|
+
|
|
85
76
|
The `aurelia` related packages should be shared with the pilets via the *package.json*:
|
|
86
77
|
|
|
87
78
|
```json
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "piral-aurelia",
|
|
3
|
-
"version": "1.9.0-beta.
|
|
3
|
+
"version": "1.9.0-beta.8209",
|
|
4
4
|
"description": "Plugin for integrating Aurelia components in Piral.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"piral",
|
|
@@ -57,7 +57,7 @@
|
|
|
57
57
|
"aurelia-pal-browser": "1.8.1",
|
|
58
58
|
"aurelia-templating-binding": "1.5.3",
|
|
59
59
|
"aurelia-templating-resources": "1.13.1",
|
|
60
|
-
"piral-core": "1.9.0-beta.
|
|
60
|
+
"piral-core": "1.9.0-beta.8209"
|
|
61
61
|
},
|
|
62
|
-
"gitHead": "
|
|
62
|
+
"gitHead": "6ae23abba61e76479bc06b76454c38957bc0e79e"
|
|
63
63
|
}
|