@rxap/oauth 22.0.0-dev.0 → 22.0.0-dev.2
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/CHANGELOG.md +32 -0
- package/README.md +5 -3
- package/compodoc/architecture.html +222 -0
- package/compodoc/changelog.html +76 -5
- package/compodoc/dependencies.html +104 -25
- package/compodoc/index.html +50 -8
- package/compodoc/injectables/AuthenticationService.html +83 -21
- package/compodoc/js/architecture-graph.js +288 -0
- package/compodoc/js/libs/bootstrap-native.js +4 -2
- package/compodoc/js/libs/jszip.min.js +13 -0
- package/compodoc/js/libs/svg-pan-zoom.min.js +3 -3
- package/compodoc/js/libs/tablesort.min.js +3 -3
- package/compodoc/js/libs/tablesort.number.min.js +3 -3
- package/compodoc/js/libs/vis-network.min.js +78 -0
- package/compodoc/js/menu-wc.js +25 -12
- package/compodoc/js/menu.js +10 -11
- package/compodoc/js/routes/routes_index.js +1 -0
- package/compodoc/js/routes.js +142 -34
- package/compodoc/js/search/search-lunr.js +6 -8
- package/compodoc/js/search/search.js +118 -66
- package/compodoc/js/search/search_index.js +2 -2
- package/compodoc/js/tabs.js +98 -15
- package/compodoc/js/tree.js +44 -7
- package/compodoc/license.html +48 -6
- package/compodoc/llms.txt +41 -0
- package/compodoc/miscellaneous/functions.html +140 -15
- package/compodoc/miscellaneous/variables.html +52 -5
- package/compodoc/modules.html +44 -3
- package/compodoc/overview.html +54 -3
- package/compodoc/properties.html +45 -4
- package/compodoc/routes.html +227 -0
- package/compodoc/styles/compodoc.css +365 -44
- package/compodoc/styles/dark.css +16 -0
- package/compodoc/template-playground/default-templates.json +192 -0
- package/compodoc/template-playground/hbs-render.service.ts +217 -0
- package/compodoc/template-playground/main.ts +9 -0
- package/compodoc/template-playground/template-editor.service.ts +173 -0
- package/compodoc/template-playground/template-playground.component.ts +614 -0
- package/compodoc/template-playground/template-playground.module.ts +29 -0
- package/compodoc/template-playground/zip-export.service.ts +86 -0
- package/compodoc/template-playground-app/app.js +1389 -0
- package/compodoc/template-playground-app/index.html +462 -0
- package/docs/documentation.json +135 -68
- package/docs/html/assets/highlight.css +1 -1
- package/docs/html/assets/icons.js +1 -1
- package/docs/html/assets/icons.svg +1 -1
- package/docs/html/assets/main.js +5 -5
- package/docs/html/assets/search.js +1 -1
- package/docs/html/assets/style.css +265 -228
- package/docs/html/classes/AuthenticationService.html +134 -8
- package/docs/html/functions/AuthenticationGuard.html +43 -1
- package/docs/html/functions/ProvideAuth.html +42 -1
- package/docs/html/functions/withAuthConfig.html +42 -1
- package/docs/html/hierarchy.html +29 -0
- package/docs/html/index.html +44 -7
- package/docs/html/modules.html +40 -1
- package/docs/markdown/README.md +6 -4
- package/docs/markdown/classes/AuthenticationService.md +13 -13
- package/docs/markdown/functions/AuthenticationGuard.md +2 -2
- package/docs/markdown/functions/ProvideAuth.md +2 -2
- package/docs/markdown/functions/withAuthConfig.md +2 -2
- package/docs/markdown/globals.md +2 -2
- package/docs/wiki/Class.AuthenticationService.md +12 -12
- package/docs/wiki/Function.AuthenticationGuard.md +1 -1
- package/docs/wiki/Function.ProvideAuth.md +1 -1
- package/docs/wiki/Function.withAuthConfig.md +1 -1
- package/docs/wiki/Home.md +5 -3
- package/docs/wiki/globals.md +1 -1
- package/generators.json +16 -0
- package/package.json +15 -17
- package/src/generators/init/generator.js +120 -0
- package/src/generators/init/index.js +6 -0
- package/src/generators/init/schema.json +8 -0
- package/src/generators/package.json +3 -0
- package/compodoc/js/libs/vis.min.js +0 -47
- package/compodoc/js/menu-wc_es5.js +0 -40
- package/theme.css +0 -1
package/compodoc/index.html
CHANGED
|
@@ -61,6 +61,20 @@
|
|
|
61
61
|
}
|
|
62
62
|
toggleDarkMode(darkModeState);
|
|
63
63
|
</script>
|
|
64
|
+
<script>
|
|
65
|
+
// --- Iframe navigation tracking for Template Playground ---
|
|
66
|
+
function sendCurrentUrlToParent() {
|
|
67
|
+
if (window.parent && window.parent !== window) {
|
|
68
|
+
window.parent.postMessage({
|
|
69
|
+
type: 'compodoc-iframe-navigate',
|
|
70
|
+
url: window.location.pathname + window.location.hash
|
|
71
|
+
}, '*');
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
window.addEventListener('hashchange', sendCurrentUrlToParent, false);
|
|
75
|
+
window.addEventListener('popstate', sendCurrentUrlToParent, false);
|
|
76
|
+
window.addEventListener('DOMContentLoaded', sendCurrentUrlToParent, false);
|
|
77
|
+
</script>
|
|
64
78
|
|
|
65
79
|
<div class="navbar navbar-default navbar-fixed-top d-md-none p-0">
|
|
66
80
|
<div class="d-flex">
|
|
@@ -70,7 +84,14 @@
|
|
|
70
84
|
</div>
|
|
71
85
|
|
|
72
86
|
<div class="xs-menu menu" id="mobile-menu">
|
|
73
|
-
<div id="book-search-input" role="search"
|
|
87
|
+
<div id="book-search-input" role="search">
|
|
88
|
+
<input type="text" placeholder="Type to search">
|
|
89
|
+
<button type="button"
|
|
90
|
+
class="search-input-clear"
|
|
91
|
+
aria-label="Clear search"
|
|
92
|
+
data-search-input-clear>×</button>
|
|
93
|
+
</div>
|
|
94
|
+
<compodoc-menu></compodoc-menu>
|
|
74
95
|
</div>
|
|
75
96
|
|
|
76
97
|
<div class="container-fluid main">
|
|
@@ -79,9 +100,10 @@
|
|
|
79
100
|
<compodoc-menu mode="normal"></compodoc-menu>
|
|
80
101
|
</div>
|
|
81
102
|
<!-- START CONTENT -->
|
|
82
|
-
<div class="content
|
|
103
|
+
<div class="content readme">
|
|
83
104
|
<div class="content-data">
|
|
84
105
|
|
|
106
|
+
|
|
85
107
|
<p>This package provides an authentication guard and service for Angular applications using OAuth 2.0 and OpenID Connect. It simplifies the integration of authentication flows, including sign-in, sign-out, and token management, with support for disabled authentication scenarios. The package also includes a provider function to streamline configuration.</p>
|
|
86
108
|
<p><a href="https://www.npmjs.com/package/@rxap/oauth"><img src="https://img.shields.io/npm/v/@rxap/oauth?style=flat-square" alt="npm version" class="img-responsive"></a>
|
|
87
109
|
<a href="https://commitizen.github.io/cz-cli/"><img src="https://img.shields.io/badge/commitizen-friendly-brightgreen.svg?style=flat-square" alt="commitizen friendly" class="img-responsive"></a>
|
|
@@ -98,9 +120,10 @@
|
|
|
98
120
|
</ul>
|
|
99
121
|
<h1>Installation</h1>
|
|
100
122
|
<p><strong>Add the package to your workspace:</strong></p>
|
|
101
|
-
<b>Example :</b><div><pre class="line-numbers"><code class="language-bash">
|
|
102
|
-
<
|
|
103
|
-
<b>Example :</b><div><pre class="line-numbers"><code class="language-bash">
|
|
123
|
+
<b>Example :</b><div><pre class="line-numbers"><code class="language-bash">npm install @rxap/oauth</code></pre></div><p>With pnpm or yarn use <code>pnpm add</code> or <code>yarn add</code> instead of <code>npm install</code>.</p>
|
|
124
|
+
<p><strong>Install peer dependencies:</strong></p>
|
|
125
|
+
<b>Example :</b><div><pre class="line-numbers"><code class="language-bash">npm install @angular/core @angular/router @rxap/authentication @rxap/rxjs angular-oauth2-oidc angular-oauth2-oidc-jwks rxjs </code></pre></div><p><strong>Execute the init generator:</strong></p>
|
|
126
|
+
<b>Example :</b><div><pre class="line-numbers"><code class="language-bash">nx g @rxap/oauth:init</code></pre></div><h1>Generators</h1>
|
|
104
127
|
<h2>init</h2>
|
|
105
128
|
<blockquote>
|
|
106
129
|
<p>Initialize the package in the workspace</p>
|
|
@@ -123,6 +146,9 @@
|
|
|
123
146
|
|
|
124
147
|
|
|
125
148
|
|
|
149
|
+
|
|
150
|
+
|
|
151
|
+
|
|
126
152
|
|
|
127
153
|
|
|
128
154
|
|
|
@@ -151,13 +177,31 @@
|
|
|
151
177
|
|
|
152
178
|
<script>
|
|
153
179
|
var COMPODOC_CURRENT_PAGE_DEPTH = 0;
|
|
154
|
-
var COMPODOC_CURRENT_PAGE_CONTEXT = '
|
|
180
|
+
var COMPODOC_CURRENT_PAGE_CONTEXT = 'readme';
|
|
155
181
|
var COMPODOC_CURRENT_PAGE_URL = 'index.html';
|
|
156
182
|
var MAX_SEARCH_RESULTS = 15;
|
|
157
183
|
</script>
|
|
158
184
|
|
|
159
185
|
<script>
|
|
160
186
|
$darkModeToggleSwitchers = document.querySelectorAll('.dark-mode-switch input');
|
|
187
|
+
var updateDarkModeSwitchOffset = function () {
|
|
188
|
+
var content = document.querySelector('.content');
|
|
189
|
+
var scrollbarWidth = 0;
|
|
190
|
+
|
|
191
|
+
if (content) {
|
|
192
|
+
scrollbarWidth = Math.max(0, content.offsetWidth - content.clientWidth);
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
document.documentElement.style.setProperty(
|
|
196
|
+
'--content-scrollbar-width',
|
|
197
|
+
scrollbarWidth + 'px'
|
|
198
|
+
);
|
|
199
|
+
};
|
|
200
|
+
|
|
201
|
+
updateDarkModeSwitchOffset();
|
|
202
|
+
requestAnimationFrame(updateDarkModeSwitchOffset);
|
|
203
|
+
window.addEventListener('resize', updateDarkModeSwitchOffset);
|
|
204
|
+
|
|
161
205
|
checkToggle(darkModeState);
|
|
162
206
|
if ($darkModeToggleSwitchers.length > 0) {
|
|
163
207
|
for (var i = 0; i < $darkModeToggleSwitchers.length; i++) {
|
|
@@ -173,14 +217,12 @@
|
|
|
173
217
|
<script src="./js/libs/lit-html.js"></script>
|
|
174
218
|
|
|
175
219
|
<script src="./js/menu-wc.js" defer></script>
|
|
176
|
-
<script nomodule src="./js/menu-wc_es5.js" defer></script>
|
|
177
220
|
|
|
178
221
|
<script src="./js/libs/bootstrap-native.js"></script>
|
|
179
222
|
|
|
180
223
|
<script src="./js/libs/es6-shim.min.js"></script>
|
|
181
224
|
<script src="./js/libs/EventDispatcher.js"></script>
|
|
182
225
|
<script src="./js/libs/promise.min.js"></script>
|
|
183
|
-
<script src="./js/libs/zepto.min.js"></script>
|
|
184
226
|
|
|
185
227
|
<script src="./js/compodoc.js"></script>
|
|
186
228
|
|
|
@@ -61,6 +61,20 @@
|
|
|
61
61
|
}
|
|
62
62
|
toggleDarkMode(darkModeState);
|
|
63
63
|
</script>
|
|
64
|
+
<script>
|
|
65
|
+
// --- Iframe navigation tracking for Template Playground ---
|
|
66
|
+
function sendCurrentUrlToParent() {
|
|
67
|
+
if (window.parent && window.parent !== window) {
|
|
68
|
+
window.parent.postMessage({
|
|
69
|
+
type: 'compodoc-iframe-navigate',
|
|
70
|
+
url: window.location.pathname + window.location.hash
|
|
71
|
+
}, '*');
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
window.addEventListener('hashchange', sendCurrentUrlToParent, false);
|
|
75
|
+
window.addEventListener('popstate', sendCurrentUrlToParent, false);
|
|
76
|
+
window.addEventListener('DOMContentLoaded', sendCurrentUrlToParent, false);
|
|
77
|
+
</script>
|
|
64
78
|
|
|
65
79
|
<div class="navbar navbar-default navbar-fixed-top d-md-none p-0">
|
|
66
80
|
<div class="d-flex">
|
|
@@ -70,7 +84,14 @@
|
|
|
70
84
|
</div>
|
|
71
85
|
|
|
72
86
|
<div class="xs-menu menu" id="mobile-menu">
|
|
73
|
-
<div id="book-search-input" role="search"
|
|
87
|
+
<div id="book-search-input" role="search">
|
|
88
|
+
<input type="text" placeholder="Type to search">
|
|
89
|
+
<button type="button"
|
|
90
|
+
class="search-input-clear"
|
|
91
|
+
aria-label="Clear search"
|
|
92
|
+
data-search-input-clear>×</button>
|
|
93
|
+
</div>
|
|
94
|
+
<compodoc-menu></compodoc-menu>
|
|
74
95
|
</div>
|
|
75
96
|
|
|
76
97
|
<div class="container-fluid main">
|
|
@@ -89,11 +110,20 @@
|
|
|
89
110
|
|
|
90
111
|
|
|
91
112
|
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
|
|
92
117
|
<ol class="breadcrumb">
|
|
93
118
|
<li class="breadcrumb-item">Injectables</li>
|
|
94
119
|
<li class="breadcrumb-item" >AuthenticationService</li>
|
|
95
120
|
</ol>
|
|
96
121
|
|
|
122
|
+
<div class="io-file io-file-path" data-compodoc="entity-file-path">
|
|
123
|
+
<span class="icon ion-ios-document" aria-hidden="true"></span>
|
|
124
|
+
<code>src/lib/authentication.service.ts</code>
|
|
125
|
+
</div>
|
|
126
|
+
|
|
97
127
|
<ul class="nav nav-tabs" role="tablist">
|
|
98
128
|
<li class="nav-item">
|
|
99
129
|
<a href="#info"
|
|
@@ -101,6 +131,12 @@
|
|
|
101
131
|
class="nav-link active"
|
|
102
132
|
role="tab" id="info-tab" data-bs-toggle="tab" data-link="info">Info</a>
|
|
103
133
|
</li>
|
|
134
|
+
<li class="nav-item">
|
|
135
|
+
<a href="#api"
|
|
136
|
+
class="nav-link"
|
|
137
|
+
|
|
138
|
+
role="tab" id="api-tab" data-bs-toggle="tab" data-link="api">API</a>
|
|
139
|
+
</li>
|
|
104
140
|
<li class="nav-item">
|
|
105
141
|
<a href="#source"
|
|
106
142
|
class="nav-link"
|
|
@@ -111,33 +147,30 @@
|
|
|
111
147
|
|
|
112
148
|
<div class="tab-content">
|
|
113
149
|
<div class="tab-pane fade active in" id="info">
|
|
114
|
-
<p class="comment">
|
|
115
|
-
<h3>File</h3>
|
|
116
|
-
</p>
|
|
117
|
-
<p class="comment">
|
|
118
|
-
<code>src/lib/authentication.service.ts</code>
|
|
119
|
-
</p>
|
|
120
150
|
|
|
121
151
|
|
|
122
152
|
|
|
123
153
|
|
|
124
154
|
|
|
155
|
+
</div>
|
|
156
|
+
|
|
157
|
+
<div class="tab-pane fade " id="api">
|
|
125
158
|
<section data-compodoc="block-index">
|
|
126
159
|
<h3 id="index">Index</h3>
|
|
127
|
-
|
|
128
|
-
|
|
160
|
+
<table class="table table-sm table-bordered index-table">
|
|
161
|
+
<tbody>
|
|
129
162
|
<tr>
|
|
130
|
-
<td class="col-md-
|
|
163
|
+
<td class="col-md-3">
|
|
131
164
|
<h6><b>Properties</b></h6>
|
|
132
165
|
</td>
|
|
133
|
-
|
|
134
|
-
<tr>
|
|
135
|
-
<td class="col-md-4">
|
|
166
|
+
<td class="col-md-9">
|
|
136
167
|
<ul class="index-list">
|
|
137
168
|
<li>
|
|
169
|
+
<span class="reference-badge reference-badge--property" aria-hidden="true">P</span>
|
|
138
170
|
<a href="#events$" >events$</a>
|
|
139
171
|
</li>
|
|
140
172
|
<li>
|
|
173
|
+
<span class="reference-badge reference-badge--property" aria-hidden="true">P</span>
|
|
141
174
|
<span class="modifier">Public</span>
|
|
142
175
|
<span class="modifier">Readonly</span>
|
|
143
176
|
<a href="#isAuthenticated$" >isAuthenticated$</a>
|
|
@@ -145,38 +178,44 @@
|
|
|
145
178
|
</ul>
|
|
146
179
|
</td>
|
|
147
180
|
</tr>
|
|
181
|
+
</tbody>
|
|
182
|
+
</table>
|
|
148
183
|
|
|
184
|
+
<table class="table table-sm table-bordered index-table">
|
|
185
|
+
<tbody>
|
|
149
186
|
<tr>
|
|
150
|
-
<td class="col-md-
|
|
187
|
+
<td class="col-md-3">
|
|
151
188
|
<h6><b>Methods</b></h6>
|
|
152
189
|
</td>
|
|
153
|
-
|
|
154
|
-
<tr>
|
|
155
|
-
<td class="col-md-4">
|
|
190
|
+
<td class="col-md-9">
|
|
156
191
|
<ul class="index-list">
|
|
157
192
|
<li>
|
|
193
|
+
<span class="reference-badge reference-badge--method" aria-hidden="true">M</span>
|
|
158
194
|
<a href="#init" >init</a>
|
|
159
195
|
</li>
|
|
160
196
|
<li>
|
|
197
|
+
<span class="reference-badge reference-badge--method" aria-hidden="true">M</span>
|
|
161
198
|
<a href="#isAuthenticated" >isAuthenticated</a>
|
|
162
199
|
</li>
|
|
163
200
|
<li>
|
|
201
|
+
<span class="reference-badge reference-badge--method" aria-hidden="true">M</span>
|
|
164
202
|
<a href="#signIn" >signIn</a>
|
|
165
203
|
</li>
|
|
166
204
|
<li>
|
|
205
|
+
<span class="reference-badge reference-badge--method" aria-hidden="true">M</span>
|
|
167
206
|
<span class="modifier">Async</span>
|
|
168
207
|
<a href="#signOut" >signOut</a>
|
|
169
208
|
</li>
|
|
170
209
|
</ul>
|
|
171
210
|
</td>
|
|
172
211
|
</tr>
|
|
212
|
+
</tbody>
|
|
213
|
+
</table>
|
|
173
214
|
|
|
174
215
|
|
|
175
216
|
|
|
176
217
|
|
|
177
218
|
|
|
178
|
-
</tbody>
|
|
179
|
-
</table>
|
|
180
219
|
</section>
|
|
181
220
|
|
|
182
221
|
<section data-compodoc="block-constructor">
|
|
@@ -354,6 +393,7 @@
|
|
|
354
393
|
</tbody>
|
|
355
394
|
</table>
|
|
356
395
|
</section>
|
|
396
|
+
|
|
357
397
|
<section data-compodoc="block-properties">
|
|
358
398
|
|
|
359
399
|
<h3 id="inputs">
|
|
@@ -403,6 +443,12 @@
|
|
|
403
443
|
</span>
|
|
404
444
|
</td>
|
|
405
445
|
</tr>
|
|
446
|
+
<tr>
|
|
447
|
+
<td class="col-md-4">
|
|
448
|
+
<i>Type : </i> <code>unknown</code>
|
|
449
|
+
|
|
450
|
+
</td>
|
|
451
|
+
</tr>
|
|
406
452
|
<tr>
|
|
407
453
|
<td class="col-md-4">
|
|
408
454
|
<i>Default value : </i><code>new BehaviorSubject<boolean | null>(null)</code>
|
|
@@ -621,6 +667,24 @@ export class AuthenticationService implements IAuthenticationService {
|
|
|
621
667
|
|
|
622
668
|
<script>
|
|
623
669
|
$darkModeToggleSwitchers = document.querySelectorAll('.dark-mode-switch input');
|
|
670
|
+
var updateDarkModeSwitchOffset = function () {
|
|
671
|
+
var content = document.querySelector('.content');
|
|
672
|
+
var scrollbarWidth = 0;
|
|
673
|
+
|
|
674
|
+
if (content) {
|
|
675
|
+
scrollbarWidth = Math.max(0, content.offsetWidth - content.clientWidth);
|
|
676
|
+
}
|
|
677
|
+
|
|
678
|
+
document.documentElement.style.setProperty(
|
|
679
|
+
'--content-scrollbar-width',
|
|
680
|
+
scrollbarWidth + 'px'
|
|
681
|
+
);
|
|
682
|
+
};
|
|
683
|
+
|
|
684
|
+
updateDarkModeSwitchOffset();
|
|
685
|
+
requestAnimationFrame(updateDarkModeSwitchOffset);
|
|
686
|
+
window.addEventListener('resize', updateDarkModeSwitchOffset);
|
|
687
|
+
|
|
624
688
|
checkToggle(darkModeState);
|
|
625
689
|
if ($darkModeToggleSwitchers.length > 0) {
|
|
626
690
|
for (var i = 0; i < $darkModeToggleSwitchers.length; i++) {
|
|
@@ -636,14 +700,12 @@ export class AuthenticationService implements IAuthenticationService {
|
|
|
636
700
|
<script src="../js/libs/lit-html.js"></script>
|
|
637
701
|
|
|
638
702
|
<script src="../js/menu-wc.js" defer></script>
|
|
639
|
-
<script nomodule src="../js/menu-wc_es5.js" defer></script>
|
|
640
703
|
|
|
641
704
|
<script src="../js/libs/bootstrap-native.js"></script>
|
|
642
705
|
|
|
643
706
|
<script src="../js/libs/es6-shim.min.js"></script>
|
|
644
707
|
<script src="../js/libs/EventDispatcher.js"></script>
|
|
645
708
|
<script src="../js/libs/promise.min.js"></script>
|
|
646
|
-
<script src="../js/libs/zepto.min.js"></script>
|
|
647
709
|
|
|
648
710
|
<script src="../js/compodoc.js"></script>
|
|
649
711
|
|
|
@@ -0,0 +1,288 @@
|
|
|
1
|
+
document.addEventListener("DOMContentLoaded", function () {
|
|
2
|
+
var container = document.getElementById("architecture-graph");
|
|
3
|
+
if (!container) {
|
|
4
|
+
return;
|
|
5
|
+
}
|
|
6
|
+
if (
|
|
7
|
+
typeof ARCHITECTURE_DEP_GRAPH === "undefined" ||
|
|
8
|
+
!ARCHITECTURE_DEP_GRAPH ||
|
|
9
|
+
!ARCHITECTURE_DEP_GRAPH.nodes
|
|
10
|
+
) {
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
if (typeof vis === "undefined" || !vis.Network) {
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
var typeColors = {
|
|
18
|
+
component: "#10b39c",
|
|
19
|
+
directive: "#6747dd",
|
|
20
|
+
pipe: "#de3b91",
|
|
21
|
+
module: "#2973f0",
|
|
22
|
+
injectable: "#b77006",
|
|
23
|
+
};
|
|
24
|
+
var isDarkMode = function () {
|
|
25
|
+
return !!(document.body && document.body.classList.contains("dark"));
|
|
26
|
+
};
|
|
27
|
+
var getNodeTextColor = function () {
|
|
28
|
+
return isDarkMode() ? "#f0f0f0" : "#2d2d2d";
|
|
29
|
+
};
|
|
30
|
+
var getEdgeColor = function () {
|
|
31
|
+
return isDarkMode() ? "#b5b5b5" : "#8b8b8b";
|
|
32
|
+
};
|
|
33
|
+
var getEdgeOpacity = function () {
|
|
34
|
+
return isDarkMode() ? 0.8 : 0.65;
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
var allNodes = ARCHITECTURE_DEP_GRAPH.nodes.map(function (node) {
|
|
38
|
+
return {
|
|
39
|
+
id: node.id,
|
|
40
|
+
label: node.name,
|
|
41
|
+
type: node.type,
|
|
42
|
+
url: node.url,
|
|
43
|
+
};
|
|
44
|
+
});
|
|
45
|
+
var allEdges = ARCHITECTURE_DEP_GRAPH.edges.map(function (edge) {
|
|
46
|
+
return {
|
|
47
|
+
from: edge.source,
|
|
48
|
+
to: edge.target,
|
|
49
|
+
};
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
if (!allNodes.length || !allEdges.length) {
|
|
53
|
+
container.innerHTML =
|
|
54
|
+
'<p class="alert alert-warning">No dependency links to render.</p>';
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
var degreeByNodeId = {};
|
|
59
|
+
allEdges.forEach(function (edge) {
|
|
60
|
+
degreeByNodeId[edge.from] = (degreeByNodeId[edge.from] || 0) + 1;
|
|
61
|
+
degreeByNodeId[edge.to] = (degreeByNodeId[edge.to] || 0) + 1;
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
allNodes = allNodes.map(function (node) {
|
|
65
|
+
var degree = degreeByNodeId[node.id] || 1;
|
|
66
|
+
return {
|
|
67
|
+
id: node.id,
|
|
68
|
+
label: node.label,
|
|
69
|
+
title: node.label + " (" + node.type + ")",
|
|
70
|
+
type: node.type,
|
|
71
|
+
url: node.url,
|
|
72
|
+
color: typeColors[node.type] || typeColors.module,
|
|
73
|
+
size: Math.min(30, 10 + degree * 1.3),
|
|
74
|
+
font: { color: getNodeTextColor(), size: 12 },
|
|
75
|
+
borderWidth: 1,
|
|
76
|
+
};
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
var activeTypes = {};
|
|
80
|
+
var knownTypes = ["component", "directive", "pipe", "module", "injectable"];
|
|
81
|
+
knownTypes.forEach(function (type) {
|
|
82
|
+
activeTypes[type] = true;
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
var nodeById = {};
|
|
86
|
+
allNodes.forEach(function (node) {
|
|
87
|
+
nodeById[node.id] = node;
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
var network;
|
|
91
|
+
var currentScale = 1;
|
|
92
|
+
|
|
93
|
+
var applyGraphTheme = function () {
|
|
94
|
+
var textColor = getNodeTextColor();
|
|
95
|
+
var edgeColor = getEdgeColor();
|
|
96
|
+
var edgeOpacity = getEdgeOpacity();
|
|
97
|
+
|
|
98
|
+
for (var i = 0; i < allNodes.length; i++) {
|
|
99
|
+
allNodes[i].font = allNodes[i].font || {};
|
|
100
|
+
allNodes[i].font.color = textColor;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
if (network) {
|
|
104
|
+
network.setOptions({
|
|
105
|
+
edges: {
|
|
106
|
+
color: { color: edgeColor, opacity: edgeOpacity },
|
|
107
|
+
},
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
var getFilteredGraphData = function () {
|
|
113
|
+
var visibleNodes = allNodes.filter(function (node) {
|
|
114
|
+
return activeTypes[node.type];
|
|
115
|
+
});
|
|
116
|
+
var visibleNodeIds = {};
|
|
117
|
+
visibleNodes.forEach(function (node) {
|
|
118
|
+
visibleNodeIds[node.id] = true;
|
|
119
|
+
});
|
|
120
|
+
var visibleEdges = allEdges.filter(function (edge) {
|
|
121
|
+
return visibleNodeIds[edge.from] && visibleNodeIds[edge.to];
|
|
122
|
+
});
|
|
123
|
+
return { nodes: visibleNodes, edges: visibleEdges };
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
var renderFilteredGraph = function () {
|
|
127
|
+
var filtered = getFilteredGraphData();
|
|
128
|
+
network.setData({
|
|
129
|
+
nodes: new vis.DataSet(filtered.nodes),
|
|
130
|
+
edges: new vis.DataSet(filtered.edges),
|
|
131
|
+
});
|
|
132
|
+
network.stabilize(120);
|
|
133
|
+
};
|
|
134
|
+
|
|
135
|
+
var options = {
|
|
136
|
+
autoResize: true,
|
|
137
|
+
layout: {
|
|
138
|
+
improvedLayout: true,
|
|
139
|
+
},
|
|
140
|
+
interaction: {
|
|
141
|
+
hover: true,
|
|
142
|
+
dragView: true,
|
|
143
|
+
zoomView: true,
|
|
144
|
+
},
|
|
145
|
+
physics: {
|
|
146
|
+
enabled: true,
|
|
147
|
+
stabilization: {
|
|
148
|
+
enabled: true,
|
|
149
|
+
iterations: 180,
|
|
150
|
+
fit: true,
|
|
151
|
+
},
|
|
152
|
+
barnesHut: {
|
|
153
|
+
gravitationalConstant: -6000,
|
|
154
|
+
centralGravity: 0.35,
|
|
155
|
+
springLength: 130,
|
|
156
|
+
springConstant: 0.02,
|
|
157
|
+
damping: 0.2,
|
|
158
|
+
},
|
|
159
|
+
},
|
|
160
|
+
edges: {
|
|
161
|
+
arrows: { to: { enabled: true, scaleFactor: 0.6 } },
|
|
162
|
+
color: { color: getEdgeColor(), opacity: getEdgeOpacity() },
|
|
163
|
+
smooth: {
|
|
164
|
+
enabled: true,
|
|
165
|
+
type: "dynamic",
|
|
166
|
+
},
|
|
167
|
+
},
|
|
168
|
+
nodes: {
|
|
169
|
+
shape: "dot",
|
|
170
|
+
scaling: {
|
|
171
|
+
min: 9,
|
|
172
|
+
max: 32,
|
|
173
|
+
},
|
|
174
|
+
},
|
|
175
|
+
};
|
|
176
|
+
|
|
177
|
+
var initialData = getFilteredGraphData();
|
|
178
|
+
network = new vis.Network(
|
|
179
|
+
container,
|
|
180
|
+
{
|
|
181
|
+
nodes: new vis.DataSet(initialData.nodes),
|
|
182
|
+
edges: new vis.DataSet(initialData.edges),
|
|
183
|
+
},
|
|
184
|
+
options,
|
|
185
|
+
);
|
|
186
|
+
|
|
187
|
+
network.on("click", function (params) {
|
|
188
|
+
if (!params.nodes || params.nodes.length === 0) {
|
|
189
|
+
return;
|
|
190
|
+
}
|
|
191
|
+
var node = nodeById[params.nodes[0]];
|
|
192
|
+
if (node && node.url) {
|
|
193
|
+
document.location.href = node.url;
|
|
194
|
+
}
|
|
195
|
+
});
|
|
196
|
+
|
|
197
|
+
network.once("stabilizationIterationsDone", function () {
|
|
198
|
+
network.fit({ animation: { duration: 250, easingFunction: "easeOutQuad" } });
|
|
199
|
+
currentScale = 1;
|
|
200
|
+
});
|
|
201
|
+
applyGraphTheme();
|
|
202
|
+
|
|
203
|
+
var legendButtons = document.querySelectorAll("[data-architecture-filter]");
|
|
204
|
+
var updateLegendState = function () {
|
|
205
|
+
for (var i = 0; i < legendButtons.length; i++) {
|
|
206
|
+
var button = legendButtons[i];
|
|
207
|
+
var type = button.getAttribute("data-architecture-filter");
|
|
208
|
+
var active = !!activeTypes[type];
|
|
209
|
+
button.setAttribute("aria-pressed", active ? "true" : "false");
|
|
210
|
+
if (active) {
|
|
211
|
+
button.classList.remove("is-disabled");
|
|
212
|
+
} else {
|
|
213
|
+
button.classList.add("is-disabled");
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
};
|
|
217
|
+
|
|
218
|
+
for (var i = 0; i < legendButtons.length; i++) {
|
|
219
|
+
legendButtons[i].addEventListener("click", function (event) {
|
|
220
|
+
event.preventDefault();
|
|
221
|
+
var type = this.getAttribute("data-architecture-filter");
|
|
222
|
+
if (!type) {
|
|
223
|
+
return;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
activeTypes[type] = !activeTypes[type];
|
|
227
|
+
|
|
228
|
+
var activeCount = 0;
|
|
229
|
+
knownTypes.forEach(function (entry) {
|
|
230
|
+
if (activeTypes[entry]) {
|
|
231
|
+
activeCount += 1;
|
|
232
|
+
}
|
|
233
|
+
});
|
|
234
|
+
if (activeCount === 0) {
|
|
235
|
+
knownTypes.forEach(function (entry) {
|
|
236
|
+
activeTypes[entry] = true;
|
|
237
|
+
});
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
updateLegendState();
|
|
241
|
+
renderFilteredGraph();
|
|
242
|
+
});
|
|
243
|
+
}
|
|
244
|
+
updateLegendState();
|
|
245
|
+
|
|
246
|
+
var zoomIn = document.getElementById("architecture-zoom-in");
|
|
247
|
+
var zoomOut = document.getElementById("architecture-zoom-out");
|
|
248
|
+
var reset = document.getElementById("architecture-reset");
|
|
249
|
+
|
|
250
|
+
if (zoomIn) {
|
|
251
|
+
zoomIn.addEventListener("click", function (ev) {
|
|
252
|
+
ev.preventDefault();
|
|
253
|
+
currentScale = Math.min(4, currentScale * 1.25);
|
|
254
|
+
network.moveTo({
|
|
255
|
+
scale: currentScale,
|
|
256
|
+
animation: { duration: 160, easingFunction: "easeOutQuad" },
|
|
257
|
+
});
|
|
258
|
+
});
|
|
259
|
+
}
|
|
260
|
+
if (zoomOut) {
|
|
261
|
+
zoomOut.addEventListener("click", function (ev) {
|
|
262
|
+
ev.preventDefault();
|
|
263
|
+
currentScale = Math.max(0.2, currentScale / 1.25);
|
|
264
|
+
network.moveTo({
|
|
265
|
+
scale: currentScale,
|
|
266
|
+
animation: { duration: 160, easingFunction: "easeOutQuad" },
|
|
267
|
+
});
|
|
268
|
+
});
|
|
269
|
+
}
|
|
270
|
+
if (reset) {
|
|
271
|
+
reset.addEventListener("click", function (ev) {
|
|
272
|
+
ev.preventDefault();
|
|
273
|
+
network.fit({ animation: { duration: 180, easingFunction: "easeOutQuad" } });
|
|
274
|
+
currentScale = 1;
|
|
275
|
+
});
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
if (window.MutationObserver && document.body) {
|
|
279
|
+
var bodyThemeObserver = new MutationObserver(function () {
|
|
280
|
+
applyGraphTheme();
|
|
281
|
+
renderFilteredGraph();
|
|
282
|
+
});
|
|
283
|
+
bodyThemeObserver.observe(document.body, {
|
|
284
|
+
attributes: true,
|
|
285
|
+
attributeFilter: ["class"],
|
|
286
|
+
});
|
|
287
|
+
}
|
|
288
|
+
});
|