@olenbetong/appframe-vite 2.2.28 → 2.2.30
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/lib/devServer.js +43 -1
- package/lib/proxy.d.ts +1 -1
- package/package.json +4 -4
package/lib/devServer.js
CHANGED
|
@@ -65,7 +65,49 @@ export function createHtmlTransformer() {
|
|
|
65
65
|
let userSession = await getUserSession();
|
|
66
66
|
return html
|
|
67
67
|
.replace("<!-- {Appframe} -->", `<script src="/lib/@olenbetong/appframe-core/2.4.0/dist/iife/af.common.js"></script>
|
|
68
|
-
<script src="/lib/@olenbetong/appframe-data/0.
|
|
68
|
+
<script src="/lib/@olenbetong/appframe-data/0.7.0/dist/iife/af.data.js"></script>
|
|
69
|
+
<template id="PromptBeforeReloadDialog">
|
|
70
|
+
<dialog class="do-prompt">
|
|
71
|
+
<form method="dialog">
|
|
72
|
+
<article>
|
|
73
|
+
<p>There are unsaved changes. Would you like to save before reloading data?
|
|
74
|
+
</article>
|
|
75
|
+
<footer>
|
|
76
|
+
<menu>
|
|
77
|
+
<li><button value="cancel">Cancel reloading</button></li>
|
|
78
|
+
<li><button value="reload">Reload without saving</button></li>
|
|
79
|
+
<li><button class="primary" value="save-and-reload">Save and reload</button></li>
|
|
80
|
+
</menu>
|
|
81
|
+
</footer>
|
|
82
|
+
</form>
|
|
83
|
+
</dialog>
|
|
84
|
+
</template>
|
|
85
|
+
|
|
86
|
+
<script type="text/javascript">
|
|
87
|
+
function waitForDialog(dialog) {
|
|
88
|
+
return new Promise((resolve) => {
|
|
89
|
+
dialog.addEventListener("close", resolve, { once: true });
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
async function promptBeforeDataObjectReload() {
|
|
93
|
+
let template = document.querySelector("#PromptBeforeReloadDialog");
|
|
94
|
+
let dialog = template.content.firstElementChild.cloneNode(true);
|
|
95
|
+
document.body.appendChild(dialog);
|
|
96
|
+
dialog.showModal();
|
|
97
|
+
|
|
98
|
+
await waitForDialog(dialog);
|
|
99
|
+
let result = dialog.returnValue || "cancel";
|
|
100
|
+
document.body.removeChild(dialog);
|
|
101
|
+
|
|
102
|
+
if (result === "save-and-reload") {
|
|
103
|
+
await this.endEdit();
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
return result !== "cancel";
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
af.DataObject.prototype.beforeReload = promptBeforeDataObjectReload;
|
|
110
|
+
</script>
|
|
69
111
|
<script>
|
|
70
112
|
af = globalThis.af ?? {};
|
|
71
113
|
af.userSession = ${JSON.stringify(userSession)};
|
package/lib/proxy.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="qs" />
|
|
2
2
|
/// <reference types="express" />
|
|
3
3
|
export declare function login(hostname: string, username: string, password: string): Promise<Record<string, string>>;
|
|
4
|
-
export
|
|
4
|
+
export type createProxyOptions = {
|
|
5
5
|
/**
|
|
6
6
|
* If true, will wait for the first login request to complete before returning.
|
|
7
7
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@olenbetong/appframe-vite",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.30",
|
|
4
4
|
"description": "Tools to use and deploy Vite applications to Appframe",
|
|
5
5
|
"main": "./lib/index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"author": "Bjørnar Vister Hansen <bvh@olenbetong.no>",
|
|
20
20
|
"license": "MIT",
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@olenbetong/appframe-data": "^0.6.
|
|
22
|
+
"@olenbetong/appframe-data": "^0.6.7",
|
|
23
23
|
"dotenv": "^16.0.3",
|
|
24
24
|
"rollup-plugin-visualizer": "^5.8.3",
|
|
25
25
|
"vite-plugin-externals": "^0.5.1"
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
},
|
|
30
30
|
"peerDependencies": {
|
|
31
31
|
"express": "^4.18.2",
|
|
32
|
-
"vite": "^3.2.
|
|
32
|
+
"vite": "^3.2.4"
|
|
33
33
|
},
|
|
34
34
|
"optionalDependencies": {
|
|
35
35
|
"@types/express": "^4.17.14",
|
|
@@ -39,5 +39,5 @@
|
|
|
39
39
|
"open": "^8.4.0",
|
|
40
40
|
"tcp-port-used": "^1.0.2"
|
|
41
41
|
},
|
|
42
|
-
"gitHead": "
|
|
42
|
+
"gitHead": "d454b0f72846f6ed4bf4c20d52dea13872ad87f2"
|
|
43
43
|
}
|