igniteui-cli 15.2.2-alpha.3 → 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/PromptSession.js +1 -1
- package/lib/commands/ai-config.d.ts +9 -2
- package/lib/commands/ai-config.js +49 -14
- package/lib/commands/build.js +7 -12
- package/lib/commands/new.js +4 -1
- 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 +3 -1
- 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 +1 -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-generate-from-image-design/references/gotchas.md +29 -6
- package/templates/blazor/igb/projects/ai-config/files/skills/igniteui-blazor-theming/SKILL.md +2 -2
- package/templates/react/igr-ts/accordion/default/index.js +2 -1
- package/templates/react/igr-ts/avatar/default/index.js +2 -1
- package/templates/react/igr-ts/badge/default/index.js +2 -1
- package/templates/react/igr-ts/banner/default/index.js +2 -1
- package/templates/react/igr-ts/button/default/index.js +2 -1
- package/templates/react/igr-ts/button-group/default/index.js +2 -1
- package/templates/react/igr-ts/calendar/default/index.js +2 -1
- package/templates/react/igr-ts/card/default/index.js +2 -1
- package/templates/react/igr-ts/checkbox/default/index.js +2 -1
- package/templates/react/igr-ts/chip/default/index.js +2 -1
- package/templates/react/igr-ts/circular-progress/default/index.js +2 -1
- package/templates/react/igr-ts/constants.d.ts +2 -0
- package/templates/react/igr-ts/constants.js +5 -0
- package/templates/react/igr-ts/custom-templates/subscription-form/index.js +2 -1
- package/templates/react/igr-ts/date-picker/default/index.js +2 -1
- package/templates/react/igr-ts/divider/default/index.js +2 -1
- package/templates/react/igr-ts/dropdown/default/index.js +2 -1
- package/templates/react/igr-ts/expansion-panel/default/index.js +2 -1
- package/templates/react/igr-ts/form/default/index.js +2 -1
- package/templates/react/igr-ts/grid/basic/index.js +2 -1
- package/templates/react/igr-ts/icon/default/index.js +2 -1
- package/templates/react/igr-ts/icon-button/default/index.js +2 -1
- package/templates/react/igr-ts/input/default/index.js +2 -1
- package/templates/react/igr-ts/linear-progress/default/index.js +2 -1
- package/templates/react/igr-ts/list/default/index.js +2 -1
- package/templates/react/igr-ts/navbar/default/index.js +2 -1
- package/templates/react/igr-ts/projects/_base/files/package.json +2 -1
- 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/react/igr-ts/radio-group/default/index.js +2 -1
- package/templates/react/igr-ts/rating/default/index.js +2 -1
- package/templates/react/igr-ts/ripple/default/index.js +2 -1
- package/templates/react/igr-ts/slider/default/index.js +2 -1
- package/templates/react/igr-ts/switch/default/index.js +2 -1
- package/templates/react/igr-ts/tabs/default/index.js +2 -1
- package/templates/react/igr-ts/text-area/default/index.js +2 -1
- package/templates/react/igr-ts/tree/default/index.js +2 -1
- package/templates/webcomponents/igc-ts/grid/default/index.js +1 -1
- package/templates/webcomponents/igc-ts/grid/grid-editing/index.js +1 -1
- package/templates/webcomponents/igc-ts/grid/grid-summaries/index.js +1 -1
- package/templates/webcomponents/igc-ts/projects/_base/files/package.json +1 -1
- 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/package.json +2 -2
- 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/webcomponents/igc-ts/tree/default/index.js +1 -1
- 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,57 @@
|
|
|
1
|
+
import { LitElement, html } from 'lit';
|
|
2
|
+
import { customElement, state } from 'lit/decorators.js';
|
|
3
|
+
import { Router } from '@vaadin/router';
|
|
4
|
+
import { ExternalAuth } from '../authentication/services/externalAuth.js';
|
|
5
|
+
import { Authentication } from '../authentication/services/authentication.js';
|
|
6
|
+
import { UserStore } from '../authentication/services/userStore.js';
|
|
7
|
+
import type { User } from '../authentication/models/user.js';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Handles the Facebook login redirect.
|
|
11
|
+
* Facebook uses a popup (JS SDK) instead of PKCE, so this page reads the profile
|
|
12
|
+
* that was stored in sessionStorage during the FB.login() callback.
|
|
13
|
+
*/
|
|
14
|
+
@customElement('app-redirect-facebook')
|
|
15
|
+
export class RedirectFacebookElement extends LitElement {
|
|
16
|
+
@state() private error = '';
|
|
17
|
+
|
|
18
|
+
connectedCallback() {
|
|
19
|
+
super.connectedCallback();
|
|
20
|
+
this._handleRedirect();
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
private async _handleRedirect() {
|
|
24
|
+
try {
|
|
25
|
+
const externalUser = await ExternalAuth.handleRedirect('facebook');
|
|
26
|
+
const result = await Authentication.loginWith(externalUser);
|
|
27
|
+
if (result.user) {
|
|
28
|
+
UserStore.setUser(result.user as User);
|
|
29
|
+
this.dispatchEvent(new CustomEvent('auth-change', { bubbles: true, composed: true }));
|
|
30
|
+
Router.go('/auth/profile');
|
|
31
|
+
} else {
|
|
32
|
+
this.error = result.error ?? 'Facebook sign-in failed.';
|
|
33
|
+
}
|
|
34
|
+
} catch (e: any) {
|
|
35
|
+
console.error('Facebook sign-in failed:', e);
|
|
36
|
+
this.error = 'Facebook sign-in failed. Please try again.';
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
render() {
|
|
41
|
+
if (this.error) {
|
|
42
|
+
return html`
|
|
43
|
+
<div style="padding:2rem;color:#d32f2f">
|
|
44
|
+
<p>${this.error}</p>
|
|
45
|
+
<button @click=${() => Router.go('/')}>Back to Home</button>
|
|
46
|
+
</div>
|
|
47
|
+
`;
|
|
48
|
+
}
|
|
49
|
+
return html`<p style="padding:2rem">Signing in with Facebook…</p>`;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
declare global {
|
|
54
|
+
interface HTMLElementTagNameMap {
|
|
55
|
+
'app-redirect-facebook': RedirectFacebookElement;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { LitElement, html } from 'lit';
|
|
2
|
+
import { customElement, state } from 'lit/decorators.js';
|
|
3
|
+
import { Router } from '@vaadin/router';
|
|
4
|
+
import { ExternalAuth } from '../authentication/services/externalAuth.js';
|
|
5
|
+
import { Authentication } from '../authentication/services/authentication.js';
|
|
6
|
+
import { UserStore } from '../authentication/services/userStore.js';
|
|
7
|
+
import type { User } from '../authentication/models/user.js';
|
|
8
|
+
|
|
9
|
+
/** Handles the OAuth redirect from Google. Exchanges the authorization code for a user profile. */
|
|
10
|
+
@customElement('app-redirect-google')
|
|
11
|
+
export class RedirectGoogleElement extends LitElement {
|
|
12
|
+
@state() private error = '';
|
|
13
|
+
|
|
14
|
+
connectedCallback() {
|
|
15
|
+
super.connectedCallback();
|
|
16
|
+
this._handleRedirect();
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
private async _handleRedirect() {
|
|
20
|
+
try {
|
|
21
|
+
const externalUser = await ExternalAuth.handleRedirect('google');
|
|
22
|
+
const result = await Authentication.loginWith(externalUser);
|
|
23
|
+
if (result.user) {
|
|
24
|
+
UserStore.setUser(result.user as User);
|
|
25
|
+
this.dispatchEvent(new CustomEvent('auth-change', { bubbles: true, composed: true }));
|
|
26
|
+
Router.go('/auth/profile');
|
|
27
|
+
} else {
|
|
28
|
+
this.error = result.error ?? 'Google sign-in failed.';
|
|
29
|
+
}
|
|
30
|
+
} catch (e: any) {
|
|
31
|
+
console.error('Google sign-in failed:', e);
|
|
32
|
+
this.error = 'Google sign-in failed. Please try again.';
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
render() {
|
|
37
|
+
if (this.error) {
|
|
38
|
+
return html`
|
|
39
|
+
<div style="padding:2rem;color:#d32f2f">
|
|
40
|
+
<p>${this.error}</p>
|
|
41
|
+
<button @click=${() => Router.go('/')}>Back to Home</button>
|
|
42
|
+
</div>
|
|
43
|
+
`;
|
|
44
|
+
}
|
|
45
|
+
return html`<p style="padding:2rem">Signing in with Google…</p>`;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
declare global {
|
|
50
|
+
interface HTMLElementTagNameMap {
|
|
51
|
+
'app-redirect-google': RedirectGoogleElement;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { LitElement, html } from 'lit';
|
|
2
|
+
import { customElement, state } from 'lit/decorators.js';
|
|
3
|
+
import { Router } from '@vaadin/router';
|
|
4
|
+
import { ExternalAuth } from '../authentication/services/externalAuth.js';
|
|
5
|
+
import { Authentication } from '../authentication/services/authentication.js';
|
|
6
|
+
import { UserStore } from '../authentication/services/userStore.js';
|
|
7
|
+
import type { User } from '../authentication/models/user.js';
|
|
8
|
+
|
|
9
|
+
/** Handles the OAuth redirect from Microsoft. Exchanges the authorization code for a user profile. */
|
|
10
|
+
@customElement('app-redirect-microsoft')
|
|
11
|
+
export class RedirectMicrosoftElement extends LitElement {
|
|
12
|
+
@state() private error = '';
|
|
13
|
+
|
|
14
|
+
connectedCallback() {
|
|
15
|
+
super.connectedCallback();
|
|
16
|
+
this._handleRedirect();
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
private async _handleRedirect() {
|
|
20
|
+
try {
|
|
21
|
+
const externalUser = await ExternalAuth.handleRedirect('microsoft');
|
|
22
|
+
const result = await Authentication.loginWith(externalUser);
|
|
23
|
+
if (result.user) {
|
|
24
|
+
UserStore.setUser(result.user as User);
|
|
25
|
+
this.dispatchEvent(new CustomEvent('auth-change', { bubbles: true, composed: true }));
|
|
26
|
+
Router.go('/auth/profile');
|
|
27
|
+
} else {
|
|
28
|
+
this.error = result.error ?? 'Microsoft sign-in failed.';
|
|
29
|
+
}
|
|
30
|
+
} catch (e: any) {
|
|
31
|
+
console.error('Microsoft sign-in failed:', e);
|
|
32
|
+
this.error = 'Microsoft sign-in failed. Please try again.';
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
render() {
|
|
37
|
+
if (this.error) {
|
|
38
|
+
return html`
|
|
39
|
+
<div style="padding:2rem;color:#d32f2f">
|
|
40
|
+
<p>${this.error}</p>
|
|
41
|
+
<button @click=${() => Router.go('/')}>Back to Home</button>
|
|
42
|
+
</div>
|
|
43
|
+
`;
|
|
44
|
+
}
|
|
45
|
+
return html`<p style="padding:2rem">Signing in with Microsoft…</p>`;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
declare global {
|
|
50
|
+
interface HTMLElementTagNameMap {
|
|
51
|
+
'app-redirect-microsoft': RedirectMicrosoftElement;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ProjectTemplate } from "@igniteui/cli-core";
|
|
2
|
+
import { SideNavProject } from "../side-nav";
|
|
3
|
+
export declare class SideNavAuthIgcProject extends SideNavProject 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: SideNavAuthIgcProject;
|
|
15
|
+
export default _default;
|
|
@@ -0,0 +1,46 @@
|
|
|
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.SideNavAuthIgcProject = void 0;
|
|
27
|
+
const path = __importStar(require("path"));
|
|
28
|
+
const side_nav_1 = require("../side-nav");
|
|
29
|
+
class SideNavAuthIgcProject extends side_nav_1.SideNavProject {
|
|
30
|
+
constructor() {
|
|
31
|
+
super(...arguments);
|
|
32
|
+
this.id = "side-nav-auth";
|
|
33
|
+
this.name = "Side navigation + login";
|
|
34
|
+
this.description = "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 [...super.templatePaths, path.join(__dirname, "files")];
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
exports.SideNavAuthIgcProject = SideNavAuthIgcProject;
|
|
46
|
+
exports.default = new SideNavAuthIgcProject();
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { type Route } from '@vaadin/router';
|
|
2
|
+
import './home/home.js';
|
|
3
|
+
import './not-found/not-found.js';
|
|
4
|
+
|
|
5
|
+
export interface AppRoute extends Route {
|
|
6
|
+
icon?: string;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export const routes: AppRoute[] = [
|
|
10
|
+
{ path: '/', component: 'app-home', name: 'Home', icon: 'home' },
|
|
11
|
+
// The fallback route should always be after other alternatives.
|
|
12
|
+
{ path: '(.*)', component: 'app-not-found' },
|
|
13
|
+
];
|
|
@@ -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();
|