arc-ux 0.0.1 → 0.0.3
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/package.json +1 -1
- package/src/ArcUX.js +12 -8
- package/src/Html.js +9 -2
package/package.json
CHANGED
package/src/ArcUX.js
CHANGED
|
@@ -5,6 +5,7 @@ import Html from "./Html.js";
|
|
|
5
5
|
import {ThemeProvider} from "styled-components";
|
|
6
6
|
import App from "./FrameworkComponents/App.jsx";
|
|
7
7
|
import Form from "./Form.js";
|
|
8
|
+
import withArcUX from "./withArcUX.js";
|
|
8
9
|
|
|
9
10
|
class ArcUX {
|
|
10
11
|
#routeMap = {};
|
|
@@ -19,7 +20,7 @@ class ArcUX {
|
|
|
19
20
|
#currentTheme;
|
|
20
21
|
#apis = {};
|
|
21
22
|
#environment = 'production';
|
|
22
|
-
#rootPath = '
|
|
23
|
+
#rootPath = '';
|
|
23
24
|
#keyVal = {};
|
|
24
25
|
|
|
25
26
|
#forms = {};
|
|
@@ -98,21 +99,16 @@ class ArcUX {
|
|
|
98
99
|
}
|
|
99
100
|
|
|
100
101
|
bindRoute(_route, _Component, _Shell=null) {
|
|
101
|
-
this.#routeMap[_route] = { Component: _Component, Shell: _Shell };
|
|
102
|
+
this.#routeMap[`${this.#rootPath}${_route}`] = { Component: _Component, Shell: _Shell };
|
|
102
103
|
this.#RouteRenderer.setMap(this.#routeMap);
|
|
103
|
-
Log.dPink(`Bind Route?`, this.#routeMap);
|
|
104
104
|
}
|
|
105
105
|
|
|
106
106
|
renderRoute(_route) {
|
|
107
107
|
const routeData = this.#RouteRenderer.travel(_route)
|
|
108
|
-
Log.dRed('RouteData?', routeData);
|
|
109
|
-
Log.dYellow('Router?', this.#RouteRenderer);
|
|
110
108
|
if (routeData.match) {
|
|
111
109
|
return routeData.match;
|
|
112
110
|
}
|
|
113
111
|
|
|
114
|
-
Log.dGreen('NotFound?', this.#handlers);
|
|
115
|
-
|
|
116
112
|
if(this.getHandler('NotFound')){
|
|
117
113
|
return this.getHandler('NotFound');
|
|
118
114
|
}
|
|
@@ -138,8 +134,12 @@ class ArcUX {
|
|
|
138
134
|
this.#Html.addHeadElement(_headElement)
|
|
139
135
|
}
|
|
140
136
|
|
|
137
|
+
htmlAddWindowVar(key, val){
|
|
138
|
+
this.#Html.addWindowVariable(key, val);
|
|
139
|
+
}
|
|
140
|
+
|
|
141
141
|
loadPage(_route, _suppressEmit=false) {
|
|
142
|
-
this.setKeyVal('route', _route
|
|
142
|
+
this.setKeyVal('route', `${this.#rootPath}${_route}`, _suppressEmit);
|
|
143
143
|
}
|
|
144
144
|
|
|
145
145
|
renderModal(_Modal, _props) {
|
|
@@ -163,3 +163,7 @@ class ArcUX {
|
|
|
163
163
|
}
|
|
164
164
|
|
|
165
165
|
export default new ArcUX;
|
|
166
|
+
|
|
167
|
+
export {
|
|
168
|
+
withArcUX
|
|
169
|
+
};
|
package/src/Html.js
CHANGED
|
@@ -2,6 +2,7 @@ class Html {
|
|
|
2
2
|
#headElements = [];
|
|
3
3
|
#pathToClientBundle = '';
|
|
4
4
|
#environment = 'production';
|
|
5
|
+
#windowVariables = {};
|
|
5
6
|
|
|
6
7
|
addHeadElement(_element) {
|
|
7
8
|
this.#headElements.push(_element);
|
|
@@ -15,14 +16,20 @@ class Html {
|
|
|
15
16
|
this.#environment = _environment;
|
|
16
17
|
}
|
|
17
18
|
|
|
19
|
+
addWindowVariable(_key, _val) {
|
|
20
|
+
this.#windowVariables[_key] = _val;
|
|
21
|
+
}
|
|
22
|
+
|
|
18
23
|
getString() {
|
|
19
24
|
return (
|
|
20
25
|
`<!DOCTYPE html>
|
|
26
|
+
<html lang="en">
|
|
21
27
|
<head>
|
|
22
28
|
${this.#headElements.join('\r\n')}
|
|
23
29
|
<script>
|
|
24
30
|
window.app = ${JSON.stringify({
|
|
25
|
-
environment: this.#environment
|
|
31
|
+
environment: this.#environment,
|
|
32
|
+
...this.#windowVariables
|
|
26
33
|
})};
|
|
27
34
|
</script>
|
|
28
35
|
</head>
|
|
@@ -30,7 +37,7 @@ class Html {
|
|
|
30
37
|
<!-- Our app container -->
|
|
31
38
|
<div id="app" style="display:flex;flex-direction: column;min-height: calc(100vh)"></div>
|
|
32
39
|
|
|
33
|
-
<!-- Our
|
|
40
|
+
<!-- Our client bundle -->
|
|
34
41
|
<script id="appBundle" src="${this.#pathToClientBundle}"></script>
|
|
35
42
|
</body>
|
|
36
43
|
</html>`);
|