piral-aurelia 1.9.0-beta.8186 → 1.9.0-beta.8196

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.
Files changed (2) hide show
  1. package/README.md +23 -32
  2. package/package.json +3 -3
package/README.md CHANGED
@@ -2,15 +2,13 @@
2
2
 
3
3
  # [Piral Aurelia](https://piral.io) · [![GitHub License](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/smapiot/piral/blob/main/LICENSE) [![npm version](https://img.shields.io/npm/v/piral-aurelia.svg?style=flat)](https://www.npmjs.com/package/piral-aurelia) [![tested with jest](https://img.shields.io/badge/tested_with-jest-99424f.svg)](https://jestjs.io) [![Community Chat](https://dcbadge.vercel.app/api/server/kKJ2FZmK8t?style=flat)](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 set of Pilet API extensions that can be used with `piral` or `piral-core`.
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 set includes an Aurelia converter for any component registration, as well as a `fromAurelia` shortcut and a `AureliaExtension` component.
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
- The following functions are brought to the Pilet API.
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: For pilet authors
23
+ ::: summary: Modern Use (recommended)
26
24
 
27
- You can use the `fromAurelia` function from the Pilet API to convert your Aurelia components to components usable by your Piral instance.
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', piral.fromAurelia(AureliaPage));
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: For Piral instance developers
47
+ ::: summary: Legacy Use
61
48
 
62
- Using Aurelia with Piral is as simple as installing `piral-aurelia` and `aurelia-framework` together with the following Aurelia packages:
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
- - `aurelia-event-aggregator`: 1.x
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.8186",
3
+ "version": "1.9.0-beta.8196",
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.8186"
60
+ "piral-core": "1.9.0-beta.8196"
61
61
  },
62
- "gitHead": "ff7d73f1903c20eb9f14e58b21f33d36dee8f572"
62
+ "gitHead": "73f7d0d90884d0b1dc1cc5ed7965f0cb0bc48a20"
63
63
  }