@soleil-se/app-util 4.1.0 → 4.1.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/CHANGELOG.md +4 -0
- package/client/utils/index.js +1 -1
- package/package.json +2 -2
- package/server/index.js +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
|
|
|
4
4
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
5
5
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
6
6
|
|
|
7
|
+
## [4.1.1] - 2021-02-17
|
|
8
|
+
### Fixed
|
|
9
|
+
- Validation error for `id` on script tags, even though it's allowed.
|
|
10
|
+
|
|
7
11
|
## [4.1.0] - 2021-02-17
|
|
8
12
|
### Changed
|
|
9
13
|
- Put app data and metadata in script elements instead of data attributes.
|
package/client/utils/index.js
CHANGED
|
@@ -17,5 +17,5 @@ export const getAttribute = (attribute) => {
|
|
|
17
17
|
|
|
18
18
|
export const parseJson = (type) => {
|
|
19
19
|
const id = getAttribute('data-app-id');
|
|
20
|
-
return JSON.parse(document.
|
|
20
|
+
return JSON.parse(document.querySelector(`[data-id="${type}_${id}"]`)?.textContent || '{}');
|
|
21
21
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@soleil-se/app-util",
|
|
3
|
-
"version": "4.1.
|
|
3
|
+
"version": "4.1.1",
|
|
4
4
|
"description": "Utility functions for Webapps.",
|
|
5
5
|
"main": "./common/index.js",
|
|
6
6
|
"author": "Soleil AB",
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"optionalDependencies": {
|
|
15
15
|
"vue": "^2.6.11"
|
|
16
16
|
},
|
|
17
|
-
"gitHead": "
|
|
17
|
+
"gitHead": "ec464f4ae29e5b27c3b04a765b5b5bbfdc88ce3f",
|
|
18
18
|
"dependencies": {},
|
|
19
19
|
"devDependencies": {}
|
|
20
20
|
}
|
package/server/index.js
CHANGED
|
@@ -36,8 +36,8 @@ export function render(data, {
|
|
|
36
36
|
const appMetadata = getAppMetadata();
|
|
37
37
|
|
|
38
38
|
const mountElement = `<div id="app_mount_${appId}">${html}</div>`;
|
|
39
|
-
const metaScriptTag = `<script id="app_meta_${appId}" type="application/json">${JSON.stringify(appMetadata)}</script>`;
|
|
40
|
-
const dataScriptTag = data ? `<script id="app_data_${appId}" type="application/json">${JSON.stringify(data)}</script>` : '';
|
|
39
|
+
const metaScriptTag = `<script data-id="app_meta_${appId}" type="application/json">${JSON.stringify(appMetadata)}</script>`;
|
|
40
|
+
const dataScriptTag = data ? `<script data-id="app_data_${appId}" type="application/json">${JSON.stringify(data)}</script>` : '';
|
|
41
41
|
|
|
42
42
|
if (isOffline) {
|
|
43
43
|
return `
|