igniteui-cli 15.2.2 → 15.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/lib/commands/build.js +7 -12
- package/package.json +4 -4
- package/templates/blazor/igb/projects/ai-config/files/skills/AGENTS.md +0 -5
- package/templates/blazor/igb/projects/ai-config/files/skills/igniteui-blazor-components/SKILL.md +2 -0
- package/templates/blazor/igb/projects/ai-config/files/skills/igniteui-blazor-components/references/charts.md +7 -35
- package/templates/blazor/igb/projects/ai-config/files/skills/igniteui-blazor-components/references/data-display.md +0 -54
- package/templates/blazor/igb/projects/ai-config/files/skills/igniteui-blazor-components/references/feedback.md +0 -38
- package/templates/blazor/igb/projects/ai-config/files/skills/igniteui-blazor-components/references/form-controls.md +0 -68
- package/templates/blazor/igb/projects/ai-config/files/skills/igniteui-blazor-components/references/layout-manager.md +1 -124
- package/templates/blazor/igb/projects/ai-config/files/skills/igniteui-blazor-components/references/layout.md +0 -62
- package/templates/blazor/igb/projects/ai-config/files/skills/igniteui-blazor-theming/SKILL.md +1 -1
- package/templates/react/igr-ts/projects/_base/files/package.json +1 -0
- package/templates/react/igr-ts/projects/_base/files/src/app/app.tsx +4 -2
- package/templates/react/igr-ts/projects/_base/files/src/setupTests.ts +12 -0
- package/templates/react/igr-ts/projects/_base/files/styles.css +6 -0
- package/templates/react/igr-ts/projects/_base_with_home/files/index.html +2 -1
- package/templates/react/igr-ts/projects/_base_with_home/files/src/app/home/home.tsx +60 -10
- package/templates/react/igr-ts/projects/_base_with_home/files/src/app/home/style.module.css +79 -20
- package/templates/react/igr-ts/projects/ai-config/files/skills/igniteui-react-components/SKILL.md +0 -8
- package/templates/react/igr-ts/projects/ai-config/files/skills/igniteui-react-components/reference/CHARTS-GRIDS.md +6 -36
- package/templates/react/igr-ts/projects/ai-config/files/skills/igniteui-react-components/reference/COMPONENT-CATALOGUE.md +8 -142
- package/templates/react/igr-ts/projects/ai-config/files/skills/igniteui-react-components/reference/EVENT-HANDLING.md +2 -0
- package/templates/react/igr-ts/projects/ai-config/files/skills/igniteui-react-customize-theme/SKILL.md +7 -14
- package/templates/react/igr-ts/projects/ai-config/files/skills/igniteui-react-customize-theme/reference/CSS-THEMING.md +2 -0
- package/templates/react/igr-ts/projects/ai-config/files/skills/igniteui-react-customize-theme/reference/MCP-SERVER.md +0 -8
- package/templates/react/igr-ts/projects/ai-config/files/skills/igniteui-react-generate-from-image-design/SKILL.md +2 -2
- package/templates/react/igr-ts/projects/ai-config/files/skills/igniteui-react-generate-from-image-design/reference/component-mapping.md +60 -74
- package/templates/react/igr-ts/projects/empty/index.js +2 -2
- package/templates/react/igr-ts/projects/side-nav/files/src/app/app-routes.tsx +5 -0
- package/templates/react/igr-ts/projects/side-nav/files/src/app/app.css +82 -0
- package/templates/react/igr-ts/projects/side-nav/files/src/app/app.tsx +104 -0
- package/templates/react/igr-ts/projects/side-nav/files/src/app/home/home.tsx +69 -0
- package/templates/react/igr-ts/projects/side-nav/files/src/app/home/style.module.css +105 -0
- package/templates/react/igr-ts/projects/{top-nav → side-nav}/index.d.ts +2 -2
- package/templates/react/igr-ts/projects/{top-nav → side-nav}/index.js +7 -7
- package/templates/react/igr-ts/projects/side-nav-auth/files/index.html +19 -0
- package/templates/react/igr-ts/projects/side-nav-auth/files/src/app/app-routes.tsx +24 -0
- package/templates/react/igr-ts/projects/side-nav-auth/files/src/app/app.css +84 -0
- package/templates/react/igr-ts/projects/side-nav-auth/files/src/app/app.tsx +124 -0
- package/templates/react/igr-ts/projects/side-nav-auth/files/src/app/authentication/AuthContext.tsx +73 -0
- package/templates/react/igr-ts/projects/side-nav-auth/files/src/app/authentication/AuthGuard.tsx +14 -0
- package/templates/react/igr-ts/projects/side-nav-auth/files/src/app/authentication/components/Login.module.css +93 -0
- package/templates/react/igr-ts/projects/side-nav-auth/files/src/app/authentication/components/Login.tsx +69 -0
- package/templates/react/igr-ts/projects/side-nav-auth/files/src/app/authentication/components/LoginBar.module.css +42 -0
- package/templates/react/igr-ts/projects/side-nav-auth/files/src/app/authentication/components/LoginBar.tsx +44 -0
- package/templates/react/igr-ts/projects/side-nav-auth/files/src/app/authentication/components/LoginDialog.module.css +14 -0
- package/templates/react/igr-ts/projects/side-nav-auth/files/src/app/authentication/components/LoginDialog.tsx +49 -0
- package/templates/react/igr-ts/projects/side-nav-auth/files/src/app/authentication/components/Register.module.css +74 -0
- package/templates/react/igr-ts/projects/side-nav-auth/files/src/app/authentication/components/Register.tsx +67 -0
- package/templates/react/igr-ts/projects/side-nav-auth/files/src/app/authentication/models/external-login.ts +10 -0
- package/templates/react/igr-ts/projects/side-nav-auth/files/src/app/authentication/models/login.ts +4 -0
- package/templates/react/igr-ts/projects/side-nav-auth/files/src/app/authentication/models/register-info.ts +6 -0
- package/templates/react/igr-ts/projects/side-nav-auth/files/src/app/authentication/models/user.ts +19 -0
- package/templates/react/igr-ts/projects/side-nav-auth/files/src/app/authentication/pages/Profile.module.css +87 -0
- package/templates/react/igr-ts/projects/side-nav-auth/files/src/app/authentication/pages/Profile.tsx +42 -0
- package/templates/react/igr-ts/projects/side-nav-auth/files/src/app/authentication/pages/RedirectFacebook.tsx +44 -0
- package/templates/react/igr-ts/projects/side-nav-auth/files/src/app/authentication/pages/RedirectGoogle.tsx +40 -0
- package/templates/react/igr-ts/projects/side-nav-auth/files/src/app/authentication/pages/RedirectMicrosoft.tsx +40 -0
- package/templates/react/igr-ts/projects/side-nav-auth/files/src/app/authentication/services/authentication.ts +37 -0
- package/templates/react/igr-ts/projects/side-nav-auth/files/src/app/authentication/services/external-auth-config.ts +44 -0
- package/templates/react/igr-ts/projects/side-nav-auth/files/src/app/authentication/services/externalAuth.ts +272 -0
- package/templates/react/igr-ts/projects/side-nav-auth/files/src/app/authentication/services/fakeBackend.ts +88 -0
- package/templates/react/igr-ts/projects/side-nav-auth/files/src/app/authentication/services/jwtUtil.ts +10 -0
- package/templates/react/igr-ts/projects/side-nav-auth/files/src/app/authentication/services/pkce.ts +29 -0
- package/templates/react/igr-ts/projects/side-nav-auth/files/src/app/authentication/services/userStore.ts +39 -0
- package/templates/react/igr-ts/projects/side-nav-auth/index.d.ts +15 -0
- package/templates/react/igr-ts/projects/side-nav-auth/index.js +46 -0
- package/templates/react/igr-ts/projects/side-nav-mini/files/src/app/app-routes.tsx +5 -0
- package/templates/react/igr-ts/projects/side-nav-mini/files/src/app/app.css +109 -0
- package/templates/react/igr-ts/projects/side-nav-mini/files/src/app/app.test.tsx +20 -0
- package/templates/react/igr-ts/projects/side-nav-mini/files/src/app/app.tsx +81 -0
- package/templates/react/igr-ts/projects/side-nav-mini/files/src/app/home/home.tsx +69 -0
- package/templates/react/igr-ts/projects/side-nav-mini/files/src/app/home/style.module.css +105 -0
- package/templates/react/igr-ts/projects/side-nav-mini/index.d.ts +15 -0
- package/templates/react/igr-ts/projects/side-nav-mini/index.js +46 -0
- package/templates/react/igr-ts/projects/side-nav-mini-auth/files/src/app/app.css +106 -0
- package/templates/react/igr-ts/projects/side-nav-mini-auth/files/src/app/app.tsx +101 -0
- package/templates/react/igr-ts/projects/side-nav-mini-auth/index.d.ts +15 -0
- package/templates/react/igr-ts/projects/side-nav-mini-auth/index.js +50 -0
- package/templates/webcomponents/igc-ts/projects/_base/files/src/app/app.ts +6 -1
- package/templates/webcomponents/igc-ts/projects/_base/files/styles.css +1 -0
- package/templates/webcomponents/igc-ts/projects/_base_with_home/files/index.html +2 -0
- package/templates/webcomponents/igc-ts/projects/_base_with_home/files/src/app/home/home.ts +103 -9
- package/templates/webcomponents/igc-ts/projects/_base_with_home/files/src/assets/wc.png +0 -0
- package/templates/webcomponents/igc-ts/projects/ai-config/files/skills/igniteui-wc-choose-components/SKILL.md +122 -160
- package/templates/webcomponents/igc-ts/projects/ai-config/files/skills/igniteui-wc-customize-component-theme/SKILL.md +83 -311
- package/templates/webcomponents/igc-ts/projects/ai-config/files/skills/igniteui-wc-customize-component-theme/references/mcp-setup.md +69 -0
- package/templates/webcomponents/igc-ts/projects/ai-config/files/skills/igniteui-wc-generate-from-image-design/SKILL.md +4 -1
- package/templates/webcomponents/igc-ts/projects/ai-config/files/skills/igniteui-wc-generate-from-image-design/references/component-mapping.md +60 -61
- package/templates/webcomponents/igc-ts/projects/ai-config/files/skills/igniteui-wc-generate-from-image-design/references/gotchas.md +15 -11
- package/templates/webcomponents/igc-ts/projects/ai-config/files/skills/igniteui-wc-optimize-bundle-size/SKILL.md +23 -274
- package/templates/webcomponents/igc-ts/projects/empty/index.js +1 -1
- package/templates/webcomponents/igc-ts/projects/side-nav/files/index.html +21 -0
- package/templates/webcomponents/igc-ts/projects/side-nav/files/src/app/app-routing.ts +9 -0
- package/templates/webcomponents/igc-ts/projects/side-nav/files/src/app/app.ts +192 -22
- package/templates/webcomponents/igc-ts/projects/side-nav/files/src/app/home/home.ts +175 -0
- package/templates/webcomponents/igc-ts/projects/side-nav/index.js +1 -1
- package/templates/webcomponents/igc-ts/projects/side-nav-auth/files/index.html +25 -0
- package/templates/webcomponents/igc-ts/projects/side-nav-auth/files/src/app/app-routing.ts +37 -0
- package/templates/webcomponents/igc-ts/projects/side-nav-auth/files/src/app/app.ts +251 -0
- package/templates/webcomponents/igc-ts/projects/side-nav-auth/files/src/app/authentication/login-bar/login-bar.ts +124 -0
- package/templates/webcomponents/igc-ts/projects/side-nav-auth/files/src/app/authentication/login-dialog/login-dialog.ts +253 -0
- package/templates/webcomponents/igc-ts/projects/side-nav-auth/files/src/app/authentication/models/external-login.ts +10 -0
- package/templates/webcomponents/igc-ts/projects/side-nav-auth/files/src/app/authentication/models/login.ts +4 -0
- package/templates/webcomponents/igc-ts/projects/side-nav-auth/files/src/app/authentication/models/register-info.ts +6 -0
- package/templates/webcomponents/igc-ts/projects/side-nav-auth/files/src/app/authentication/models/user.ts +19 -0
- package/templates/webcomponents/igc-ts/projects/side-nav-auth/files/src/app/authentication/services/authentication.ts +37 -0
- package/templates/webcomponents/igc-ts/projects/side-nav-auth/files/src/app/authentication/services/external-auth-config.ts +44 -0
- package/templates/webcomponents/igc-ts/projects/side-nav-auth/files/src/app/authentication/services/externalAuth.ts +272 -0
- package/templates/webcomponents/igc-ts/projects/side-nav-auth/files/src/app/authentication/services/fakeBackend.ts +88 -0
- package/templates/webcomponents/igc-ts/projects/side-nav-auth/files/src/app/authentication/services/jwtUtil.ts +10 -0
- package/templates/webcomponents/igc-ts/projects/side-nav-auth/files/src/app/authentication/services/pkce.ts +29 -0
- package/templates/webcomponents/igc-ts/projects/side-nav-auth/files/src/app/authentication/services/userStore.ts +39 -0
- package/templates/webcomponents/igc-ts/projects/side-nav-auth/files/src/app/profile/profile.ts +142 -0
- package/templates/webcomponents/igc-ts/projects/side-nav-auth/files/src/app/redirect/redirect-facebook.ts +57 -0
- package/templates/webcomponents/igc-ts/projects/side-nav-auth/files/src/app/redirect/redirect-google.ts +53 -0
- package/templates/webcomponents/igc-ts/projects/side-nav-auth/files/src/app/redirect/redirect-microsoft.ts +53 -0
- package/templates/webcomponents/igc-ts/projects/side-nav-auth/index.d.ts +15 -0
- package/templates/webcomponents/igc-ts/projects/side-nav-auth/index.js +46 -0
- package/templates/webcomponents/igc-ts/projects/side-nav-mini/files/src/app/app-routing.ts +13 -0
- package/templates/webcomponents/igc-ts/projects/side-nav-mini/files/src/app/app.ts +238 -0
- package/templates/webcomponents/igc-ts/projects/side-nav-mini/index.d.ts +14 -0
- package/templates/webcomponents/igc-ts/projects/side-nav-mini/index.js +45 -0
- package/templates/webcomponents/igc-ts/projects/side-nav-mini-auth/files/src/app/app.ts +258 -0
- package/templates/webcomponents/igc-ts/projects/side-nav-mini-auth/index.d.ts +15 -0
- package/templates/webcomponents/igc-ts/projects/side-nav-mini-auth/index.js +50 -0
- package/templates/react/igr-ts/projects/top-nav/files/src/app/app.css +0 -62
- package/templates/react/igr-ts/projects/top-nav/files/src/app/app.tsx +0 -18
- package/templates/react/igr-ts/projects/top-nav/files/src/components/navigation-header/index.tsx +0 -19
- /package/templates/react/igr-ts/projects/{top-nav → side-nav}/files/src/app/app.test.tsx +0 -0
|
@@ -0,0 +1,258 @@
|
|
|
1
|
+
import { html, css, LitElement } from 'lit';
|
|
2
|
+
import { customElement, state } from 'lit/decorators.js';
|
|
3
|
+
import {
|
|
4
|
+
defineComponents,
|
|
5
|
+
IgcIconComponent,
|
|
6
|
+
IgcNavDrawerComponent,
|
|
7
|
+
IgcNavDrawerItemComponent,
|
|
8
|
+
registerIcon,
|
|
9
|
+
} from 'igniteui-webcomponents';
|
|
10
|
+
import { Router } from '@vaadin/router';
|
|
11
|
+
import { routes, type AppRoute } from './app-routing.js';
|
|
12
|
+
import { UserStore } from './authentication/services/userStore.js';
|
|
13
|
+
import './authentication/login-bar/login-bar.js';
|
|
14
|
+
|
|
15
|
+
defineComponents(
|
|
16
|
+
IgcIconComponent,
|
|
17
|
+
IgcNavDrawerComponent,
|
|
18
|
+
IgcNavDrawerItemComponent,
|
|
19
|
+
);
|
|
20
|
+
|
|
21
|
+
const materialIcons = [
|
|
22
|
+
['home', 'action/svg/production/ic_home_24px.svg'],
|
|
23
|
+
['menu', 'navigation/svg/production/ic_menu_24px.svg'],
|
|
24
|
+
['apps', 'navigation/svg/production/ic_apps_24px.svg'],
|
|
25
|
+
['code', 'action/svg/production/ic_code_24px.svg'],
|
|
26
|
+
['build', 'action/svg/production/ic_build_24px.svg'],
|
|
27
|
+
['palette', 'image/svg/production/ic_palette_24px.svg'],
|
|
28
|
+
['account_circle', 'action/svg/production/ic_account_circle_24px.svg'],
|
|
29
|
+
['lock', 'action/svg/production/ic_lock_24px.svg'],
|
|
30
|
+
['assignment_ind', 'action/svg/production/ic_assignment_ind_24px.svg'],
|
|
31
|
+
] as const;
|
|
32
|
+
|
|
33
|
+
materialIcons.forEach(([name, path]) =>
|
|
34
|
+
registerIcon(name, `https://unpkg.com/material-design-icons@3.0.1/${path}`, 'material')
|
|
35
|
+
);
|
|
36
|
+
|
|
37
|
+
@customElement('app-root')
|
|
38
|
+
export default class App extends LitElement {
|
|
39
|
+
@state()
|
|
40
|
+
private drawerOpen = true;
|
|
41
|
+
|
|
42
|
+
@state()
|
|
43
|
+
private currentPath = window.location.pathname;
|
|
44
|
+
|
|
45
|
+
@state()
|
|
46
|
+
private isLoggedIn = Boolean(UserStore.getUser());
|
|
47
|
+
|
|
48
|
+
private mediaQuery?: MediaQueryList;
|
|
49
|
+
|
|
50
|
+
static styles = css`
|
|
51
|
+
:host {
|
|
52
|
+
display: flex;
|
|
53
|
+
height: 100%;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.app {
|
|
57
|
+
display: flex;
|
|
58
|
+
flex-flow: column nowrap;
|
|
59
|
+
width: 100%;
|
|
60
|
+
height: 100%;
|
|
61
|
+
overflow: hidden;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
.app__navbar {
|
|
65
|
+
display: flex;
|
|
66
|
+
align-items: center;
|
|
67
|
+
flex: 0 0 auto;
|
|
68
|
+
height: 56px;
|
|
69
|
+
padding: 0 16px;
|
|
70
|
+
background: #239ef0;
|
|
71
|
+
box-shadow: 0 2px 4px rgba(0, 0, 0, .24);
|
|
72
|
+
box-sizing: border-box;
|
|
73
|
+
position: relative;
|
|
74
|
+
z-index: 10;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
.app__menu-button {
|
|
78
|
+
display: inline-flex;
|
|
79
|
+
align-items: center;
|
|
80
|
+
justify-content: center;
|
|
81
|
+
width: 40px;
|
|
82
|
+
height: 40px;
|
|
83
|
+
padding: 0;
|
|
84
|
+
color: #000;
|
|
85
|
+
border: 0;
|
|
86
|
+
background: transparent;
|
|
87
|
+
cursor: pointer;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
.app__menu-button igc-icon {
|
|
91
|
+
font-size: 24px;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
.app__title {
|
|
95
|
+
margin: 0 0 0 16px;
|
|
96
|
+
color: #000;
|
|
97
|
+
font-size: 1.25rem;
|
|
98
|
+
font-weight: 600;
|
|
99
|
+
line-height: 1;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
.app__navbar-spacer {
|
|
103
|
+
flex: 1 1 auto;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
.app__body {
|
|
107
|
+
display: flex;
|
|
108
|
+
flex: 1 1 auto;
|
|
109
|
+
min-height: 0;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
.app__drawer {
|
|
113
|
+
flex: 0 0 auto;
|
|
114
|
+
height: 100%;
|
|
115
|
+
--menu-full-width: 280px;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
.app--mini .app__drawer {
|
|
119
|
+
--menu-full-width: 68px;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
igc-nav-drawer.app__drawer::part(base) {
|
|
123
|
+
transition: width 0.3s ease-out;
|
|
124
|
+
overflow: hidden;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
.app--mini igc-nav-drawer-item::part(base) {
|
|
128
|
+
justify-content: center;
|
|
129
|
+
width: 40px;
|
|
130
|
+
min-height: 40px;
|
|
131
|
+
padding: 0;
|
|
132
|
+
margin: 4px auto;
|
|
133
|
+
border-radius: 8px;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
.app--mini igc-nav-drawer-item::part(content) {
|
|
137
|
+
display: none;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
igc-nav-drawer-item[active]::part(base) {
|
|
141
|
+
background: #e0f2ff;
|
|
142
|
+
color: #0075d2;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
igc-nav-drawer-item[active] igc-icon {
|
|
146
|
+
color: #0075d2;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
router-outlet {
|
|
150
|
+
flex: 1 1 auto;
|
|
151
|
+
display: flex;
|
|
152
|
+
align-items: stretch;
|
|
153
|
+
justify-content: center;
|
|
154
|
+
min-width: 0;
|
|
155
|
+
overflow: auto;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
@media (max-width: 1024px) {
|
|
159
|
+
.app__menu-button {
|
|
160
|
+
display: none;
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
`;
|
|
164
|
+
|
|
165
|
+
render() {
|
|
166
|
+
const visibleRoutes = (routes as AppRoute[]).filter((route) => {
|
|
167
|
+
if (!route.name) return false;
|
|
168
|
+
if ((route as any).requiresAuth && !this.isLoggedIn) return false;
|
|
169
|
+
return true;
|
|
170
|
+
});
|
|
171
|
+
|
|
172
|
+
return html`
|
|
173
|
+
<div class="app">
|
|
174
|
+
<header class="app__navbar">
|
|
175
|
+
<button
|
|
176
|
+
class="app__menu-button"
|
|
177
|
+
type="button"
|
|
178
|
+
aria-label="Toggle navigation"
|
|
179
|
+
@click=${this.toggleDrawer}
|
|
180
|
+
>
|
|
181
|
+
<igc-icon name="menu" collection="material"></igc-icon>
|
|
182
|
+
</button>
|
|
183
|
+
<h1 class="app__title">$(name)</h1>
|
|
184
|
+
<div class="app__navbar-spacer"></div>
|
|
185
|
+
<auth-login-bar @auth-change=${this.handleAuthChange}></auth-login-bar>
|
|
186
|
+
</header>
|
|
187
|
+
<div class=${this.drawerOpen ? 'app__body' : 'app__body app--mini'}>
|
|
188
|
+
<igc-nav-drawer
|
|
189
|
+
class="app__drawer"
|
|
190
|
+
?open=${true}
|
|
191
|
+
position="relative"
|
|
192
|
+
>
|
|
193
|
+
${visibleRoutes.map((route) => html`
|
|
194
|
+
<igc-nav-drawer-item
|
|
195
|
+
?active=${this.currentPath === route.path}
|
|
196
|
+
@click=${() => this.navigate(route.path)}
|
|
197
|
+
>
|
|
198
|
+
<igc-icon
|
|
199
|
+
slot="icon"
|
|
200
|
+
name=${route.icon || 'apps'}
|
|
201
|
+
collection="material"
|
|
202
|
+
></igc-icon>
|
|
203
|
+
<span slot="content">${route.name}</span>
|
|
204
|
+
</igc-nav-drawer-item>
|
|
205
|
+
`)}
|
|
206
|
+
</igc-nav-drawer>
|
|
207
|
+
<router-outlet></router-outlet>
|
|
208
|
+
</div>
|
|
209
|
+
</div>
|
|
210
|
+
`;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
connectedCallback() {
|
|
214
|
+
super.connectedCallback();
|
|
215
|
+
this.mediaQuery = window.matchMedia('(min-width: 1025px)');
|
|
216
|
+
this.updateDrawerState();
|
|
217
|
+
this.mediaQuery.addEventListener('change', this.updateDrawerState);
|
|
218
|
+
window.addEventListener('popstate', this.updateCurrentPath);
|
|
219
|
+
// Listen globally so redirect components (Google/Facebook/Microsoft) in the router
|
|
220
|
+
// outlet can also trigger a shell state update after a successful OAuth redirect.
|
|
221
|
+
window.addEventListener('auth-change', this.handleAuthChange);
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
disconnectedCallback() {
|
|
225
|
+
this.mediaQuery?.removeEventListener('change', this.updateDrawerState);
|
|
226
|
+
window.removeEventListener('popstate', this.updateCurrentPath);
|
|
227
|
+
window.removeEventListener('auth-change', this.handleAuthChange);
|
|
228
|
+
super.disconnectedCallback();
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
firstUpdated() {
|
|
232
|
+
const outlet = this.shadowRoot?.querySelector('router-outlet');
|
|
233
|
+
const router = new Router(outlet);
|
|
234
|
+
router.setRoutes(routes);
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
private toggleDrawer = () => {
|
|
238
|
+
this.drawerOpen = !this.drawerOpen;
|
|
239
|
+
};
|
|
240
|
+
|
|
241
|
+
private navigate(path: string) {
|
|
242
|
+
this.currentPath = path;
|
|
243
|
+
Router.go(path);
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
private updateDrawerState = () => {
|
|
247
|
+
this.drawerOpen = Boolean(this.mediaQuery?.matches);
|
|
248
|
+
};
|
|
249
|
+
|
|
250
|
+
private updateCurrentPath = () => {
|
|
251
|
+
this.currentPath = window.location.pathname;
|
|
252
|
+
};
|
|
253
|
+
|
|
254
|
+
private handleAuthChange = () => {
|
|
255
|
+
this.isLoggedIn = Boolean(UserStore.getUser());
|
|
256
|
+
this.currentPath = window.location.pathname;
|
|
257
|
+
};
|
|
258
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ProjectTemplate } from "@igniteui/cli-core";
|
|
2
|
+
import { SideNavMiniProject } from "../side-nav-mini";
|
|
3
|
+
export declare class SideNavMiniAuthIgcProject extends SideNavMiniProject implements ProjectTemplate {
|
|
4
|
+
id: string;
|
|
5
|
+
name: string;
|
|
6
|
+
description: string;
|
|
7
|
+
dependencies: string[];
|
|
8
|
+
framework: string;
|
|
9
|
+
projectType: string;
|
|
10
|
+
hasExtraConfiguration: boolean;
|
|
11
|
+
isHidden: boolean;
|
|
12
|
+
get templatePaths(): string[];
|
|
13
|
+
}
|
|
14
|
+
declare const _default: SideNavMiniAuthIgcProject;
|
|
15
|
+
export default _default;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.SideNavMiniAuthIgcProject = void 0;
|
|
27
|
+
const path = __importStar(require("path"));
|
|
28
|
+
const side_nav_mini_1 = require("../side-nav-mini");
|
|
29
|
+
class SideNavMiniAuthIgcProject extends side_nav_mini_1.SideNavMiniProject {
|
|
30
|
+
constructor() {
|
|
31
|
+
super(...arguments);
|
|
32
|
+
this.id = "side-nav-mini-auth";
|
|
33
|
+
this.name = "Side navigation (mini) + login";
|
|
34
|
+
this.description = "Collapsible mini side navigation extended with user authentication module";
|
|
35
|
+
this.dependencies = [];
|
|
36
|
+
this.framework = "webcomponents";
|
|
37
|
+
this.projectType = "igc-ts";
|
|
38
|
+
this.hasExtraConfiguration = false;
|
|
39
|
+
this.isHidden = true;
|
|
40
|
+
}
|
|
41
|
+
get templatePaths() {
|
|
42
|
+
return [
|
|
43
|
+
...super.templatePaths,
|
|
44
|
+
path.join(__dirname, "../side-nav-auth/files"),
|
|
45
|
+
path.join(__dirname, "files")
|
|
46
|
+
];
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
exports.SideNavMiniAuthIgcProject = SideNavMiniAuthIgcProject;
|
|
50
|
+
exports.default = new SideNavMiniAuthIgcProject();
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
.app {
|
|
2
|
-
text-align: center;
|
|
3
|
-
display: flex;
|
|
4
|
-
flex-flow: column;
|
|
5
|
-
min-height: 100vh;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
.content {
|
|
9
|
-
flex: 1 0 auto;
|
|
10
|
-
padding: 1em;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
/* quick nav menubar */
|
|
14
|
-
nav,
|
|
15
|
-
.app__name {
|
|
16
|
-
background-color: rgb(0, 153, 255);
|
|
17
|
-
box-sizing: border-box;
|
|
18
|
-
}
|
|
19
|
-
.app__name {
|
|
20
|
-
font-weight: 600;
|
|
21
|
-
font-size: 24px;
|
|
22
|
-
line-height: 32px;
|
|
23
|
-
padding-left: 24px;
|
|
24
|
-
text-align: left;
|
|
25
|
-
color: #fff;
|
|
26
|
-
padding-bottom: 8px;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
nav ul {
|
|
30
|
-
list-style: none;
|
|
31
|
-
display: flex;
|
|
32
|
-
justify-content: flex-start;
|
|
33
|
-
flex-wrap: wrap;
|
|
34
|
-
margin: 0;
|
|
35
|
-
padding: 0;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
nav ul a {
|
|
39
|
-
color: #fff;
|
|
40
|
-
line-height: 2;
|
|
41
|
-
text-decoration: none;
|
|
42
|
-
margin: 0 5px;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
nav ul a.active {
|
|
46
|
-
color: #fff;
|
|
47
|
-
font-weight: 600;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
nav ul li {
|
|
51
|
-
margin: 0px 16px;
|
|
52
|
-
box-sizing: border-box;
|
|
53
|
-
border-bottom: 1px solid transparent;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
nav ul li.active {
|
|
57
|
-
border-bottom: 2px solid #fff;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
nav ul li:not(.active):hover {
|
|
61
|
-
border-bottom: 1px solid #fff;
|
|
62
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { Outlet } from "react-router-dom";
|
|
2
|
-
import { routes } from './app-routes';
|
|
3
|
-
import NavigationHeader from "../components/navigation-header";
|
|
4
|
-
import "./app.css";
|
|
5
|
-
|
|
6
|
-
export default function App() {
|
|
7
|
-
const name = "$(name)";
|
|
8
|
-
|
|
9
|
-
return (
|
|
10
|
-
<div className="app">
|
|
11
|
-
<div className="app__name">{name}</div>
|
|
12
|
-
<NavigationHeader routes={routes}></NavigationHeader>
|
|
13
|
-
<div className="content">
|
|
14
|
-
<Outlet />
|
|
15
|
-
</div>
|
|
16
|
-
</div>
|
|
17
|
-
);
|
|
18
|
-
}
|
package/templates/react/igr-ts/projects/top-nav/files/src/components/navigation-header/index.tsx
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { useMemo } from 'react';
|
|
2
|
-
import { Link, useLocation } from 'react-router-dom';
|
|
3
|
-
|
|
4
|
-
export default function NavigationHeader({ routes }: any) {
|
|
5
|
-
const location = useLocation();
|
|
6
|
-
const activeItem = useMemo(() => {
|
|
7
|
-
return routes.findIndex((route: { path: string; }) => route.path === location.pathname);
|
|
8
|
-
}, [routes, location.pathname]);
|
|
9
|
-
|
|
10
|
-
return (
|
|
11
|
-
<nav>
|
|
12
|
-
<ul>
|
|
13
|
-
{routes.map(
|
|
14
|
-
(route: any, i: any) => <li key={i} className={activeItem === i ? 'active' : ''}><Link to={route.path}>{route.text}</Link></li>
|
|
15
|
-
)}
|
|
16
|
-
</ul>
|
|
17
|
-
</nav>
|
|
18
|
-
)
|
|
19
|
-
}
|
|
File without changes
|