@soleil-se/app-util 5.6.0 → 5.6.2
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/CHANGELOG.md +13 -2
- package/client/svelte/index.js +1 -2
- package/docs/1.svelte.md +25 -28
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,10 +1,21 @@
|
|
|
1
|
-
|
|
1
|
+
---
|
|
2
|
+
title: Changelog
|
|
3
|
+
---
|
|
2
4
|
|
|
3
5
|
All notable changes to this project will be documented in this file.
|
|
4
6
|
|
|
5
7
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
8
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
9
|
|
|
10
|
+
## [5.6.2] - 2023-12-14
|
|
11
|
+
|
|
12
|
+
- Update to correct homepage in `package.json`.
|
|
13
|
+
|
|
14
|
+
## [5.6.1] - 2023-12-14
|
|
15
|
+
|
|
16
|
+
- Hydrate when children other than HTML Elements exist in target.
|
|
17
|
+
- New argument for client side Svelte rendering for `hydrate`.
|
|
18
|
+
|
|
8
19
|
## [5.6.0] - 2023-11-23
|
|
9
20
|
|
|
10
21
|
- New constants: `isServer` and `isBrowser`.
|
|
@@ -166,7 +177,7 @@ See [MIGRATION](./MIGRATION.md).
|
|
|
166
177
|
- App data import in client, `@soleil-api/webapp-util/app-data`.
|
|
167
178
|
- `getViewUri` to get the URI that also renders the page.
|
|
168
179
|
- `isOnline` to see if the app is online.
|
|
169
|
-
- `vue` is now an optional depedency.
|
|
180
|
+
- `vue` is now an optional depedency.
|
|
170
181
|
|
|
171
182
|
## [2.0.0] - 2020-02-12
|
|
172
183
|
|
package/client/svelte/index.js
CHANGED
package/docs/1.svelte.md
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
|
|
1
|
+
---
|
|
2
|
+
title: Svelte
|
|
3
|
+
---
|
|
2
4
|
|
|
3
5
|
Sitevision supports both server and client side rendering with Svelte.
|
|
4
6
|
|
|
5
7
|
## index.js
|
|
6
8
|
|
|
7
|
-
For rendering a client side only app use the framework agnostic [client renderer](./1.render.md).
|
|
8
|
-
|
|
9
9
|
### `render(App, [props])`
|
|
10
10
|
|
|
11
11
|
`@soleil-api/webapp-util/server/svelte`
|
|
@@ -13,20 +13,19 @@ For rendering a client side only app use the framework agnostic [client renderer
|
|
|
13
13
|
Get a HTML string for rendering a universal Svelte application.
|
|
14
14
|
If a client bundle is available the server rendered HTML will be hydrated and not completely re-rendered.
|
|
15
15
|
|
|
16
|
-
**Returns**:
|
|
16
|
+
**Returns**: `String` - HTML for rendering a Svelte application.
|
|
17
17
|
|
|
18
|
-
| Param
|
|
19
|
-
|
|
20
|
-
| [App]
|
|
21
|
-
| [props] |
|
|
18
|
+
| Param | Type | Default | Description |
|
|
19
|
+
|---------|----------|---------|---------------------------------------|
|
|
20
|
+
| [App] | `Svelte` | | Svelte app to be rendered. |
|
|
21
|
+
| [props] | `Object` | `{}` | Props that will be passed to the app. |
|
|
22
22
|
|
|
23
23
|
### Universal
|
|
24
24
|
|
|
25
25
|
Render an app with both server and client code.
|
|
26
26
|
|
|
27
|
-
`index.js`
|
|
28
|
-
|
|
29
27
|
```javascript
|
|
28
|
+
// index.js
|
|
30
29
|
import router from '@sitevision/api/common/router';
|
|
31
30
|
import { render } from '@soleil-api/webapp-util/server/svelte';
|
|
32
31
|
|
|
@@ -35,7 +34,7 @@ import App from './App.svelte';
|
|
|
35
34
|
router.get('/', (req, res) => {
|
|
36
35
|
const props = { foo: 'bar' };
|
|
37
36
|
const html = render(App, props);
|
|
38
|
-
res.agnosticRender(html, props);
|
|
37
|
+
res.agnosticRender(html, props);
|
|
39
38
|
});
|
|
40
39
|
```
|
|
41
40
|
|
|
@@ -43,9 +42,8 @@ router.get('/', (req, res) => {
|
|
|
43
42
|
|
|
44
43
|
Render an app with only server side code.
|
|
45
44
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
```javascript
|
|
45
|
+
```js
|
|
46
|
+
// index.js
|
|
49
47
|
import router from '@sitevision/api/common/router';
|
|
50
48
|
import { render } from '@soleil-api/webapp-util/server/svelte';
|
|
51
49
|
|
|
@@ -54,7 +52,7 @@ import App from './App.svelte';
|
|
|
54
52
|
router.get('/', (req, res) => {
|
|
55
53
|
const props = { foo: 'bar' };
|
|
56
54
|
const html = render(App, props);
|
|
57
|
-
res.send(html);
|
|
55
|
+
res.send(html);
|
|
58
56
|
});
|
|
59
57
|
```
|
|
60
58
|
|
|
@@ -62,9 +60,8 @@ router.get('/', (req, res) => {
|
|
|
62
60
|
|
|
63
61
|
Render an app with only client side code.
|
|
64
62
|
|
|
65
|
-
`index.js`
|
|
66
|
-
|
|
67
63
|
```javascript
|
|
64
|
+
// index.js
|
|
68
65
|
import router from '@sitevision/api/common/router';
|
|
69
66
|
|
|
70
67
|
router.get('/', (req, res) => {
|
|
@@ -81,19 +78,19 @@ router.get('/', (req, res) => {
|
|
|
81
78
|
|
|
82
79
|
Renders a client side Svelte application.
|
|
83
80
|
|
|
84
|
-
**Returns**:
|
|
85
|
-
|
|
86
|
-
| Param | Type | Default | Description |
|
|
87
|
-
| --- | --- | --- | --- |
|
|
88
|
-
| App | <code>\*</code> | | Svelte app root component. |
|
|
89
|
-
| [settings] | <code>Object</code> | <code>{}</code> | Settings object. |
|
|
90
|
-
| [settings.target] | <code>Element</code> | | Target where app should be mounted. |
|
|
91
|
-
| [settings.props] | <code>Object</code> | | Root component props. |
|
|
92
|
-
| [settings.intro] | <code>String</code> | <code>false</code> | If true, will play transitions on initial render, rather than waiting for subsequent state changes. |
|
|
81
|
+
**Returns**: `SvelteComponent` - Initialized Svelte component.
|
|
93
82
|
|
|
94
|
-
|
|
83
|
+
| Param | Type | Default | Description |
|
|
84
|
+
|--------------------|-------------------|--------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
|
85
|
+
| App | `SvelteComponent` | | Svelte app root component. |
|
|
86
|
+
| [settings] | `Object` | `{}` | Settings object. |
|
|
87
|
+
| [settings.target] | `Element` | | Target where app should be mounted. |
|
|
88
|
+
| [settings.props] | `Object` | | Root component props. |
|
|
89
|
+
| [settings.intro] | `Boolean` | `false` | If true, will play transitions on initial render, rather than waiting for subsequent state changes. |
|
|
90
|
+
| [settings.hydrate] | `Boolean` | `target.hasChildNodes()` | Instructs Svelte to upgrade existing DOM (usually from server-side rendering) rather than creating new elements. By default the app will hydrate when the target has any child nodes. |
|
|
95
91
|
|
|
96
92
|
```javascript
|
|
93
|
+
// main.js
|
|
97
94
|
import { render } from '@soleil-api/webapp-util/client/svelte';
|
|
98
95
|
import App from './App.svelte';
|
|
99
96
|
|
|
@@ -103,9 +100,9 @@ export default (props, target) => {
|
|
|
103
100
|
```
|
|
104
101
|
|
|
105
102
|
Mount the app in another element:
|
|
106
|
-
`main.js`
|
|
107
103
|
|
|
108
104
|
```javascript
|
|
105
|
+
// main.js
|
|
109
106
|
import { render } from '@soleil-api/webapp-util/client/svelte';
|
|
110
107
|
import App from './App.svelte';
|
|
111
108
|
|
package/package.json
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@soleil-se/app-util",
|
|
3
|
-
"version": "5.6.
|
|
3
|
+
"version": "5.6.2",
|
|
4
4
|
"description": "Utility and rendering functions for WebApps.",
|
|
5
5
|
"main": "./common/index.js",
|
|
6
6
|
"author": "Soleil AB",
|
|
7
7
|
"license": "UNLICENSED",
|
|
8
8
|
"private": false,
|
|
9
|
-
"homepage": "https://docs.soleil.se/
|
|
9
|
+
"homepage": "https://docs.soleil.se/packages/app-util/",
|
|
10
10
|
"devDependencies": {
|
|
11
|
-
"@sitevision/api": "^
|
|
12
|
-
"svelte": "^3.
|
|
11
|
+
"@sitevision/api": "^2023.9.2",
|
|
12
|
+
"svelte": "^3.59.2"
|
|
13
13
|
},
|
|
14
14
|
"peerDependencies": {
|
|
15
15
|
"@sitevision/api": "*"
|
|
16
16
|
},
|
|
17
|
-
"gitHead": "
|
|
17
|
+
"gitHead": "454db615bcb04eb8f1475f0f8ab9a9fee5fce15f",
|
|
18
18
|
"dependencies": {}
|
|
19
19
|
}
|