igniteui-cli 15.2.2 → 15.3.1-beta.1

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