cedro 0.1.9 → 0.1.10
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/README.md +7 -4
- package/dist/cedro-logo.png +0 -0
- package/dist/fangio.jpg +0 -0
- package/package.json +4 -2
- package/src/core/application.builder.tsx +121 -60
- package/src/core/application.core.tsx +110 -11
- package/src/core/themes.core.ts +160 -1
- package/src/core/uid.ts +3 -3
- package/src/interfaces/application.interface.ts +3 -2
- package/src/interfaces/widget.interface.ts +3 -0
- package/src/types/select.item.type.ts +11 -0
- package/src/ui/Icon.ui.tsx +158 -0
- package/src/ui/IconButton.ui.tsx +51 -9
- package/src/ui/{textbox.ui.tsx → Textbox.ui.tsx} +23 -15
- package/src/ui/accordion.ui.tsx +152 -0
- package/src/ui/button.ui.tsx +56 -14
- package/src/ui/buttonColor.ui.tsx +87 -0
- package/src/ui/buttonmenu.ui.tsx +134 -0
- package/src/ui/{buttonstack.ui.ts → buttonstack.ui.tsx} +67 -1
- package/src/ui/checkbox.ui.tsx +9 -13
- package/src/ui/container.ui.tsx +141 -76
- package/src/ui/datagrid.ui.tsx +518 -0
- package/src/ui/dialog.tsx +143 -56
- package/src/ui/hpanel.ui.tsx +37 -11
- package/src/ui/iconButtonMenu.ui.tsx +176 -0
- package/src/ui/image.ui.tsx +123 -112
- package/src/ui/index.ts +8 -8
- package/src/ui/label.ui.tsx +61 -3
- package/src/ui/loading.ui.ts +10 -10
- package/src/ui/menu.ui.ts +2 -2
- package/src/ui/progressbar.ui.tsx +9 -8
- package/src/ui/{radiobutton.tsx → radiobutton.ui.tsx} +9 -13
- package/src/ui/scroll.ui.ts +13 -12
- package/src/ui/select.ui.tsx +143 -0
- package/src/ui/styles/button.css +114 -32
- package/src/ui/styles/buttoncolor.css +8 -8
- package/src/ui/styles/container.css +29 -0
- package/src/ui/styles/icon.css +29 -0
- package/src/ui/styles/image.css +19 -19
- package/src/ui/styles/label.css +63 -0
- package/src/ui/styles/loading.css +12 -12
- package/src/ui/styles/main.css +5 -0
- package/src/ui/styles/progressbar.css +2 -1
- package/src/ui/styles/select.css +13 -0
- package/src/ui/styles/stackbutton.css +36 -0
- package/src/ui/styles/tabs.css +5 -7
- package/src/ui/styles/textarea.css +13 -13
- package/src/ui/switch.ui.tsx +9 -13
- package/src/ui/tabs.ui.tsx +43 -22
- package/src/ui/textarea.ui.tsx +48 -0
- package/src/ui/toolbar.ui.tsx +17 -12
- package/src/ui/valuebar.ui.tsx +11 -13
- package/src/ui/vpanel.ui.tsx +19 -13
- package/src/ui/widget.builder.ts +243 -159
- package/src/ui/widget.collection.ts +24 -2
- package/src/ui/widget.ui.ts +79 -19
- package/src/ui/Icon.ui.ts +0 -64
- package/src/ui/accordion.ui.ts +0 -71
- package/src/ui/buttonColor.ui.ts +0 -24
- package/src/ui/buttonmenu.ui.ts +0 -59
- package/src/ui/datagrid.ui.ts +0 -231
- package/src/ui/iconButtonMenu.ui.ts +0 -59
- package/src/ui/select.ui.ts +0 -73
- package/src/ui/textarea.ui.ts +0 -20
- /package/src/ui/{toggle.ui.ts → toggle.ui.tsx} +0 -0
package/README.md
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
<div align="center">
|
|
2
|
+
<img src="https://raw.githubusercontent.com/hdrdevs/cedro/main/public/cedro-logo.svg" alt="Cedro" width="170">
|
|
3
|
+
<h1>cedro</h1>
|
|
2
4
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
**Don't use this library. "cedro" is on development.**
|
|
5
|
+
</div>
|
|
6
|
+
<h6>Javascript library to build user interfece based on widgets.</h6>
|
|
6
7
|
|
|
7
8
|
## Getting Started
|
|
8
9
|
|
|
@@ -14,3 +15,5 @@ npx degit hdrdevs/vite-cedro#main my-app-name
|
|
|
14
15
|
npm install
|
|
15
16
|
npm run dev
|
|
16
17
|
```
|
|
18
|
+
|
|
19
|
+
⚠️ **Warning:** Don't use this library. "cedro" is on development.
|
|
Binary file
|
package/dist/fangio.jpg
ADDED
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cedro",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.10",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"devDependencies": {
|
|
6
6
|
"@types/node": "^20.4.4",
|
|
@@ -11,8 +11,10 @@
|
|
|
11
11
|
"@oothkoo/seo-js": "1.0.5",
|
|
12
12
|
"@types/color": "3.0.3",
|
|
13
13
|
"@types/react": "18.2.17",
|
|
14
|
+
"html-entities": "^2.5.2",
|
|
14
15
|
"color": "4.2.3",
|
|
15
|
-
"
|
|
16
|
+
"glob": "^11.0.0",
|
|
17
|
+
"material-icons": "1.13.12",
|
|
16
18
|
"navigo": "8.11.1"
|
|
17
19
|
}
|
|
18
20
|
}
|
|
@@ -1,60 +1,121 @@
|
|
|
1
|
-
//import { createWidget } from "src/ui/builder/widget.builder";
|
|
2
|
-
import { WidgetAlignTypes } from "../ui";
|
|
3
|
-
import { createWidget } from "../ui/widget.builder";
|
|
4
|
-
import Application, { ApplicationProps } from "./application.core";
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
1
|
+
//import { createWidget } from "src/ui/builder/widget.builder";
|
|
2
|
+
import { Widget, WidgetAlignTypes } from "../ui";
|
|
3
|
+
import { createWidget } from "../ui/widget.builder";
|
|
4
|
+
import Application, { ApplicationProps } from "./application.core";
|
|
5
|
+
import { decode } from "html-entities";
|
|
6
|
+
|
|
7
|
+
function getApplicationProps(content: any): ApplicationProps {
|
|
8
|
+
let props: ApplicationProps = {
|
|
9
|
+
title: content.title,
|
|
10
|
+
padding: 0,
|
|
11
|
+
theme: null,
|
|
12
|
+
orientation: null,
|
|
13
|
+
children: null,
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
if (content.getAttribute("w-title") !== null) {
|
|
17
|
+
props.title = content.getAttribute("w-title");
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
if (content.getAttribute("w-padding") !== null) {
|
|
21
|
+
props.padding = parseInt(content.getAttribute("w-padding"));
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
if (content.getAttribute("w-orientation") !== null) {
|
|
25
|
+
props.orientation = content.getAttribute("w-orientation");
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
if (content.getAttribute("w-theme") !== null) {
|
|
29
|
+
props.theme = content.getAttribute("w-theme");
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
return props;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export function createApplication(content: any): Application {
|
|
36
|
+
const appProps = getApplicationProps(content);
|
|
37
|
+
const newApp = new Application(appProps.title);
|
|
38
|
+
|
|
39
|
+
if (appProps.padding) {
|
|
40
|
+
newApp.getRoot().setPadding(appProps.padding);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
if (appProps.orientation) {
|
|
44
|
+
if (appProps.orientation === "horizontal") {
|
|
45
|
+
newApp.getRoot().setAlign(WidgetAlignTypes.HORIZONTAL);
|
|
46
|
+
} else {
|
|
47
|
+
newApp.getRoot().setAlign(WidgetAlignTypes.VERTICAL);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
if (appProps.theme) {
|
|
52
|
+
newApp.theme.setTheme(appProps.theme);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
content.childNodes.forEach((item: HTMLElement) => {
|
|
56
|
+
if (item.getAttribute("w-widget-collection")) {
|
|
57
|
+
item.childNodes.forEach((ietmWidget: any) => {
|
|
58
|
+
const appWidgets = createWidget(ietmWidget);
|
|
59
|
+
|
|
60
|
+
if (appWidgets !== null) {
|
|
61
|
+
newApp.getRoot().addChild(appWidgets);
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
} else if (item.getAttribute("w-routes")) {
|
|
65
|
+
newApp.setRouterHostId(item.getAttribute("w-host-id"));
|
|
66
|
+
item.childNodes.forEach((ietmRoute: any) => {
|
|
67
|
+
if (ietmRoute.getAttribute("w-route-path") && ietmRoute.getAttribute("href")) {
|
|
68
|
+
newApp.router.on(decode(ietmRoute.getAttribute("href")), () => {
|
|
69
|
+
const url = decode(ietmRoute.getAttribute("href"));
|
|
70
|
+
const timestamp = new Date().getTime();
|
|
71
|
+
const isProduction = process.env.NODE_ENV === "production";
|
|
72
|
+
|
|
73
|
+
const pathDev = ".." + url + "?ts=" + timestamp;
|
|
74
|
+
|
|
75
|
+
const pathProduction = `../../assets${decode(
|
|
76
|
+
ietmRoute.getAttribute("href")
|
|
77
|
+
)}/index.js?ts=${timestamp}`;
|
|
78
|
+
|
|
79
|
+
const path = isProduction ? pathProduction : pathDev;
|
|
80
|
+
|
|
81
|
+
import(/*@vite-ignore*/ path).then((module) => {
|
|
82
|
+
newApp.clearLoadedModule();
|
|
83
|
+
newApp.setLoadedModule(module.default);
|
|
84
|
+
const host = w.get(newApp.getRouterHostId());
|
|
85
|
+
if (host) {
|
|
86
|
+
newApp.attachWidget(newApp.getLoadedModule() as Widget, host);
|
|
87
|
+
}
|
|
88
|
+
newApp.hideLoading();
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
const loadCss = async () => {
|
|
92
|
+
try {
|
|
93
|
+
const timestamp = new Date().getTime();
|
|
94
|
+
const cssName = "../../assets" + url + "/style.css?ts=" + timestamp;
|
|
95
|
+
|
|
96
|
+
// Crear un elemento <link> para cargar el CSS
|
|
97
|
+
const link = document.createElement("link");
|
|
98
|
+
link.rel = "stylesheet";
|
|
99
|
+
link.href = cssName;
|
|
100
|
+
document.head.appendChild(link);
|
|
101
|
+
} catch (error) {
|
|
102
|
+
console.log(error);
|
|
103
|
+
}
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
if (isProduction) loadCss();
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
});
|
|
110
|
+
newApp.router.resolve();
|
|
111
|
+
}
|
|
112
|
+
});
|
|
113
|
+
|
|
114
|
+
appConnections.forEach((cb) => {
|
|
115
|
+
newApp.subscribe(cb);
|
|
116
|
+
});
|
|
117
|
+
|
|
118
|
+
appConnections = [];
|
|
119
|
+
|
|
120
|
+
return newApp;
|
|
121
|
+
}
|
|
@@ -14,10 +14,20 @@ import Navigo from "navigo";
|
|
|
14
14
|
import { Dialog } from "../ui/dialog";
|
|
15
15
|
import { Label } from "../ui/label.ui";
|
|
16
16
|
import { Seo } from "./seo";
|
|
17
|
-
import {
|
|
17
|
+
import {
|
|
18
|
+
CedroLightTheme,
|
|
19
|
+
CedroDarkTheme,
|
|
20
|
+
DarkTheme,
|
|
21
|
+
LightTheme,
|
|
22
|
+
ThemeManager,
|
|
23
|
+
} from "./themes.core";
|
|
18
24
|
import { Loading } from "../ui/loading.ui";
|
|
19
25
|
import { OrientationTypes } from "../types/orientation.type";
|
|
20
26
|
|
|
27
|
+
declare global {
|
|
28
|
+
var appConnections: Array<WUICallback>;
|
|
29
|
+
}
|
|
30
|
+
|
|
21
31
|
class WApplication implements IApplication {
|
|
22
32
|
seo: Seo;
|
|
23
33
|
|
|
@@ -26,6 +36,7 @@ class WApplication implements IApplication {
|
|
|
26
36
|
screen: Screen;
|
|
27
37
|
root: Widget;
|
|
28
38
|
router: Navigo;
|
|
39
|
+
routerHostId: string;
|
|
29
40
|
|
|
30
41
|
alertDialog: Dialog;
|
|
31
42
|
confirmDialog: Dialog;
|
|
@@ -35,6 +46,8 @@ class WApplication implements IApplication {
|
|
|
35
46
|
|
|
36
47
|
theme: ThemeManager;
|
|
37
48
|
|
|
49
|
+
loadedModule: any;
|
|
50
|
+
|
|
38
51
|
constructor(title: string) {
|
|
39
52
|
this.seo = new Seo(title);
|
|
40
53
|
|
|
@@ -45,12 +58,15 @@ class WApplication implements IApplication {
|
|
|
45
58
|
this.root.setType(WidgetTypes.FILL);
|
|
46
59
|
this.screen = new Screen();
|
|
47
60
|
this.router = new Navigo("/");
|
|
61
|
+
this.routerHostId = this.getRoot().id;
|
|
48
62
|
|
|
49
63
|
this.mediaQueries = new Map<string, IScreenSize>();
|
|
50
64
|
|
|
51
65
|
this.theme = new ThemeManager();
|
|
52
66
|
this.theme.add(LightTheme);
|
|
53
67
|
this.theme.add(DarkTheme);
|
|
68
|
+
this.theme.add(CedroDarkTheme);
|
|
69
|
+
this.theme.add(CedroLightTheme);
|
|
54
70
|
|
|
55
71
|
this.screen.onResize(() => {
|
|
56
72
|
this.getRoot().resize();
|
|
@@ -62,6 +78,12 @@ class WApplication implements IApplication {
|
|
|
62
78
|
this.run("load");
|
|
63
79
|
});
|
|
64
80
|
|
|
81
|
+
window.addEventListener("resize", () => {
|
|
82
|
+
this.screen.updateSize();
|
|
83
|
+
this.getRoot().resize();
|
|
84
|
+
this.run("resize");
|
|
85
|
+
});
|
|
86
|
+
|
|
65
87
|
this.alertDialog = new Dialog("Dialog.alert", null);
|
|
66
88
|
this.confirmDialog = new Dialog("Dialog.confirm", null);
|
|
67
89
|
|
|
@@ -70,6 +92,30 @@ class WApplication implements IApplication {
|
|
|
70
92
|
this.theme.load();
|
|
71
93
|
}
|
|
72
94
|
|
|
95
|
+
public setLoadedModule(module: any): void {
|
|
96
|
+
this.loadedModule = module;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
public getLoadedModule(): any {
|
|
100
|
+
return this.loadedModule;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
public clearLoadedModule(): void {
|
|
104
|
+
this.loadedModule = null;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
public setRouterHostId(id: string | null): void {
|
|
108
|
+
if (!id) {
|
|
109
|
+
this.routerHostId = this.getRoot().id;
|
|
110
|
+
return;
|
|
111
|
+
}
|
|
112
|
+
this.routerHostId = id;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
public getRouterHostId(): string {
|
|
116
|
+
return this.routerHostId;
|
|
117
|
+
}
|
|
118
|
+
|
|
73
119
|
public run(eventId: WUIEvent): void {
|
|
74
120
|
this.subscribers.forEach((callback) => {
|
|
75
121
|
if (callback.event == eventId) {
|
|
@@ -90,13 +136,20 @@ class WApplication implements IApplication {
|
|
|
90
136
|
this.subscribers.delete(`${event}`);
|
|
91
137
|
}
|
|
92
138
|
|
|
93
|
-
alert(
|
|
139
|
+
public alert(
|
|
140
|
+
title: string = "",
|
|
141
|
+
msg: string,
|
|
142
|
+
onOk: () => void = () => {},
|
|
143
|
+
onCancell: () => void = () => {}
|
|
144
|
+
): void {
|
|
94
145
|
const mesageLabel = new Label("alert.label", "span");
|
|
95
146
|
|
|
96
147
|
mesageLabel.setType(WidgetTypes.FILL);
|
|
97
148
|
mesageLabel.setAlign(WidgetAlignTypes.VERTICAL);
|
|
98
149
|
mesageLabel.setText(msg);
|
|
99
150
|
|
|
151
|
+
this.alertDialog.titleBar.setText(title);
|
|
152
|
+
|
|
100
153
|
this.alertDialog.setOkCallback({ event: "click", then: onOk });
|
|
101
154
|
this.alertDialog.setCancellCallback({
|
|
102
155
|
event: "click",
|
|
@@ -108,7 +161,11 @@ class WApplication implements IApplication {
|
|
|
108
161
|
this.alertDialog.show();
|
|
109
162
|
}
|
|
110
163
|
|
|
111
|
-
confirm(
|
|
164
|
+
public confirm(
|
|
165
|
+
msg: string,
|
|
166
|
+
onOk: () => void = () => {},
|
|
167
|
+
onCancell: () => void = () => {}
|
|
168
|
+
): void {
|
|
112
169
|
const mesageLabel = new Label("alert.label", "span");
|
|
113
170
|
|
|
114
171
|
mesageLabel.setType(WidgetTypes.FILL);
|
|
@@ -126,10 +183,16 @@ class WApplication implements IApplication {
|
|
|
126
183
|
this.confirmDialog.show();
|
|
127
184
|
}
|
|
128
185
|
|
|
129
|
-
attachWidget(guest: IWidget, host: IWidget): void {
|
|
186
|
+
public attachWidget(guest: IWidget, host: IWidget): void {
|
|
130
187
|
if (!host) {
|
|
131
188
|
console.log("guest:", guest);
|
|
189
|
+
return;
|
|
132
190
|
}
|
|
191
|
+
|
|
192
|
+
if (!guest) {
|
|
193
|
+
return;
|
|
194
|
+
}
|
|
195
|
+
|
|
133
196
|
for (const child of host.getBody().childNodes) {
|
|
134
197
|
child.parentNode?.removeChild(child);
|
|
135
198
|
}
|
|
@@ -141,13 +204,14 @@ class WApplication implements IApplication {
|
|
|
141
204
|
host.removeAllChilds();
|
|
142
205
|
|
|
143
206
|
host.addChild(guest);
|
|
207
|
+
guest.populate(); //tiene que recorrer todos los widgets hijos en forma recursiva e ir agregandolos a window.w
|
|
144
208
|
guest.setParent(host);
|
|
145
209
|
guest.render();
|
|
146
210
|
this.root.resize();
|
|
147
211
|
this.root.render();
|
|
148
212
|
}
|
|
149
213
|
|
|
150
|
-
addMediaQuery(
|
|
214
|
+
public addMediaQuery(
|
|
151
215
|
query: string,
|
|
152
216
|
minWidth: number,
|
|
153
217
|
maxWidth: number,
|
|
@@ -161,7 +225,7 @@ class WApplication implements IApplication {
|
|
|
161
225
|
*
|
|
162
226
|
* @return {void} This function does not return a value.
|
|
163
227
|
*/
|
|
164
|
-
init(): void {
|
|
228
|
+
public init(): void {
|
|
165
229
|
this.root.subscribe({
|
|
166
230
|
event: "resize",
|
|
167
231
|
then: () => {
|
|
@@ -186,7 +250,7 @@ class WApplication implements IApplication {
|
|
|
186
250
|
*
|
|
187
251
|
* @return {Widget} The root widget of the application.
|
|
188
252
|
*/
|
|
189
|
-
getRoot(): Widget {
|
|
253
|
+
public getRoot(): Widget {
|
|
190
254
|
return this.root;
|
|
191
255
|
}
|
|
192
256
|
|
|
@@ -196,7 +260,7 @@ class WApplication implements IApplication {
|
|
|
196
260
|
* @param {Widget} root - The root widget to set.
|
|
197
261
|
* @return {void}
|
|
198
262
|
*/
|
|
199
|
-
setRoot(root: Widget): void {
|
|
263
|
+
public setRoot(root: Widget): void {
|
|
200
264
|
this.root = root;
|
|
201
265
|
}
|
|
202
266
|
|
|
@@ -208,18 +272,48 @@ class WApplication implements IApplication {
|
|
|
208
272
|
public hideLoading(): void {
|
|
209
273
|
this.loading.setVisible(false);
|
|
210
274
|
}
|
|
275
|
+
|
|
276
|
+
public goTo(path: string): void {
|
|
277
|
+
this.router.navigate(path);
|
|
278
|
+
}
|
|
211
279
|
}
|
|
212
280
|
|
|
281
|
+
export const initApplicationConnections = () => {
|
|
282
|
+
if (!window.appConnections) {
|
|
283
|
+
window.appConnections = new Array<WUICallback>();
|
|
284
|
+
}
|
|
285
|
+
};
|
|
286
|
+
export const connectApplication = (cb: WUICallback) => {
|
|
287
|
+
initApplicationConnections();
|
|
288
|
+
window.appConnections.push(cb);
|
|
289
|
+
};
|
|
290
|
+
|
|
213
291
|
export type ApplicationProps = {
|
|
214
292
|
title: string;
|
|
215
293
|
padding?: number | null;
|
|
216
294
|
orientation?: OrientationTypes | null;
|
|
295
|
+
theme?: string | null;
|
|
217
296
|
children: any;
|
|
297
|
+
onResize?: (args: any) => void;
|
|
298
|
+
onLoad?: (args: any) => void;
|
|
218
299
|
};
|
|
219
300
|
|
|
220
301
|
export const Application = (props: ApplicationProps) => {
|
|
302
|
+
if (props.onLoad) {
|
|
303
|
+
connectApplication({ event: "load", then: props.onLoad });
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
if (props.onResize) {
|
|
307
|
+
connectApplication({ event: "resize", then: props.onResize });
|
|
308
|
+
}
|
|
309
|
+
|
|
221
310
|
return (
|
|
222
|
-
<div
|
|
311
|
+
<div
|
|
312
|
+
title={props.title}
|
|
313
|
+
w-padding={props.padding}
|
|
314
|
+
w-orientation={props.orientation}
|
|
315
|
+
w-theme={props.theme}
|
|
316
|
+
>
|
|
223
317
|
{props.children}
|
|
224
318
|
</div>
|
|
225
319
|
);
|
|
@@ -234,11 +328,16 @@ export const Widgets = (props: WidgetsProps) => {
|
|
|
234
328
|
};
|
|
235
329
|
|
|
236
330
|
export type RoutesProps = {
|
|
331
|
+
hostId: string;
|
|
237
332
|
children: any;
|
|
238
333
|
};
|
|
239
334
|
|
|
240
335
|
export const Routes = (props: RoutesProps) => {
|
|
241
|
-
return
|
|
336
|
+
return (
|
|
337
|
+
<div w-routes w-host-id={props.hostId}>
|
|
338
|
+
{props.children}
|
|
339
|
+
</div>
|
|
340
|
+
);
|
|
242
341
|
};
|
|
243
342
|
|
|
244
343
|
export type RouteProps = {
|
|
@@ -246,7 +345,7 @@ export type RouteProps = {
|
|
|
246
345
|
};
|
|
247
346
|
|
|
248
347
|
export const Route = (props: RouteProps) => {
|
|
249
|
-
return <a w-path href={props.src}></a>;
|
|
348
|
+
return <a w-route-path href={props.src}></a>;
|
|
250
349
|
};
|
|
251
350
|
|
|
252
351
|
export default WApplication;
|
package/src/core/themes.core.ts
CHANGED
|
@@ -16,12 +16,15 @@ export class Theme implements ITheme {
|
|
|
16
16
|
|
|
17
17
|
export const LightTheme = new Theme("light");
|
|
18
18
|
export const DarkTheme = new Theme("dark");
|
|
19
|
+
export const CedroDarkTheme = new Theme("cedro-dark");
|
|
20
|
+
export const CedroLightTheme = new Theme("cedro");
|
|
19
21
|
|
|
20
22
|
LightTheme.add("--palette-text-primary", "rgba(0, 0, 0, 0.87)")
|
|
21
23
|
.add("--palette-text-secondary", "rgba(0, 0, 0, 0.6)")
|
|
22
24
|
.add("--palette-text-disabled", "rgba(0, 0, 0, 0.38)")
|
|
23
25
|
.add("--palette-background-default", "#ffffff")
|
|
24
26
|
.add("--palette-background-paper", "#ffffff")
|
|
27
|
+
.add("--palette-background-light", "#f5f5f5")
|
|
25
28
|
.add("--palette-action-active", "rgba(0, 0, 0, 0.54)")
|
|
26
29
|
.add("--palette-action-disabled", "rgba(0, 0, 0, 0.26)")
|
|
27
30
|
.add("--palette-action-hover", "#f5f5f5")
|
|
@@ -37,7 +40,7 @@ LightTheme.add("--palette-text-primary", "rgba(0, 0, 0, 0.87)")
|
|
|
37
40
|
|
|
38
41
|
.add("--palette-primary-main", "#90caf9")
|
|
39
42
|
.add("--palette-primary-dark", "#42a5f5")
|
|
40
|
-
.add("--palette-primary-light", "#
|
|
43
|
+
.add("--palette-primary-light", "#90caf9")
|
|
41
44
|
|
|
42
45
|
.add("--palette-primary-text-main", "#2a3b49")
|
|
43
46
|
.add("--palette-primary-text-dark", "#133048")
|
|
@@ -99,6 +102,7 @@ DarkTheme.add("--palette-text-primary", "#cdd0d3")
|
|
|
99
102
|
|
|
100
103
|
.add("--palette-background-default", "#121212")
|
|
101
104
|
.add("--palette-background-paper", "#121212")
|
|
105
|
+
.add("--palette-background-light", "rgba(255, 255, 255, 0.02)")
|
|
102
106
|
|
|
103
107
|
.add("--palette-action-active", "#ffffff")
|
|
104
108
|
.add("--palette-action-disabled", "rgba(255, 255, 255, 0.3)")
|
|
@@ -170,6 +174,161 @@ DarkTheme.add("--palette-text-primary", "#cdd0d3")
|
|
|
170
174
|
.add("--palette-success-text-dark", "#263b27")
|
|
171
175
|
.add("--palette-success-text-light", "#c3ddc5");
|
|
172
176
|
|
|
177
|
+
CedroDarkTheme.add("--palette-text-primary", "#d3d0c8")
|
|
178
|
+
.add("--palette-text-secondary", "#a6a29a")
|
|
179
|
+
.add("--palette-text-disabled", "rgba(80, 81, 82, 0.5)")
|
|
180
|
+
|
|
181
|
+
.add("--palette-background-default", "#655349")
|
|
182
|
+
.add("--palette-background-paper", "#56473e")
|
|
183
|
+
.add("--palette-background-light", "#6d5a4e")
|
|
184
|
+
|
|
185
|
+
.add("--palette-action-active", "#655447")
|
|
186
|
+
.add("--palette-action-disabled", "rgba(39, 32, 27, 0.3)")
|
|
187
|
+
.add("--palette-action-hover", "#56473e")
|
|
188
|
+
.add("--palette-action-selected", "rgba(255, 255, 255, 0.16)")
|
|
189
|
+
.add("--palette-action-disabled-bg", "rgba(255, 255, 255, 0.12)")
|
|
190
|
+
|
|
191
|
+
.add("--palette-divider", "rgba(255, 255, 255, 0.12)")
|
|
192
|
+
|
|
193
|
+
.add("--palette-link", "#ffa500")
|
|
194
|
+
.add("--palette-link-hover", "#c07e06")
|
|
195
|
+
|
|
196
|
+
/*PRIMARY*/
|
|
197
|
+
.add("--palette-primary-main", "#f9ca90")
|
|
198
|
+
.add("--palette-primary-dark", "#da9f56")
|
|
199
|
+
.add("--palette-primary-light", "#fcd09a")
|
|
200
|
+
|
|
201
|
+
.add("--palette-primary-text-main", "#2a3b49")
|
|
202
|
+
.add("--palette-primary-text-dark", "#133048")
|
|
203
|
+
.add("--palette-primary-text-light", "#43474b")
|
|
204
|
+
|
|
205
|
+
/*SECONDARY*/
|
|
206
|
+
|
|
207
|
+
.add("--palette-secondary-main", "#ce93d8")
|
|
208
|
+
.add("--palette-secondary-dark", "#ab47bc")
|
|
209
|
+
.add("--palette-secondary-light", "#f3e5f5")
|
|
210
|
+
|
|
211
|
+
.add("--palette-secondary-text-main", "#3d2b40")
|
|
212
|
+
.add("--palette-secondary-text-dark", "#e6c8eb")
|
|
213
|
+
.add("--palette-secondary-text-light", "#484348")
|
|
214
|
+
|
|
215
|
+
/*ERROR*/
|
|
216
|
+
|
|
217
|
+
.add("--palette-error-main", "#9e5656")
|
|
218
|
+
.add("--palette-error-dark", "#d32f2f")
|
|
219
|
+
.add("--palette-error-light", "#e57373")
|
|
220
|
+
|
|
221
|
+
.add("--palette-error-text-main", "#fbc7c3")
|
|
222
|
+
.add("--palette-error-text-dark", "#f1c1c1")
|
|
223
|
+
.add("--palette-error-text-light", "#432222")
|
|
224
|
+
|
|
225
|
+
/*WARNING*/
|
|
226
|
+
|
|
227
|
+
.add("--palette-warning-main", "#ffa726")
|
|
228
|
+
.add("--palette-warning-dark", "#ffb74d")
|
|
229
|
+
.add("--palette-warning-light", "#f57c00")
|
|
230
|
+
|
|
231
|
+
.add("--palette-warning-text-main", "#4b310b")
|
|
232
|
+
.add("--palette-warning-text-dark", "#4b3616")
|
|
233
|
+
.add("--palette-warning-text-light", "#482400")
|
|
234
|
+
|
|
235
|
+
/*INFO*/
|
|
236
|
+
|
|
237
|
+
.add("--palette-info-main", "#29b6f6")
|
|
238
|
+
.add("--palette-info-dark", "#4fc3f7")
|
|
239
|
+
.add("--palette-info-light", "#0288d1")
|
|
240
|
+
|
|
241
|
+
.add("--palette-info-text-main", "#0c3649")
|
|
242
|
+
.add("--palette-info-text-dark", "#173949")
|
|
243
|
+
.add("--palette-info-text-light", "#b3dbf1")
|
|
244
|
+
|
|
245
|
+
/*SUCCESS*/
|
|
246
|
+
|
|
247
|
+
.add("--palette-success-main", "#599062")
|
|
248
|
+
.add("--palette-success-dark", "#81c784")
|
|
249
|
+
.add("--palette-success-light", "#388e3c")
|
|
250
|
+
|
|
251
|
+
.add("--palette-success-text-main", "#1e371f")
|
|
252
|
+
.add("--palette-success-text-dark", "#263b27")
|
|
253
|
+
.add("--palette-success-text-light", "#c3ddc5");
|
|
254
|
+
|
|
255
|
+
CedroLightTheme.add("--palette-text-primary", "#4f3e2e")
|
|
256
|
+
.add("--palette-text-secondary", "rgba(0, 0, 0, 0.6)")
|
|
257
|
+
.add("--palette-text-disabled", "rgba(0, 0, 0, 0.38)")
|
|
258
|
+
.add("--palette-background-default", "#ffffff")
|
|
259
|
+
.add("--palette-background-paper", "#ffffff")
|
|
260
|
+
.add("--palette-background-light", "rgba(250, 243, 235, 0.5)")
|
|
261
|
+
.add("--palette-action-active", "rgba(0, 0, 0, 0.54)")
|
|
262
|
+
.add("--palette-action-disabled", "#ffe2ba")
|
|
263
|
+
.add("--palette-action-hover", "#f5f5f5")
|
|
264
|
+
.add("--palette-action-selected", "rgba(0, 0, 0, 0.08)")
|
|
265
|
+
.add("--palette-action-disabled-bg", "rgba(0, 0, 0, 0.12)")
|
|
266
|
+
|
|
267
|
+
.add("--palette-divider", "#ffe2ba")
|
|
268
|
+
|
|
269
|
+
.add("--palette-link", "#1d79ee")
|
|
270
|
+
.add("--palette-link-hover", "#3393f2")
|
|
271
|
+
|
|
272
|
+
/*PRIMARY*/
|
|
273
|
+
|
|
274
|
+
.add("--palette-primary-main", "#baf990")
|
|
275
|
+
.add("--palette-primary-dark", "#9bce79")
|
|
276
|
+
.add("--palette-primary-light", "#d1ffb2")
|
|
277
|
+
|
|
278
|
+
.add("--palette-primary-text-main", "#2a3b49")
|
|
279
|
+
.add("--palette-primary-text-dark", "#133048")
|
|
280
|
+
.add("--palette-primary-text-light", "#43474b")
|
|
281
|
+
|
|
282
|
+
/*SECONDARY*/
|
|
283
|
+
|
|
284
|
+
.add("--palette-secondary-main", "#ce93d8")
|
|
285
|
+
.add("--palette-secondary-dark", "#ab47bc")
|
|
286
|
+
.add("--palette-secondary-light", "#f3e5f5")
|
|
287
|
+
|
|
288
|
+
.add("--palette-secondary-text-main", "#3d2b40")
|
|
289
|
+
.add("--palette-secondary-text-dark", "#e6c8eb")
|
|
290
|
+
.add("--palette-secondary-text-light", "#484348")
|
|
291
|
+
|
|
292
|
+
/*ERROR*/
|
|
293
|
+
|
|
294
|
+
.add("--palette-error-main", "#f44336")
|
|
295
|
+
.add("--palette-error-dark", "#d32f2f")
|
|
296
|
+
.add("--palette-error-light", "#e57373")
|
|
297
|
+
|
|
298
|
+
.add("--palette-error-text-main", "#fbc7c3")
|
|
299
|
+
.add("--palette-error-text-dark", "#f1c1c1")
|
|
300
|
+
.add("--palette-error-text-light", "#432222")
|
|
301
|
+
|
|
302
|
+
/*WARNING*/
|
|
303
|
+
|
|
304
|
+
.add("--palette-warning-main", "#ffa726")
|
|
305
|
+
.add("--palette-warning-dark", "#ffb74d")
|
|
306
|
+
.add("--palette-warning-light", "#f57c00")
|
|
307
|
+
|
|
308
|
+
.add("--palette-warning-text-main", "#4b310b")
|
|
309
|
+
.add("--palette-warning-text-dark", "#4b3616")
|
|
310
|
+
.add("--palette-warning-text-light", "#482400")
|
|
311
|
+
|
|
312
|
+
/*INFO*/
|
|
313
|
+
|
|
314
|
+
.add("--palette-info-main", "#29b6f6")
|
|
315
|
+
.add("--palette-info-dark", "#4fc3f7")
|
|
316
|
+
.add("--palette-info-light", "#0288d1")
|
|
317
|
+
|
|
318
|
+
.add("--palette-info-text-main", "#0c3649")
|
|
319
|
+
.add("--palette-info-text-dark", "#173949")
|
|
320
|
+
.add("--palette-info-text-light", "#b3dbf1")
|
|
321
|
+
|
|
322
|
+
/*SUCCESS*/
|
|
323
|
+
|
|
324
|
+
.add("--palette-success-main", "#66bb6a")
|
|
325
|
+
.add("--palette-success-dark", "#81c784")
|
|
326
|
+
.add("--palette-success-light", "#388e3c")
|
|
327
|
+
|
|
328
|
+
.add("--palette-success-text-main", "#1e371f")
|
|
329
|
+
.add("--palette-success-text-dark", "#263b27")
|
|
330
|
+
.add("--palette-success-text-light", "#c3ddc5");
|
|
331
|
+
|
|
173
332
|
export class ThemeManager implements IThemeManager {
|
|
174
333
|
themes: ITheme[];
|
|
175
334
|
current: ITheme | null;
|