@genesislcap/blank-app-seed 2.1.0 → 2.3.0
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/.genx/configure.js +16 -0
- package/.genx/package.json +1 -1
- package/.genx/prompts/ui.js +22 -0
- package/.genx/prompts.js +3 -0
- package/.genx/templates/route.hbs +14 -0
- package/{client/src/routes/home/home.styles.ts → .genx/templates/route.styles.hbs} +1 -1
- package/.genx/templates/route.template.hbs +7 -0
- package/CHANGELOG.md +14 -0
- package/client/.editorconfig +8 -0
- package/client/package.json +22 -1
- package/client/src/components/components.ts +55 -37
- package/client/src/layouts/default.ts +89 -72
- package/client/src/main/main.css +1 -1
- package/client/src/main/main.styles.ts +3 -2
- package/client/src/main/main.template.ts +9 -6
- package/client/src/main/main.ts +63 -18
- package/client/src/pbc/README.md +8 -0
- package/client/src/routes/config.ts +29 -32
- package/client/src/store/index.ts +1 -0
- package/client/src/store/store.ts +29 -0
- package/client/src/typings.d.ts +5 -0
- package/package.json +1 -1
- package/client/src/routes/home/home.template.ts +0 -6
- package/client/src/routes/home/home.ts +0 -14
package/.genx/configure.js
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
const versions = require('./versions.json');
|
|
2
|
+
const path = require('path');
|
|
3
|
+
const fs = require('fs');
|
|
4
|
+
const directoryExists = (directory) => fs.existsSync(directory);
|
|
2
5
|
|
|
6
|
+
const makeDirectory = (directory) => {
|
|
7
|
+
if (!directoryExists(directory)) {
|
|
8
|
+
fs.mkdirSync(directory);
|
|
9
|
+
}
|
|
10
|
+
};
|
|
3
11
|
/**
|
|
4
12
|
* Signature is `async (data: inquirer.Answers, utils: SeedConfigurationUtils)`
|
|
5
13
|
*/
|
|
@@ -12,4 +20,12 @@ module.exports = async (data, utils) => {
|
|
|
12
20
|
data.versions = versions;
|
|
13
21
|
// to be exposed via user prompt in the future
|
|
14
22
|
data.useDocker = !!process.env.USE_DOCKER;
|
|
23
|
+
data.routes.forEach(route => {
|
|
24
|
+
// utils.makeDirectory(path.resolve(data.directory,`client/src/routes/${route}`))
|
|
25
|
+
makeDirectory(path.resolve(data.directory,`client/src/routes/${route}`));
|
|
26
|
+
utils.writeFileWithData(path.resolve(data.directory, `client/src/routes/${route}/${route}.ts`), {route}, path.resolve(data.directory, '.genx/templates/route.hbs'));
|
|
27
|
+
utils.writeFileWithData(path.resolve(data.directory, `client/src/routes/${route}/${route}.template.ts`), {route}, path.resolve(data.directory, '.genx/templates/route.template.hbs'));
|
|
28
|
+
utils.writeFileWithData(path.resolve(data.directory, `client/src/routes/${route}/${route}.styles.ts`), {route}, path.resolve(data.directory, '.genx/templates/route.styles.hbs'));
|
|
29
|
+
})
|
|
30
|
+
|
|
15
31
|
};
|
package/.genx/package.json
CHANGED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
const routesInto = () => console.log(`
|
|
2
|
+
Pages to be added to the navigation header
|
|
3
|
+
`);
|
|
4
|
+
|
|
5
|
+
module.exports = async (inquirer, prevAns = {}) => {
|
|
6
|
+
routesInto();
|
|
7
|
+
const {
|
|
8
|
+
routes = prevAns.routes,
|
|
9
|
+
} = await inquirer.prompt([
|
|
10
|
+
{
|
|
11
|
+
name: 'routes',
|
|
12
|
+
type: 'input',
|
|
13
|
+
message: 'Pages in comma separated format e.g. home,dashboard,admin',
|
|
14
|
+
when: !prevAns.routes,
|
|
15
|
+
default: prevAns.routes || 'home',
|
|
16
|
+
},
|
|
17
|
+
])
|
|
18
|
+
|
|
19
|
+
return {
|
|
20
|
+
routes: routes?.split(','),
|
|
21
|
+
};
|
|
22
|
+
};
|
package/.genx/prompts.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
const apiPrompts = require('./prompts/api');
|
|
2
2
|
const genesisServerPrompts = require('./prompts/server');
|
|
3
|
+
const uiPrompts = require('./prompts/ui');
|
|
3
4
|
const {description, license, name, version} = require('./package.json');
|
|
4
5
|
|
|
5
6
|
module.exports = async (inquirer, prevAns = {}) => {
|
|
@@ -12,9 +13,11 @@ module.exports = async (inquirer, prevAns = {}) => {
|
|
|
12
13
|
|
|
13
14
|
const {apiHost, enableSSO} = await apiPrompts(inquirer, prevAns)
|
|
14
15
|
const {groupId, applicationVersion, enableDeployPlugin} = await genesisServerPrompts(inquirer, prevAns);
|
|
16
|
+
const {routes} = await uiPrompts(inquirer, prevAns);
|
|
15
17
|
|
|
16
18
|
return {
|
|
17
19
|
apiHost,
|
|
20
|
+
routes,
|
|
18
21
|
enableSSO,
|
|
19
22
|
groupId,
|
|
20
23
|
applicationVersion,
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { customElement, FASTElement } from '@microsoft/fast-element';
|
|
2
|
+
import { {{pascalCase route}}Styles as styles } from './{{route}}.styles';
|
|
3
|
+
import { {{pascalCase route}}Template as template } from './{{route}}.template';
|
|
4
|
+
|
|
5
|
+
@customElement({
|
|
6
|
+
name: '{{route}}-route',
|
|
7
|
+
template,
|
|
8
|
+
styles,
|
|
9
|
+
})
|
|
10
|
+
export class {{pascalCase route}} extends FASTElement {
|
|
11
|
+
constructor() {
|
|
12
|
+
super();
|
|
13
|
+
}
|
|
14
|
+
}
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [2.3.0](https://github.com/genesiscommunitysuccess/blank-app-seed/compare/v2.2.0...v2.3.0) (2024-03-14)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* route generation GENC-57 (#144) 5374330
|
|
9
|
+
|
|
10
|
+
## [2.2.0](https://github.com/genesiscommunitysuccess/blank-app-seed/compare/v2.1.0...v2.2.0) (2024-03-11)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Features
|
|
14
|
+
|
|
15
|
+
* add ui pbc compatibility [PLAT-1028](https://github.com/genesiscommunitysuccess/blank-app-seed/issues/1028) (#139) 2a1f927
|
|
16
|
+
|
|
3
17
|
## [2.1.0](https://github.com/genesiscommunitysuccess/blank-app-seed/compare/v2.0.2...v2.1.0) (2024-03-11)
|
|
4
18
|
|
|
5
19
|
|
package/client/package.json
CHANGED
|
@@ -88,12 +88,15 @@
|
|
|
88
88
|
"dependencies": {
|
|
89
89
|
"@genesislcap/foundation-comms": "{{versions.UI}}",
|
|
90
90
|
"@genesislcap/foundation-entity-management": "{{versions.UI}}",
|
|
91
|
+
"@genesislcap/foundation-events": "{{versions.UI}}",
|
|
91
92
|
"@genesislcap/foundation-forms": "{{versions.UI}}",
|
|
92
93
|
"@genesislcap/foundation-header": "{{versions.UI}}",
|
|
93
94
|
"@genesislcap/foundation-inbox": "{{versions.UI}}",
|
|
94
95
|
"@genesislcap/foundation-layout": "{{versions.UI}}",
|
|
95
96
|
"@genesislcap/foundation-logger": "{{versions.UI}}",
|
|
96
97
|
"@genesislcap/foundation-login": "{{versions.UI}}",
|
|
98
|
+
"@genesislcap/foundation-shell": "{{versions.UI}}",
|
|
99
|
+
"@genesislcap/foundation-store": "{{versions.UI}}",
|
|
97
100
|
"@genesislcap/foundation-ui": "{{versions.UI}}",
|
|
98
101
|
"@genesislcap/foundation-utils": "{{versions.UI}}",
|
|
99
102
|
"@genesislcap/foundation-zero": "{{versions.UI}}",
|
|
@@ -106,5 +109,23 @@
|
|
|
106
109
|
"@microsoft/fast-web-utilities": "^5.1.0",
|
|
107
110
|
"rxjs": "^7.5.4",
|
|
108
111
|
"tslib": "^2.3.1"
|
|
109
|
-
}
|
|
112
|
+
},
|
|
113
|
+
"overrides": {
|
|
114
|
+
"@genesislcap/foundation-comms": "{{versions.UI}}",
|
|
115
|
+
"@genesislcap/foundation-entity-management": "{{versions.UI}}",
|
|
116
|
+
"@genesislcap/foundation-events": "{{versions.UI}}",
|
|
117
|
+
"@genesislcap/foundation-forms": "{{versions.UI}}",
|
|
118
|
+
"@genesislcap/foundation-header": "{{versions.UI}}",
|
|
119
|
+
"@genesislcap/foundation-inbox": "{{versions.UI}}",
|
|
120
|
+
"@genesislcap/foundation-layout": "{{versions.UI}}",
|
|
121
|
+
"@genesislcap/foundation-logger": "{{versions.UI}}",
|
|
122
|
+
"@genesislcap/foundation-login": "{{versions.UI}}",
|
|
123
|
+
"@genesislcap/foundation-shell": "{{versions.UI}}",
|
|
124
|
+
"@genesislcap/foundation-store": "{{versions.UI}}",
|
|
125
|
+
"@genesislcap/foundation-ui": "{{versions.UI}}",
|
|
126
|
+
"@genesislcap/foundation-utils": "{{versions.UI}}",
|
|
127
|
+
"@genesislcap/foundation-zero": "{{versions.UI}}",
|
|
128
|
+
"@genesislcap/foundation-zero-grid-pro": "{{versions.UI}}",
|
|
129
|
+
"@genesislcap/g2plot-chart": "{{versions.UI}}"
|
|
130
|
+
}
|
|
110
131
|
}
|
|
@@ -1,57 +1,75 @@
|
|
|
1
1
|
import { EntityManagement } from '@genesislcap/foundation-entity-management';
|
|
2
2
|
import { Form } from '@genesislcap/foundation-forms';
|
|
3
|
+
import { Navigation } from '@genesislcap/foundation-header';
|
|
3
4
|
import { foundationLayoutComponents } from '@genesislcap/foundation-layout';
|
|
5
|
+
import { getApp } from '@genesislcap/foundation-shell/app';
|
|
6
|
+
import { FoundationRouter } from '@genesislcap/foundation-ui';
|
|
7
|
+
import {
|
|
8
|
+
assureDesignSystem,
|
|
9
|
+
DesignSystemModule,
|
|
10
|
+
ResourceType,
|
|
11
|
+
} from '@genesislcap/foundation-utils';
|
|
4
12
|
import { zeroGridComponents } from '@genesislcap/foundation-zero-grid-pro';
|
|
5
13
|
import { g2plotChartsComponents } from '@genesislcap/g2plot-chart';
|
|
6
|
-
import { FASTRouter } from '@microsoft/fast-router';
|
|
7
14
|
import { logger } from '../utils';
|
|
8
15
|
|
|
9
|
-
EntityManagement;
|
|
10
|
-
Form;
|
|
11
|
-
|
|
12
|
-
enum ResourceType {
|
|
13
|
-
LOCAL = 'LOCAL',
|
|
14
|
-
REMOTE = 'REMOTE',
|
|
15
|
-
}
|
|
16
|
-
|
|
17
16
|
/**
|
|
18
|
-
*
|
|
17
|
+
* Ensure tree shaking doesn't remove these.
|
|
19
18
|
*/
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
);
|
|
25
|
-
}
|
|
19
|
+
FoundationRouter;
|
|
20
|
+
Navigation;
|
|
21
|
+
EntityManagement;
|
|
22
|
+
Form;
|
|
26
23
|
|
|
27
24
|
/**
|
|
28
|
-
*
|
|
25
|
+
* zeroDesignSystemImport.
|
|
26
|
+
* @remarks
|
|
27
|
+
* Attempts to use a module federation version of zero before falling back to the version that was bundled with the app.
|
|
28
|
+
* @internal
|
|
29
29
|
*/
|
|
30
|
-
async function
|
|
31
|
-
let
|
|
30
|
+
async function zeroDesignSystemImport(): Promise<DesignSystemModule> {
|
|
31
|
+
let module: DesignSystemModule;
|
|
32
|
+
let type: ResourceType = ResourceType.remote;
|
|
32
33
|
try {
|
|
33
|
-
|
|
34
|
-
|
|
34
|
+
module = await import(
|
|
35
|
+
/* webpackChunkName: "foundation-zero" */
|
|
36
|
+
'foundationZero/ZeroDesignSystem'
|
|
37
|
+
);
|
|
38
|
+
return assureDesignSystem(module);
|
|
35
39
|
} catch (e) {
|
|
36
|
-
|
|
37
|
-
|
|
40
|
+
logger.info(
|
|
41
|
+
`Please note remoteEntry.js load errors are expected if module federated dependencies are offline. Falling back to locally bundled versions.`,
|
|
42
|
+
);
|
|
43
|
+
type = ResourceType.local;
|
|
44
|
+
module = await import(
|
|
45
|
+
/* webpackChunkName: "foundation-zero" */
|
|
46
|
+
'@genesislcap/foundation-zero'
|
|
47
|
+
);
|
|
48
|
+
return assureDesignSystem(module);
|
|
38
49
|
} finally {
|
|
39
|
-
logger.debug(`Using '${type}' version of
|
|
50
|
+
logger.debug(`Using '${type}' version of foundation-zero`);
|
|
40
51
|
}
|
|
41
52
|
}
|
|
42
53
|
|
|
43
|
-
|
|
54
|
+
/**
|
|
55
|
+
* registerComponents.
|
|
56
|
+
* @public
|
|
57
|
+
*/
|
|
58
|
+
export async function registerComponents() {
|
|
59
|
+
const designSystem = await zeroDesignSystemImport();
|
|
60
|
+
const { provideDesignSystem, baseComponents } = designSystem;
|
|
44
61
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
g2plotChartsComponents,
|
|
52
|
-
foundationLayoutComponents,
|
|
53
|
-
),
|
|
54
|
-
};
|
|
55
|
-
}
|
|
62
|
+
/**
|
|
63
|
+
* Register any PBC components with the design system
|
|
64
|
+
*/
|
|
65
|
+
getApp().registerComponents({
|
|
66
|
+
designSystem,
|
|
67
|
+
});
|
|
56
68
|
|
|
57
|
-
|
|
69
|
+
provideDesignSystem().register(
|
|
70
|
+
baseComponents,
|
|
71
|
+
zeroGridComponents,
|
|
72
|
+
g2plotChartsComponents,
|
|
73
|
+
foundationLayoutComponents,
|
|
74
|
+
);
|
|
75
|
+
}
|
|
@@ -1,5 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { getApp } from '@genesislcap/foundation-shell/app';
|
|
2
|
+
import type { FoundationRouter } from '@genesislcap/foundation-ui';
|
|
3
|
+
import { css, html } from '@microsoft/fast-element';
|
|
2
4
|
import { FASTElementLayout } from '@microsoft/fast-router';
|
|
5
|
+
import type { Store } from '../store';
|
|
6
|
+
|
|
7
|
+
type ClientAppRouter = FoundationRouter & { store: Store };
|
|
8
|
+
|
|
9
|
+
const app = getApp();
|
|
3
10
|
|
|
4
11
|
const baseLayoutCss = css`
|
|
5
12
|
.container {
|
|
@@ -19,7 +26,7 @@ const baseLayoutCss = css`
|
|
|
19
26
|
`;
|
|
20
27
|
|
|
21
28
|
export const loginLayout = new FASTElementLayout(
|
|
22
|
-
html
|
|
29
|
+
html<ClientAppRouter>`
|
|
23
30
|
<div class="container">
|
|
24
31
|
<div class="content">
|
|
25
32
|
<slot></slot>
|
|
@@ -30,84 +37,76 @@ export const loginLayout = new FASTElementLayout(
|
|
|
30
37
|
);
|
|
31
38
|
|
|
32
39
|
export const defaultLayout = new FASTElementLayout(
|
|
33
|
-
html
|
|
40
|
+
html<ClientAppRouter>`
|
|
34
41
|
<div class="container">
|
|
42
|
+
${app.registerElementsTarget('layout-start')}
|
|
35
43
|
<foundation-header
|
|
36
44
|
show-luminance-toggle-button
|
|
37
45
|
show-misc-toggle-button
|
|
38
|
-
|
|
46
|
+
:routeNavItems=${(x) => x.config.getNavItems()}
|
|
39
47
|
>
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
<zero-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
</zero-tree-
|
|
60
|
-
<
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
</zero-tree-
|
|
79
|
-
<
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
<zero-icon variant="solid" name="location-arrow"></zero-icon>
|
|
96
|
-
User Slot
|
|
97
|
-
</zero-tree-item>
|
|
98
|
-
<zero-tree-item>
|
|
99
|
-
<zero-icon variant="solid" name="location-arrow"></zero-icon>
|
|
100
|
-
Reporting Slot
|
|
101
|
-
</zero-tree-item>
|
|
102
|
-
<zero-tree-item>
|
|
103
|
-
<zero-icon variant="solid" name="location-arrow"></zero-icon>
|
|
104
|
-
Settings Slot
|
|
105
|
-
</zero-tree-item>
|
|
106
|
-
</zero-tree-view>
|
|
48
|
+
<div slot="menu-contents">
|
|
49
|
+
<span slot="group-title-1">GROUP SLOT</span>
|
|
50
|
+
<zero-tree-view slot="nav-items-1">
|
|
51
|
+
<zero-tree-item>
|
|
52
|
+
<zero-icon variant="solid" name="location-arrow"></zero-icon>
|
|
53
|
+
Slot Tree Item
|
|
54
|
+
</zero-tree-item>
|
|
55
|
+
<zero-tree-item>
|
|
56
|
+
<zero-icon variant="solid" name="location-arrow"></zero-icon>
|
|
57
|
+
Slot Tree Item
|
|
58
|
+
</zero-tree-item>
|
|
59
|
+
<zero-tree-item>
|
|
60
|
+
<zero-icon variant="solid" name="location-arrow"></zero-icon>
|
|
61
|
+
Slot Tree Item
|
|
62
|
+
</zero-tree-item>
|
|
63
|
+
<zero-tree-item>
|
|
64
|
+
<zero-icon variant="solid" name="location-arrow"></zero-icon>
|
|
65
|
+
Slot Tree Item
|
|
66
|
+
</zero-tree-item>
|
|
67
|
+
</zero-tree-view>
|
|
68
|
+
<span slot="group-title-2">GROUP SLOT 2</span>
|
|
69
|
+
<zero-tree-view slot="nav-items-2">
|
|
70
|
+
<zero-tree-item>
|
|
71
|
+
<zero-icon variant="solid" name="location-arrow"></zero-icon>
|
|
72
|
+
Slot Tree Item 2
|
|
73
|
+
</zero-tree-item>
|
|
74
|
+
<zero-tree-item>
|
|
75
|
+
<zero-icon variant="solid" name="location-arrow"></zero-icon>
|
|
76
|
+
Slot Tree Item 2
|
|
77
|
+
</zero-tree-item>
|
|
78
|
+
<zero-tree-item>
|
|
79
|
+
<zero-icon variant="solid" name="location-arrow"></zero-icon>
|
|
80
|
+
Slot Tree Item 2
|
|
81
|
+
</zero-tree-item>
|
|
82
|
+
<zero-tree-item>
|
|
83
|
+
<zero-icon variant="solid" name="location-arrow"></zero-icon>
|
|
84
|
+
Slot Tree Item 2
|
|
85
|
+
</zero-tree-item>
|
|
86
|
+
</zero-tree-view>
|
|
87
|
+
<span slot="group-title-3">GROUP SLOT 3</span>
|
|
88
|
+
<zero-tree-view slot="nav-items-3">
|
|
89
|
+
<zero-tree-item>
|
|
90
|
+
<zero-icon variant="solid" name="location-arrow"></zero-icon>
|
|
91
|
+
User Slot
|
|
92
|
+
</zero-tree-item>
|
|
93
|
+
<zero-tree-item>
|
|
94
|
+
<zero-icon variant="solid" name="location-arrow"></zero-icon>
|
|
95
|
+
Reporting Slot
|
|
96
|
+
</zero-tree-item>
|
|
97
|
+
<zero-tree-item>
|
|
98
|
+
<zero-icon variant="solid" name="location-arrow"></zero-icon>
|
|
99
|
+
Settings Slot
|
|
100
|
+
</zero-tree-item>
|
|
101
|
+
</zero-tree-view>
|
|
102
|
+
</div>
|
|
107
103
|
</foundation-header>
|
|
108
104
|
<div class="content">
|
|
105
|
+
${app.registerElementsTarget('content-start')}
|
|
109
106
|
<slot></slot>
|
|
107
|
+
${app.registerElementsTarget(['content', 'content-end'])}
|
|
110
108
|
</div>
|
|
109
|
+
${app.registerElementsTarget(['layout', 'layout-end'])}
|
|
111
110
|
</div>
|
|
112
111
|
`,
|
|
113
112
|
css`
|
|
@@ -131,5 +130,23 @@ export const defaultLayout = new FASTElementLayout(
|
|
|
131
130
|
color: #879ba6;
|
|
132
131
|
padding-right: 10px;
|
|
133
132
|
}
|
|
134
|
-
|
|
133
|
+
|
|
134
|
+
foundation-header::part(nav-visibility-icon) {
|
|
135
|
+
color: var(--accent-foreground-rest);
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
foundation-header::part(notifications-button) {
|
|
139
|
+
position: relative;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
zero-flyout::part(flyout) {
|
|
143
|
+
width: 40%;
|
|
144
|
+
min-width: 320px;
|
|
145
|
+
padding: 0;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
zero-flyout::part(content) {
|
|
149
|
+
height: 100%;
|
|
150
|
+
}
|
|
151
|
+
`.withBehaviors(app.registerStylesTarget('layout')),
|
|
135
152
|
);
|
package/client/src/main/main.css
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { getApp } from '@genesislcap/foundation-shell/app';
|
|
1
2
|
import { css } from '@microsoft/fast-element';
|
|
2
3
|
import { stylesFontFaces } from '../styles';
|
|
3
4
|
import './main.css';
|
|
@@ -13,9 +14,9 @@ export const MainStyles = css`
|
|
|
13
14
|
:host,
|
|
14
15
|
zero-design-system-provider,
|
|
15
16
|
.dynamic-template,
|
|
16
|
-
|
|
17
|
+
foundation-router {
|
|
17
18
|
display: flex;
|
|
18
19
|
width: 100%;
|
|
19
20
|
height: 100%;
|
|
20
21
|
}
|
|
21
|
-
|
|
22
|
+
`.withBehaviors(getApp().registerStylesTarget('main'));
|
|
@@ -1,11 +1,14 @@
|
|
|
1
|
+
import { LAYOUT_POPOUT_CONTAINER_CLASS } from '@genesislcap/foundation-layout';
|
|
1
2
|
import { html, ref } from '@microsoft/fast-element';
|
|
2
3
|
import type { ViewTemplate } from '@microsoft/fast-element';
|
|
3
4
|
import type { MainApplication } from './main';
|
|
4
5
|
|
|
5
6
|
export const DynamicTemplate: ViewTemplate<MainApplication> = html`
|
|
6
|
-
<
|
|
7
|
-
<
|
|
8
|
-
|
|
7
|
+
<template>
|
|
8
|
+
<zero-design-system-provider ${ref('provider')} class="${LAYOUT_POPOUT_CONTAINER_CLASS}">
|
|
9
|
+
<div class="dynamic-template">${(x) => x.selectTemplate()}</div>
|
|
10
|
+
</zero-design-system-provider>
|
|
11
|
+
</template>
|
|
9
12
|
`;
|
|
10
13
|
|
|
11
14
|
export const LoadingTemplate: ViewTemplate<MainApplication> = html`
|
|
@@ -13,9 +16,9 @@ export const LoadingTemplate: ViewTemplate<MainApplication> = html`
|
|
|
13
16
|
`;
|
|
14
17
|
|
|
15
18
|
export const MainTemplate: ViewTemplate<MainApplication> = html`
|
|
16
|
-
<
|
|
19
|
+
<foundation-router
|
|
17
20
|
@luminance-icon-clicked=${(x) => x.onDarkModeToggle()}
|
|
18
21
|
:config=${(x) => x.config}
|
|
19
|
-
:
|
|
20
|
-
></
|
|
22
|
+
:store=${(x) => x.store}
|
|
23
|
+
></foundation-router>
|
|
21
24
|
`;
|
package/client/src/main/main.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { Connect, ConnectConfig, defaultConnectConfig } from '@genesislcap/foundation-comms';
|
|
2
|
-
import {
|
|
2
|
+
import { EventEmitter } from '@genesislcap/foundation-events';
|
|
3
|
+
import { App } from '@genesislcap/foundation-shell/app';
|
|
4
|
+
import { importPBCAssets } from '@genesislcap/foundation-shell/pbc';
|
|
3
5
|
import { configureDesignSystem } from '@genesislcap/foundation-ui';
|
|
4
6
|
import { baseLayerLuminance, StandardLuminance } from '@microsoft/fast-components';
|
|
5
7
|
import { FASTElement, customElement, observable, DOM } from '@microsoft/fast-element';
|
|
@@ -7,35 +9,40 @@ import { Container, inject, Registration } from '@microsoft/fast-foundation';
|
|
|
7
9
|
import { DefaultRouteRecognizer } from '@microsoft/fast-router';
|
|
8
10
|
import * as Components from '../components';
|
|
9
11
|
import { MainRouterConfig } from '../routes';
|
|
12
|
+
import { Store, StoreEventDetailMap } from '../store';
|
|
10
13
|
import designTokens from '../styles/design-tokens.json';
|
|
11
|
-
import { logger } from '../utils';
|
|
12
14
|
import { MainStyles as styles } from './main.styles';
|
|
13
15
|
import { DynamicTemplate as template, LoadingTemplate, MainTemplate } from './main.template';
|
|
14
16
|
|
|
15
|
-
|
|
16
|
-
declare var API_HOST: string;
|
|
17
|
-
|
|
18
|
-
const hostEnv = location.host;
|
|
19
|
-
const hostUrl = API_HOST || `wss://${hostEnv}/gwf/`;
|
|
17
|
+
const name = '{{rootElement}}';
|
|
20
18
|
|
|
19
|
+
/**
|
|
20
|
+
* @fires store-connected - Fired when the store is connected.
|
|
21
|
+
* @fires store-ready - Fired when the store is ready.
|
|
22
|
+
*/
|
|
21
23
|
@customElement({
|
|
22
|
-
name
|
|
24
|
+
name,
|
|
23
25
|
template,
|
|
24
26
|
styles,
|
|
25
27
|
})
|
|
26
|
-
export class MainApplication extends FASTElement {
|
|
27
|
-
@
|
|
28
|
-
@inject(Navigation) navigation!: Navigation;
|
|
28
|
+
export class MainApplication extends EventEmitter<StoreEventDetailMap>(FASTElement) {
|
|
29
|
+
@App app: App;
|
|
29
30
|
@Connect connect!: Connect;
|
|
30
31
|
@Container container!: Container;
|
|
32
|
+
@Store store: Store;
|
|
33
|
+
|
|
34
|
+
@inject(MainRouterConfig) config!: MainRouterConfig;
|
|
35
|
+
|
|
31
36
|
@observable provider!: any;
|
|
32
37
|
@observable ready: boolean = false;
|
|
33
38
|
@observable data: any = null;
|
|
34
39
|
|
|
35
40
|
async connectedCallback() {
|
|
36
|
-
super.connectedCallback();
|
|
37
|
-
logger.debug('{{rootElement}} is now connected to the DOM');
|
|
38
41
|
this.registerDIDependencies();
|
|
42
|
+
super.connectedCallback();
|
|
43
|
+
this.addEventListeners();
|
|
44
|
+
this.readyStore();
|
|
45
|
+
await this.loadPBCs();
|
|
39
46
|
await this.loadRemotes();
|
|
40
47
|
DOM.queueUpdate(() => {
|
|
41
48
|
configureDesignSystem(this.provider, designTokens);
|
|
@@ -44,6 +51,8 @@ export class MainApplication extends FASTElement {
|
|
|
44
51
|
|
|
45
52
|
disconnectedCallback() {
|
|
46
53
|
super.disconnectedCallback();
|
|
54
|
+
this.removeEventListeners();
|
|
55
|
+
this.disconnectStore();
|
|
47
56
|
}
|
|
48
57
|
|
|
49
58
|
onDarkModeToggle() {
|
|
@@ -55,16 +64,28 @@ export class MainApplication extends FASTElement {
|
|
|
55
64
|
);
|
|
56
65
|
}
|
|
57
66
|
|
|
58
|
-
async
|
|
59
|
-
|
|
67
|
+
async loadPBCs() {
|
|
68
|
+
/**
|
|
69
|
+
* Import PBC assets that may have been added to the ./pbc directory by genx or by hand
|
|
70
|
+
*/
|
|
71
|
+
const pbcAssets = await importPBCAssets();
|
|
60
72
|
/**
|
|
61
|
-
*
|
|
62
|
-
* await new Promise(resolve => setTimeout(resolve, 3000));
|
|
73
|
+
* Register bulk assets
|
|
63
74
|
*/
|
|
75
|
+
this.app.registerAssets(pbcAssets);
|
|
76
|
+
/**
|
|
77
|
+
* Register the top-level route collection
|
|
78
|
+
*/
|
|
79
|
+
this.app.registerRouteCollection(this.config.routes);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
async loadRemotes() {
|
|
83
|
+
const { registerComponents } = Components;
|
|
84
|
+
await registerComponents();
|
|
64
85
|
this.ready = true;
|
|
65
86
|
}
|
|
66
87
|
|
|
67
|
-
|
|
88
|
+
selectTemplate() {
|
|
68
89
|
return this.ready ? MainTemplate : LoadingTemplate;
|
|
69
90
|
}
|
|
70
91
|
|
|
@@ -90,6 +111,30 @@ export class MainApplication extends FASTElement {
|
|
|
90
111
|
heartbeatInterval: 15_000,
|
|
91
112
|
},
|
|
92
113
|
}),
|
|
114
|
+
/**
|
|
115
|
+
* // example of setting grid options for all grids from app level
|
|
116
|
+
* Registration.instance<GridOptionsConfig>(GridOptionsConfig, {
|
|
117
|
+
* defaultCsvExportParams: csvExportParams,
|
|
118
|
+
* }),
|
|
119
|
+
*/
|
|
93
120
|
);
|
|
94
121
|
}
|
|
122
|
+
|
|
123
|
+
protected addEventListeners() {
|
|
124
|
+
this.addEventListener('store-connected', this.store.onConnected);
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
protected removeEventListeners() {
|
|
128
|
+
this.removeEventListener('store-connected', this.store.onConnected);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
protected readyStore() {
|
|
132
|
+
// @ts-ignore
|
|
133
|
+
this.$emit('store-connected', this);
|
|
134
|
+
this.$emit('store-ready', true);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
protected disconnectStore() {
|
|
138
|
+
this.$emit('store-disconnected');
|
|
139
|
+
}
|
|
95
140
|
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
# PBC
|
|
2
|
+
|
|
3
|
+
This directory contains PBCs that have been added dynamically via the `genx add` command. Each `genx add` will create
|
|
4
|
+
a new changeset for you and your team to review and merge. You may choose to tailor the generate PBC assets post
|
|
5
|
+
`genx add` for fine grain control, but be aware that doing so makes it more difficult to automate future PBC upgrades.
|
|
6
|
+
You may need to re-add a PBC that you have previously edited and re-merge any changes to it yourself.
|
|
7
|
+
|
|
8
|
+
See the app README.md in `@genesislcap/foundation-shell/app` or visit https://learn.genesis.global/docs/web/ to learn more.
|
|
@@ -1,21 +1,17 @@
|
|
|
1
|
-
import {
|
|
2
|
-
Auth,
|
|
3
|
-
FoundationAnalytics,
|
|
4
|
-
FoundationAnalyticsEvent,
|
|
5
|
-
FoundationAnalyticsEventType,
|
|
6
|
-
Session,
|
|
7
|
-
} from '@genesislcap/foundation-comms';
|
|
1
|
+
import { Auth, Session } from '@genesislcap/foundation-comms';
|
|
8
2
|
import {
|
|
9
3
|
defaultLoginConfig,
|
|
10
4
|
LoginConfig,
|
|
11
5
|
Settings as LoginSettings,
|
|
12
6
|
} from '@genesislcap/foundation-login';
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import { Route
|
|
7
|
+
import { FoundationRouterConfiguration } from '@genesislcap/foundation-ui';
|
|
8
|
+
import { optional } from '@microsoft/fast-foundation';
|
|
9
|
+
import { Route } from '@microsoft/fast-router';
|
|
16
10
|
import { defaultLayout, loginLayout } from '../layouts';
|
|
17
|
-
import { Home } from './home/home';
|
|
18
11
|
import { NotFound } from './not-found/not-found';
|
|
12
|
+
{{#each routes}}
|
|
13
|
+
import { {{pascalCase this}} } from './{{this}}/{{this}}';
|
|
14
|
+
{{/each}}
|
|
19
15
|
|
|
20
16
|
// eslint-disable-next-line
|
|
21
17
|
declare var ENABLE_SSO: string;
|
|
@@ -31,11 +27,9 @@ const ssoSettings =
|
|
|
31
27
|
}
|
|
32
28
|
: {};
|
|
33
29
|
|
|
34
|
-
export class MainRouterConfig extends
|
|
30
|
+
export class MainRouterConfig extends FoundationRouterConfiguration<LoginSettings> {
|
|
35
31
|
constructor(
|
|
36
32
|
@Auth private auth: Auth,
|
|
37
|
-
@Container private container: Container,
|
|
38
|
-
@FoundationAnalytics private analytics: FoundationAnalytics,
|
|
39
33
|
@Session private session: Session,
|
|
40
34
|
@optional(LoginConfig)
|
|
41
35
|
private loginConfig: LoginConfig = { ...defaultLoginConfig, autoAuth: true, autoConnect: true },
|
|
@@ -43,9 +37,8 @@ export class MainRouterConfig extends RouterConfiguration<LoginSettings> {
|
|
|
43
37
|
super();
|
|
44
38
|
}
|
|
45
39
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
public configure() {
|
|
40
|
+
async configure() {
|
|
41
|
+
this.configureAnalytics();
|
|
49
42
|
this.title = 'Blank App Demo';
|
|
50
43
|
this.defaultLayout = defaultLayout;
|
|
51
44
|
|
|
@@ -64,7 +57,7 @@ export class MainRouterConfig extends RouterConfiguration<LoginSettings> {
|
|
|
64
57
|
);
|
|
65
58
|
configure(this.container, {
|
|
66
59
|
autoConnect: true,
|
|
67
|
-
defaultRedirectUrl: '
|
|
60
|
+
defaultRedirectUrl: '{{routes.[0]}}',
|
|
68
61
|
...ssoSettings,
|
|
69
62
|
});
|
|
70
63
|
return define({
|
|
@@ -78,12 +71,26 @@ export class MainRouterConfig extends RouterConfiguration<LoginSettings> {
|
|
|
78
71
|
settings: { public: true },
|
|
79
72
|
childRouters: true,
|
|
80
73
|
},
|
|
81
|
-
{ path: 'home', element: Home, title: 'Home', name: 'home' },
|
|
82
74
|
{ path: 'not-found', element: NotFound, title: 'Not Found', name: 'not-found' },
|
|
75
|
+
{{#each routes}}
|
|
76
|
+
{
|
|
77
|
+
path: '{{this}}',
|
|
78
|
+
element: {{pascalCase this}},
|
|
79
|
+
title: '{{sentenceCase this}}',
|
|
80
|
+
name: '{{this}}',
|
|
81
|
+
navItems: [
|
|
82
|
+
{
|
|
83
|
+
title: '{{sentenceCase this}}',
|
|
84
|
+
icon: {
|
|
85
|
+
name: 'cog',
|
|
86
|
+
variant: 'solid',
|
|
87
|
+
},
|
|
88
|
+
},
|
|
89
|
+
],
|
|
90
|
+
},
|
|
91
|
+
{{/each}}
|
|
83
92
|
);
|
|
84
93
|
|
|
85
|
-
const auth = this.auth;
|
|
86
|
-
|
|
87
94
|
/**
|
|
88
95
|
* Example of a FallbackRouteDefinition
|
|
89
96
|
*/
|
|
@@ -98,12 +105,6 @@ export class MainRouterConfig extends RouterConfiguration<LoginSettings> {
|
|
|
98
105
|
navigate: async (phase) => {
|
|
99
106
|
const settings = phase.route.settings;
|
|
100
107
|
|
|
101
|
-
this.analytics.trackEvent(FoundationAnalyticsEventType.routeChanged, <
|
|
102
|
-
FoundationAnalyticsEvent.RouteChanged
|
|
103
|
-
>{
|
|
104
|
-
path: phase.route.endpoint.path,
|
|
105
|
-
});
|
|
106
|
-
|
|
107
108
|
/**
|
|
108
109
|
* If public route don't block
|
|
109
110
|
*/
|
|
@@ -121,7 +122,7 @@ export class MainRouterConfig extends RouterConfiguration<LoginSettings> {
|
|
|
121
122
|
/**
|
|
122
123
|
* If allowAutoAuth and session is valid try to connect+auto-login
|
|
123
124
|
*/
|
|
124
|
-
if (this.loginConfig.autoAuth && (await auth.reAuthFromSession())) {
|
|
125
|
+
if (this.loginConfig.autoAuth && (await this.auth.reAuthFromSession())) {
|
|
125
126
|
return;
|
|
126
127
|
}
|
|
127
128
|
|
|
@@ -135,8 +136,4 @@ export class MainRouterConfig extends RouterConfiguration<LoginSettings> {
|
|
|
135
136
|
},
|
|
136
137
|
});
|
|
137
138
|
}
|
|
138
|
-
|
|
139
|
-
public construct<T>(Type: Constructable<T>): T {
|
|
140
|
-
return this.container.get(Type) as T;
|
|
141
|
-
}
|
|
142
139
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './store';
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { CustomEventMap } from '@genesislcap/foundation-events';
|
|
2
|
+
import { getApp } from '@genesislcap/foundation-shell/app';
|
|
3
|
+
import {
|
|
4
|
+
AbstractStoreRoot,
|
|
5
|
+
registerStore,
|
|
6
|
+
StoreRoot,
|
|
7
|
+
StoreRootEventDetailMap,
|
|
8
|
+
} from '@genesislcap/foundation-store';
|
|
9
|
+
|
|
10
|
+
export interface Store extends StoreRoot {}
|
|
11
|
+
|
|
12
|
+
export type StoreEventDetailMap = StoreRootEventDetailMap & {};
|
|
13
|
+
|
|
14
|
+
declare global {
|
|
15
|
+
interface HTMLElementEventMap extends CustomEventMap<StoreEventDetailMap> {}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
class DefaultStore extends AbstractStoreRoot<Store, StoreEventDetailMap> implements Store {
|
|
19
|
+
constructor() {
|
|
20
|
+
super();
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Register the store root
|
|
24
|
+
*/
|
|
25
|
+
getApp().registerStoreRoot(this);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export const Store = registerStore(DefaultStore, 'Store');
|
package/package.json
CHANGED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { customElement, FASTElement } from '@microsoft/fast-element';
|
|
2
|
-
import { HomeStyles as styles } from './home.styles';
|
|
3
|
-
import { HomeTemplate as template } from './home.template';
|
|
4
|
-
|
|
5
|
-
@customElement({
|
|
6
|
-
name: 'home-route',
|
|
7
|
-
template,
|
|
8
|
-
styles,
|
|
9
|
-
})
|
|
10
|
-
export class Home extends FASTElement {
|
|
11
|
-
constructor() {
|
|
12
|
-
super();
|
|
13
|
-
}
|
|
14
|
-
}
|